:root {
  --bg: #eef1ed;
  --surface: #ffffff;
  --surface-2: #f7f9f6;
  --surface-3: #edf2ee;
  --ink: #172421;
  --ink-2: #45564f;
  --muted: #788680;
  --line: #dbe3de;
  --line-strong: #c3cec8;
  --nav: #12221e;
  --nav-2: #1b302a;
  --teal: #0b7f73;
  --teal-2: #1f9a8c;
  --teal-soft: #e0f2ee;
  --blue: #376b93;
  --blue-soft: #e8f0f6;
  --amber: #b97522;
  --amber-soft: #fff1df;
  --red: #c84f4b;
  --red-soft: #fbe8e6;
  --green: #278269;
  --green-soft: #e3f3ed;
  --purple: #745b8e;
  --shadow: 0 12px 32px rgba(25, 47, 40, .07);
  --shadow-small: 0 5px 16px rgba(25, 47, 40, .06);
  --radius: 13px;
  --radius-sm: 8px;
  --sans: "Aptos", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Bahnschrift", "Aptos Display", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: #bde6df; color: #0c3f37; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c7d2cc; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--nav);
  color: #eaf4ef;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.boot-mark {
  width: 64px;
  height: 64px;
  border: 1px solid #4c6960;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 1px;
}
.boot-copy strong { display: block; font-size: 15px; font-weight: 650; }
.boot-copy span { display: block; font-size: 11px; color: #93aba3; margin-top: 6px; }
.boot-line { width: 230px; height: 2px; background: #2d4540; margin-top: 14px; overflow: hidden; }
.boot-line i { display: block; width: 42%; height: 100%; background: #44c5b2; animation: boot 1.2s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
.boot-screen.hidden { display: none; }

.app {
  width: 100%;
  height: 100vh;
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  overflow: hidden;
}
.app.bigscreen { grid-template-columns: 0 minmax(0, 1fr); }
.app.bigscreen .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }

.sidebar {
  background: var(--nav);
  color: #dfeae5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 12;
  transition: transform .25s ease, opacity .2s ease;
}
.brand {
  padding: 20px 19px 17px;
  border-bottom: 1px solid #263b35;
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid #4a655d;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: .7px;
}
.brand-text strong { display: block; font-size: 14px; font-weight: 650; letter-spacing: .1px; }
.brand-text span { display: block; color: #829a92; font-size: 8px; letter-spacing: 1.25px; margin-top: 4px; text-transform: uppercase; }
.nav-scroll { flex: 1; overflow: auto; padding: 11px 9px 16px; }
.nav-group { margin: 0 0 12px; }
.nav-label {
  display: block;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: #667f77;
  text-transform: uppercase;
  padding: 9px 11px 6px;
}
.nav-link {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 10px;
  text-decoration: none;
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 8px;
  color: #95aaa2;
  font-size: 11px;
  transition: .15s ease;
}
.nav-link .nav-code {
  width: 23px;
  height: 23px;
  border-radius: 6px;
  border: 1px solid #3c554d;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-family: var(--display);
}
.nav-link .nav-count {
  min-width: 17px;
  height: 17px;
  border-radius: 99px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  background: #6d3430;
  color: #ffdcd8;
  font-size: 8px;
  font-family: var(--display);
}
.nav-link:hover { background: #1a302a; color: #eef6f2; }
.nav-link.active { background: #e4f2ed; color: #13362d; font-weight: 650; }
.nav-link.active .nav-code { border-color: #9fc6bb; color: var(--teal); }
.nav-link.active .nav-count { background: #c5524d; color: #fff; }
.sidebar-foot {
  border-top: 1px solid #263b35;
  padding: 12px 15px 15px;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 9px;
  align-items: center;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2d4b42;
  color: #dcebe5;
  display: grid;
  place-items: center;
  font-size: 10px;
}
.side-user strong { display: block; font-size: 10px; color: #d8e4df; }
.side-user span { display: block; font-size: 8px; color: #6f8a82; margin-top: 3px; }

.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.topbar {
  min-height: 66px;
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 10;
}
.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--ink-2);
}
.crumb { min-width: 210px; }
.crumb strong { display: block; font-size: 13px; font-weight: 650; }
.crumb span { display: block; font-size: 8px; letter-spacing: .8px; color: var(--muted); margin-top: 4px; text-transform: uppercase; }
.top-tabs { display: flex; gap: 3px; align-items: center; flex: 1; }
.top-tab {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  min-height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 10px;
}
.top-tab:hover { background: var(--surface-3); }
.top-tab.active { background: var(--teal-soft); color: var(--teal); font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.mode-pill {
  height: 25px;
  padding: 0 8px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  background: #fff3e2;
  border: 1px solid #ead0aa;
  color: #946528;
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}
.live-pill {
  height: 25px;
  padding: 0 8px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f2faf7;
  border: 1px solid #c7ddd6;
  color: #397467;
  font-size: 8px;
  white-space: nowrap;
  cursor: pointer;
}
.live-pill:hover { border-color: #8eb8ad; background: #ecf8f4; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: #21a78e; }
.live-pill.stale { background: var(--red-soft); border-color: #e6beb9; color: var(--red); }
.live-pill.stale i { background: var(--red); animation: none; }
.live-banner {
  display: none;
  padding: 8px 20px;
  background: #fff0ee;
  border-bottom: 1px solid #e9c2bd;
  color: #923d38;
  font-size: 9px;
}
.live-banner.visible { display: block; }
.icon-button {
  width: 35px;
  height: 35px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  position: relative;
  font-size: 10px;
  font-weight: 700;
}
.icon-button:hover { border-color: #9fc5ba; color: var(--teal); background: #f7fbf9; }
.icon-button .badge-dot {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  border: 1px solid #fff;
}
.search-trigger {
  height: 35px;
  border: 1px solid var(--line);
  background: #f8faf7;
  border-radius: 8px;
  color: #7b8983;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  font-size: 9px;
}
.search-trigger kbd { font-size: 8px; border: 1px solid #d2dad5; border-radius: 4px; padding: 2px 4px; background: #fff; }
.role-switch {
  height: 35px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0 8px;
  color: var(--ink-2);
  font-size: 9px;
}
.clock { text-align: right; line-height: 1.3; min-width: 95px; }
.clock b { display: block; font-family: var(--display); font-size: 11px; font-weight: 500; }
.clock span { display: block; font-size: 8px; color: var(--muted); }

.page-shell {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 22px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 2px 0 14px;
}
.page-kicker { font-size: 8px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--teal); font-weight: 700; margin-bottom: 5px; }
.page-head h1 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 650; letter-spacing: -.4px; }
.page-head p { margin: 5px 0 0; font-size: 10px; color: var(--muted); }
.page-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink-2);
  font-size: 9px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: .15s ease;
}
.button:hover { border-color: #8eb8ad; color: var(--teal); background: #f7fbf9; }
.button.primary { border-color: var(--teal); background: var(--teal); color: #fff; }
.button.primary:hover { background: #086c62; border-color: #086c62; color: #fff; }
.button.danger { border-color: #dab0ac; color: var(--red); background: #fffafa; }
.button.danger:hover { border-color: var(--red); background: var(--red-soft); }
.button.small { min-height: 27px; padding: 0 8px; font-size: 8px; border-radius: 6px; }
.button:disabled { cursor: not-allowed; opacity: .45; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}
.card-head {
  padding: 14px 15px 11px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .05px; }
.card-head p { margin: 4px 0 0; font-size: 9px; color: var(--muted); }
.card-body { padding: 0 15px 15px; }
.muted { color: var(--muted); }
.small { font-size: 9px; }
.tiny { font-size: 8px; }
.eyebrow { font-size: 8px; color: var(--muted); letter-spacing: .8px; text-transform: uppercase; font-weight: 650; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #aab8b2; }
.status-dot.good { background: #22a486; }
.status-dot.warn { background: #d78b34; }
.status-dot.risk { background: #ce554f; }
.status-dot.info { background: #5586aa; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 8px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: #60716a;
  white-space: nowrap;
}
.chip.good { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.risk { background: var(--red-soft); color: var(--red); }
.chip.info { background: var(--blue-soft); color: var(--blue); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.state-card .card-body { display: grid; grid-template-columns: 108px 1fr; gap: 13px; align-items: center; }
.health-ring {
  --score: 96;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--teal) calc(var(--score) * 1%), #e5ece8 0);
  position: relative;
}
.health-ring::before { content: ""; position: absolute; inset: 9px; background: #fff; border-radius: 50%; }
.health-ring > div { position: relative; text-align: center; }
.health-ring b { display: block; font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1; }
.health-ring span { display: block; font-size: 8px; color: var(--muted); margin-top: 4px; }
.health-list { display: flex; flex-direction: column; gap: 8px; }
.health-list > div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid #edf1ee; padding-bottom: 7px; font-size: 8px; }
.health-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.health-list span { color: var(--muted); }
.health-list b { color: var(--ink-2); font-family: var(--display); font-weight: 500; }
.risk-device {
  border: 1px solid #e1e8e3;
  background: #fbfcfa;
  border-radius: 9px;
  padding: 11px;
  text-align: left;
  transition: .15s ease;
}
.risk-device:hover { border-color: #a7c8bf; background: #fff; transform: translateY(-1px); }
.risk-device strong { display: block; font-size: 10px; margin-top: 6px; }
.risk-device > span:nth-of-type(2) { display: block; font-size: 8px; color: var(--muted); margin-top: 4px; }
.risk-device > div { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.risk-device b { font-family: var(--display); font-size: 15px; font-weight: 500; }
.risk-device i { display: block; height: 4px; width: 100%; max-width: 90px; border-radius: 99px; background: linear-gradient(90deg, var(--teal) var(--w), #e7ede9 var(--w)); }
.env-list { display: flex; flex-direction: column; gap: 0; }
.env-list > div { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid #edf1ee; font-size: 9px; }
.env-list > div:last-child { border-bottom: 0; }
.env-list span { color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.env-list b { font-family: var(--display); font-weight: 500; color: #41584e; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.quick-grid a {
  border: 1px solid #e1e8e3;
  border-radius: 8px;
  background: #fbfcfa;
  min-height: 62px;
  text-decoration: none;
  padding: 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: .15s ease;
}
.quick-grid a:hover { border-color: #a7c8bf; background: #fff; }
.quick-grid b { font-family: var(--display); font-size: 10px; color: var(--teal); }
.quick-grid span { font-size: 8px; color: var(--muted); }
.snapshot-frame { position: relative; border-radius: 9px; overflow: hidden; border: 1px solid #dbe3de; background: #0f1c20; }
.snapshot-frame img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.snapshot-frame span { position: absolute; left: 8px; top: 8px; background: rgba(8,21,25,.7); color: #dff7f1; padding: 4px 6px; border: 1px solid rgba(255,255,255,.15); font-size: 7px; }
.snapshot-frame.large img { max-height: 62vh; object-fit: contain; background: #071217; }
.report-preview h3 { font-size: 11px; margin: 15px 0 6px; }
.notification { cursor: pointer; }
.notification:hover { border-color: #99c0b5; background: #fff; }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr);
  gap: 13px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 9px;
  margin-bottom: 13px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  min-height: 88px;
  position: relative;
  box-shadow: var(--shadow-small);
  text-align: left;
}
button.kpi-card { cursor: pointer; }
button.kpi-card:hover { border-color: #9ec3b9; transform: translateY(-1px); }
.kpi-card label { display: block; color: var(--muted); font-size: 9px; }
.kpi-card strong { display: block; margin-top: 7px; font-family: var(--display); font-size: 23px; font-weight: 600; letter-spacing: -.4px; line-height: 1; }
.kpi-card small { display: block; color: #7a8983; font-size: 8px; margin-top: 6px; }
.kpi-card .state { position: absolute; right: 12px; top: 12px; }
.kpi-card.good { background: linear-gradient(180deg, #fff, #fbfdfc); }
.overview-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
.event-mini-list { display: flex; flex-direction: column; gap: 7px; padding: 0 11px 11px; }
.event-mini {
  border: 1px solid #e3e9e5;
  border-radius: 9px;
  background: #fcfdfc;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  cursor: pointer;
  transition: .15s ease;
  text-align: left;
}
.event-mini:hover { border-color: #a7c8bf; background: #fff; }
.event-mini strong { display: block; font-size: 10px; font-weight: 650; }
.event-mini span { display: block; font-size: 8px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.event-mini time { font-family: var(--display); font-size: 8px; color: #91a09a; }
.event-mini .tag { margin-top: 4px; }
.event-mini .chip { display: inline-flex; width: max-content; margin-top: 5px; }
.space-mini { min-height: 360px; position: relative; overflow: hidden; }
.space-mini .scene { height: 260px; margin: 0 12px; }
.space-mini .scene-footer { padding: 10px 13px 12px; display: flex; justify-content: space-between; align-items: center; }
.energy-card { min-height: 220px; }
.chart-container { position: relative; min-height: 150px; }
.chart-container svg { display: block; width: 100%; overflow: visible; }
.chart-legend { display: flex; gap: 14px; padding: 0 15px 12px; font-size: 8px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 15px; height: 2px; display: block; }
.ai-card {
  padding: 13px 14px;
  border: 1px solid #cfe2dc;
  border-radius: 10px;
  background: #f5fbf8;
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 10px;
}
.ai-orb {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: #d8eee8;
  color: var(--teal);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 10px;
}
.ai-card h3 { margin: 0 0 5px; font-size: 10px; font-weight: 650; }
.ai-card p { margin: 0; font-size: 9px; line-height: 1.55; color: #5c7068; }
.ai-card .source-row { margin-top: 8px; }
.source-row { display: flex; flex-wrap: wrap; gap: 5px; }
.source {
  border: 1px solid #c5ddd6;
  background: #fff;
  color: #4b756b;
  border-radius: 4px;
  font-size: 7px;
  padding: 2px 5px;
}

.scene {
  position: relative;
  overflow: hidden;
  border: 1px solid #dfe7e2;
  border-radius: 10px;
  background:
    linear-gradient(rgba(48,80,69,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48,80,69,.035) 1px, transparent 1px),
    #f2f7f3;
  background-size: 30px 30px;
  min-height: 260px;
}
.scene-plane {
  position: absolute;
  left: 13%;
  top: 21%;
  width: 65%;
  height: 56%;
  transform: rotateX(58deg) rotateZ(-28deg);
  transform-origin: center;
  border: 1.5px solid #55756b;
  background: #e6ede8;
  box-shadow: 17px 20px 0 rgba(61,88,79,.08);
  transition: transform .2s ease;
}
.scene-plane .room {
  position: absolute;
  border: 1px solid #b7c6c0;
  background: rgba(255,255,255,.78);
  display: grid;
  place-items: center;
  color: #657870;
}
.scene-plane .room strong { display: block; font-size: 10px; color: #2e473d; font-weight: 650; text-align: center; }
.scene-plane .room span { display: block; font-size: 7px; color: #819087; text-align: center; margin-top: 3px; }
.scene-plane .room.r1 { left: 0; top: 0; width: 42%; height: 55%; background: #f6faf7; }
.scene-plane .room.r2 { left: 42%; top: 0; width: 31%; height: 61%; background: #edf5f1; }
.scene-plane .room.r3 { left: 73%; top: 0; width: 27%; height: 33%; }
.scene-plane .room.r4 { left: 73%; top: 33%; width: 27%; height: 28%; }
.scene-plane .room.r5 { left: 0; top: 55%; width: 26%; height: 45%; }
.scene-plane .room.r6 { left: 26%; top: 55%; width: 32%; height: 45%; }
.scene-plane .room.r7 { left: 58%; top: 61%; width: 42%; height: 39%; }
.scene-plane .room.r8 { left: 58%; top: 33%; width: 15%; height: 28%; }
.scene-plane .corridor { position: absolute; left: 0; top: 46%; width: 100%; height: 9%; background: rgba(77,107,94,.1); border: 0; }
.hotspot {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: #168d7d;
  box-shadow: 0 0 0 3px rgba(22,141,125,.17), 0 3px 8px rgba(19,64,54,.25);
  color: #fff;
  font-family: var(--display);
  font-size: 7px;
  z-index: 3;
  transition: .15s ease;
}
.hotspot:hover, .hotspot.selected { transform: scale(1.32); box-shadow: 0 0 0 5px rgba(22,141,125,.14), 0 4px 10px rgba(19,64,54,.25); }
.hotspot.warn { background: var(--amber); }
.hotspot.risk { background: var(--red); }
.hotspot-label {
  position: absolute;
  z-index: 2;
  padding: 5px 7px;
  border: 1px solid #d4e1dc;
  background: rgba(255,255,255,.92);
  border-radius: 6px;
  font-size: 8px;
  color: #425850;
  white-space: nowrap;
  box-shadow: var(--shadow-small);
}
.scene-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; z-index: 4; }
.scene-tools button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 9px;
}
.scene-tools button:hover { border-color: #8eb8ad; color: var(--teal); }
.scene-legend { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; max-width: 75%; }
.scene-legend span { background: rgba(255,255,255,.9); border: 1px solid #d9e3de; border-radius: 5px; padding: 4px 6px; font-size: 7px; color: #61736b; display: flex; align-items: center; gap: 4px; }
.scene-legend i { display: block; width: 6px; height: 6px; border-radius: 50%; }

.drawer-scrim, .modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(14,27,22,.28);
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 41;
  width: min(470px, 94vw);
  background: #fff;
  box-shadow: -12px 0 46px rgba(16,32,25,.18);
  animation: drawer-in .22s ease;
  display: flex;
  flex-direction: column;
}
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head {
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.drawer-head p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.drawer-body { flex: 1; overflow: auto; padding: 15px 18px 20px; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 7px; justify-content: flex-end; }
.close-button { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 7px; color: var(--ink-2); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.detail-cell { border: 1px solid #e4eae6; border-radius: 8px; padding: 10px; background: #f8faf8; }
.detail-cell label { display: block; font-size: 8px; color: var(--muted); }
.detail-cell b { display: block; margin-top: 4px; font-family: var(--display); font-size: 15px; font-weight: 500; }
.timeline { margin-top: 13px; }
.timeline-item { position: relative; padding: 0 0 14px 17px; border-left: 1px solid #d7e2dd; }
.timeline-item::before { content: ""; position: absolute; left: -4px; top: 2px; width: 7px; height: 7px; border-radius: 50%; background: #84b6aa; }
.timeline-item.risk::before { background: var(--red); }
.timeline-item time { display: block; font-family: var(--display); font-size: 8px; color: #8b9993; }
.timeline-item p { margin: 4px 0 0; font-size: 9px; line-height: 1.5; color: #52665d; }
.evidence-list { display: flex; flex-direction: column; gap: 7px; }
.evidence {
  border: 1px solid #dce5e0;
  background: #f8fbf9;
  border-radius: 7px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  font-size: 8px;
  color: #60736a;
}
.evidence b { display: block; font-size: 9px; color: #314a40; margin-bottom: 3px; }
.evidence button { border: 0; background: transparent; color: var(--teal); font-size: 8px; }

.modal {
  position: fixed;
  z-index: 45;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 94vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 70px rgba(14,32,25,.25);
  animation: modal-in .18s ease;
}
.modal.wide { width: min(860px, 94vw); }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -47%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-head { padding: 17px 19px 13px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.modal-body { padding: 16px 19px; }
.modal-foot { padding: 12px 19px 17px; display: flex; justify-content: flex-end; gap: 7px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 8px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #d3ddd7;
  background: #fbfcfa;
  border-radius: 7px;
  min-height: 36px;
  padding: 8px 9px;
  font-size: 10px;
  color: var(--ink);
  outline: none;
}
.field textarea { min-height: 78px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #71aa9e; box-shadow: 0 0 0 3px rgba(11,127,115,.08); background: #fff; }
.field .error { color: var(--red); font-size: 8px; display: none; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); }
.field.invalid .error { display: block; }
.check-line { display: flex; align-items: flex-start; gap: 8px; font-size: 9px; color: var(--ink-2); line-height: 1.5; }
.check-line input { margin-top: 1px; accent-color: var(--teal); }

.toast-root { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; }
.toast {
  background: #172922;
  color: #eff8f4;
  border: 1px solid #355249;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 9px;
  box-shadow: 0 10px 30px rgba(12,28,21,.22);
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.search-modal { width: min(640px, 92vw); }
.search-input-wrap { display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); padding: 14px 16px; }
.search-input-wrap input { flex: 1; border: 0; outline: 0; font-size: 13px; }
.search-results { max-height: 380px; overflow: auto; padding: 8px; }
.search-result { width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 10px 11px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-result:hover { background: #f3f8f5; }
.search-result strong { display: block; font-size: 10px; }
.search-result span { display: block; font-size: 8px; color: var(--muted); margin-top: 3px; }

.notification-list { display: flex; flex-direction: column; gap: 8px; }
.notification {
  border: 1px solid #e1e7e3;
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.notification strong { display: block; font-size: 10px; }
.notification p { margin: 4px 0 0; font-size: 8px; color: var(--muted); line-height: 1.45; }
.notification time { font-family: var(--display); font-size: 8px; color: #8e9d96; }

.tabs {
  display: flex;
  gap: 3px;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
}
.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  min-height: 38px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 9px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 650; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 7px; background: #f6f8f6; padding: 2px; }
.segmented button { border: 0; background: transparent; color: var(--muted); border-radius: 5px; min-height: 25px; padding: 0 8px; font-size: 8px; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(24,45,36,.08); }

.filter-bar { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 11px; }
.filter-bar input, .filter-bar select {
  min-height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 0 9px;
  color: var(--ink-2);
  font-size: 9px;
  outline: none;
}
.filter-bar input { min-width: 220px; }
.filter-bar input:focus, .filter-bar select:focus { border-color: #81b6aa; box-shadow: 0 0 0 3px rgba(11,127,115,.06); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { background: #f6f8f6; color: #7b8882; font-size: 8px; font-weight: 650; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #edf1ee; font-size: 9px; color: #485c53; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f8fbf9; }
td strong { color: #283d34; font-weight: 650; }
td small { display: block; color: #8a9791; margin-top: 3px; font-size: 7px; }
.table-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.link-button { border: 0; background: transparent; color: var(--teal); padding: 3px 0; font-size: 8px; }
.link-button:hover { text-decoration: underline; }
.empty-state { padding: 38px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 10px; }
.empty-state strong { display: block; font-size: 12px; color: var(--ink-2); }
.empty-state span { display: block; margin-top: 6px; font-size: 9px; }
.skeleton { background: linear-gradient(90deg, #eef2ef, #f7f9f7, #eef2ef); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.badge-count { font-family: var(--display); font-size: 24px; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .8fr); gap: 13px; }
.three-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.four-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.five-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-bottom: 12px; }
.process-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: center; }
.process-node { border: 1px solid #d5dfda; border-radius: 8px; padding: 12px 10px; background: #fbfcfb; text-align: center; position: relative; }
.process-node strong { display: block; font-size: 10px; }
.process-node span { display: block; margin-top: 5px; font-size: 8px; color: var(--muted); }
.process-node::after { content: ""; position: absolute; width: 30px; height: 1px; background: #b7c8c1; right: -23px; top: 50%; }
.process-node:last-child::after { display: none; }
.gauge-row { display: flex; gap: 7px; flex-wrap: wrap; }
.gauge { border: 1px solid #dde6e1; border-radius: 9px; background: #fbfcfb; padding: 11px; min-width: 132px; flex: 1; }
.gauge label { display: block; color: var(--muted); font-size: 8px; }
.gauge strong { display: block; margin-top: 7px; font-family: var(--display); font-size: 21px; font-weight: 500; }
.gauge span { display: block; margin-top: 4px; font-size: 8px; color: var(--muted); }
.room-card { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; }
.room-card h3 { margin: 0; font-size: 11px; }
.room-card .metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.room-card .metrics div { border: 1px solid #edf1ee; border-radius: 6px; padding: 7px; }
.room-card label { font-size: 7px; color: var(--muted); display: block; }
.room-card b { font-family: var(--display); font-size: 14px; font-weight: 500; display: block; margin-top: 3px; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 10px; overflow: auto; }
.kanban-column { background: #f6f8f6; border: 1px solid #dfe6e1; border-radius: 10px; padding: 8px; min-height: 250px; }
.kanban-column h3 { margin: 0 0 8px; display: flex; justify-content: space-between; font-size: 9px; color: var(--ink-2); }
.kanban-card { background: #fff; border: 1px solid #e1e7e3; border-radius: 8px; padding: 10px; margin-bottom: 7px; box-shadow: 0 2px 7px rgba(30,48,40,.03); }
.kanban-card h4 { margin: 0; font-size: 9px; }
.kanban-card p { margin: 5px 0; font-size: 8px; color: var(--muted); line-height: 1.45; }
.kanban-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 4px; margin-top: 8px; font-size: 7px; color: #8a9791; }

.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.video-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.video-card img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.video-card .video-meta { padding: 9px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.video-card strong { font-size: 9px; }
.video-card span { font-size: 7px; color: var(--muted); }
.video-card:hover { border-color: #95bcb1; }
.video-card .snapshot { position: relative; cursor: pointer; }
.video-card .snapshot .overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,17,23,.06), rgba(7,17,23,.18)); }
.video-card .snapshot .live-tag { position: absolute; left: 8px; top: 8px; background: rgba(7,17,23,.66); color: #e7f9f5; font-size: 7px; padding: 3px 5px; border: 1px solid rgba(255,255,255,.18); }
.video-card .snapshot .expand-tag { position: absolute; right: 8px; bottom: 8px; background: rgba(7,17,23,.66); color: #d8f5ef; font-size: 7px; padding: 3px 5px; }

.ai-page { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(290px, .65fr); gap: 13px; min-height: 580px; }
.chat-card { display: flex; flex-direction: column; min-height: 580px; }
.chat-head { padding: 13px 15px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.chat-status { font-size: 8px; color: var(--green); display: flex; align-items: center; gap: 5px; }
.chat-messages { flex: 1; overflow: auto; padding: 15px; display: flex; flex-direction: column; gap: 12px; background: #fbfcfa; }
.message { max-width: 82%; padding: 10px 12px; border-radius: 10px; font-size: 10px; line-height: 1.6; }
.message.assistant { background: #fff; border: 1px solid #dde7e2; border-top-left-radius: 3px; color: #42574e; }
.message.user { align-self: flex-end; background: var(--teal); color: #fff; border-top-right-radius: 3px; }
.message .msg-head { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 8px; color: var(--muted); }
.message.user .msg-head { color: #bde9e1; }
.message .sources { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.message .msg-actions { display: flex; gap: 5px; margin-top: 8px; }
.prompt-chips { padding: 10px 15px 12px; display: flex; gap: 5px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.prompt-chip { border: 1px solid #d5dfda; background: #fff; border-radius: 999px; padding: 5px 8px; font-size: 8px; color: #5a6b63; }
.prompt-chip:hover { border-color: #84b7ab; color: var(--teal); }
.chat-input { padding: 10px 15px 14px; border-top: 1px solid var(--line); display: flex; gap: 7px; }
.chat-input textarea { flex: 1; min-height: 42px; max-height: 100px; resize: vertical; border: 1px solid #d4ddd8; border-radius: 8px; padding: 10px; font-size: 10px; outline: none; }
.chat-input textarea:focus { border-color: #7db4a7; box-shadow: 0 0 0 3px rgba(11,127,115,.06); }
.ai-side { display: flex; flex-direction: column; gap: 11px; }
.ai-tool-card { padding: 13px; }
.ai-tool-card h3 { margin: 0; font-size: 10px; }
.tool-trace { margin-top: 9px; display: flex; flex-direction: column; gap: 6px; }
.tool-trace div { border-left: 1px solid #c7ddd6; padding-left: 9px; font-size: 8px; color: var(--muted); }
.tool-trace b { display: block; color: #486458; font-size: 9px; margin-bottom: 2px; }

.report-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 13px; }
.report-card { display: grid; grid-template-columns: 1fr auto; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 11px; background: #fff; }
.report-card h3 { margin: 0; font-size: 10px; }
.report-card p { margin: 5px 0 0; font-size: 8px; color: var(--muted); line-height: 1.45; }
.report-list { display: flex; flex-direction: column; gap: 8px; }
.progress { height: 6px; background: #e8eeea; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .35s ease; }
.knowledge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.knowledge-card { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; cursor: pointer; }
.knowledge-card:hover { border-color: #9ec2b8; }
.knowledge-card h3 { margin: 7px 0 5px; font-size: 10px; line-height: 1.4; }
.knowledge-card p { margin: 0; font-size: 8px; line-height: 1.5; color: var(--muted); }
.knowledge-card .foot { display: flex; justify-content: space-between; margin-top: 9px; font-size: 7px; color: #899791; }

.settings-grid { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 13px; }
.settings-nav { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px; height: max-content; }
.settings-nav button { border: 0; background: transparent; border-radius: 6px; width: 100%; text-align: left; padding: 10px 9px; color: var(--muted); font-size: 9px; }
.settings-nav button:hover { background: #f5f9f6; color: var(--ink); }
.settings-nav button.active { background: var(--teal-soft); color: var(--teal); font-weight: 650; }
.settings-panel { min-height: 450px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid #edf1ee; }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 10px; color: var(--ink-2); }
.setting-row span { display: block; font-size: 8px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.switch { width: 36px; height: 20px; border-radius: 99px; border: 0; background: #d5ddd8; padding: 2px; transition: .2s; flex: none; }
.switch i { display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: .2s; }
.switch.on { background: var(--teal); }
.switch.on i { transform: translateX(16px); }
.integration-list { display: flex; flex-direction: column; gap: 7px; }
.integration-row { border: 1px solid #e0e7e3; border-radius: 8px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.integration-row strong { font-size: 9px; }
.integration-row span { display: block; margin-top: 3px; font-size: 8px; color: var(--muted); }
.log-list { display: flex; flex-direction: column; gap: 7px; }
.log-item { display: grid; grid-template-columns: 88px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid #e3e9e5; border-radius: 7px; font-size: 8px; }
.log-item time { font-family: var(--display); color: #87958f; }

.command-bar { display: flex; gap: 7px; flex-wrap: wrap; }
.callout { border: 1px solid #d5e2dd; border-radius: 9px; padding: 11px 12px; background: #f8fbf9; }
.callout strong { display: block; font-size: 10px; margin-bottom: 4px; }
.callout p { margin: 0; font-size: 8px; line-height: 1.55; color: var(--muted); }
.callout.warn { background: var(--amber-soft); border-color: #f0d4a9; }
.callout.risk { background: var(--red-soft); border-color: #e9c4c0; }
.callout.teal { background: #f2faf7; border-color: #cbe1da; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { display: grid; grid-template-columns: 24px 1fr auto; gap: 9px; align-items: start; padding: 9px 0; border-bottom: 1px solid #edf1ee; }
.step:last-child { border-bottom: 0; }
.step-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 8px; background: #e7efeb; color: #668078; }
.step.done .step-num { background: var(--green-soft); color: var(--green); }
.step.active .step-num { background: var(--teal-soft); color: var(--teal); }
.step strong { display: block; font-size: 9px; }
.step p { margin: 3px 0 0; font-size: 8px; color: var(--muted); line-height: 1.45; }

@media (max-width: 1280px) {
  .app { grid-template-columns: 198px minmax(0, 1fr); }
  .overview-main { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .ai-page { grid-template-columns: 1fr; }
  .ai-side { display: grid; grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .split-grid { grid-template-columns: 1fr; }
  .four-grid { grid-template-columns: repeat(2, 1fr); }
  .five-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 235px; box-shadow: 16px 0 38px rgba(10,23,17,.22); }
  .sidebar.mobile-hidden { display: none; }
  .menu-toggle { display: grid; place-items: center; }
  .topbar { padding: 0 13px; gap: 9px; flex-wrap: wrap; min-height: 58px; }
  .crumb { min-width: 0; flex: 1; }
  .top-tabs, .search-trigger, .clock { display: none; }
  .live-pill { display: none; }
  .page-shell { padding: 12px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .overview-grid, .split-grid, .report-grid, .settings-grid, .ai-page { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow: auto; }
  .settings-nav button { width: auto; white-space: nowrap; }
  .three-grid, .four-grid, .five-grid, .knowledge-grid, .video-grid { grid-template-columns: 1fr 1fr; }
  .video-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .ai-side { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid, .three-grid, .four-grid, .five-grid, .knowledge-grid { grid-template-columns: 1fr; }
  .top-actions .role-switch { display: none; }
  .page-head h1 { font-size: 20px; }
  .scene { min-height: 300px; }
}
