/* ============================================================================
   The developer dashboard's one stylesheet.

   The look is flat and two-tone: a dark ground, tiles one step lighter, and
   one raised tone for the rows, inputs and buttons inside a tile. Nothing
   else separates things: no shadows, no gradients, no lines round boxes.
   Inside a raised row a control drops back to the tile tone, so it still
   reads. Orange is the one accent and is used sparingly: the main action of a
   page, the dot in a tile's label, the current choice.

   Sections: tokens · base · frame (menu, page, log box) · tiles · rows ·
   forms · buttons · small pieces · tabs · log viewer · Bluetooth setup ·
   sign-in · narrow screens.

   theme.css is not used here: it belongs to the phone app as well.
   ========================================================================== */

:root {
  /* tones */
  --ground: #141414;
  --tile: #1f1f1f;
  --raised: #2b2b2b;
  --raised-hover: #353535;

  /* text */
  --ink: #f4f4f4;
  --text: #d8d6d6;
  --mut: #a5a3a3;
  --faint: #8c8a8a;

  /* the accent, and dark text for on top of it */
  --accent: #f89925;
  --accent-hover: #e5871a;
  --accent-ink: #181d27;
  --accent-soft: rgba(248, 153, 37, 0.14);

  /* states (always written out in words as well) */
  --ok: #3ddc84;
  --warn: #f2b34b;
  --danger: #f2685f;
  --danger-hover: #e4564d;
  --danger-soft: rgba(242, 104, 95, 0.14);
  --info: #4aa8f2;

  /* shape */
  --r-tile: 22px;
  --r-row: 13px;
  --r-ctl: 11px;
  --r-pill: 999px;

  /* spacing scale */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 28px;
  --gap: 14px; /* between tiles, and round the frame */

  --ctl-h: 40px;
  /* the small arrow of a list to choose from, and of anything that folds */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%23a5a3a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --font: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
}

/* ---- base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; color: var(--ink); }
.hide, [hidden] { display: none !important; }
.muted { color: var(--mut); }
.mono { font-family: var(--mono); }

/* The one ring: on whatever has the keyboard. */
:focus { outline: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: var(--raised-hover) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--raised-hover); border-radius: var(--r-pill); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- frame: menu · page · log box (built by ui/shell.js) ------------------ */

body.shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr) minmax(380px, 36vw);
  height: 100vh;
  overflow: hidden;
}
body.shell.shell--nologs { grid-template-columns: 208px minmax(0, 1fr); }

.app {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding: var(--gap) var(--gap) var(--s6);
}
.page {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.page--wide { max-width: none; }
/* a page whose last tile takes the height that is left (logs.html) */
.page--fill { min-height: 100%; }

.pagehead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  min-height: 44px;
  padding: 0 var(--s2);
}
.pagehead h1 { font-size: 22px; line-height: 30px; font-weight: 600; color: var(--ink); margin-right: auto; }
.pagehead__note { color: var(--mut); font-size: 13px; }

/* menu */
.sh-nav {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  height: 100vh;
  padding: var(--s5) var(--s3) var(--s4);
  overflow-y: auto;
}
.sh-brand { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s3); min-height: 30px; }
.sh-brand img { height: 22px; display: block; }
.sh-menu { display: flex; flex-direction: column; gap: 2px; }
.sh-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--s3);
  border-radius: var(--r-ctl);
  color: var(--mut);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}
.sh-link::before { content: ''; width: 6px; height: 6px; border-radius: var(--r-pill); background: transparent; flex: none; }
.sh-link:hover { background: var(--tile); color: var(--ink); text-decoration: none; }
.sh-link[aria-current] { background: var(--tile); color: var(--ink); }
.sh-link[aria-current]::before { background: var(--accent); }
.sh-link--btn { appearance: none; border: 0; background: transparent; font-family: inherit; text-align: left; width: 100%; cursor: pointer; }
.sh-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.sh-user { padding: 6px var(--s3) 6px 28px; display: flex; flex-direction: column; font-size: 13px; line-height: 18px; }
.sh-user b { overflow-wrap: anywhere; }
.sh-user span { color: var(--faint); }
.sh-nav .sh-menubtn { display: none; }

/* log box: a tile of its own, with air round it */
.sh-logs {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100vh - 2 * var(--gap));
  margin: var(--gap) var(--gap) var(--gap) 0;
  background: var(--tile);
  border-radius: var(--r-tile);
  overflow: hidden;
}
.sh-loghead { display: flex; align-items: center; gap: var(--s2); padding: var(--s5) var(--s5) var(--s1); }
.sh-loghead .tile__label { margin-right: auto; }
.sh-loghead .tile__label a { color: inherit; }
.sh-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--mut); white-space: nowrap; }
.sh-logbox { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* only for narrower screens, where the box is a panel (see the end of this file) */
.sh-logbtn, .sh-logs .sh-logclose, .sh-scrim { display: none; appearance: none; border: 0; padding: 0; }

/* ---- tiles ---------------------------------------------------------------- */

.tile, .panel {
  background: var(--tile);
  border-radius: var(--r-tile);
  padding: var(--s5);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
/* A tile's label: small, upper case, muted, after an accent dot. */
.tile__label, .panel__title {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: 0;
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mut);
}
.tile__label::before, .panel__title::before { content: ''; width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--accent); flex: none; }
.tile__count { margin-left: auto; color: var(--faint); letter-spacing: 0; text-transform: none; font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
.tile__note, .panel__desc { color: var(--mut); font-size: 13px; line-height: 19px; max-width: 76ch; }
.panel__desc { margin-top: 6px; }
.tile__head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.tile__head .tile__label { margin-right: auto; }
.tile__sub { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); margin-top: var(--s2); }

/* A tile that folds: the label is the handle. A block, not a column with
   gaps: a gap would open under the label while the tile is closed. */
details.tile { display: block; }
details.tile > summary { list-style: none; cursor: pointer; border-radius: 6px; }
details.tile > summary::-webkit-details-marker { display: none; }
details.tile > summary::after, .advanced > summary::after { content: ''; width: 12px; height: 8px; margin-left: auto; flex: none; background: var(--chevron) no-repeat center; transform: rotate(-90deg); }
details.tile[open] > summary::after, .advanced[open] > summary::after { transform: none; }
details.tile > summary:has(.tile__count)::after { margin-left: var(--s2); }
details.tile > summary:hover { color: var(--ink); }
details.tile > :not(summary) { margin-top: var(--gap); }

.empty { color: var(--mut); font-size: 13px; line-height: 19px; }
.empty b { display: block; font-size: 14px; margin-bottom: 2px; }
.page > .empty { padding: 0 var(--s2); }

/* ---- rows: raised pills inside a tile -------------------------------------- */

.rows { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  min-width: 0;
  background: var(--raised);
  border-radius: var(--r-row);
  padding: 10px 14px;
  color: var(--text);
}
a.row:hover, button.row:hover { background: var(--raised-hover); text-decoration: none; }
.row__main { flex: 1 1 200px; min-width: 0; }
.row__title { color: var(--ink); font-weight: 600; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.row__meta { color: var(--mut); font-size: 12.5px; line-height: 18px; overflow-wrap: anywhere; }
.row__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row__go { color: var(--faint); flex: none; }
/* a second line inside a row: choosing where something goes */
.row__pick { flex: 1 1 100%; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row__pick select { flex: 0 1 320px; width: auto; height: 30px; font-size: 13px; }

/* one charger in the list: dot · serial · state · quiet facts · tags · arrow.
   On one line while there is room; the arrow keeps its place when it wraps. */
.crow { position: relative; padding-right: 34px; }
.crow .row__go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.crow__id { flex: 0 0 auto; min-width: 150px; font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.crow__state { flex: 1 0 auto; max-width: 100%; font-size: 13.5px; color: var(--text); }
.crow__fw { flex: 0 1 auto; min-width: 0; font-size: 12.5px; color: var(--mut); overflow-wrap: anywhere; }
.crow__tags { display: flex; gap: var(--s1); flex-wrap: wrap; }

.dot { width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--faint); flex: none; }
.dot[data-tone='ok'] { background: var(--ok); }
.dot[data-tone='info'] { background: var(--info); }
.dot[data-tone='accent'] { background: var(--accent); }
.dot[data-tone='warn'] { background: var(--warn); }
.dot[data-tone='danger'] { background: var(--danger); }

.tag { display: inline-flex; align-items: center; font-size: 11px; line-height: 16px; font-weight: 500; padding: 1px 8px; border-radius: var(--r-pill); background: var(--raised); color: var(--mut); white-space: nowrap; }

/* a label, a value to copy, a button */
.copyrow { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; background: var(--raised); border-radius: var(--r-row); padding: 8px 8px 8px 14px; min-width: 0; }
.copyrow__label { flex: 0 0 132px; color: var(--mut); font-size: 12.5px; line-height: 18px; }
.copyrow__value { flex: 1 1 180px; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }

/* key = value lines read from a charger */
.kv { display: flex; align-items: baseline; gap: var(--s2) var(--s3); flex-wrap: wrap; background: var(--raised); border-radius: var(--r-ctl); padding: 7px 12px; font-family: var(--mono); font-size: 12.5px; line-height: 18px; min-width: 0; }
.kv__key { flex: 0 1 240px; min-width: 0; color: var(--mut); overflow-wrap: anywhere; }
.kv__val { flex: 1 1 140px; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.kv .btn { margin-left: auto; }

/* inside a raised row, things drop back to the tile tone */
.row .btn, .copyrow .btn, .kv .btn, .once .btn, .row .tag, .kv .tag,
.row input, .row select { background: var(--tile); }
.row .btn:hover, .copyrow .btn:hover, .kv .btn:hover, .once .btn:hover { background: var(--ground); }

/* ---- forms ------------------------------------------------------------------ */

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s3) var(--s3); align-items: start; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.col-span { grid-column: 1 / -1; }
.field__label { display: flex; align-items: center; gap: var(--s2); font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text); }
.field__key { margin-left: auto; font-family: var(--mono); font-size: 10.5px; font-weight: 400; color: var(--faint); }
.field__help { font-size: 12.5px; line-height: 18px; color: var(--mut); }
.field__btns { display: flex; gap: 6px; flex-wrap: wrap; }

input, select, textarea {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  height: var(--ctl-h);
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  padding: 0 var(--s3);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
select {
  cursor: pointer;
  padding-right: 34px;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
}
textarea { display: block; height: auto; min-height: 88px; padding: 10px var(--s3); resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 19px; }
input[type='file'] { height: auto; padding: 8px var(--s3); color: var(--mut); font-size: 13px; }
input[type='file']::file-selector-button { appearance: none; border: 0; border-radius: 8px; background: var(--tile); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; padding: 4px 10px; margin-right: var(--s3); cursor: pointer; }
input[type='checkbox'], input[type='radio'] { appearance: auto; -webkit-appearance: auto; width: 16px; height: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--accent); background: none; }

/* a password box with its Show button */
.secret { position: relative; }
.secret input { padding-right: 58px; }
.secret button { position: absolute; right: 5px; top: 5px; height: 30px; appearance: none; border: 0; border-radius: 8px; background: var(--tile); color: var(--mut); font: inherit; font-size: 12px; font-weight: 500; padding: 0 10px; cursor: pointer; }
.secret button:hover { color: var(--ink); }

/* a choice explained: one raised row per option */
.choices { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.choices legend { padding: 0; margin-bottom: 6px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text); }
.choice { display: flex; align-items: flex-start; gap: var(--s3); background: var(--raised); border-radius: var(--r-row); padding: 10px 14px; cursor: pointer; }
.choice:hover { background: var(--raised-hover); }
.choice input { margin-top: 3px; }
.choice__name { display: block; color: var(--ink); font-weight: 600; font-size: 14px; line-height: 20px; }
.choice__what { display: block; color: var(--mut); font-size: 12.5px; line-height: 18px; }
.choice:has(input:checked) .choice__name { color: var(--accent); }

/* ---- buttons ---------------------------------------------------------------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
a.btn, a.btn:hover { text-decoration: none; }
.btn:hover { background: var(--raised-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--accent, .row .btn--accent, .kv .btn--accent { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn--accent:hover, .row .btn--accent:hover { background: var(--accent-hover); }
/* Destructive: solid red for the one big action, red words for a row's "Remove". */
.btn--danger { background: var(--danger); color: var(--accent-ink); font-weight: 600; }
.btn--danger:hover { background: var(--danger-hover); }
.btn--remove, .btn--remove:hover { color: var(--danger); }
.btn--sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn--lg { height: 44px; padding: 0 var(--s5); font-size: 15px; font-weight: 600; }
.btn:disabled:hover { background: var(--raised); }
.btn--accent:disabled:hover { background: var(--accent); }
.btn--danger:disabled:hover { background: var(--danger); }

.actions, .panel__actions { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.actions__end { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; }
/* a box and its button on one line (add a card, send an address) */
.actions > input, .actions > select { flex: 1 1 200px; width: auto; max-width: 420px; }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* two or three choices side by side */
.segment { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border-radius: var(--r-ctl); background: var(--raised); }
.segment button { appearance: none; border: 0; background: transparent; color: var(--mut); font: inherit; font-size: 13px; line-height: 20px; font-weight: 500; padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.segment button:hover { color: var(--ink); }
.segment button[aria-pressed='true'] { background: var(--tile); color: var(--ink); }
.pagehead .segment { background: var(--tile); }
.pagehead .segment button[aria-pressed='true'] { background: var(--raised); }

/* ---- small pieces ----------------------------------------------------------- */

/* What just happened: one line that stays in view while the page scrolls. */
.statusline {
  position: sticky;
  top: var(--s2);
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--raised);
  border-radius: var(--r-row);
  padding: 10px 14px;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 20px;
  overflow-wrap: anywhere;
}
.statusline::before { content: ''; width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--ok); flex: none; transform: translateY(-1px); }
.statusline[data-tone='danger']::before { background: var(--danger); }
.statusline[data-tone='accent']::before, .statusline[data-tone='muted']::before { background: var(--accent); }

/* Something shown one time only: a password, a PIN, a key. */
.once { background: var(--accent-soft); border-radius: var(--r-tile); padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.once__title { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); }
.once__note { font-size: 13px; line-height: 19px; color: var(--text); max-width: 76ch; }
.once .copyrow { background: var(--ground); }

/* live numbers */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(98px, 1fr)); gap: 6px; }
.stat { background: var(--raised); border-radius: var(--r-row); padding: 12px; min-width: 0; }
.stat__num { display: flex; align-items: baseline; height: 28px; font-size: 22px; line-height: 28px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat__num small { font-size: 12px; font-weight: 500; color: var(--mut); margin-left: 3px; }
.stat__label { display: block; margin-top: 2px; font-size: 10.5px; line-height: 14px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--mut); }
.stat--main[data-on='1'] .stat__num { color: var(--accent); }

/* a table that scrolls inside its own box */
.tablewrap { background: var(--raised); border-radius: var(--r-row); overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 19px; }
.table th { text-align: left; padding: 10px 14px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--mut); white-space: nowrap; }
.table td { padding: 6px 14px; white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; }
.table tr:last-child td { padding-bottom: 12px; }

/* the charger's answer, as text */
.answer { margin: 0; background: var(--raised); border-radius: var(--r-row); padding: var(--s3) 14px; font-family: var(--mono); font-size: 12.5px; line-height: 19px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; }

.progress { height: 6px; border-radius: var(--r-pill); background: var(--raised); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: var(--accent); transition: width 0.3s; }

/* a centred message when there is nothing to show yet */
.hero { display: flex; justify-content: center; padding-top: var(--s6); }
.hero__card { background: var(--tile); border-radius: var(--r-tile); padding: 40px var(--s6); width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: center; gap: var(--s4); text-align: center; }
.hero__title { font-size: 20px; line-height: 28px; font-weight: 600; color: var(--ink); }
.hero__sub { color: var(--mut); max-width: 320px; }
.hero__hint { font-size: 12.5px; color: var(--mut); min-height: 18px; }
.hero__card .btn--lg { width: 100%; max-width: 300px; }
.hero__card .devices { width: 100%; }

/* ---- one charger: header and tabs ------------------------------------------- */

.back { display: inline-flex; align-items: center; gap: 6px; color: var(--mut); font-size: 13px; line-height: 18px; font-weight: 500; align-self: flex-start; border-radius: 6px; }
.back:hover { color: var(--ink); text-decoration: none; }
.chead { gap: var(--s3); }
.chead__top { display: flex; align-items: flex-start; gap: var(--s2) var(--s4); flex-wrap: wrap; }
.chead__id { font-family: var(--mono); font-size: 24px; line-height: 32px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; margin-right: auto; }
.chead__state { display: flex; align-items: center; gap: var(--s2); font-size: 15px; line-height: 22px; font-weight: 500; color: var(--ink); }
.chead__meta { color: var(--mut); font-size: 13px; line-height: 19px; overflow-wrap: anywhere; }

.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin: var(--s1) calc(var(--s2) * -1) calc(var(--s2) * -1); }
.tab { appearance: none; border: 0; background: transparent; color: var(--mut); font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; padding: 8px 14px; border-radius: var(--r-ctl); cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'] { background: var(--raised); color: var(--ink); }
.tabpanel { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* ---- log viewer (ui/logview.js) --------------------------------------------- */

.lg { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.lg-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: var(--s3) var(--s5); align-items: center; }
/* in the box at the right: the search on a line of its own, the choices under it */
.lg--compact .lg-search { flex-basis: 100%; }
.lg--compact .lg-select { flex: 1 1 0; max-width: none; }
.lg-search, .lg-select, .lg-btn { height: 34px; border-radius: 9px; font-size: 13px; padding: 0 10px; }
.lg-search { flex: 1 1 150px; font-family: var(--mono); font-size: 12px; }
.lg-select { flex: 0 1 auto; width: auto; max-width: 160px; padding-right: 30px; background-position: right 10px center; }
.lg-btn { appearance: none; border: 0; background: var(--raised); color: var(--text); font-family: inherit; cursor: pointer; white-space: nowrap; }
.lg-btn:hover { background: var(--raised-hover); color: var(--ink); }
.lg-live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; user-select: none; padding: 0 4px 0 6px; }
.lg-strip { margin: 0 var(--s5) var(--s3); padding: 8px 12px; border-radius: 9px; font-size: 12.5px; color: var(--mut); background: var(--raised); }
.lg-wrap { position: relative; flex: 1; min-height: 0; container-type: inline-size; }
/* One column as wide as the longest line (or the box, if that is wider), so
   every line and its tint end at the same place when the list scrolls sideways. */
.lg-list { position: absolute; inset: 0; overflow: auto; font-size: 13px; padding: 0 var(--s3) var(--s3); display: grid; grid-template-columns: minmax(max-content, 1fr); align-content: start; }
.lg-item { margin-bottom: 2px; }
.lg-row { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 16px; border-radius: 8px; white-space: nowrap; cursor: pointer; position: relative; }
/* the level, as a short bar at the start of the line */
.lg-row::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--info); }
.lg-row:hover, .lg-row.is-open { background: var(--raised); }
.lg-row:focus-visible { outline-offset: -2px; }
.lg-row[data-level='debug']::before { background: var(--faint); }
.lg-row[data-level='notice']::before { background: #3fc7c7; }
.lg-row[data-level='warning']::before { background: var(--warn); }
.lg-row[data-level='error']::before { background: var(--danger); }
.lg-row[data-level='warning'] { background: rgba(242, 179, 75, 0.08); }
.lg-row[data-level='error'] { background: var(--danger-soft); }
.lg-chev { color: var(--faint); width: 10px; display: inline-block; transition: transform 0.12s; }
.lg-row.is-open .lg-chev { transform: rotate(90deg); }
.lg-time { width: 82px; flex: none; font-family: var(--mono); font-size: 12px; color: var(--mut); font-variant-numeric: tabular-nums; }
.lg-level { width: 58px; flex: none; }
.lg-level b { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--info); }
.lg-level b[data-level='debug'] { color: var(--faint); }
.lg-level b[data-level='notice'] { color: #3fc7c7; }
.lg-level b[data-level='warning'] { color: var(--warn); }
.lg-level b[data-level='error'] { color: var(--danger); }
.lg-src { flex: none; border-radius: 6px; background: var(--raised); padding: 0 6px; font-size: 11px; line-height: 18px; color: var(--mut); }
.lg-row:hover .lg-src, .lg-row.is-open .lg-src { background: var(--tile); }
.lg-msg { font-family: var(--mono); font-size: 12px; color: var(--text); }
.lg-dir { color: var(--faint); }
.lg-act { color: var(--ink); font-weight: 600; }
.lg-str { color: #d0a089; } .lg-num { color: #b5cea8; } .lg-key { color: #9cc7e6; } .lg-kw { color: #6fa8dc; } .lg-pun { color: var(--faint); }
.lg mark { background: rgba(248, 153, 37, 0.35); color: inherit; border-radius: 2px; }
/* an opened line stays as wide as the box, and in view, however far the list is scrolled sideways */
.lg-detail { position: sticky; left: 0; width: calc(100cqw - 2 * var(--s3)); padding: 8px 12px 12px 16px; margin-top: 2px; border-radius: 8px; background: var(--raised); }
.lg-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--mono); font-size: 12px; color: var(--text); margin-bottom: 8px; }
.lg-facts i { font-style: normal; color: var(--faint); }
.lg-json { margin: 0; background: var(--tile); border-radius: 9px; padding: 12px; font-family: var(--mono); font-size: 12px; line-height: 18px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; }
.lg-detail .lg-btn { margin-top: 8px; height: 28px; font-size: 12px; background: var(--tile); }
.lg-detail .lg-btn:hover { background: var(--ground); }
.lg-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 56px 20px; color: var(--mut); font-size: 13px; }
.lg-empty b { font-size: 14px; }
.lg-pill { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); appearance: none; border: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font: 600 13px/20px var(--font); padding: 6px 14px; cursor: pointer; white-space: nowrap; }
.lg-pill:hover { background: var(--accent-hover); }

/* the log viewer as a page of its own (logs.html) */
.logpage { background: var(--tile); border-radius: var(--r-tile); display: flex; flex-direction: column; overflow: hidden; flex: 1 1 auto; min-height: 440px; }
.logbar { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; }
.logbar .field { flex: 0 1 200px; }
.logbar .field--grow { flex: 1 1 200px; }

/* ---- Bluetooth setup (index.html, app.js) ------------------------------------ */

.conn-pill { display: inline-flex; align-items: center; gap: var(--s2); border-radius: var(--r-pill); background: var(--tile); padding: 6px 12px; font-size: 12.5px; line-height: 18px; font-weight: 500; color: var(--ink); min-width: 0; }
.conn-pill #connLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--faint); flex: none; }
.conn-pill[data-tone='ok'] .status-dot { background: var(--ok); }
.conn-pill[data-tone='danger'] .status-dot { background: var(--danger); }
.conn-pill[data-tone='accent'] .status-dot { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.workspace { display: flex; flex-direction: column; gap: var(--gap); }
.idcard { background: var(--tile); border-radius: var(--r-tile); padding: var(--s5); display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3) var(--s4); }
.idcard__label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mut); }
.idcard__serial { font-family: var(--mono); font-size: 24px; line-height: 32px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.idcard__meta { font-size: 13px; color: var(--mut); }
.idcard__actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.panel__head { min-width: 0; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li { background: var(--raised); border-radius: var(--r-row); padding: 10px 14px; display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.checklist__tick { width: 22px; height: 22px; border-radius: var(--r-pill); background: var(--tile); color: var(--faint); display: grid; place-items: center; font-size: 12px; flex: none; }
.checklist li[data-status='ok'] .checklist__tick { background: var(--ok); color: var(--accent-ink); }
.checklist li[data-status='fail'] .checklist__tick { background: var(--danger); color: var(--accent-ink); }
.checklist li[data-status='busy'] .checklist__tick { background: var(--accent); color: var(--accent-ink); }
.checklist__text { display: flex; flex-direction: column; min-width: 0; }
.checklist__label { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.checklist__value { font-family: var(--mono); font-size: 12px; color: var(--mut); overflow-wrap: anywhere; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
.setcard { background: var(--tile); border-radius: var(--r-tile); padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.setcard__title { display: flex; align-items: center; gap: var(--s2); font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mut); }
.setcard__title::before { content: ''; width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--accent); flex: none; }
.setcard__current { font-size: 12.5px; line-height: 18px; color: var(--mut); overflow-wrap: anywhere; }
.setcard__current b { font-family: var(--mono); font-weight: 500; color: var(--text); }
.setcard__current[data-read='ok'] b { color: var(--ok); }
.setcard__current[data-read='none'] b { color: var(--warn); }

.devices { display: flex; flex-direction: column; gap: 6px; }
.device { background: var(--raised); border-radius: var(--r-row); padding: 10px 14px; display: flex; align-items: center; gap: var(--s3); cursor: pointer; text-align: left; }
.device:hover { background: var(--raised-hover); }
.device__name { font-weight: 600; color: var(--ink); }
.device__meta { font-family: var(--mono); font-size: 12px; color: var(--mut); }
.device .spacer { margin-left: auto; }

.advanced { background: var(--tile); border-radius: var(--r-tile); padding: var(--s5); }
.advanced > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s2); font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mut); border-radius: 6px; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: ''; width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--accent); flex: none; }
.advanced__body { display: flex; flex-direction: column; gap: var(--s5); margin-top: var(--s5); }
/* what is inside the folded part is already inside a tile */
.advanced .panel, .advanced .console { background: none; border-radius: 0; padding: 0; }
.column { display: flex; flex-direction: column; gap: var(--s5); }

.console { display: flex; flex-direction: column; gap: var(--s3); }
.console__head { display: flex; align-items: center; gap: var(--s2); }
.console__title { font-size: 13px; font-weight: 600; color: var(--ink); margin-right: auto; }
.console__body { background: var(--raised); border-radius: var(--r-row); padding: var(--s3) 14px; font-family: var(--mono); font-size: 12px; line-height: 1.7; height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.log-line { display: flex; gap: var(--s3); white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line__time { color: var(--faint); flex: none; }
.log-line__msg { color: var(--text); }
.log-line[data-level='ok'] .log-line__msg { color: var(--ok); }
.log-line[data-level='warn'] .log-line__msg { color: var(--warn); }
.log-line[data-level='error'] .log-line__msg { color: var(--danger); }
.log-line[data-level='send'] .log-line__msg { color: var(--info); }

/* ---- sign-in ----------------------------------------------------------------- */

.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.signin__card { width: 100%; max-width: 380px; background: var(--tile); border-radius: var(--r-tile); padding: var(--s6); display: flex; flex-direction: column; gap: var(--s4); }
.signin__logo { height: 26px; align-self: flex-start; }
.signin__title { font-size: 22px; line-height: 30px; font-weight: 600; color: var(--ink); }
.signin__sub { margin-top: calc(var(--s3) * -1); color: var(--mut); font-size: 14px; line-height: 20px; }
.signin__error { color: var(--danger); font-size: 13.5px; line-height: 20px; }

/* a page that only sends you on (charge.html, dev.html, account.html, people.html) */
.moved { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); color: var(--mut); }

/* ---- narrower screens --------------------------------------------------------- */

/* The log box becomes a panel opened by a "Logs" button. */
@media (max-width: 1240px) {
  body.shell { grid-template-columns: 208px minmax(0, 1fr); }
  .app { padding-bottom: 76px; }
  .sh-logs { position: fixed; top: 0; right: 0; bottom: 0; height: auto; width: min(560px, calc(100vw - 2 * var(--gap))); margin: var(--gap); transform: translateX(calc(100% + 2 * var(--gap))); transition: transform 0.18s; z-index: 30; visibility: hidden; }
  body.logs-open .sh-logs { transform: none; visibility: visible; }
  /* the page dims behind the open panel, so the panel needs no shadow */
  body.logs-open .sh-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, 0.6); cursor: default; }
  .sh-logbtn { display: inline-flex; align-items: center; gap: var(--s2); position: fixed; right: var(--gap); bottom: var(--gap); z-index: 20; border-radius: var(--r-pill); background: var(--raised); color: var(--ink); font: 500 14px/20px var(--font); padding: 10px 18px; cursor: pointer; }
  .sh-logbtn:hover { background: var(--raised-hover); }
  .sh-logs .sh-logclose { display: inline-flex; padding: 0 11px; }
}
/* The menu becomes a bar across the top. */
@media (max-width: 800px) {
  html, body { height: auto; }
  body.shell, body.shell.shell--nologs { display: block; height: auto; overflow: visible; }
  .app { height: auto; overflow: visible; padding: var(--s3) var(--s3) 84px; }
  .sh-nav { height: auto; position: sticky; top: 0; z-index: 25; background: var(--ground); padding: 10px var(--s3); gap: 6px; }
  .sh-brand { padding: 0 var(--s1); }
  .sh-nav .sh-menubtn { display: inline-flex; margin-left: auto; }
  .sh-nav .sh-menu, .sh-nav .sh-foot { display: none; }
  .sh-nav.is-open .sh-menu, .sh-nav.is-open .sh-foot { display: flex; }
  .sh-nav.is-open .sh-foot { margin-top: var(--s2); }
  .statusline { top: 58px; }
  .tile, .panel, .idcard, .setcard, .advanced, .once { padding: var(--s4); border-radius: 18px; }
  .pagehead h1 { font-size: 20px; }
  .chead__id, .idcard__serial { font-size: 20px; line-height: 28px; }
  .copyrow__label { flex-basis: 100%; }
  /* a charger's row as short lines: serial, state, the quiet facts */
  .crow__id { flex: 1 1 calc(100% - 24px); min-width: 0; }
  .crow__state, .crow__fw, .crow__tags { flex: 1 1 100%; padding-left: 20px; }
  .crow__state { margin-top: -4px; }
  .logbar .field { flex: 1 1 100%; }
  .logpage { height: 70vh; }
  .idcard__actions { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sh-logs, .lg-chev, .progress > i { transition: none; }
  .conn-pill[data-tone='accent'] .status-dot { animation: none; }
}
