:root {
    color-scheme: dark;
    font: 16px/1.5 Inter, system-ui, sans-serif;
    --bg: #0c1412;
    --surface: #14201c;
    --field: #101a17;
    --line: #2a3b34;
    --text: #edf4ed;
    --muted: #a3b7ad;
    --mint: #b7ed84;
    --ink: #14230d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--bg); }
body.signed-out { min-height: 100dvh; background: radial-gradient(ellipse at 50% 25%, #22392c, var(--bg) 62%); }
a { color: inherit; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.shell { width: min(1120px, 100% - 40px); margin-inline: auto; }
.topbar { background: #101a17; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 1.1rem; font-weight: 750; white-space: nowrap; }
.brand > span:last-child { color: var(--muted); font-weight: 450; }
.brand-mark { display: grid; place-items: center; margin-right: 5px; width: 35px; height: 35px; border-radius: 10px; background: var(--mint); color: var(--ink); font-size: 1.5rem; }
.nav { display: flex; align-items: center; gap: 5px; }
.nav a, .command-list a { padding: 8px 12px; border-radius: 7px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.nav a:hover, .command-list a:hover { color: var(--text); background: #1d2d26; }
[aria-current="page"] { color: var(--mint) !important; background: #23372a !important; }
.main { padding-block: 40px 64px; }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.device-id { margin: 0 0 4px; color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.device-id span { padding-inline: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.055em; line-height: 1.12; }
h2 { font-size: 1.15rem; margin-bottom: 10px; letter-spacing: -.02em; }
h3 { font-size: 1rem; margin-bottom: 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 23px; min-width: 0; }
.login { max-width: 440px; margin: clamp(32px, 10vh, 104px) auto 0; padding: clamp(22px, 5vw, 38px); }
.login h1 { font-size: 2rem; margin-bottom: 12px; }
.login > p, .control > p { color: var(--muted); }
.stack { display: grid; gap: 16px; }
.fields, .actions, .subnav { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.fields > label { flex: 1 1 160px; }
.fields:empty { display: none; }
label { display: grid; gap: 5px; font-size: .9rem; }
input:not([type="checkbox"]), select { width: 100%; padding: 9px 11px; min-height: 42px; color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: 7px; }
input[type="checkbox"] { accent-color: var(--mint); margin: 0; width: 16px; height: 16px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 41px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: .9rem; font-weight: 650; text-align: center; }
.primary { color: var(--ink); background: var(--mint); }
.primary:hover { background: #cef8a7; }
.secondary { color: var(--text); background: #1b2923; border-color: var(--line); }
.secondary:hover { background: #283a30; }
.quiet { color: var(--muted); background: transparent; }
.quiet:hover { color: var(--text); }
button:disabled { opacity: .5; cursor: default; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { min-height: 126px; padding: 18px; background: linear-gradient(155deg, #1c3025, var(--surface) 80%); }
.metric h2 { font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.metric p { font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 750; letter-spacing: -.04em; margin: 0; overflow-wrap: anywhere; }
.metric p small, .metric > span { font-size: .8rem; font-weight: 450; color: var(--muted); letter-spacing: normal; }
.metric > span { display: block; }
.peak-summary { margin-bottom: 18px; }
.peak-summary p { margin-bottom: 5px; }
.peak-summary p:last-child { margin-bottom: 0; }
.peak-value { font-size: 1.15rem; font-weight: 700; }
.measurement-group { border-top: 1px solid var(--line); }
.measurement-group > summary { padding: 12px 2px; color: var(--text); font-weight: 650; }
.measurement-group > summary .muted { float: right; padding-right: 3px; font-weight: 450; font-variant-numeric: tabular-nums; }
.measurement-group table { table-layout: fixed; }
.measurement-group th:first-child { width: 64%; }
.measurement-group .scroll { padding-bottom: 8px; }
.section-heading { margin-bottom: 12px; }
.section-heading h2 { margin-bottom: 3px; }
.muted, .empty { color: var(--muted); font-size: .9rem; }
.section-heading p, .empty { margin-bottom: 0; }
.tag { border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px; color: var(--muted); font-size: .8rem; text-align: center; }
.tag.done { background: #253a28; color: #d3f6b5; }
.tag.failed, .message.error { color: #ffd8cd; background: #392520; border-color: #714a40; }
.tag.pending, .tag.uncertain { color: #f0dda0; }
.message { padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 11px; }
th { color: var(--muted); font-weight: 600; }
td { overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
summary { color: var(--muted); cursor: pointer; }
.data-details, .pagination:not(:empty) { margin-top: 16px; }
canvas { display: block; width: 100%; height: 260px; margin-block: 18px 12px; }
.subnav { margin-bottom: 14px; }
.values { margin: 12px 0; }
.values > div { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(90px, 1fr); gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.values dt { color: var(--muted); }
.values dd { margin: 0; overflow-wrap: anywhere; }
.control-layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 14px; align-items: start; }
.command-list { display: grid; padding: 10px; gap: 2px; }
.presets { margin-bottom: 15px; }
.checks { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
.checks label, label.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 9px; }
label.check { min-height: 41px; }
.checks legend { padding: 0 5px; color: var(--muted); font-size: .9rem; }
.schedule { min-width: 520px; }
.schedule td { padding: 5px; }
.order { padding: 15px 0; border-bottom: 1px solid var(--line); }
.order:last-child { border-bottom: 0; padding-bottom: 0; }
.order form { margin-top: 10px; }
.order p:last-child { margin-bottom: 0; }
pre { overflow: auto; background: var(--field); padding: 12px; border-radius: 7px; }

@media (max-width: 740px) {
    .topbar-inner { flex-wrap: wrap; min-height: auto; padding-block: 10px; gap: 5px 12px; }
    .nav { order: 3; width: 100%; overflow-x: auto; }
    .nav a { padding-inline: 9px; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .control-layout { grid-template-columns: minmax(0, 1fr); }
    .command-list { display: flex; overflow: auto; }
    .command-list a { flex: 0 0 auto; }
}

@media (max-width: 440px) {
    .shell { width: calc(100% - 24px); }
    .main { padding-top: 25px; }
    .page-heading { align-items: start; flex-direction: column; }
    .card { padding: 15px; }
    .nav a { font-size: .8rem; }
}
