:root {
  color-scheme: light;
  --bg: #edf2f4;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef3f5;
  --ink: #17242d;
  --muted: #526069;
  --muted-2: #66747c;
  --line: #d9e2e6;
  --line-strong: #c8d4da;
  --teal: #0e766f;
  --teal-soft: #e5f3f0;
  --blue: #2e668c;
  --blue-soft: #e9f1f6;
  --amber: #a56e19;
  --amber-soft: #fbf0dd;
  --red: #b7463f;
  --red-soft: #fae9e7;
  --navy: #123244;
  --shadow: 0 12px 28px rgba(33, 50, 61, .07);
  --sidebar-width: 228px;
  --topbar-height: 72px;
  --radius: 13px;
  --font-sans: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.modal-open, body.drawer-open { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: color-mix(in srgb, var(--teal) 22%, transparent); }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.global-progress {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--teal);
  opacity: 0;
  transition: width .25s ease, opacity .2s ease;
}
.fault-banner {
  position: fixed;
  z-index: 95;
  left: calc(var(--sidebar-width) + 24px);
  right: 24px;
  top: 80px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid #e3c28c;
  border-radius: 9px;
  background: #fff7e9;
  color: #714d13;
  box-shadow: 0 10px 28px rgba(70, 52, 24, .12);
  font-size: 13px;
}
.fault-banner[hidden] { display: none; }
.fault-banner strong { white-space: nowrap; }
.fault-banner span { flex: 1; }
.fault-banner button { border: 0; background: transparent; color: var(--amber); font-size: 12px; font-weight: 700; cursor: pointer; }
body.is-loading .global-progress { width: 72%; opacity: 1; }

.sidebar {
  position: fixed;
  z-index: 80;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 20px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  letter-spacing: -.06em;
  box-shadow: 0 7px 16px rgba(14, 118, 111, .18);
}
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 16px; letter-spacing: -.03em; }
.brand-copy small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 0 2px;
}
.nav-group { margin-bottom: 18px; }
.nav-group-label {
  display: block;
  color: var(--muted-2);
  padding: 0 9px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 2px 0;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  transition: color .15s ease, background .15s ease, transform .15s ease;
}
.nav-item:hover { color: var(--ink); background: var(--surface-2); }
.nav-item.active { color: var(--teal); background: var(--teal-soft); font-weight: 700; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--teal);
}
.nav-mark {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.nav-item.active .nav-mark { background: var(--teal); color: #fff; }
.nav-item em {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--line);
}
.sidebar-footer div { min-width: 0; }
.sidebar-footer strong { display: block; font-size: 13px; }
.sidebar-footer small { display: block; color: var(--muted); font-size: 11px; }
.scope-dot, .online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 13%, transparent);
}
.degraded-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--amber);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 13%, transparent);
}

.main-shell {
  grid-column: 2;
  min-width: 0;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(12px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb strong { color: var(--ink); font-weight: 700; }
.menu-toggle { display: none !important; }
.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.topbar-status:hover { border-color: var(--line-strong); color: var(--ink); }
.topbar-status small { color: var(--muted-2); margin-left: 2px; }
.topbar-status.degraded { border-color: #e2c592; background: #fff8ea; color: var(--amber); }
.live-clock { min-width: 94px; text-align: right; line-height: 1.2; }
.live-clock strong { display: block; font-variant-numeric: tabular-nums; font-size: 15px; letter-spacing: -.02em; }
.live-clock small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: .15s ease;
}
.icon-button:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }
.ai-button { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 28%, var(--line)); font-size: 13px; font-weight: 800; }
.notification-button { position: relative; }
.notification-count {
  position: absolute;
  right: -4px;
  top: -5px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  border: 2px solid var(--surface);
}
.notification-count.empty { display: none; }
.role-menu-wrap { position: relative; }
.user-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  padding: 2px 5px 2px 2px;
  cursor: pointer;
}
.user-button:hover { border-color: var(--line); background: var(--surface-2); }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.avatar-large { width: 52px; height: 52px; font-size: 19px; background: var(--teal-soft); color: var(--teal); }
.user-copy { text-align: left; }
.user-copy strong { display: block; font-size: 13px; }
.user-copy small { display: block; color: var(--muted); font-size: 11px; }
.role-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 120;
  width: 280px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(25, 43, 54, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: .15s ease;
}
.role-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.role-menu button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  padding: 8px;
  cursor: pointer;
}
.role-menu button:hover, .role-menu button.active { background: var(--surface-2); }
.role-menu button > span:nth-child(2) { min-width: 0; flex: 1; }
.role-menu strong { display: block; font-size: 13px; }
.role-menu small { display: block; color: var(--muted); font-size: 11px; }
.role-menu b { color: var(--teal); font-size: 11px; }
.role-menu-note { margin: 6px 4px 2px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.page-root {
  min-height: calc(100vh - var(--topbar-height));
  padding: 28px 32px 64px;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}
.page-heading h1 {
  margin: 4px 0 6px;
  font-size: clamp(26px, 2.25vw, 34px);
  line-height: 1.15;
  letter-spacing: -.055em;
}
.page-heading p { margin: 0; max-width: 760px; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: .16s ease;
}
.button:hover { transform: translateY(-1px); border-color: #aebec7; box-shadow: 0 5px 14px rgba(33, 50, 61, .07); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
.button.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.button.primary:hover { background: #0b6963; }
.button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.button.danger-ghost { color: var(--red); border-color: color-mix(in srgb, var(--red) 32%, var(--line)); background: var(--red-soft); }
.button.ghost { background: var(--surface); color: var(--muted); }
.button.small { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.button.full { width: 100%; }
.text-button {
  border: 0;
  padding: 2px;
  background: transparent;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.text-button:hover { color: #095e59; text-decoration: underline; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.panel.loading, .loading { opacity: .55; pointer-events: none; }
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px 13px;
}
.section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.025em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.badge, .risk, .count-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-neutral { background: var(--surface-3); color: var(--muted); }
.badge-success, .badge-low { background: var(--teal-soft); color: var(--teal); }
.badge-warning, .badge-medium { background: var(--amber-soft); color: var(--amber); }
.badge-danger, .badge-high { background: var(--red-soft); color: var(--red); }
.badge-new, .badge-assigned, .badge-accepted, .badge-enroute, .badge-onsite { background: var(--blue-soft); color: var(--blue); }
.risk i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.risk-high { background: var(--red-soft); color: var(--red); }
.risk-medium { background: var(--amber-soft); color: var(--amber); }
.risk-low { background: var(--teal-soft); color: var(--teal); }
.count-chip { justify-content: center; min-width: 23px; background: var(--surface-3); color: var(--muted); }
.muted { color: var(--muted); }
.error-text { color: var(--red); }
.form-hint { color: var(--muted); font-size: 12px; line-height: 1.55; }
.row-arrow { color: var(--muted-2); font-size: 16px; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.fault-location .map-marker,
.fault-location .marker { display: none !important; }

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.filter-note { margin-left: auto; color: var(--muted); font-size: 12px; }
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 4px rgba(30,47,58,.09); }
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 100%);
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 11px;
}
.search-field span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; }
.search-field:focus-within { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 10%, transparent); }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.summary-strip article {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  padding: 13px 15px;
}
.summary-strip span { display: block; color: var(--muted); font-size: 12px; }
.summary-strip strong { display: block; margin: 4px 0 1px; font: 500 26px/1.1 var(--font-serif); }
.summary-strip small { color: var(--muted); font-size: 11px; }

.table-panel { overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.data-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .15s ease; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.person-cell { display: flex; align-items: center; gap: 9px; min-width: 150px; }
.person-cell strong { display: block; font-size: 13px; }
.person-cell small { display: block; color: var(--muted); font-size: 11px; }
.bed-number { font: 500 16px var(--font-serif); color: var(--blue); }
.device-avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 800; }

.empty-state {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26px;
}
.empty-glyph { width: 36px; height: 36px; border: 1px dashed var(--line-strong); border-radius: 12px; margin-bottom: 10px; }
.empty-state strong { font-size: 13px; }
.empty-state p { margin: 5px 0 12px; max-width: 360px; color: var(--muted); font-size: 12px; }
.skeleton-page { max-width: 1500px; }
.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, #e1e8eb 25%, #f1f5f6 37%, #e1e8eb 63%);
  background-size: 400% 100%;
  animation: skeleton 1.35s ease infinite;
}
.skeleton-title { width: 36%; height: 34px; margin: 8px 0 28px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.skeleton-card { height: 112px; }
.skeleton-main { height: 520px; }
@keyframes skeleton { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.modal-open .modal-backdrop { pointer-events: auto; }
#modalRoot .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(9, 20, 28, .42);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .18s ease;
}
#modalRoot .modal {
  position: fixed;
  z-index: 151;
  top: 50%;
  left: 50%;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(9,20,28,.24);
  transform: translate(-50%, -47%) scale(.98);
  opacity: 0;
  transition: .18s ease;
}
#modalRoot .modal-wide { width: min(680px, calc(100vw - 32px)); }
#modalRoot.open .modal-backdrop { opacity: 1; }
#modalRoot.open .modal { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-head { display: flex; justify-content: space-between; gap: 18px; padding: 20px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.03em; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.form-field { display: grid; gap: 6px; margin-bottom: 13px; color: var(--muted); font-size: 12px; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  outline: 0;
  resize: vertical;
  font-size: 13px;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 10%, transparent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--teal); }
.modal-details { display: grid; gap: 8px; margin: 0; }
.modal-details div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.modal-details dt { color: var(--muted); font-size: 12px; }
.modal-details dd { margin: 0; font-size: 13px; }

.toast-root { position: fixed; z-index: 300; right: 24px; bottom: 24px; display: grid; gap: 8px; pointer-events: none; }
.toast {
  min-width: 220px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(17,35,46,.18);
  color: var(--ink);
  font-size: 13px;
  transform: translateY(8px);
  opacity: 0;
  transition: .2s ease;
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); margin-top: 5px; flex: 0 0 auto; }
.toast-danger .toast-dot { background: var(--red); }

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(9,20,28,.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: .18s ease;
}
.drawer-scrim.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed;
  z-index: 110;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 94vw);
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 50px rgba(16,32,42,.15);
  transform: translateX(102%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 14px; padding: 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 3px 0 0; font-size: 20px; letter-spacing: -.03em; }
.drawer-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 13px; }
.drawer-loading { padding: 30px 20px; color: var(--muted); font-size: 13px; }
.drawer-actions { display: flex; justify-content: space-between; align-items: center; padding: 3px 3px 10px; color: var(--muted); font-size: 12px; }
.drawer-notification {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 11px;
  margin-bottom: 7px;
  cursor: pointer;
}
.drawer-notification:hover { border-color: var(--line-strong); background: var(--surface-2); }
.drawer-notification.read { opacity: .68; }
.drawer-notification strong { display: block; font-size: 13px; }
.drawer-notification small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.drawer-notification time { color: var(--muted-2); font-size: 11px; }
.notification-category {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.notification-category.alert { background: var(--red-soft); color: var(--red); }
.notification-category.decision { background: var(--amber-soft); color: var(--amber); }
.notification-category.effect_report { background: var(--teal-soft); color: var(--teal); }
.drawer-chat { flex: 1; overflow-y: auto; padding: 16px; background: var(--surface-2); }
.drawer-message { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 13px; }
.drawer-message.user { justify-content: flex-end; }
.drawer-message.user div { max-width: 82%; border-radius: 11px 11px 3px 11px; background: var(--teal); color: #fff; padding: 9px 11px; }
.drawer-message.assistant > div, .drawer-message.assistant > p { max-width: calc(100% - 38px); }
.drawer-message.assistant div { border: 1px solid var(--line); border-radius: 11px 11px 11px 3px; background: var(--surface); padding: 10px 11px; }
.drawer-message p { margin: 0; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.drawer-message small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.drawer-sources { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.drawer-sources button { border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--teal); font-size: 11px; padding: 4px 6px; cursor: pointer; }
.drawer-composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.drawer-composer textarea { border: 1px solid var(--line-strong); border-radius: 9px; resize: none; padding: 9px 10px; outline: 0; font-size: 13px; }
.typing-dots { display: inline-flex; gap: 4px; padding: 8px 2px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); animation: typing 1s ease infinite; }
.typing-dots i:nth-child(2) { animation-delay: .12s; }
.typing-dots i:nth-child(3) { animation-delay: .24s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.command-overlay {
  position: fixed;
  z-index: 140;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
  background: rgba(8,19,27,.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: .16s ease;
}
.command-overlay.open { opacity: 1; visibility: visible; }
.command-panel { width: min(620px, calc(100vw - 28px)); border: 1px solid rgba(255,255,255,.3); border-radius: 14px; background: var(--surface); box-shadow: 0 30px 80px rgba(7,17,24,.3); overflow: hidden; }
.command-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 15px; border-bottom: 1px solid var(--line); }
.command-input-wrap > span { color: var(--muted); font-size: 18px; }
.command-input-wrap input { flex: 1; border: 0; outline: 0; font-size: 14px; background: transparent; }
.command-input-wrap kbd { border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; color: var(--muted); font-size: 11px; }
.command-results { max-height: 390px; overflow-y: auto; padding: 8px; }
.command-section-label { display: block; padding: 7px 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.command-item { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-radius: 8px; background: transparent; padding: 8px; cursor: pointer; }
.command-item:hover { background: var(--surface-2); }
.command-kind { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal); font-size: 11px; font-weight: 800; }
.command-item > span:nth-child(2) { flex: 1; }
.command-item strong { display: block; font-size: 13px; }
.command-item small { display: block; color: var(--muted); font-size: 11px; }
.command-item b { color: var(--muted-2); font-size: 12px; }
.command-footer { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.not-found, .error-panel { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.not-found > span { font: 500 72px/1 var(--font-serif); color: var(--muted-2); }
.not-found h1, .error-panel h1 { margin: 8px 0; }
.error-panel pre { padding: 10px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }

@media (max-width: 1200px) {
  :root { --sidebar-width: 206px; }
  .page-root { padding: 24px 22px 50px; }
  .topbar { padding: 0 20px; }
  .topbar-status small, .live-clock small { display: none; }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 18px 0 40px rgba(16,32,42,.14);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-shell { grid-column: auto; }
  .menu-toggle { display: inline-grid !important; }
  .topbar-status, .live-clock { display: none; }
  .topbar { height: 62px; padding: 0 14px; }
  .page-root { padding: 18px 14px 44px; }
  .fault-banner { left: 12px; right: 12px; top: 70px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .page-actions { justify-content: flex-start; }
  .summary-strip, .skeleton-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .user-copy { display: none; }
  .toast-root { right: 12px; bottom: 12px; left: 12px; }
  .toast { max-width: none; }
}
@media (max-width: 620px) {
  .topbar-right { gap: 7px; }
  .breadcrumb a, .breadcrumb span { display: none; }
  .topbar-right .ai-button { display: none; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .page-actions .button { flex: 1 1 auto; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .segmented { overflow-x: auto; max-width: 100%; }
  .search-field { min-width: 0; width: 100%; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .data-table { min-width: 760px; }
  .table-panel { overflow-x: auto; }
}

@media print {
  .sidebar, .topbar, .page-actions, .command-overlay, .drawer, .drawer-scrim, .toast-root { display: none !important; }
  .app-shell { display: block; }
  .page-root { padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}

small,
.badge,
.eyebrow,
.text-button,
.segmented button,
.nav-group-label,
.task-copy small,
.timeline-item small,
.metric-card > small,
.metric-card > div {
  font-size: max(10px, 0.62vw);
}
