/* ============================================================
   棚安卫士 · 校园电动车棚 AI 安全监管系统
   视觉：深墨底 + 电光青(充电/在线) + 苔绿(空位) + 琥珀(告警)
   ============================================================ */
:root {
  --bg: #08090b;
  --bg-soft: #0b0d10;
  --panel: #101317;
  --panel-2: #15181d;
  --panel-3: #1b1f25;
  --line: #1e2228;
  --line-2: #2a2f37;
  --text: #e9eef3;
  --sub: #8d99a6;
  --sub-2: #5f6b77;
  --cyan: #5eead4;
  --green: #4ade80;
  --amber: #f5c451;
  --red: #f87171;
  --blue: #7dd3fc;
  --purple: #c4b5fd;
  --r: 16px;
  --r-sm: 11px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .55);
  --glow: 0 0 0 1px rgba(94, 234, 212, .1), 0 12px 32px -14px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(760px 420px at 96% 2%, rgba(52, 211, 153, .08), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #233b45; border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 登录 ============================ */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-art {
  position: relative; overflow: hidden; padding: 52px 56px;
  background: linear-gradient(155deg, #0a1a20 0%, #0a1420 50%, #060b10 100%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.login-art::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(34, 211, 238, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, .06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 25% 35%, #000 8%, transparent 72%);
}
.login-art > * { position: relative; z-index: 1; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, #0891b2, #10b981);
  box-shadow: 0 8px 22px rgba(16, 185, 129, .35);
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .6px; }
.brand-sub { font-size: 11.5px; color: var(--sub-2); margin-top: 3px; letter-spacing: .4px; }
.login-hero h1 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.25; margin: 0 0 16px; letter-spacing: 1px; }
.login-hero h1 em { font-style: normal; color: var(--cyan); }
.login-hero p { color: var(--sub); line-height: 1.95; max-width: 470px; margin: 0; font-size: 14px; }
.hero-tags { display: flex; gap: 9px; margin-top: 26px; flex-wrap: wrap; }
.hero-tags span {
  font-size: 12px; color: #b8d4da; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(22, 36, 44, .72);
}
.login-stats { display: flex; gap: 38px; flex-wrap: wrap; }
.login-stats b { display: block; font-size: 26px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.login-stats span { font-size: 12px; color: var(--sub-2); }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: rgba(6, 11, 16, .55); }
.login-form { width: 100%; max-width: 356px; }
.login-form h2 { margin: 0 0 6px; font-size: 24px; }
.login-form .hint { color: var(--sub-2); font-size: 13px; margin: 0 0 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; letter-spacing: .4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm); background: #0b1418;
  border: 1px solid var(--line); color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .14);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font-size: 13.5px; cursor: pointer;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #3a5b68; background: var(--panel-3); }
.btn.primary { background: linear-gradient(135deg, #0891b2, #10b981); border-color: transparent; font-weight: 600; color: #04211d; box-shadow: 0 6px 18px rgba(16, 185, 129, .28); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: rgba(248, 113, 113, .45); color: #fca5a5; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; padding: 13px; font-size: 15px; }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.demo-accounts { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--sub-2); line-height: 2; }
.demo-accounts b { color: #a8c6ce; font-weight: 500; cursor: pointer; }
.demo-accounts b:hover { color: var(--cyan); }

/* ============================ 布局 ============================ */
.app { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0b141a, #080f14);
  border-right: 1px solid var(--line);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; z-index: 40; overflow-y: auto;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; }
.sb-brand .brand-logo { width: 36px; height: 36px; border-radius: 11px; }
.sb-brand .brand-name { font-size: 15.5px; }
.sb-brand .brand-sub { font-size: 10px; }
.nav-label { font-size: 10.5px; color: var(--sub-2); letter-spacing: 1.6px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--r-sm);
  color: #9db7bf; font-size: 13.5px; cursor: pointer; transition: .14s; position: relative; min-width: 0;
}
.nav-item svg { flex: none; opacity: .85; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: rgba(34, 211, 238, .07); color: #d9eef2; }
.nav-item.active { background: linear-gradient(90deg, rgba(16, 185, 129, .2), rgba(34, 211, 238, .04)); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--green); box-shadow: 0 0 10px rgba(52, 211, 153, .8);
}
.nav-badge {
  margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 700; flex: none;
}
.sb-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.sb-user { display: flex; align-items: center; gap: 9px; padding: 6px 4px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, #0e7490, #047857); font-size: 12px; font-weight: 700; color: #fff;
}
.sb-user .u-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .u-role { font-size: 10.5px; color: var(--sub-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-logout { margin-left: auto; color: var(--sub-2); cursor: pointer; padding: 5px; border-radius: 7px; flex: none; }
.sb-logout:hover { color: #fca5a5; background: rgba(248, 113, 113, .12); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 20px;
  border-bottom: 1px solid var(--line); background: rgba(8, 14, 19, .86);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: .4px; white-space: nowrap; }
.topbar .crumb { font-size: 11.5px; color: var(--sub-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 9px; min-width: 0; }
.chip-live {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: #9fe9c8;
  background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .28);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.chip-sync { color: #b9d7f5; background: rgba(96, 165, 250, .1); border-color: rgba(96, 165, 250, .3); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; animation: pulse 1.9s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.clock { font-size: 12.5px; color: var(--sub); font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; color: #9db7bf; position: relative;
}
.icon-btn:hover { color: #fff; border-color: var(--line-2); }
.icon-btn .badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; font-weight: 700; padding: 0 4px;
}
.view { padding: 18px 20px 36px; flex: 1; min-width: 0; }

/* ============================ 组件 ============================ */
.grid { display: grid; gap: 13px; min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px 19px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025); min-width: 0;
}
.panel-hd { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; min-width: 0; }
.panel-hd h3 { font-size: 13px; margin: 0; font-weight: 600; letter-spacing: .2px; white-space: nowrap; color: var(--text); }
.panel-hd .sub { font-size: 11px; color: var(--sub-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-hd .right { margin-left: auto; display: flex; align-items: center; gap: 7px; flex: none; }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 2px 0 13px; flex-wrap: wrap; }
.sec-title h2 { font-size: 15px; margin: 0; font-weight: 650; }
.sec-title .sub { font-size: 12px; color: var(--sub-2); }
.muted { color: var(--sub); }
.tiny { font-size: 11.5px; color: var(--sub-2); }
.num { font-variant-numeric: tabular-nums; }
.flex { display: flex; align-items: center; gap: 8px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.kpi .k-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.kpi .k-ico {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: rgba(94, 234, 212, .08); color: var(--cyan); border: 1px solid rgba(94, 234, 212, .16);
}
.kpi .k-label { font-size: 12px; color: var(--sub-2); letter-spacing: .3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .k-val { font-size: clamp(26px, 2.4vw, 34px); font-weight: 600; letter-spacing: -1px; margin: 12px 0 3px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .k-val small { font-size: 12.5px; font-weight: 500; color: var(--sub-2); margin-left: 4px; letter-spacing: 0; }
.kpi .k-foot { font-size: 11.5px; color: var(--sub-2); line-height: 1.55; }
.kpi .k-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .06); margin-top: 12px; overflow: hidden; }
.kpi .k-bar i { display: block; height: 100%; border-radius: 3px; background: var(--cyan); opacity: .85; }
.kpi.green .k-ico { background: rgba(74, 222, 128, .08); color: var(--green); border-color: rgba(74, 222, 128, .16); }
.kpi.green .k-val { color: #86efac; }
.kpi.green .k-bar i { background: var(--green); }
.kpi.amber .k-ico { background: rgba(245, 196, 81, .08); color: var(--amber); border-color: rgba(245, 196, 81, .16); }
.kpi.amber .k-val { color: #fcd34d; }
.kpi.amber .k-bar i { background: var(--amber); }
.kpi.red .k-ico { background: rgba(248, 113, 113, .08); color: var(--red); border-color: rgba(248, 113, 113, .16); }
.kpi.red .k-val { color: #fca5a5; }
.kpi.red .k-bar i { background: var(--red); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2.5px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.badge.high { background: rgba(248, 113, 113, .14); color: #fca5a5; border-color: rgba(248, 113, 113, .34); }
.badge.mid { background: rgba(251, 191, 36, .14); color: #fcd34d; border-color: rgba(251, 191, 36, .3); }
.badge.low { background: rgba(96, 165, 250, .14); color: #93c5fd; border-color: rgba(96, 165, 250, .3); }
.badge.ok { background: rgba(52, 211, 153, .14); color: #6ee7b7; border-color: rgba(52, 211, 153, .3); }
.badge.gray { background: rgba(144, 168, 178, .1); color: #b0c6cd; border-color: var(--line-2); }
.badge.pending { background: rgba(248, 113, 113, .12); color: #fca5a5; border-color: rgba(248, 113, 113, .3); }
.badge.doing { background: rgba(251, 191, 36, .12); color: #fcd34d; border-color: rgba(251, 191, 36, .3); }
.badge.done { background: rgba(52, 211, 153, .12); color: #6ee7b7; border-color: rgba(52, 211, 153, .3); }

.tbl-wrap { width: 100%; overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table.tb th {
  text-align: left; font-weight: 500; color: var(--sub-2); font-size: 11.5px;
  letter-spacing: .5px; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tb td { padding: 10px; border-bottom: 1px solid rgba(30, 48, 56, .65); vertical-align: middle; }
table.tb tbody tr { transition: background .12s; }
table.tb tbody tr:hover { background: rgba(34, 211, 238, .045); }
table.tb tbody tr:last-child td { border-bottom: none; }
.plate {
  font-family: Consolas, ui-monospace, monospace; font-weight: 700; letter-spacing: .5px;
  background: linear-gradient(180deg, #f2f7f8, #d3e2e6); color: #08161a;
  padding: 2px 7px; border-radius: 4px; font-size: 12px; display: inline-block; white-space: nowrap;
}
.plate.none { background: rgba(248, 113, 113, .16); color: #fca5a5; border: 1px dashed rgba(248, 113, 113, .5); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 12px; font-size: 12.5px; color: var(--sub); flex-wrap: wrap; }
.pager button { padding: 5px 10px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); color: #bcd2d8; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.input, select.input {
  padding: 8px 11px; border-radius: 9px; background: #0b1418; border: 1px solid var(--line);
  color: var(--text); font-size: 13px; outline: none; min-width: 0; font-family: inherit;
}
.input:focus { border-color: var(--cyan); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: #0b1418; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { padding: 6px 12px; border-radius: 7px; border: none; background: transparent; color: var(--sub); font-size: 12.5px; cursor: pointer; }
.seg button.on { background: linear-gradient(135deg, #0891b2, #0d9488); color: #fff; font-weight: 600; }

/* 车棚卡片 */
.shed-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.shed-card { cursor: pointer; transition: .16s; position: relative; overflow: hidden; }
.shed-card:hover { border-color: #2f5560; transform: translateY(-2px); box-shadow: var(--shadow); }
.shed-card .s-top { display: flex; align-items: flex-start; gap: 10px; }
.shed-card .s-name { font-size: 15px; font-weight: 650; }
.shed-card .s-loc { font-size: 11.5px; color: var(--sub-2); margin-top: 2px; }
.ring-wrap { position: relative; width: 58px; height: 58px; flex: none; }
.ring-wrap .rv { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; }
.ring-wrap .rv small { font-size: 8.5px; color: var(--sub-2); font-weight: 400; }
.shed-card .s-nums { display: flex; gap: 16px; margin-top: 12px; }
.shed-card .s-nums > div { min-width: 0; }
.shed-card .s-nums b { font-size: 19px; font-variant-numeric: tabular-nums; display: block; }
.shed-card .s-nums span { display: block; font-size: 10.5px; color: var(--sub-2); margin-top: 1px; }
.shed-card .s-foot { display: flex; align-items: center; gap: 6px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--sub-2); }

/* 监控画面 */
.cam { position: relative; border-radius: var(--r-sm); overflow: hidden; background: #050a0e; border: 1px solid var(--line-2); aspect-ratio: 16 / 9; }
.cam svg { display: block; width: 100%; height: 100%; }
.cam .cam-hud { position: absolute; inset: 0; pointer-events: none; font-family: Consolas, monospace; font-size: 10.5px; color: rgba(255, 255, 255, .78); text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.cam .cam-hud .tl { position: absolute; left: 9px; top: 8px; display: flex; align-items: center; gap: 6px; }
.cam .cam-hud .tr { position: absolute; right: 9px; top: 8px; }
.cam .cam-hud .bl { position: absolute; left: 9px; bottom: 8px; }
.cam::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); pointer-events: none; }
.rec { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
@keyframes boxpulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* 告警 */
.alert-item {
  display: flex; gap: 11px; padding: 11px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: rgba(11, 20, 24, .6); cursor: pointer; transition: .14s; min-width: 0; align-items: center;
}
.alert-item:hover { border-color: #2f5560; background: rgba(22, 36, 44, .85); }
.alert-item .a-thumb { width: 72px; height: 50px; border-radius: 8px; overflow: hidden; flex: none; border: 1px solid var(--line-2); }
.alert-item .a-thumb svg { width: 100%; height: 100%; display: block; }
.alert-item .a-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.alert-item .a-meta { font-size: 11.5px; color: var(--sub-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.alert-item.high { border-left: 3px solid var(--red); }
.alert-item.mid { border-left: 3px solid var(--amber); }
.alert-item.low { border-left: 3px solid var(--blue); }

.feed { display: flex; flex-direction: column; min-width: 0; }
.feed-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; font-size: 12.5px; border-bottom: 1px dashed rgba(30, 48, 56, .5); min-width: 0; }
.feed-row:last-child { border-bottom: none; }
.feed-row .fr-tag { font-size: 10.5px; padding: 2px 6px; border-radius: 5px; font-weight: 600; flex: none; }
.fr-tag.in { background: rgba(52, 211, 153, .14); color: #6ee7b7; }
.fr-tag.out { background: rgba(96, 165, 250, .14); color: #93c5fd; }

/* 抽屉 / 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(3, 7, 10, .68); backdrop-filter: blur(3px); z-index: 80; opacity: 0; pointer-events: none; transition: .2s; }
.mask.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 470px; max-width: 94vw; z-index: 90;
  background: linear-gradient(180deg, #0e1a21, #081016); border-left: 1px solid var(--line-2);
  transform: translateX(102%); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.drawer-hd { padding: 15px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-bd { padding: 16px; overflow: auto; flex: 1; }
.modal {
  position: fixed; z-index: 95; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.97);
  width: 470px; max-width: 93vw; max-height: 88vh; overflow: auto;
  background: linear-gradient(180deg, #101d24, #0a1218);
  border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  opacity: 0; pointer-events: none; transition: .2s;
}
.modal.on { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-hd { padding: 15px 17px 6px; font-size: 14.5px; font-weight: 650; }
.modal-bd { padding: 6px 17px 2px; }
.modal-ft { padding: 12px 17px 16px; display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 9px 12px; font-size: 13px; }
.kv .k { color: var(--sub-2); }
.kv > div:nth-child(2n) { overflow-wrap: anywhere; }
.face { width: 84px; height: 104px; border-radius: var(--r-sm); border: 1px solid var(--line-2); overflow: hidden; flex: none; }
.face svg { width: 100%; height: 100%; display: block; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.tl-item { position: relative; padding-bottom: 13px; }
.tl-item::before { content: ''; position: absolute; left: -16px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .16); }

.empty { text-align: center; color: var(--sub-2); padding: 36px 12px; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 14px); z-index: 200;
  background: #16262e; border: 1px solid var(--line-2); color: #e6f1f4; padding: 10px 16px;
  border-radius: var(--r-sm); font-size: 13px; box-shadow: var(--shadow); opacity: 0; transition: .22s; pointer-events: none; max-width: 90vw;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(248, 113, 113, .5); }
.toast.ok { border-color: rgba(52, 211, 153, .5); }

/* 图表容器 */
.chart-box { position: relative; width: 100%; min-width: 0; }
.chart-box canvas { display: block; width: 100%; }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--sub); min-width: 0; }
.legend .lg { display: flex; align-items: center; gap: 8px; }
.legend .lg i { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.legend .lg b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.donut-wrap canvas { flex: none; }

/* 报表 */
.report-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 13px; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.tick { color: #6ee7b7; } .cross { color: #3f5560; }

/* ============================ 大屏 ============================ */
.screen-wrap { min-height: 100vh; display: flex; flex-direction: column; background: #04090d; }
.sc-head {
  display: flex; align-items: center; gap: 16px; padding: clamp(14px, 2vw, 26px) clamp(16px, 3vw, 40px);
  border-bottom: 1px solid rgba(34, 211, 238, .18);
  background: linear-gradient(180deg, rgba(12, 32, 38, .92), rgba(4, 9, 13, .2));
}
.sc-head .brand-logo { width: clamp(38px, 3vw, 50px); height: clamp(38px, 3vw, 50px); }
.sc-head h1 { margin: 0; font-size: clamp(19px, 2.2vw, 30px); letter-spacing: 3px; font-weight: 700; }
.sc-head .sc-sub { font-size: clamp(10px, 1vw, 12.5px); color: var(--cyan); letter-spacing: 3px; opacity: .85; margin-top: 3px; }
.sc-clock { margin-left: auto; text-align: right; }
.sc-clock b { font-size: clamp(18px, 2.2vw, 32px); font-variant-numeric: tabular-nums; letter-spacing: 1px; display: block; line-height: 1.15; }
.sc-clock span { font-size: clamp(10px, 1vw, 12.5px); color: var(--sub-2); }

.sc-totals {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1.6vw, 22px);
  padding: clamp(16px, 2.4vw, 34px) clamp(16px, 3vw, 40px) clamp(12px, 1.4vw, 20px);
}
.sc-total {
  border: 1px solid rgba(34, 211, 238, .22); border-radius: clamp(14px, 1.4vw, 20px);
  background: linear-gradient(160deg, rgba(16, 38, 46, .95), rgba(7, 16, 21, .96));
  padding: clamp(16px, 2vw, 30px) clamp(18px, 2.2vw, 34px); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.sc-total::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: .8; }
.sc-total .t-label { font-size: clamp(12px, 1.2vw, 16px); color: var(--sub); letter-spacing: 2px; }
.sc-total .t-num {
  font-size: clamp(52px, 8vw, 116px); font-weight: 800; line-height: 1.05; letter-spacing: -3px;
  font-variant-numeric: tabular-nums; color: #fff; display: flex; align-items: baseline; gap: 10px; margin-top: 6px;
}
.sc-total .t-num i { font-style: normal; font-size: clamp(14px, 1.5vw, 22px); color: var(--sub-2); font-weight: 500; letter-spacing: 0; }
.sc-total.green .t-num { color: #6ee7b7; }
.sc-total.green::before { background: linear-gradient(90deg, transparent, var(--green), transparent); }
.sc-total .t-note { font-size: clamp(11px, 1.1vw, 13.5px); color: var(--sub-2); margin-top: 8px; }

.sc-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.2vw, 18px);
  padding: 0 clamp(16px, 3vw, 40px) clamp(16px, 2vw, 30px); flex: 1; align-content: start;
}
.sc-card {
  border: 1px solid rgba(34, 211, 238, .18); border-radius: clamp(12px, 1.2vw, 18px);
  background: linear-gradient(160deg, rgba(13, 30, 37, .92), rgba(6, 14, 18, .95));
  padding: clamp(12px, 1.4vw, 22px); position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.sc-card .c-head { display: flex; align-items: baseline; gap: 8px; }
.sc-card .c-name { font-size: clamp(16px, 1.7vw, 24px); font-weight: 700; }
.sc-card .c-loc { font-size: clamp(10px, 1vw, 12.5px); color: var(--sub-2); margin-left: auto; }
.sc-card .c-free { display: flex; align-items: baseline; gap: 6px; }
.sc-card .c-free b { font-size: clamp(38px, 4.4vw, 64px); font-weight: 800; line-height: 1; letter-spacing: -2px; font-variant-numeric: tabular-nums; color: #6ee7b7; }
.sc-card .c-free span { font-size: clamp(11px, 1.1vw, 14px); color: var(--sub-2); }
.sc-card .c-bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.sc-card .c-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #5eead4, #34d399); }
.sc-card .c-meta { display: flex; align-items: center; justify-content: space-between; font-size: clamp(10.5px, 1vw, 12.5px); color: var(--sub-2); }
.sc-card.full .c-free b { color: #fca5a5; }
.sc-card.full .c-bar i { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.sc-card.tight .c-free b { color: #fcd34d; }

/* ============================ 响应式 ============================ */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .sc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form-wrap { min-height: 100vh; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto;
    flex-direction: row; padding: 7px 5px calc(7px + env(safe-area-inset-bottom)); gap: 1px;
    border-right: none; border-top: 1px solid var(--line); z-index: 60; overflow-x: auto; overflow-y: hidden;
  }
  .sb-brand, .nav-label, .sb-foot { display: none; }
  .nav-item { flex: 1 0 auto; min-width: 56px; flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 10px; border-radius: 9px; justify-content: center; }
  .nav-item span { font-size: 9.5px; }
  .nav-item.active::before { left: 50%; top: 0; bottom: auto; width: 20px; height: 2px; transform: translateX(-50%); }
  .nav-badge { position: absolute; top: 0; right: 6px; margin: 0; }
  #navScreen { display: none; }
  .view { padding: 13px 13px 88px; }
  .topbar { height: 54px; padding: 0 13px; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .topbar .crumb, .clock, .chip-live .t { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi .k-val { font-size: 22px; }
  .shed-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 13px; border-radius: 12px; }
  .g2, .g3, .g4, .report-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .panel-hd { flex-wrap: wrap; }
  .panel-hd .sub { display: none; }
  .sec-title .sub { display: none; }
  .donut-wrap { justify-content: center; }
  .legend { flex-direction: row; flex-wrap: wrap; gap: 8px 14px; justify-content: center; }
  .legend .lg b { margin-left: 4px; }
  .drawer { width: 100vw; max-width: 100vw; }
  .kv { grid-template-columns: 84px minmax(0, 1fr); }
  .sc-totals { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 14px 20px; gap: 10px; }
  .sc-head { padding: 14px 16px; }
  .sc-head h1 { letter-spacing: 2px; }
  /* 表格转卡片 */
  table.tb.resp { min-width: 0; }
  table.tb.resp thead { display: none; }
  table.tb.resp tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 10px;
    padding: 11px 0; border-bottom: 1px solid var(--line);
  }
  table.tb.resp td { border: none; padding: 2px 0; min-width: 0; overflow-wrap: anywhere; }
  table.tb.resp td[data-l]::before { content: attr(data-l) '：'; color: var(--sub-2); font-size: 11px; }
  table.tb.resp td[data-l="号牌"]::before, table.tb.resp td[data-l="状态"]::before,
  table.tb.resp td[data-l="合规状态"]::before, table.tb.resp td[data-l="操作"]::before { display: none; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .sc-grid { grid-template-columns: minmax(0, 1fr); }
  .top-right .icon-btn { width: 32px; height: 32px; }
}

/* Netlify 徽标上移，避免遮住底部导航 */
@media (max-width: 900px) { #nl-badge-frame { bottom: 78px !important; } }

/* 横向条形图（HTML 实现，自适应不挤压） */
.hbar { margin-bottom: 11px; }
.hbar:last-child { margin-bottom: 0; }
.hbar-h { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--sub); margin-bottom: 5px; }
.hbar-h span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-h b { color: var(--text); font-variant-numeric: tabular-nums; font-size: 13px; }
.hbar-h em { font-style: normal; font-size: 11px; color: var(--sub-2); min-width: 34px; text-align: right; }
.hbar-t { height: 7px; border-radius: 4px; background: #17272f; overflow: hidden; }
.hbar-t i { display: block; height: 100%; border-radius: 4px; transition: width .4s ease; }

/* ---------------- 账号切换 ---------------- */
.sb-user { cursor: pointer; border-radius: 11px; transition: background .16s; }
.sb-user:hover { background: rgba(255, 255, 255, .045); }
.sb-user .sb-logout:hover { color: var(--cyan); }

.acct-list { display: flex; flex-direction: column; gap: 7px; }
.acct-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
  cursor: pointer; transition: border-color .16s, background .16s;
}
.acct-row:hover { border-color: var(--line-2); background: var(--panel-3); }
.acct-row.on { border-color: rgba(94, 234, 212, .32); background: rgba(94, 234, 212, .06); cursor: default; }
.acct-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; }
.acct-go { font-size: 11.5px; color: var(--cyan); flex: none; }

/* ---------------- 编辑弹窗里的表单 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-grid .field { margin: 0; }
.form-grid .full { grid-column: 1 / -1; }
.danger-text { color: var(--red); }

/* ---------------- 停车可视化 ---------------- */
.park-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.park-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 17px; cursor: pointer; transition: border-color .18s, transform .18s, background .18s;
  min-width: 0;
}
.park-card:hover { border-color: var(--line-2); transform: translateY(-2px); background: var(--panel-2); }
.park-hd { display: flex; align-items: baseline; gap: 8px; margin-bottom: 13px; min-width: 0; }
.park-hd b { font-size: 14px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; flex: none; }
.park-hd span { font-size: 11.5px; color: var(--sub-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.park-hd em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--sub-2); flex: none; }
.park-lane {
  position: relative; height: 58px; border-radius: 12px; background: rgba(255, 255, 255, .022);
  border: 1px solid var(--line); display: flex; gap: 3px; padding: 7px; overflow: hidden;
}
.park-slot {
  flex: 1 1 0; min-width: 0; border-radius: 6px; border: 1px dashed rgba(255, 255, 255, .07);
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.park-slot.on { border-style: solid; border-color: rgba(94, 234, 212, .3); background: rgba(94, 234, 212, .07); }
.park-slot.warn { border-style: solid; border-color: rgba(245, 196, 81, .32); background: rgba(245, 196, 81, .08); }
.park-slot.bad { border-style: solid; border-color: rgba(248, 113, 113, .32); background: rgba(248, 113, 113, .09); }
.park-slot svg { width: 100%; height: 100%; max-width: 21px; max-height: 21px; display: block; }
.park-slot.on svg, .park-slot.warn svg, .park-slot.bad svg {
  animation: driveIn .62s cubic-bezier(.2, .85, .3, 1) both;
}
@keyframes driveIn {
  0% { transform: translateX(-30px) scale(.72); opacity: 0; }
  55% { transform: translateX(3px) scale(1.05); opacity: 1; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
.park-ft { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.park-legend { display: flex; gap: 11px; font-size: 11px; color: var(--sub-2); white-space: nowrap; }
.park-legend span { display: inline-flex; align-items: center; }
.park-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.park-num { margin-left: auto; font-size: 12px; color: var(--sub-2); }
.park-num b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------------- 可点击卡片 ---------------- */
.click-card { cursor: pointer; transition: border-color .18s, transform .18s; }
.click-card:hover { border-color: var(--line-2); transform: translateY(-1px); }

/* ---------------- 车棚详情 / 车辆详情 ---------------- */
.detail-hd {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
}
.detail-hd .dh-main { min-width: 0; }
.detail-hd h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.2px; }
.detail-hd .dh-sub { font-size: 12px; color: var(--sub-2); }
.detail-hd .dh-stats { margin-left: auto; display: flex; gap: 26px; flex: none; }
.detail-hd .dh-stats div { text-align: right; }
.detail-hd .dh-stats b { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.detail-hd .dh-stats span { font-size: 11px; color: var(--sub-2); }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--sub);
  cursor: pointer; margin-bottom: 12px; transition: color .15s;
}
.back-link:hover { color: var(--cyan); }

/* ---------------- 台账两栏 ---------------- */
.tally-tabs { display: flex; gap: 14px; margin-bottom: 14px; }
.tally-card {
  flex: 1; padding: 16px 18px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; transition: border-color .18s, background .18s;
}
.tally-card:hover { border-color: var(--line-2); }
.tally-card.on { border-color: rgba(94, 234, 212, .38); background: rgba(94, 234, 212, .05); }
.tally-card.on.red { border-color: rgba(248, 113, 113, .38); background: rgba(248, 113, 113, .05); }
.tally-card .tc-num { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }
.tally-card .tc-num small { font-size: 12px; font-weight: 500; color: var(--sub-2); margin-left: 4px; }
.tally-card .tc-label { font-size: 12px; color: var(--sub-2); margin-top: 3px; }
.tally-card.green .tc-num { color: #86efac; }
.tally-card.red .tc-num { color: #fca5a5; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.chip-filter {
  font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); color: var(--sub); background: transparent; transition: all .15s;
}
.chip-filter:hover { border-color: var(--line-2); color: var(--text); }
.chip-filter.on { border-color: rgba(94, 234, 212, .4); color: var(--cyan); background: rgba(94, 234, 212, .08); }

/* ---------------- 车棚卡片（简洁版） ---------------- */
.sh-name { font-size: 15px; font-weight: 600; letter-spacing: .1px; }
.sh-loc { font-size: 11.5px; color: var(--sub-2); margin-top: 3px; }
.sh-num { display: flex; align-items: baseline; gap: 5px; margin: 16px 0 10px; }
.sh-num b { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -1px; line-height: 1; }
.sh-num span { font-size: 12.5px; color: var(--sub-2); }
.sh-bar { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.sh-bar i { display: block; height: 100%; border-radius: 3px; transition: width .4s; }
.sh-ft { display: flex; align-items: center; gap: 8px; margin-top: 11px; font-size: 11.5px; color: var(--sub-2); }


/* ---------------- 批量操作条 ---------------- */
.batch-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.batch-bar .btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------------- 视频识别 ---------------- */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  height: 260px; border: 1.5px dashed var(--line-2); border-radius: var(--r);
  cursor: pointer; transition: border-color .18s, background .18s; text-align: center; padding: 16px;
}
.drop-zone:hover, .drop-zone.over { border-color: rgba(94, 234, 212, .45); background: rgba(94, 234, 212, .04); }
.drop-zone svg { color: var(--sub-2); }
.dz-title { font-size: 13.5px; font-weight: 600; }
.dz-sub { font-size: 11.5px; color: var(--sub-2); }

.rec-video {
  width: 100%; border-radius: var(--r); background: #000; display: block;
  max-height: 340px; object-fit: contain;
}
.rec-progress { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .07); margin-top: 12px; overflow: hidden; }
.rec-progress i { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .2s linear; }

.rec-feed { display: flex; flex-direction: column; gap: 7px; max-height: 420px; overflow: auto; }
.rec-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
  animation: recIn .32s ease both;
}
.rec-item.viol { border-color: rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .05); }
.rec-item .ri-ico {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: rgba(94, 234, 212, .1); color: var(--cyan);
}
.rec-item.viol .ri-ico { background: rgba(248, 113, 113, .12); color: var(--red); }
.rec-item .ri-main { min-width: 0; flex: 1; }
.rec-item .ri-t { font-size: 12.5px; font-weight: 600; }
.rec-item .ri-s { font-size: 11px; color: var(--sub-2); margin-top: 2px; }
.rec-item .ri-c { font-size: 11px; color: var(--sub-2); font-variant-numeric: tabular-nums; flex: none; }
@keyframes recIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 停车可视化：窄屏适配 ---------------- */
@media (max-width: 1180px) {
  .park-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 780px) {
  .park-grid { grid-template-columns: 1fr; gap: 11px; }
  .park-card { padding: 14px 15px; }
  .park-lane { height: 52px; padding: 6px; gap: 2px; }
  .park-slot svg { max-width: 17px; max-height: 17px; }
  .park-legend { gap: 9px; font-size: 10.5px; }
  .park-num { font-size: 11.5px; }
}
@media (max-width: 420px) {
  .park-lane { height: 46px; padding: 5px; gap: 1.5px; }
  .park-slot svg { max-width: 14px; max-height: 14px; }
  .park-legend span { font-size: 10px; }
}
