:root {
  color-scheme: dark;
  --page: #101923;
  --panel: #172330;
  --panel-raised: #1d2b39;
  --line: #2a3947;
  --text: #edf2f6;
  --muted: #9aa9b6;
  --faint: #71818e;
  --mint: #72e0ba;
  --red: #ff8585;
  --amber: #f5c46b;
  --blue: #88b8ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 18% -20%, rgb(61 116 111 / 16%), transparent 44rem),
    var(--page);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell { max-width: 1280px; margin: 0 auto; padding: 0 42px 38px; }
.topbar {
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgb(154 169 182 / 15%);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); font-weight: 750; letter-spacing: .02em; text-decoration: none; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: var(--mint); color: #10221e; font-weight: 850; }
.brand-sub { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.feed-state { display: flex; align-items: center; gap: 8px; color: #b7c5ce; font-size: 10px; font-weight: 700; letter-spacing: .11em; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px rgb(114 224 186 / 65%); }
.button { border: 1px solid transparent; border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 650; }
.button-primary { background: var(--mint); color: #10221e; }
.button-primary:hover { background: #91ebcc; }
.button-quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.button-quiet:hover { border-color: #506474; color: var(--text); }

.eyebrow { color: var(--mint); font-size: 10px; font-weight: 750; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(29px, 4vw, 39px); line-height: 1.15; letter-spacing: -.04em; }
h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.02em; }
.subheading { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 40px 0 26px; }
.updated-label { color: var(--faint); font-size: 12px; padding-bottom: 3px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 21px; }
.metric-card { min-height: 124px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, rgb(29 43 57 / 88%), rgb(23 35 48 / 86%)); }
.metric-label, .metric-foot { display: block; color: var(--muted); font-size: 12px; }
.metric-card strong { display: block; margin: 8px 0 1px; font-size: 30px; line-height: 1.15; letter-spacing: -.04em; }
.metric-critical strong { color: var(--red); }
.metric-warning strong { color: var(--amber); }
.metric-foot { color: var(--faint); font-size: 11px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: rgb(23 35 48 / 88%); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 19px 21px; }
.search-box input, .filter-box select, .password-row input, .history-box select, .sheet-selector select {
  border: 1px solid #354656;
  border-radius: 7px;
  outline: none;
  background: #111c26;
  color: var(--text);
}
.search-box input { width: 205px; padding: 8px 11px; font-size: 12px; }
.search-box input:focus, .filter-box select:focus, .password-row input:focus, .history-box select:focus, .sheet-selector select:focus { border-color: var(--mint); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 10px 20px; color: var(--faint); background: #14202a; font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 20px; border-top: 1px solid rgb(42 57 71 / 75%); color: #cbd4db; font-size: 12px; vertical-align: middle; }
.device-row:hover { background: rgb(136 184 255 / 5%); }
.device-name { display: flex; align-items: center; gap: 11px; min-width: 165px; }
.device-icon { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border: 1px solid #354656; border-radius: 8px; color: var(--blue); font-size: 12px; }
.asset-link { border: 0; padding: 0; background: transparent; color: var(--text); font-weight: 650; text-align: left; }
.asset-link:hover { color: var(--mint); text-decoration: underline; }
.count-critical { color: var(--red); font-weight: 700; }
.count-warning { color: var(--amber); font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 750; text-transform: uppercase; white-space: nowrap; }
.badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.badge-critical { border-color: rgb(255 133 133 / 20%); background: rgb(255 133 133 / 9%); color: var(--red); }
.badge-warning { border-color: rgb(245 196 107 / 20%); background: rgb(245 196 107 / 9%); color: var(--amber); }
.badge-pass { border-color: rgb(114 224 186 / 20%); background: rgb(114 224 186 / 8%); color: var(--mint); }
.badge-info { border-color: rgb(136 184 255 / 20%); background: rgb(136 184 255 / 8%); color: var(--blue); }
.report-panel { margin-top: 20px; }

.history-box select { max-width: 320px; padding: 8px 10px; color: var(--muted); font-size: 12px; }
.detail-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 0 20px; border-bottom: 1px solid var(--line); }
.detail-tab { position: relative; flex: 0 0 auto; border: 0; border-bottom: 2px solid transparent; padding: 11px 12px; background: transparent; color: var(--muted); font-size: 12px; }
.detail-tab:hover { color: var(--text); }
.detail-tab.is-active { border-bottom-color: var(--mint); color: var(--mint); }
.detail-tab:disabled { cursor: not-allowed; opacity: .42; }
.artifact-message { min-height: 17px; margin: 10px 21px 0; color: var(--faint); font-size: 11px; }
.artifact-message:empty { display: none; }
.artifact-view { padding-bottom: 4px; }
.artifact-toolbar { display: flex; justify-content: flex-end; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 20px; }
.artifact-toolbar .button { padding: 6px 9px; font-size: 11px; }
.sheet-selector { display: flex; align-items: center; gap: 9px; margin-right: auto; color: var(--muted); font-size: 11px; }
.sheet-selector select { min-width: 190px; padding: 7px 9px; font-size: 11px; }
.artifact-content { padding: 0 20px 20px; }
.workbook-table-wrap { max-height: 560px; border: 1px solid var(--line); border-radius: 8px; }
.workbook-table-wrap th { position: sticky; top: 0; }
.workbook-table-wrap th, .workbook-table-wrap td { padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.workbook-table-wrap tr:first-child th { color: #c9d6de; }
.document-content { max-width: 900px; margin: 0 auto; padding: 18px 22px; border: 1px solid var(--line); border-radius: 9px; background: #f5f4ed; color: #252a2d; }
.document-content p { margin: 0; padding: 5px 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.55 ui-sans-serif, system-ui, sans-serif; }
.document-content p:empty { min-height: 10px; }
.report-text { max-height: 580px; overflow: auto; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: #111c26; color: #cbd4db; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.battery-report-frame { display: block; width: 100%; min-height: 640px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.artifact-empty { margin: 0; padding: 22px 4px; color: var(--muted); font-size: 12px; }
.detail-table { min-width: 770px; }
.detail-table td { max-width: 280px; overflow-wrap: anywhere; }
.detail-table td:nth-child(2) { color: var(--text); font-weight: 600; }
.guidance-link { color: var(--blue); font-size: 11px; white-space: nowrap; }
.guidance-link:hover { color: var(--mint); }
.empty-state { padding: 50px 20px; text-align: center; }
.empty-state h3 { margin: 8px 0 5px; font-size: 16px; }
.empty-state p { max-width: 410px; margin: 0 auto; color: var(--muted); font-size: 12px; }
.empty-icon { color: var(--mint); font-size: 25px; }
.compact-empty { padding: 26px; color: var(--muted); font-size: 12px; }
.message { min-height: 20px; margin: 0; font-size: 12px; }
.error-message { color: var(--red); }
.login-panel { max-width: 480px; margin: 10vh auto 0; padding: 38px; border: 1px solid var(--line); border-radius: 13px; background: rgb(23 35 48 / 92%); box-shadow: 0 25px 90px rgb(0 0 0 / 18%); }
.login-panel h1 { margin-top: 10px; }
.login-panel > p { max-width: 350px; margin: 12px 0 28px; color: var(--muted); font-size: 13px; }
.login-panel label { display: block; margin-bottom: 7px; color: #c5d0d8; font-size: 12px; font-weight: 650; }
.password-row { display: flex; gap: 9px; }
.password-row input { min-width: 0; flex: 1; padding: 10px 12px; }
footer { padding: 22px 2px 0; color: var(--faint); font-size: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 760px) {
  .shell { padding: 0 18px 28px; }
  .topbar { min-height: 66px; }
  .brand-sub { display: none; }
  .feed-state { font-size: 0; }
  .feed-state .pulse { width: 8px; height: 8px; }
  .top-actions { gap: 7px; }
  .button { padding: 8px 10px; font-size: 11px; }
  .page-heading { align-items: start; flex-direction: column; padding: 30px 0 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric-card { min-height: 108px; padding: 14px; }
  .metric-card strong { font-size: 26px; }
  .panel-heading { align-items: start; flex-direction: column; }
  .history-box, .history-box select { width: 100%; max-width: none; }
  .search-box, .search-box input { width: 100%; }
  .detail-tabs { padding-right: 10px; padding-left: 10px; }
  .detail-tab { padding-right: 9px; padding-left: 9px; font-size: 11px; }
  .artifact-content { padding-right: 10px; padding-left: 10px; }
  .fleet-panel td, .fleet-panel th { padding-right: 12px; padding-left: 12px; }
  .login-panel { margin-top: 7vh; padding: 27px 22px; }
  .password-row { flex-direction: column; }
}
