/* hwpanel app layout (tokens + status + chart styles are in base.css) */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 15px/1.45 var(--sans); min-height: 100vh; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .pad { padding: 16px; } .nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .85em; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 48px;
       background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .92rem; }
.top nav a.on { color: var(--ink); background: var(--surface-2); font-weight: 600; }
.who { margin-left: auto; color: var(--ink-2); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who + .clock { margin-left: 12px; }
.clock { margin-left: auto; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
main { max-width: 1840px; margin: 0 auto; padding: 16px; }     /* a 1920 screen (Andrew 10-15: "a little wider") */

/* ---- controls ---- */
.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; cursor: pointer;
       border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: .88rem; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical-ink); border-color: var(--critical); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { padding: 3px 8px; font-size: .8rem; }
input[type=text], input[type=password], input[type=number], input[type=search], select {
  background: var(--surface); border: 1px solid var(--base); border-radius: 6px; padding: 6px 9px; min-width: 0; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 200px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--ink-2); cursor: pointer; }

/* ---- dashboard ---- */
.summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; min-width: 120px; }
.tile .v { font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: .8rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.dut { display: flex; flex-direction: column; gap: 8px; position: relative; }
.dut.off { opacity: .72; }
.dut.alarm { border-color: var(--critical); box-shadow: inset 3px 0 0 var(--critical); }
.dut.warnb { border-color: var(--warning); box-shadow: inset 3px 0 0 var(--warning); }
.dut h3 { margin: 0; font-size: 1rem; line-height: 1.25; display: flex; gap: 8px; align-items: flex-start; }
.dut h3 a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.dut h3 a:hover { text-decoration: underline; }
.dut .sel { margin: 2px 0 0; }
.meta { color: var(--ink-2); font-size: .82rem; overflow-wrap: anywhere; }
.conn { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--ink-2); white-space: nowrap; margin-left: auto; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.conn.on i { background: var(--good); }
.conn.down i { background: var(--critical); }
.activity { font-size: .88rem; }
.activity b { font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips .st { font-size: .74rem; padding: .22em .42em; }
.chips .st .k { font-weight: 500; opacity: .85; }
.sens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sens div { background: var(--surface-2); border-radius: 6px; padding: 5px 8px; min-width: 0; }
.sens b { display: block; font-size: 1.02rem; font-weight: 600; }
.sens span { display: block; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert { font-size: .84rem; padding: 6px 9px; border-radius: 6px; background: var(--critical-wash); color: var(--critical-ink); }
.alert.warn { background: var(--warning-wash); color: var(--warning-ink); }
.drives { font-size: .8rem; color: var(--ink-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.drives > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drives b { color: var(--ink); font-weight: 600; }
.drives .bad { color: var(--critical-ink); }
.drives > div.wrap { white-space: normal; }
.drives .why { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drives .warn, .minv { color: var(--warning-ink); }
.alert .alarm-line { margin-bottom: 3px; overflow-wrap: anywhere; }
.alert a { color: inherit; font-weight: 600; }
.foot { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); }
.foot > span:first-child { margin-right: auto; }
.bulkbar { position: sticky; bottom: 0; margin-top: 14px; background: var(--surface); border: 1px solid var(--accent);
           border-radius: 8px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; z-index: 10; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }

/* ---- DUT page ---- */
.dhead { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.dhead h1 { font-size: 1.35rem; margin: 0; }
.dhead .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; order: 1; }
/* the claim / reboot bars always take their own full row under the title + buttons: a longer claim text ('Claim this
   station', 'Checked out by ... - you can act as admin.') no longer pushes the buttons onto a row of their own (Andrew 10-15) */
.dhead .claimbar, .dhead .rebootbar { order: 2; flex: 0 0 100%; box-sizing: border-box; margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--base); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .92rem; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: 0; font-size: .86rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
h2.sec { font-size: .98rem; margin: 18px 0 8px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.ranges { display: inline-flex; border: 1px solid var(--base); border-radius: 6px; overflow: hidden; }
.ranges button { border: 0; background: var(--surface); padding: 5px 10px; cursor: pointer; font-size: .84rem; }
.ranges button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.events { max-height: 360px; overflow: auto; }
pre.log { font: 12px/1.35 var(--mono); background: var(--surface-2); border-radius: 6px; padding: 10px; max-height: 520px;
          overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* ---- terminal mirror ---- */
.termwrap { display: flex; flex-direction: column; gap: 8px; }
.wins { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.term { width: fit-content; min-width: min(100%, 82ch); max-width: 100%; background: var(--term-bg); color: var(--term-fg); font: 13px/1.25 var(--mono); padding: 10px; border-radius: 6px;
        overflow: auto; white-space: pre; outline: none; border: 2px solid transparent; tab-size: 8; }
.term.live { border-color: var(--accent); }
.term > div { height: 1.25em; white-space: pre; }
.term > div > span { display: inline-block; height: 100%; vertical-align: top; }
.term .cur { outline: 1px solid #d8d8d0; }
.keys { display: flex; flex-wrap: wrap; gap: 4px; }
.keys .btn { font-family: var(--mono); font-size: .78rem; padding: 4px 8px; }

/* ---- modal / toast ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-start;
         justify-content: center; padding: 6vh 16px 16px; overflow: auto; }
.dialog { background: var(--surface); border-radius: 10px; border: 1px solid var(--border); width: 100%; max-width: 620px;
          padding: 18px 18px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.dialog h2 { margin: 0 0 6px; font-size: 1.15rem; }
.form { display: grid; grid-template-columns: 1fr 150px; gap: 8px 12px; align-items: center; margin: 12px 0; }
.form label { font-size: .88rem; } .form .hint { grid-column: 1 / -1; margin-top: -4px; font-size: .78rem; color: var(--muted); }
.form input, .form select { width: 100%; }
.testlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin: 10px 0 4px; }
.testlist label { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.blurb { color: var(--ink-2); margin: 6px 0 0; min-height: 2.6em; }
.testlist label:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.testlist b { display: block; font-size: .92rem; } .testlist span { font-size: .8rem; color: var(--ink-2); }
.testlist label.off { opacity: .5; cursor: not-allowed; }
.testlist label.danger { border-color: var(--critical); } .testlist label.danger b { color: var(--critical-ink); }
.dialog.wide { max-width: 980px; }
.testlist .vnote { margin-left: auto; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.where .alert { margin: 6px 0; }
.dialog .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btns.left { display: flex; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }
.drivepick { grid-column: 1 / -1; max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; }
.drivepick label { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; font-size: .84rem; cursor: pointer; }
.drivepick label.all { border-bottom: 1px solid var(--border); margin-bottom: 2px; font-weight: 600; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drivepick label.off { opacity: .55; cursor: not-allowed; }
.form .drivepick input { width: auto; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: var(--page);
         padding: 9px 14px; border-radius: 8px; font-size: .88rem; z-index: 60; max-width: calc(100vw - 32px); }
.toast.err { background: var(--critical); color: #fff; }
.login { max-width: 360px; margin: 12vh auto; }
.login .card { display: grid; gap: 10px; }

@media (max-width: 640px) {
  main { padding: 12px; } .top { gap: 10px; padding: 0 12px; } .clock { display: none; }
  .cards { grid-template-columns: 1fr; } .charts { grid-template-columns: 1fr; } .form { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; } dl.kv dt { margin-top: .3rem; }
  .term { font-size: 10px; }
  .top nav { min-width: 0; overflow-x: auto; } .top nav a { padding: 6px 7px; }     /* four nav items + the user */
}

/* "the panel was updated" - shown by an open tab after a deploy */
.updbar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; display: flex; gap: .7rem;
          align-items: center; background: var(--surface); color: var(--ink); border: 1px solid var(--border);
          border-left: 4px solid var(--accent); border-radius: 8px; padding: 8px 10px 8px 14px; font-size: .9rem;
          box-shadow: 0 4px 18px rgba(0,0,0,.18); max-width: calc(100vw - 32px); }
.warnnote { color: var(--warning-ink); font-weight: 600; margin-top: 2px; }

/* DUT claims */
.claimline { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .25rem 0 .1rem; }
.claimbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .5rem 0 .2rem; padding: .45rem .7rem;
            border-radius: 6px; border: 1px solid var(--border); background: var(--surface); font-size: .9rem; }
.claimbar.mine { border-left: 4px solid var(--good); }
.claimbar.theirs { border-left: 4px solid var(--warning); }
.claimbar.free { border-left: 4px solid var(--accent); }
.rebootbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .5rem 0 .2rem; padding: .45rem .7rem;
             border-radius: 6px; border: 1px solid var(--border); border-left: 4px solid var(--warning); background: var(--warning-wash); font-size: .9rem; }

/* phone width: a wide table scrolls inside its card instead of widening the page */
.card { min-width: 0; overflow-x: auto; }
.grid2 > * { min-width: 0; }
table.t tr.bad td { background: var(--critical-wash); }
table.t tr.warn td { background: var(--warning-wash); }
