:root {
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #17211f;
  --muted: #66736f;
  --line: #dce4e1;
  --teal: #138c7e;
  --teal-soft: #e3f4f1;
  --amber: #b36b09;
  --amber-soft: #fff3dc;
  --red: #c7443e;
  --red-soft: #fce9e7;
  --blue-soft: #e9f2f8;
  --shadow: 0 1px 2px rgba(19, 43, 36, .05);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 196px minmax(0, 1fr); }
.side-nav { position: sticky; top: 0; height: 100vh; padding: 18px 12px; background: #fbfcfc; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; color: white; background: var(--teal); border-radius: 6px; font-size: 12px; }
.side-nav nav { display: grid; gap: 5px; margin-top: 18px; }
.nav-item { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 6px; color: #4d5c58; font-size: 14px; }
.nav-item.active { color: #08776b; background: var(--teal-soft); font-weight: 650; }
.nav-item.muted { color: #9aa4a1; cursor: default; }
.nav-icon { width: 24px; font: 600 10px/24px ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; border: 1px solid currentColor; border-radius: 4px; }
.nav-foot { margin-top: auto; min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #9aa4a1; }
.status-dot.healthy { background: #22a88e; box-shadow: 0 0 0 3px #daf3ec; }
.status-dot.warning { background: #e09722; box-shadow: 0 0 0 3px #fff1d7; }
.status-dot.critical { background: #d9524d; box-shadow: 0 0 0 3px #fae3e1; }
.workspace { min-width: 0; }
.topbar { height: 78px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 3px; color: var(--teal); font-size: 10px; font-weight: 750; letter-spacing: 1.2px; }
h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: 0; }
.top-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.identity { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.logout { color: var(--teal); font-weight: 650; }
.review-entry { display: inline-flex; align-items: center; min-height: 36px; padding: 8px 12px; border-radius: 5px; background: var(--teal); color: white; font-weight: 650; white-space: nowrap; }
.review-entry:hover { background: #10786d; }
main { padding: 18px 20px 28px; }
.entry-section { margin-bottom: 20px; }
.entry-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.entry-heading h2 { margin: 0; font-size: 17px; }
.entry-session { font-size: 12px; color: var(--muted); }
.entry-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.entry-group { min-width: 0; }
.entry-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; font-size: 13px; font-weight: 600; }
.entry-group h3 svg { width: 16px; height: 16px; color: var(--muted); }
.access-label { margin-left: auto; font-size: 11px; font-weight: 500; }
.access-label.public { color: #12806e; }
.access-label.private { color: #526580; }
.entry-list { display: grid; gap: 7px; }
.feature-entry { min-width: 0; min-height: 76px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; transition: border-color .15s, background .15s; }
.feature-entry:hover { border-color: #8baca2; background: #fafdfc; }
.feature-entry:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.entry-icon { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 5px; background: #edf5f1; color: #25795a; }
.entry-icon svg { width: 20px; height: 20px; }
.entry-icon.event { background: #fff3dc; color: #966107; }
.entry-icon.upload, .entry-icon.video { background: #e9f2f8; color: #315f7f; }
.entry-icon.door { background: #f3eef6; color: #7b598c; }
.entry-icon.review { background: #e3f4f1; color: #08776b; }
.entry-copy { flex: 1; min-width: 0; }
.entry-copy strong { display: block; font-size: 14px; line-height: 1.5; }
.entry-copy small { display: block; margin-top: 3px; font-size: 12px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.entry-arrow { flex: 0 0 17px; width: 17px; height: 17px; color: var(--muted); }
.entry-action { flex: 0 0 auto; font-size: 11px; color: var(--teal); }
.summary-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 10px; }
.metric { min-height: 108px; padding: 15px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); display: grid; align-content: space-between; }
.metric.accent { border-top: 3px solid var(--teal); padding-top: 13px; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric strong { margin: 5px 0 2px; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric strong.time-value { font-size: 16px; }
.metric small { min-height: 16px; color: #89938f; font-size: 11px; }
.compute-section { margin-top: 16px; }
.compute-heading { padding: 0 0 10px !important; min-height: 34px !important; border: 0 !important; }
.compute-updated { color: var(--muted); font-size: 12px; }
.compute-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 12px; align-items: start; }
.compute-node { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.compute-node-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px 12px; }
.compute-node-head h3 { margin: 0; font-size: 16px; }
.compute-node-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.compute-node-head .state { font-size: 12px; white-space: nowrap; }
.gpu-readings { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 18px; padding: 4px 16px 14px; }
.gpu-readings > div { min-width: 0; }
.gpu-readings span, .gpu-readings small { display: block; font-size: 12px; color: var(--muted); }
.gpu-readings strong { display: block; margin: 7px 0 10px; font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; }
.gpu-readings em { font-size: 12px; font-style: normal; font-weight: 400; color: var(--muted); white-space: nowrap; }
.compute-meter { display: block; width: 100%; height: 5px; margin: 0 0 8px; border: 0; border-radius: 2px; overflow: hidden; appearance: none; background: #e8eeeb; }
.compute-meter::-webkit-progress-bar { background: #e8eeeb; }
.compute-meter::-webkit-progress-value { background: var(--teal); }
.compute-meter::-moz-progress-bar { background: var(--teal); }
.compute-meter.memory::-webkit-progress-value { background: #cf972d; }
.compute-meter.memory::-moz-progress-bar { background: #cf972d; }
.compute-meter[data-unknown] { opacity: .4; }
.power-reading { padding-top: 4px; font-variant-numeric: tabular-nums; }
.host-readings { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-soft); font-size: 12px; color: var(--muted); }
.host-readings b { color: #46534f; font-weight: 500; font-variant-numeric: tabular-nums; }
.compute-services { min-height: 72px; padding: 6px 16px; }
.compute-service { min-height: 29px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; padding: 4px 0; }
.compute-service strong { font-weight: 600; }
.compute-service small { margin-left: auto; font-size: 12px; color: var(--muted); }
.healthy-text { color: #12806e; }
.warning-text { color: var(--amber); }
.inactive-text { color: var(--muted); }
.compute-empty { margin: 10px 0; font-size: 12px; color: var(--muted); }
.compute-models { border-top: 1px solid var(--line); }
.compute-models summary { padding: 11px 16px; cursor: pointer; font-size: 13px; color: #46534f; }
.compute-models summary span { float: right; font-size: 12px; color: var(--muted); }
.compute-models summary:hover { background: var(--surface-soft); }
.compute-models summary:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.compute-models ul { padding: 0 16px 8px; margin: 0; list-style: none; }
.compute-models li { display: grid; grid-template-columns: minmax(0, 1fr) 62px 64px; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid #edf1ef; font-size: 12px; }
.model-name { overflow-wrap: anywhere; line-height: 1.5; }
.model-size { color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.model-state { color: var(--muted); text-align: right; }
.model-state.serving { color: var(--teal); }
.compute-node.stale .gpu-readings { opacity: .6; }
.content-grid { margin-top: 12px; display: grid; grid-template-columns: minmax(680px, 1.85fr) minmax(290px, .72fr); gap: 12px; align-items: start; }
.gateway-panel, .insight-section, .recent-section { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.section-head { min-height: 66px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.section-head.compact { min-height: 58px; }
.section-head h2 { margin: 0; font-size: 15px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-head > a { color: var(--teal); font-size: 12px; font-weight: 650; }
.filters { display: flex; align-items: center; gap: 7px; }
.search { height: 34px; min-width: 190px; display: flex; align-items: center; gap: 6px; padding: 0 9px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; }
.search span { color: #89938f; font-size: 11px; }
.search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
select, .icon-button { height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: #485652; }
select { padding: 0 28px 0 9px; font-size: 12px; }
.icon-button { width: 34px; padding: 0; cursor: pointer; font-size: 19px; }
.icon-button:hover { color: var(--teal); border-color: #9bcfc7; }
.icon-button.loading { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.table-scroll { overflow-x: auto; }
.gateway-table { width: 100%; min-width: 1000px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.gateway-table th { height: 38px; padding: 0 8px; color: #66736f; background: #f6f8f7; text-align: left; font-weight: 650; border-bottom: 1px solid var(--line); }
.gateway-table td { height: 46px; padding: 7px 8px; border-bottom: 1px solid #e7ecea; vertical-align: middle; }
.gateway-table tbody tr.gateway-row { cursor: pointer; }
.gateway-table tbody tr.gateway-row:hover { background: #fafcfb; }
.gateway-table tbody tr.gateway-row.open { background: #f1f8f6; }
.gateway-table th:nth-child(1) { width: 50px; }
.gateway-expand { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gateway-expand .chevron { width: 18px; height: 18px; }
.gateway-expand:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.gateway-table th:nth-child(2) { width: 210px; }
.gateway-access { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; color: var(--muted, #647078); font-size: 11px; line-height: 1.5; }
.gateway-access > span { white-space: nowrap; }
.gateway-access[href] { text-decoration: none; cursor: pointer; }
.gateway-access[href]:hover, .gateway-access[href]:focus-visible { text-decoration: underline; color: #17647b; }
.gateway-name-input { display: block; box-sizing: border-box; width: 100%; min-width: 0; padding: 3px 4px; margin: -3px -4px 0; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #182521; font: inherit; font-weight: 700; cursor: text; }
.gateway-name-input:hover { border-color: #bacbc4; }
.gateway-name-input:focus { border-color: #287965; outline: 2px solid #d9ece5; background: #fff; }
.gateway-name-input:disabled { color: #66736f; }
.gateway-name-status { display: block; color: #66736f; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.gateway-name-status:empty { display: none; }
.gateway-access b { color: var(--text, #24332d); font-weight: 600; font-variant-numeric: tabular-nums; }
.gateway-sn { display: block; max-width: 190px; color: var(--muted, #647078); font-size: 10px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.gateway-new { margin-left: 7px; color: #17647b; font-size: 11px; font-weight: 500; }
.gateway-table th:nth-child(3) { width: 90px; }
.gateway-table th:nth-child(4) { width: 92px; }
.gateway-table th:nth-child(5) { width: 74px; }
.gateway-table th:nth-child(6) { width: 72px; }
.gateway-table th:nth-child(7), .gateway-table th:nth-child(8) { width: 96px; }
.gateway-table th:nth-child(9) { width: 130px; }
.gateway-name { font-weight: 750; font-variant-numeric: tabular-nums; }
.chevron { display: inline-block; transition: transform .16s ease; color: var(--muted); }
.open .chevron { transform: rotate(90deg); }
.state { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; }
.chip { display: inline-block; padding: 3px 6px; background: var(--blue-soft); color: #315f7f; border-radius: 4px; font: 600 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.number { font-variant-numeric: tabular-nums; }
.muted-value { color: #9aa4a1; }
.detail-row td { height: auto; padding: 0 10px 10px 30px; background: #f8fbfa; }
.channel-table { width: 100%; border: 1px solid var(--line); border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.channel-table th { height: 32px; background: #f1f5f3; font-size: 10px; }
.channel-table td { height: 40px; padding: 6px 8px; border-bottom: 1px solid #e8eeeb; }
.channel-table th:nth-child(1) { width: 70px; }
.channel-table th:nth-child(2) { width: 130px; }
.channel-table th:nth-child(3) { width: 90px; }
.channel-table th:nth-child(5), .channel-table th:nth-child(6) { width: 88px; }
.algorithm-list { display: flex; flex-wrap: wrap; gap: 4px; }
.algorithm-tag { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 6px; border-radius: 4px; background: var(--teal-soft); color: #146f65; white-space: nowrap; font-size: 10px; }
.algorithm-tag:nth-child(2n) { color: #965511; background: var(--amber-soft); }
.loading-cell, .empty-state { color: var(--muted); text-align: center; padding: 34px 12px !important; }
.insight-column { display: grid; gap: 12px; }
.trend-chart { height: 206px; padding: 18px 14px 12px; display: flex; align-items: end; gap: 8px; }
.trend-item { min-width: 0; flex: 1; height: 100%; display: grid; grid-template-rows: 1fr auto auto; gap: 5px; align-items: end; text-align: center; }
.trend-track { height: 100%; display: flex; align-items: end; justify-content: center; border-bottom: 1px solid var(--line); }
.trend-bar { width: min(28px, 70%); min-height: 2px; background: var(--teal); border-radius: 3px 3px 0 0; }
.trend-value { font-size: 10px; color: #46534f; font-variant-numeric: tabular-nums; }
.trend-label { color: #87918e; font-size: 9px; white-space: nowrap; }
.count-badge { min-width: 24px; height: 22px; display: grid; place-items: center; padding: 0 6px; border-radius: 4px; color: var(--red); background: var(--red-soft); font-size: 11px; font-weight: 750; }
.attention-list { max-height: 260px; overflow: auto; }
.attention-item { min-height: 54px; padding: 10px 13px; display: grid; grid-template-columns: 10px minmax(0,1fr); gap: 9px; border-bottom: 1px solid #e8eeeb; }
.attention-item:last-child { border-bottom: 0; }
.attention-item strong { display: block; font-size: 11px; }
.attention-item p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.recent-section { margin-top: 12px; }
.capture-strip { min-height: 152px; padding: 12px; display: grid; grid-template-columns: repeat(8, minmax(100px, 1fr)); gap: 8px; overflow-x: auto; }
.capture-item { min-width: 108px; }
.capture-image { width: 100%; aspect-ratio: 16/10; display: block; object-fit: cover; background: #dce4e1; border: 1px solid var(--line); border-radius: 5px; }
.capture-meta { margin-top: 6px; display: grid; gap: 2px; font-size: 10px; }
.capture-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.capture-meta span { color: var(--muted); }
.capture-login { grid-column: 1 / -1; align-self: center; margin: 0; }
.capture-login a { color: var(--teal); font-weight: 650; }
.login-dialog { width: min(420px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: 0 16px 60px #17211f26; }
.login-dialog::backdrop { background: #17211f66; }
.login-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-heading h2 { margin: 0; font-size: 20px; }
.login-subtitle { color: var(--muted); font-size: 13px; }
.login-message { min-height: 20px; margin: 14px 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.login-message.error { color: var(--red); }
#loginForm { display: grid; gap: 10px; }
#loginForm label { font-size: 13px; font-weight: 600; }
#loginForm input { width: 100%; min-width: 0; height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; font: inherit; background: var(--surface); color: var(--ink); }
#loginForm input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
#loginSubmit { border: 0; min-height: 44px; margin-top: 6px; justify-content: center; cursor: pointer; }
#loginSubmit:disabled { opacity: .65; cursor: wait; }
.login-code-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.login-code-actions button { border: 0; padding: 4px 0; background: transparent; color: var(--teal); cursor: pointer; font-size: 13px; }
.login-code-actions button:disabled { color: var(--muted); cursor: wait; }
@media (max-width: 1160px) {
  .gpu-readings { gap: 12px; }
  .summary-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .insight-column { grid-template-columns: 1fr 1fr; }
  .capture-strip { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
}
@media (max-width: 760px) {
  .entry-groups { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .entry-heading { flex-wrap: wrap; gap: 6px; }
  .feature-entry { padding: 12px; }
  .compute-grid { grid-template-columns: 1fr; }
  .compute-heading { gap: 6px; }
  .compute-node-head, .host-readings { padding-left: 12px; padding-right: 12px; }
  .gpu-readings { padding-left: 12px; padding-right: 12px; grid-template-columns: 1fr 1.25fr 1fr; gap: 10px; }
  .gpu-readings strong { font-size: 21px; }
  .app-shell { grid-template-columns: 1fr; }
  .side-nav { position: static; width: 100%; height: auto; padding: 8px 10px; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { min-width: 128px; padding: 0 10px 0 0; border: 0; font-size: 13px; }
  .brand-mark { width: 28px; height: 28px; }
  .side-nav nav { display: flex; margin: 0; gap: 4px; }
  .nav-item { min-width: 94px; min-height: 36px; padding: 0 8px; }
  .nav-icon, .nav-foot { display: none; }
  .topbar { height: 68px; padding: 0 14px; }
  h1 { font-size: 18px; }
  .identity { max-width: 120px; }
  .top-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .top-actions .identity { display: none; }
  main { padding: 12px 10px 20px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 94px; padding: 12px; }
  .metric strong { font-size: 23px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; }
  .search { min-width: 0; flex: 1; }
  .insight-column { grid-template-columns: 1fr; }
  .capture-strip { grid-template-columns: repeat(8, 128px); }
}
