/* ============================================================================
 *  style.css — Fleet control page
 *  Same dark industrial palette as the panel's log screen (src/logui.cpp), so
 *  a colour means the same thing on the glass and in the browser.
 * ========================================================================== */

:root {
  --bg:      #0b1015;
  --panel:   #121a21;
  --panel-2: #18232c;
  --line:    #1e2a35;
  --text:    #c9d6df;
  --dim:     #64748b;
  --cyan:    #22d3ee;
  --green:   #22c55e;
  --red:     #ef4444;
  --amber:   #f59e0b;
  --violet:  #a78bfa;
}

* { box-sizing: border-box; }

/* MUST come before any rule that sets `display` on something we hide from JS.
 *
 * `[hidden] { display: none }` lives in the browser's UA stylesheet, and ANY
 * author rule beats a UA rule regardless of specificity. So `.gate { display:
 * grid }` below silently won over `hidden`, and `$('gate').hidden = true` did
 * nothing visible: the login overlay is position:fixed/inset:0/z-index:10, so
 * a correct password logged you in behind a full-screen panel that never went
 * away. It looked exactly like the Enter key doing nothing. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
}

h1, h2 { margin: 0; font-weight: 600; }
.sub  { color: var(--dim); }
.dim  { color: var(--dim); }
.error { color: var(--red); }

/* ---- gate ---------------------------------------------------------------- */
.gate {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 10;
}
.gate-card {
  width: min(340px, 90vw);
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.gate-card h1 { font-size: 22px; }
.gate-card .sub { margin: -8px 0 8px; font-size: 13px; }

input, button, select {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
}
input {
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
}
input:focus { outline: 2px solid var(--cyan); outline-offset: -1px; }

button {
  padding: 10px 14px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--cyan); }
button:disabled { opacity: .4; cursor: not-allowed; }

button.ghost {
  padding: 2px 8px;
  font-size: 12px;
  background: none;
  color: var(--dim);
}

/* ---- shell --------------------------------------------------------------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand strong { font-size: 16px; }
.brand .sub { margin-left: 10px; font-size: 13px; }

.pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}
.pill-ok   { color: var(--green);  border-color: var(--green); }
.pill-warn { color: var(--amber);  border-color: var(--amber); }
.pill-bad  { color: var(--red);    border-color: var(--red); }

main {
  display: grid;
  grid-template-columns: 260px minmax(320px, 1fr) minmax(340px, 460px);
  gap: 1px;
  background: var(--line);
  height: calc(100vh - 57px);
}
main > * {
  background: var(--bg);
  padding: 16px;
  overflow-y: auto;
}
main h2 {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ---- device list --------------------------------------------------------- */
#device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#device-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--panel);
}
#device-list li:hover { border-color: var(--dim); }
#device-list li[aria-selected="true"] { border-color: var(--cyan); background: var(--panel-2); }
#device-list .serial { font-weight: 600; letter-spacing: .02em; }
#device-list .meta { font-size: 12px; color: var(--dim); }
.empty { color: var(--dim); font-size: 13px; }

/* ---- command groups ------------------------------------------------------ */
.target {
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.target .serial { font-size: 16px; font-weight: 600; color: var(--cyan); }
.target .meta { font-size: 12px; color: var(--dim); }

.group { margin-bottom: 20px; }
.group > h3 {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); margin: 0 0 8px;
}
.group-note {
  font-size: 12px; color: var(--amber);
  margin: -4px 0 8px;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.param-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px; align-items: center;
  margin-bottom: 8px;
}
.param-row label { font-size: 13px; }
.param-row .range { font-size: 11px; color: var(--dim); display: block; }

/* ---- log ----------------------------------------------------------------- */
#log {
  font: 12px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace;
  display: flex; flex-direction: column; gap: 2px;
}
#log .row { white-space: pre-wrap; word-break: break-word; }
#log .t    { color: var(--dim); }
#log .net  { color: var(--cyan); }
#log .sent { color: var(--violet); }
#log .ok   { color: var(--green); }
#log .fail { color: var(--red); }
#log .warn { color: var(--amber); }
#log .frames { color: var(--dim); padding-left: 2ch; }

@media (max-width: 980px) {
  main { grid-template-columns: 1fr; height: auto; }
  main > * { overflow: visible; }
}
