/* Layout: a console of panels on a cool aluminium ground; status reads at a glance through pills. */
:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --line: #d6dce3;
  --fg: #18202a;
  --muted: #5d6b7a;
  --accent: #0f6e74;
  --accent-fg: #ffffff;
  --ok: #2e7d32;
  --warn: #9a5b00;
  --bad: #b3261e;
  --ok-bg: #e3f2e5;
  --warn-bg: #fbefd9;
  --bad-bg: #fbe4e2;
  --code-bg: #f4f6f8;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171d; --panel: #1a2129; --line: #2c3540; --fg: #e4e9ee; --muted: #93a1b0;
    --accent: #4cc3c9; --accent-fg: #0b1d1e; --ok: #7ccf82; --warn: #f0b45a; --bad: #ff8a80;
    --ok-bg: #1d3322; --warn-bg: #3a2c14; --bad-bg: #3d1f1d; --code-bg: #141a20;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12171d; --panel: #1a2129; --line: #2c3540; --fg: #e4e9ee; --muted: #93a1b0;
  --accent: #4cc3c9; --accent-fg: #0b1d1e; --ok: #7ccf82; --warn: #f0b45a; --bad: #ff8a80;
  --ok-bg: #1d3322; --warn-bg: #3a2c14; --bad-bg: #3d1f1d; --code-bg: #141a20;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 1.15rem; font-weight: 650; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
.meta, .hint { color: var(--muted); font-size: 0.85rem; margin: 0; }

.bar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.bar-inner, .page {
  max-width: 1200px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* Two stacked discs: the family of players. */
.mark { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--accent); box-shadow: 8px 0 0 -3px var(--panel), 8px 0 0 0 var(--accent); flex: none; }
.bar-actions { display: flex; gap: 8px; }

.page { padding-block: 20px 40px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.wide { grid-column: 1 / -1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 460px; margin: 40px auto; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.stack { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
label { font-size: 0.82rem; color: var(--muted); }
input[type="text"], input:not([type]) {
  font: inherit; font-family: var(--mono); font-size: 0.9rem; color: var(--fg); background: var(--code-bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%;
}
textarea {
  font: inherit; font-family: var(--mono); font-size: 0.85rem; color: var(--fg); background: var(--code-bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; resize: vertical;
}
input:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--fg); }

button {
  font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; border-radius: 6px; padding: 7px 12px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg);
}
button.ghost { background: transparent; color: var(--accent); }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
button.small { padding: 3px 8px; font-size: 0.8rem; }
button:disabled { opacity: 0.5; cursor: default; }

.chip { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--code-bg); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.summary { margin: 0; font-variant-numeric: tabular-nums; }
.warn { margin: 0; color: var(--warn); font-size: 0.88rem; }
.error { margin: 0; color: var(--bad); font-size: 0.88rem; }

table.members { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.members th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.members td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.members tr:last-child td { border-bottom: none; }
.members .name { font-weight: 600; }
.members .sub { color: var(--muted); font-size: 0.8rem; }
.members td:last-child { text-align: right; white-space: nowrap; }
.members .report { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.members .detail td { background: var(--code-bg); padding: 10px; text-align: left; white-space: normal; }
.meetings { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; }
.meetings .when { font-family: var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.battery { margin: 8px 0 4px; max-width: 640px; }
.battery-chart { width: 100%; height: auto; display: block; }
.bc-grid { stroke: var(--line); stroke-width: 1; }
.bc-label { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.bc-line { fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-linejoin: round; }
.bc-charging { fill: var(--ok-bg); }
.bc-playing { fill: var(--accent); }
.bc-syncing { fill: var(--warn); }
.bc-screen { fill: var(--muted); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.legend .key::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.legend .charging::before { background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok); }
.legend .playing::before { background: var(--accent); }
.legend .syncing::before { background: var(--warn); }
.legend .screen::before { background: var(--muted); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 600; font-size: 0.8rem; cursor: pointer; }

.devices { display: flex; flex-direction: column; gap: 10px; }
.device { border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.device > .pill { align-self: flex-start; }
.device-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.device form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.device form .full { grid-column: 1 / -1; }
.empty { color: var(--muted); font-size: 0.9rem; margin: 0; }

.activity { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.jobs { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; }
.job { border: 1px solid var(--line); border-radius: 6px; }
.job summary { cursor: pointer; padding: 6px 8px; display: flex; gap: 8px; align-items: center; font-size: 0.88rem; }
.job pre, .log { margin: 0; font-family: var(--mono); font-size: 0.78rem; line-height: 1.45; background: var(--code-bg); padding: 8px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.job pre { max-height: 220px; border-top: 1px solid var(--line); }
.log { max-height: 360px; border-radius: 6px; border: 1px solid var(--line); }

.toast { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 6px; font-size: 0.88rem; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .grid, .activity { grid-template-columns: minmax(0, 1fr); }
  .device form { grid-template-columns: 1fr; }
  .hide-narrow { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
