:root {
  color-scheme: light;
  --page: #f5f7f8;
  --surface: #ffffff;
  --ink: #222c34;
  --muted: #75818b;
  --border: #e4e9ed;
  --green: #20856a;
  --green-soft: #edf7f2;
  --amber: #ac7418;
  --amber-soft: #fff6e4;
  --red: #c64d50;
  --red-soft: #fcf0f0;
  --blue: #397fbc;
  --blue-soft: #edf4fb;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.5; letter-spacing: 0; }
button, input, a { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, tr:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
button, input { letter-spacing: 0; }
a { color: inherit; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.65; flex-shrink: 0; }
[hidden] { display: none !important; }
.app-shell { max-width: 1440px; padding: 34px 44px 20px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.heading-group { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; background: #e6efed; color: #277965; border-radius: 8px; }
.brand-mark svg { width: 24px; height: 24px; }
.eyebrow { font-size: 11px; font-weight: 500; color: var(--muted); margin-bottom: 1px; }
h1 { font-size: 26px; line-height: 1.35; margin: 0; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; margin: 0; }
.header-controls { display: flex; align-items: center; gap: 10px; }
.auto-refresh { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #626e78; margin-right: 6px; white-space: nowrap; cursor: pointer; }
.auto-refresh input { width: 14px; height: 14px; accent-color: var(--green); margin: 0; }
.unit-switch { display: flex; border: 1px solid #dce3e7; border-radius: 6px; background: #ebeff2; padding: 3px; gap: 2px; }
.unit-switch button { border: 0; border-radius: 3px; width: 44px; height: 28px; font-size: 12px; font-weight: 550; background: transparent; color: var(--muted); }
.unit-switch button.active { background: white; color: var(--ink); box-shadow: 0 1px 3px #23343a0d; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #dce3e7; border-radius: 6px; background: #fff; text-decoration: none; color: #586874; flex-shrink: 0; }
.icon-button:hover { border-color: #bbcbc5; background: #f7faf9; color: var(--green); }
.icon-button:disabled { opacity: .65; }
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px; }
.login-shell { width: min(100%, 360px); }
.login-shell .heading-group { margin-bottom: 38px; }
.login-shell h1 { font-size: 26px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-form h2 { font-size: 16px; margin-bottom: 2px; }
.login-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.login-field label { font-size: 12px; color: #62717c; font-weight: 500; }
.login-field input { width: 100%; min-width: 0; height: 44px; border: 1px solid #dce3e7; border-radius: 6px; padding: 0 12px; background: #fff; color: var(--ink); font-size: 14px; }
.password-input { position: relative; }
.password-input input { padding-right: 46px; }
.password-toggle { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 4px; color: #75858e; background: transparent; }
.password-toggle:hover { color: var(--green); background: var(--green-soft); }
.login-submit { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; width: 100%; border: 1px solid #1b765e; border-radius: 6px; background: var(--green); color: #fff; font-size: 14px; font-weight: 550; }
.login-submit:hover { background: #1b765e; }
.login-submit:disabled { opacity: .65; }
.login-error { min-width: 0; overflow-wrap: anywhere; padding: 10px 12px; border-left: 3px solid var(--red); background: var(--red-soft); color: #a23f45; font-size: 12px; }
.login-footer { margin-top: 30px; color: #9aa6ae; font-size: 11px; }
.status-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin: 22px 0 15px; font-size: 11px; color: var(--muted); }
.sampling-status { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.status-dot.muted { background: #a6b0b7; }
.status-dot.warning { background: #c99435; }
.request-error { border-left: 3px solid var(--red); color: #a23f45; background: var(--red-soft); padding: 11px 15px; font-size: 12px; margin-bottom: 15px; overflow-wrap: anywhere; }
.overview { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: grid; grid-template-columns: 1fr 1fr 1fr; margin-bottom: 29px; }
.metric { padding: 24px 28px 22px; min-width: 0; }
.metric + .metric { border-left: 1px solid var(--border); }
.metric-label { display: flex; align-items: center; gap: 8px; color: #687781; font-size: 12px; }
.metric-label svg { width: 16px; height: 16px; color: #83949d; }
.metric-value { font-size: 30px; font-weight: 630; line-height: 1.35; font-variant-numeric: tabular-nums; margin: 11px 0 6px; white-space: nowrap; }
.metric-value .value-unit { font-size: 17px; font-weight: 450; color: #75838a; margin-left: 6px; }
.metric-note { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.health-value { display: inline-flex; align-items: baseline; gap: 8px; }
.health-value .health-total { font-weight: 450; color: #9aa6ae; font-size: 20px; }
.metric-note .note-warning { color: var(--amber); }
.metric-note .note-good { color: var(--green); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 352px; align-items: start; gap: 28px; }
.device-section { min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.section-heading > div { display: flex; align-items: center; gap: 9px; }
.section-count { color: #96a2ab; font-size: 12px; }
.search-field { width: 206px; height: 35px; display: flex; align-items: center; gap: 8px; padding: 0 11px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.search-field svg { width: 15px; height: 15px; color: #9aa7b0; }
.search-field input { width: 100%; min-width: 0; outline: none; border: 0; background: transparent; padding: 0; color: var(--ink); font-size: 12px; }
.search-field input::placeholder { color: #99a5ae; }
.filter-tabs { display: flex; gap: 22px; margin-bottom: 0; border-bottom: 1px solid var(--border); }
.filter-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 9px 0 12px; min-height: 40px; font-size: 12px; color: #82909a; }
.filter-tabs button.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.filter-tabs button:hover { color: var(--green); }
.device-table-wrap { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 6px 6px; overflow: hidden; }
.device-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.device-table th { color: #8b98a1; font-size: 10px; font-weight: 500; text-align: left; height: 39px; background: #fafbfc; border-bottom: 1px solid var(--border); }
.device-table th:first-child { width: 40%; padding-left: 18px; }
.device-table th.capacity-column { width: 18%; }
.device-table th.usage-column { width: 19%; }
.device-table th.row-arrow { width: 25px; }
.device-table td { height: 90px; border-bottom: 1px solid #eef1f3; vertical-align: middle; padding: 14px 10px 14px 0; }
.device-table td:first-child { padding-left: 18px; }
.device-table tr:last-child td { border-bottom: 0; }
.device-row { cursor: pointer; }
.device-row:hover { background: #f8fafb; }
.device-row.selected { background: #f0f7f5; }
.device-row.selected td:first-child { box-shadow: inset 3px 0 var(--green); }
.device-identity { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.device-icon { display: grid; place-items: center; color: #83919b; width: 30px; height: 30px; margin-top: 3px; flex-shrink: 0; }
.device-row.selected .device-icon { color: var(--green); }
.device-description { min-width: 0; }
.device-name { font-size: 13px; font-weight: 570; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; line-height: 1.45; overflow-wrap: anywhere; }
.device-subline { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; color: #96a2ab; margin-top: 3px; overflow-wrap: anywhere; }
.device-state { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 400; color: var(--green); white-space: nowrap; }
.device-state .status-dot { width: 4px; height: 4px; }
.device-state.offline { color: var(--red); }
.device-state.offline .status-dot { background: var(--red); }
.device-state.stale { color: var(--amber); }
.device-state.stale .status-dot { background: #c99435; }
.device-state.pending, .device-state.unconfigured { color: #919ba3; }
.device-state.pending .status-dot, .device-state.unconfigured .status-dot { background: #a5afb6; }
.table-amount { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 550; }
.table-amount .amount-unit { font-size: 10px; font-weight: 450; color: #8b98a1; margin-left: 3px; }
.cell-note { color: #98a3ab; font-size: 9px; margin-top: 2px; }
.usage-value { font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; margin-bottom: 7px; }
.usage-value.warning { color: var(--amber); }
.usage-value.critical { color: var(--red); }
.usage-bar { width: 78px; max-width: 100%; height: 4px; border-radius: 2px; overflow: hidden; background: #e9eef0; }
.usage-fill { height: 100%; background: #54a88d; }
.usage-fill.warning { background: #d4a14c; }
.usage-fill.critical { background: #d57478; }
.device-row .row-arrow svg { width: 14px; height: 14px; color: #a5b1b9; }
.empty-state { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; color: #94a1aa; font-size: 12px; }
.empty-state svg { width: 23px; height: 23px; }
.empty-row td { padding: 0 !important; }
.table-note { margin: 11px 0 0; color: #94a0aa; font-size: 10px; }
.alerts { display: flex; flex-direction: column; gap: 8px; margin-top: 23px; }
.alert-line { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; background: var(--amber-soft); color: #986d24; border-left: 2px solid #d4a14c; font-size: 11px; }
.alert-line svg { width: 14px; height: 14px; margin-top: 2px; }
.alert-line.critical { background: var(--red-soft); color: #ad555a; border-color: #d57478; }
.alert-line.neutral { background: #eaf0f3; color: #687d8c; border-color: #9bacb8; }
.device-detail { min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.detail-empty { min-height: 390px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; font-size: 12px; color: #98a5ad; }
.detail-empty svg { width: 28px; height: 28px; }
.detail-header { padding: 22px 22px 18px; border-bottom: 1px solid var(--border); }
.detail-title-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title-line h2 { font-size: 17px; overflow-wrap: anywhere; }
.detail-role { margin-top: 5px; color: #8b98a1; font-size: 11px; overflow-wrap: anywhere; }
.detail-icon { color: var(--green); width: 34px; height: 34px; background: #eef6f3; display: grid; place-items: center; border-radius: 6px; flex-shrink: 0; }
.detail-state-line { margin-top: 13px; display: flex; align-items: center; gap: 10px; }
.detail-location { font-size: 10px; color: #a0aab2; overflow-wrap: anywhere; }
.stale-warning { padding: 10px 22px; font-size: 11px; color: #ab792a; background: #fff8eb; border-bottom: 1px solid #f2e9d5; overflow-wrap: anywhere; }
.volume-detail { padding: 20px 22px 19px; }
.volume-detail + .volume-detail { border-top: 1px solid var(--border); }
.volume-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; font-size: 11px; margin-bottom: 7px; }
.volume-name { color: #6c7b85; overflow-wrap: anywhere; }
.volume-percent { color: var(--green); font-variant-numeric: tabular-nums; white-space: nowrap; }
.volume-percent.warning { color: var(--amber); }
.volume-percent.critical { color: var(--red); }
.detail-capacity { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; margin-bottom: 17px; }
.detail-capacity strong { font-size: 25px; font-weight: 630; font-variant-numeric: tabular-nums; }
.detail-capacity .detail-unit { color: #7f8f99; font-size: 14px; }
.detail-capacity .available-label { color: #9da8b0; font-size: 10px; margin-left: 3px; }
.capacity-chart { height: 12px; width: 100%; display: flex; overflow: hidden; border-radius: 3px; background: #eaf0f3; }
.capacity-segment { height: 100%; flex-shrink: 0; }
.capacity-segment.used { background: #8fa4b0; }
.capacity-segment.used.warning { background: #d8aa5e; }
.capacity-segment.used.critical { background: #ce8589; }
.capacity-segment.reserved { background: #ced8de; }
.capacity-segment.available { background: #69ab91; }
.capacity-legend { margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.capacity-legend > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.capacity-legend dt { display: flex; align-items: center; gap: 7px; color: #7e8e98; }
.capacity-legend dd { margin: 0; color: #526572; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-dot { width: 6px; height: 6px; border-radius: 1px; background: #8fa4b0; }
.legend-dot.available { background: #69ab91; }
.legend-dot.reserved { background: #ced8de; }
.volume-meta { display: flex; gap: 7px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #9da8b1; font-size: 9px; margin-top: 16px; overflow-wrap: anywhere; }
.volume-meta span { min-width: 0; }
.history-section { border-top: 1px solid var(--border); padding: 19px 22px 15px; }
.detail-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 11px; color: #6f808b; }
.detail-section-heading .history-count { font-size: 9px; color: #a2acb3; }
.history-chart { display: block; width: 100%; height: 125px; overflow: visible; margin-top: 7px; }
.history-chart text { fill: #a0acb5; font-family: inherit; font-size: 9px; }
.history-empty { height: 110px; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; color: #a2adb5; }
.history-empty svg { width: 15px; height: 15px; }
.history-delta { font-size: 10px; color: #8a98a1; margin-top: 3px; }
.history-delta .positive { color: var(--green); }
.history-delta .negative { color: var(--amber); }
.detail-timestamps { border-top: 1px solid var(--border); padding: 13px 22px; color: #99a5ae; font-size: 9px; display: flex; flex-direction: column; gap: 4px; }
.offload-section { margin-top: 30px; padding: 17px 20px; border: 1px solid var(--border); border-radius: 6px; background: #eef3f6; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.offload-primary { display: flex; gap: 12px; align-items: flex-start; }
.offload-primary > svg { width: 20px; height: 20px; color: #7a93a3; margin-top: 2px; }
.offload-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 560; font-size: 12px; }
.offload-title > svg { width: 12px; height: 12px; }
.offload-state { color: var(--green); font-size: 10px; font-weight: 400; }
.offload-state.warning { color: var(--amber); }
.offload-state.critical { color: var(--red); }
.offload-stage { color: #91a0aa; font-size: 10px; margin-top: 4px; overflow-wrap: anywhere; }
.offload-secondary { display: flex; gap: 26px; font-size: 11px; color: #738692; align-items: center; }
.offload-secondary > div { display: flex; flex-direction: column; gap: 3px; }
.offload-secondary strong { font-weight: 550; font-size: 11px; color: #617784; white-space: nowrap; }
.offload-secondary span { font-size: 9px; color: #93a1aa; }
.page-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; color: #a2acb4; font-size: 9px; margin-top: 27px; padding-top: 14px; border-top: 1px solid #e8ecef; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 1441px) { .app-shell { padding-top: 42px; } }
@media (max-width: 1120px) {
  .app-shell { padding: 28px 28px 20px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
  .metric { padding: 22px; }
  .metric-value { font-size: 27px; }
  .device-table th:first-child { width: 43%; padding-left: 13px; }
  .device-table td:first-child { padding-left: 13px; }
  .device-table .capacity-column { display: none; }
  .device-table th.usage-column { width: 24%; }
  .device-icon { display: none; }
  .search-field { width: 172px; }
  .filter-tabs { gap: 18px; }
}
@media (max-width: 820px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .device-table .capacity-column { display: table-cell; }
  .device-table th:first-child { width: 42%; }
  .device-table th.usage-column { width: 18%; }
  .device-icon { display: grid; }
  .device-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .detail-header, .stale-warning, .detail-timestamps, .detail-empty { grid-column: 1 / -1; }
  .history-section { border-top: 0; border-left: 1px solid var(--border); }
  .history-chart { height: 155px; }
  .history-empty { height: 180px; }
  .offload-section { margin-top: 24px; }
}
@media (max-width: 540px) {
  .app-shell { padding: 22px 17px 18px; }
  .page-header { align-items: flex-start; gap: 15px; flex-wrap: wrap; }
  .heading-group { gap: 10px; }
  .brand-mark { width: 39px; height: 39px; }
  .brand-mark svg { width: 21px; height: 21px; }
  h1 { font-size: 23px; }
  .eyebrow { font-size: 10px; }
  .header-controls { width: 100%; justify-content: flex-end; gap: 8px; margin-top: 1px; }
  .auto-refresh { margin-right: auto; font-size: 11px; }
  .icon-button { width: 34px; height: 34px; }
  .unit-switch button { width: 37px; height: 26px; }
  .status-line { margin: 15px 0 12px; font-size: 9px; gap: 6px 9px; }
  .overview { grid-template-columns: 1fr 1fr; margin-bottom: 23px; }
  .metric { padding: 17px 14px 16px; }
  .metric-label { font-size: 10px; gap: 5px; }
  .metric-label svg { width: 13px; height: 13px; }
  .metric-value { font-size: 23px; margin: 8px 0 5px; }
  .metric-value .value-unit { font-size: 12px; margin-left: 4px; }
  .metric-note { font-size: 9px; }
  .health-metric { grid-column: 1 / -1; border-left: 0 !important; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 13px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
  .health-metric .metric-value { margin: 0; font-size: 20px; }
  .health-value { gap: 5px; }
  .health-value .health-total { font-size: 15px; }
  .health-metric .metric-note { margin-left: auto; }
  .section-heading { margin-bottom: 10px; gap: 10px; }
  h2 { font-size: 15px; }
  .section-count { font-size: 10px; }
  .search-field { width: 168px; height: 33px; padding: 0 8px; gap: 6px; }
  .search-field input { font-size: 11px; }
  .filter-tabs { gap: 22px; }
  .filter-tabs button { font-size: 11px; }
  .device-table .capacity-column { display: none; }
  .device-table th:first-child { width: 49%; padding-left: 12px; }
  .device-table th.usage-column { width: 20%; }
  .device-table th.row-arrow { width: 17px; }
  .device-table th { font-size: 9px; height: 34px; }
  .device-table td { padding-right: 7px; height: 86px; }
  .device-table td:first-child { padding-left: 12px; }
  .device-icon { display: none; }
  .device-name { font-size: 12px; gap: 3px 6px; }
  .device-state { font-size: 9px; }
  .device-subline { font-size: 9px; }
  .table-amount { font-size: 12px; }
  .table-amount .amount-unit { font-size: 9px; margin-left: 2px; }
  .cell-note { font-size: 8px; }
  .usage-value { font-size: 10px; }
  .usage-bar { width: 53px; }
  .table-note { font-size: 9px; }
  .alerts { margin-top: 17px; }
  .alert-line { padding: 9px 11px; font-size: 10px; }
  .workspace { gap: 22px; }
  .device-detail { display: block; }
  .detail-header { padding: 18px 20px 15px; }
  .detail-title-line h2 { font-size: 16px; }
  .volume-detail { padding: 19px 20px; }
  .history-section { border-left: 0; border-top: 1px solid var(--border); padding: 18px 20px 15px; }
  .history-chart { height: 126px; }
  .history-empty { height: 100px; }
  .offload-section { flex-direction: column; align-items: flex-start; gap: 15px; padding: 16px; }
  .offload-secondary { width: 100%; padding-left: 32px; justify-content: space-between; gap: 10px; }
  .offload-secondary strong { font-size: 10px; }
  .page-footer { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
