/* 大坝碾压实时管理系统 · 生产版样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #081120; color: #d7e7f7;
  display: flex; flex-direction: column; overflow: hidden;
}

/* ============ 登录页 ============ */
.login-wrap { flex: 1; display: flex; justify-content: center; align-items: center; }
.login-box {
  width: 360px; background: #0d1e36; border: 1px solid #1d4b7a; border-radius: 8px;
  padding: 36px 34px; text-align: center;
}
.login-box h1 { font-size: 20px; color: #eaf6ff; letter-spacing: 1px; }
.login-sub { font-size: 12px; color: #5f7d99; margin: 8px 0 24px; }
.login-box input {
  width: 100%; padding: 11px; margin: 8px 0; border-radius: 4px;
  border: 1px solid #1d4b7a; background: #0a1626; color: #fff; font-size: 14px;
}
.login-box button {
  width: 100%; padding: 11px; background: #1e9bd7; color: #fff; border: 0;
  border-radius: 4px; cursor: pointer; font-size: 15px; margin-top: 8px;
}
.login-box button:hover { background: #27c6f0; }
.login-err { color: #ff7a5c; font-size: 12px; min-height: 16px; }

/* ============ 顶部栏 ============ */
header {
  height: 50px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: linear-gradient(180deg, #0d2036, #0a1626);
  border-bottom: 1px solid #1d4b7a; flex: none;
}
.brand { font-size: 17px; font-weight: bold; color: #eaf6ff; letter-spacing: 1px; }
.badge {
  font-size: 11px; font-weight: normal; color: #ffd24a;
  border: 1px solid #7a6420; border-radius: 3px; padding: 2px 8px; margin-left: 10px;
  background: rgba(255,210,74,.08);
}
.badge.off { color: #7ee787; border-color: #2d6b3a; background: rgba(126,231,135,.08); }
.top-right { display: flex; align-items: center; gap: 16px; }
.bell { position: relative; cursor: pointer; font-size: 18px; }
.bell .n {
  position: absolute; top: -7px; right: -12px; background: #e03b28; color: #fff;
  font-size: 10px; border-radius: 8px; padding: 0 5px; min-width: 16px; text-align: center;
}
.user { font-size: 12px; color: #8fb3d1; }
.logout { font-size: 12px; color: #ff9f6b; cursor: pointer; }
.logout:hover { color: #ff7a3c; text-decoration: underline; }
.clock { font-size: 14px; color: #27c6f0; font-family: Consolas, monospace; }

/* ============ 主体 ============ */
.layout { flex: 1; display: flex; min-height: 0; }
nav {
  width: 180px; flex: none; background: #0b1a2e; border-right: 1px solid #1d4b7a;
  padding: 10px 0; overflow-y: auto;
}
nav::-webkit-scrollbar { width: 5px; }
nav::-webkit-scrollbar-thumb { background: #1d4b7a; border-radius: 3px; }
.nav-group { font-size: 11px; color: #5f7d99; padding: 10px 16px 4px; letter-spacing: 1px; }
.nav-item {
  display: block; padding: 9px 16px; font-size: 13px; color: #b8d2e8;
  cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(39,198,240,.08); color: #eaf6ff; }
.nav-item.active { background: rgba(39,198,240,.14); color: #27c6f0; border-left-color: #27c6f0; font-weight: bold; }
.content { flex: 1; min-width: 0; padding: 10px; overflow-y: auto; }
.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-thumb { background: #1d4b7a; border-radius: 3px; }
.page { display: none; }
.page.visible { display: block; }

/* ============ 通用面板 ============ */
.panel {
  background: rgba(13, 30, 54, .85); border: 1px solid #1d4b7a;
  border-radius: 6px; padding: 10px 12px; min-width: 0; margin-bottom: 10px;
}
.panel h3 {
  font-size: 14px; color: #27c6f0; margin-bottom: 8px;
  padding-left: 8px; border-left: 3px solid #27c6f0;
}
.kv { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; }
.kv span:first-child { color: #8fb3d1; }
.kv span:last-child { color: #d7e7f7; font-family: Consolas, monospace; }
.hint { font-size: 11px; color: #5f7d99; line-height: 1.6; }

/* ============ 看板页 ============ */
#page-overview.visible { display: grid; grid-template-columns: 290px 1fr 290px; grid-template-rows: 1fr 1fr; gap: 10px; }
#page-overview .panel { margin-bottom: 0; }
#ov-prog { grid-area: 1 / 1; }
#ov-map { grid-area: 1 / 2 / 3 / 3; position: relative; }
#ov-comp { grid-area: 1 / 3; }
#ov-trans { grid-area: 2 / 1; }
#ov-qual { grid-area: 2 / 3; }
.prog-bar { height: 10px; background: #0b1a2e; border-radius: 5px; overflow: hidden; margin: 6px 0 4px; }
.prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1e9bd7, #27c6f0); }
.big-pct { font-size: 26px; color: #ffd24a; font-family: Consolas, monospace; }
.zone { margin-top: 8px; padding: 7px 9px; background: rgba(11,26,46,.7); border-radius: 4px; }
.zone b { font-size: 13px; }
.zone .kv span:last-child { color: #27c6f0; }
.gauge-row { display: flex; justify-content: space-around; margin: 6px 0; }
.gauge { text-align: center; }
.gauge svg { display: block; margin: 0 auto; }
.gauge .gv { font-family: Consolas, monospace; font-size: 13px; fill: #eaf6ff; }
.gauge .gl { font-size: 11px; fill: #8fb3d1; }
.gauge .cap { font-size: 11px; color: #8fb3d1; margin-top: 2px; }
.stat-cards { display: flex; gap: 8px; margin-bottom: 8px; }
.stat-cards .sc { flex: 1; text-align: center; padding: 6px 2px; background: rgba(11,26,46,.7); border-radius: 4px; }
.stat-cards .sc b { display: block; font-size: 18px; color: #ffd24a; font-family: Consolas, monospace; }
.stat-cards .sc.good b { color: #7ee787; }
.stat-cards .sc span { font-size: 11px; color: #8fb3d1; }
.ov-map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-label { position: absolute; font-size: 13px; color: #cfe8ff; text-shadow: 0 0 6px #0a1626; pointer-events: none; }
.map-tip {
  position: absolute; left: 10px; top: 10px; font-size: 11px; color: #5f7d99;
  background: rgba(8,17,32,.7); padding: 4px 8px; border-radius: 4px;
}
@media (max-width: 1100px) {
  #page-overview.visible { grid-template-columns: 1fr 1fr; grid-template-rows: 320px auto auto; }
  #ov-prog { grid-area: 1 / 1; } #ov-map { grid-area: 1 / 2; }
  #ov-comp { grid-area: 2 / 1; } #ov-trans { grid-area: 2 / 2; }
  #ov-qual { grid-area: 3 / 1 / 4 / 3; }
}

/* ============ 实时监控页 ============ */
#page-realtime.visible { display: grid; grid-template-columns: 240px 1fr 290px; gap: 10px; }
.rt-left, .rt-right { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
.rt-left::-webkit-scrollbar, .rt-right::-webkit-scrollbar { width: 5px; }
.rt-left::-webkit-scrollbar-thumb, .rt-right::-webkit-scrollbar-thumb { background: #1d4b7a; border-radius: 3px; }
.rt-center { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.statbar { display: flex; gap: 10px; flex: none; }
.stat {
  flex: 1; text-align: center; padding: 8px 4px;
  background: rgba(13, 30, 54, .85); border: 1px solid #1d4b7a; border-radius: 6px;
}
.stat b { display: block; font-size: 20px; color: #ffd24a; font-family: Consolas, monospace; }
.stat.warn b { color: #ff5f3c; }
.stat span { font-size: 12px; color: #8fb3d1; }
.map-wrap {
  flex: 1; position: relative; min-height: 300px; background: #060d18;
  border: 1px solid #1d4b7a; border-radius: 6px; overflow: hidden;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; }
.legend {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(8, 17, 32, .85); border: 1px solid #1d4b7a; border-radius: 4px;
  padding: 5px 10px; font-size: 12px; color: #8fb3d1;
  display: flex; align-items: center; gap: 5px;
}
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.replay-bar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(90, 30, 20, .92); border: 1px solid #ff5f3c; border-radius: 4px;
  padding: 6px 14px; font-size: 13px; color: #ffd8cf;
  display: flex; gap: 10px; align-items: center;
}
.replay-bar.hidden { display: none; }
.replay-bar button {
  background: #ff5f3c; color: #fff; border: 0; border-radius: 3px;
  padding: 3px 10px; cursor: pointer; font-size: 12px;
}
.unit-item { padding: 8px 10px; margin-bottom: 6px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; }
.unit-item:hover { background: rgba(39, 198, 240, .08); }
.unit-item.active { border-color: #27c6f0; background: rgba(39, 198, 240, .12); }
.unit-item b { font-size: 13px; display: block; }
.unit-item .sub { font-size: 12px; color: #8fb3d1; margin-top: 3px; }
.device-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 12px; border-radius: 4px; }
.device-item:hover { background: rgba(39, 198, 240, .08); }
.device-item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.device-item .nm { flex: 1; }
.device-item .sp { font-family: Consolas, monospace; }
.device-item .sp.over { color: #ff5f3c; font-weight: bold; }
.device-item .ut { color: #5f7d99; }
.alert-list { font-size: 12px; max-height: 260px; overflow-y: auto; }
.alert-item {
  padding: 6px 8px; border-left: 3px solid #ff5f3c; margin-bottom: 6px;
  background: rgba(255, 95, 60, .08); border-radius: 0 4px 4px 0;
}
.alert-item .t { color: #8fb3d1; font-family: Consolas, monospace; }
.alert-item .m { color: #ffb3a3; margin-top: 2px; }
.alert-empty { color: #5f7d99; padding: 8px; font-size: 12px; }
.replay-ctrl { display: flex; flex-direction: column; gap: 6px; }
.replay-ctrl button {
  background: rgba(39, 198, 240, .12); color: #27c6f0;
  border: 1px solid #1d6b8a; border-radius: 4px;
  padding: 7px; cursor: pointer; font-size: 13px;
}
.replay-ctrl button:hover { background: rgba(39, 198, 240, .25); }
.tip { font-size: 11px; color: #5f7d99; margin-top: 8px; line-height: 1.5; }

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid #16324f; }
th { color: #27c6f0; font-weight: normal; background: rgba(39,198,240,.06); white-space: nowrap; }
td { color: #c3d9ec; white-space: nowrap; }
td.num { font-family: Consolas, monospace; }
tr:hover td { background: rgba(39,198,240,.05); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 3px; font-size: 11px; }
.tag.good { background: rgba(126,231,135,.15); color: #7ee787; border: 1px solid #2d6b3a; }
.tag.ok { background: rgba(39,198,240,.15); color: #27c6f0; border: 1px solid #1d6b8a; }
.tag.wait { background: rgba(143,179,209,.12); color: #8fb3d1; border: 1px solid #3a5872; }
.tag.warn { background: rgba(255,95,60,.15); color: #ff7a5c; border: 1px solid #7a3c2a; }
.bar-cell { min-width: 90px; }
.bar-bg { height: 8px; background: #0b1a2e; border-radius: 4px; overflow: hidden; }
.bar-bg i { display: block; height: 100%; background: linear-gradient(90deg,#1e9bd7,#27c6f0); }
.bar-bg i.high { background: linear-gradient(90deg,#ffb13c,#7ee787); }
.qcards { display: flex; gap: 10px; }
.qcards .panel { flex: 1; text-align: center; }
.qcards .panel b { display: block; font-size: 26px; color: #ffd24a; font-family: Consolas, monospace; }
.qcards .panel.g b { color: #7ee787; }
.qcards .panel span { font-size: 12px; color: #8fb3d1; }

/* ============ 管理表单 ============ */
.form-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row input, .form-row select {
  padding: 8px; border-radius: 4px; border: 1px solid #1d4b7a;
  background: #0a1626; color: #d7e7f7; font-size: 13px; min-width: 110px; flex: 1;
}
.form-col { display: flex; flex-direction: column; gap: 10px; }
.form-col label { font-size: 12px; color: #8fb3d1; display: flex; flex-direction: column; gap: 5px; }
.form-col input {
  padding: 8px; border-radius: 4px; border: 1px solid #1d4b7a;
  background: #0a1626; color: #d7e7f7; font-size: 13px;
}
.form-col .chk { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.form-col .chk input { width: 16px; height: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.btn-p {
  background: #1e9bd7; color: #fff; border: 0; border-radius: 4px;
  padding: 8px 20px; cursor: pointer; font-size: 13px; align-self: flex-start;
}
.btn-p:hover { background: #27c6f0; }
.btn-s {
  background: rgba(39,198,240,.12); color: #27c6f0; border: 1px solid #1d6b8a;
  border-radius: 3px; padding: 3px 10px; cursor: pointer; font-size: 11px; margin-right: 4px;
}
.btn-d {
  background: rgba(255,95,60,.12); color: #ff7a5c; border: 1px solid #7a3c2a;
  border-radius: 3px; padding: 3px 10px; cursor: pointer; font-size: 11px;
}
.token-cell { font-family: Consolas, monospace; font-size: 11px; color: #8fb3d1; }

footer {
  flex: none; height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #5f7d99; border-top: 1px solid #1d4b7a; background: #0a1626;
}
@media (max-width: 1100px) { #page-realtime.visible { grid-template-columns: 1fr; } }
