/* ----------------------------------------------------------------
   /me dashboard — shared stylesheet.
   Mirrors public-site tokens from static/site.css (mirror-redesign
   overrides applied). No new colors, fonts, or radii.
---------------------------------------------------------------- */

:root {
  --nav-h: 34px;
  --font-mono: 'Ubuntu Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --yellow:  #ffff00;
  --red:     #ff3240;
  --orange:  #fe8c2c;
  --green:   #0dbe4e;
  --blue:    #008df4;
  --purple:  #c635e4;

  /* dark theme */
  --bg:           #131316;
  --surface:      #1b1b1f;
  --surface-2:    #242429;
  --border:       #34343a;
  --accent:       #e8e8ea;
  --accent-dim:   #242429;
  --text:         #e8e8ea;
  --muted:        #8e8e95;
  --muted2:       #c9c9cf;
  --success:      #5cdd7a;
  --success-dim:  rgba(92, 221, 122, 0.12);
  --success-border: rgba(92, 221, 122, 0.35);

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-press: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root.light {
  --bg: #f4f4ef;
  --surface: #e8e8df;
  --surface-2: #d9d9cf;
  --border: #b7b7aa;
  --accent: #111114;
  --accent-dim: #e2e2d8;
  --text: #111114;
  --muted: #717166;
  --muted2: #3d3d38;
  --success: #137333;
  --success-dim: rgba(19, 115, 51, 0.1);
  --success-border: rgba(19, 115, 51, 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; letter-spacing: 0 !important; }
[hidden] { display: none !important; }
html, body { min-height: 100%; background: var(--bg); color: var(--text); font: 16px/24px var(--font-mono); overflow-x: hidden; }
body { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::selection { background: var(--yellow); color: #000; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }
button { background: none; border: none; color: inherit; font: inherit; cursor: pointer; }

/* ── Top nav (private flavor: brackets kept, active tab gets a 1px yellow underline) ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--bg);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2px clamp(20px, 3vw, 40px) 0;
}
.nav-tabs { display: flex; gap: 8px; }
.nav-tab {
  position: relative;
  padding: 0 3px;
  color: var(--muted);
  font: 400 16px/24px var(--font-mono);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.nav-tab::before { content: "[ "; }
.nav-tab::after  { content: " ]"; }
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--text); }
/* brackets + color change is the active state. no underline. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.18s var(--ease-out-expo), transform 0.18s var(--ease-press);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle:focus-visible {
  outline: 1px solid var(--yellow);
  outline-offset: 2px;
}
.theme-toggle__glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle__glyph svg {
  width: 14px;
  height: 14px;
}
.theme-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.nav > .theme-picker {
  position: absolute;
  top: 2px;
  right: clamp(20px, 3vw, 40px);
}
.theme-picker__options {
  position: absolute;
  top: 50%;
  right: calc(100% + 6px);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  transform: translateY(-50%);
}
.theme-picker__option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s var(--ease-out-expo), transform 0.18s var(--ease-press);
}
.theme-picker__option:hover,
.theme-picker__option.active {
  color: var(--text);
}
.theme-picker__option:active { transform: scale(0.94); }
.theme-picker__option:focus-visible {
  outline: 1px solid var(--yellow);
  outline-offset: 2px;
}
.theme-picker__option svg {
  width: 14px;
  height: 14px;
}

.dash-footer {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(20px, 3vw, 40px) 40px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.dash-footer__load {
  padding: 0 3px;
  color: var(--muted);
  font: 400 16px/24px var(--font-mono);
  text-transform: uppercase;
}
.dash-footer__load::before { content: "[ "; }
.dash-footer__load::after { content: " ]"; }
.dash-footer form {
  flex: 0 0 auto;
}
.dash-footer button {
  padding: 0 3px;
  color: var(--muted);
  font: 400 16px/24px var(--font-mono);
  text-transform: uppercase;
}
.dash-footer button::before { content: "[ "; }
.dash-footer button::after { content: " ]"; }
.dash-footer button:hover { color: var(--text); }

/* ── Page shell ── */
.page {
  width: 100%;
  max-width: 1440px;
  min-height: calc(100dvh + 1px);
  margin-inline: auto;
  padding: calc(var(--nav-h) + 24px) clamp(20px, 3vw, 40px) 80px;
}
.page--device-detail {
  padding-top: calc(var(--nav-h) + 10px);
}
/* ── Small-caps section label (the "no card chrome" pattern) ── */
.label {
  display: block;
  color: var(--muted);
  font: 700 10px/16px var(--font-mono);
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.label-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 8px;
}
.label-row .label { margin-bottom: 0; }
.label-row .label-meta {
  color: var(--muted);
  font: 400 10px/16px var(--font-mono);
  text-transform: uppercase;
}

.machine-list {
  display: grid;
  gap: 6px;
  width: 100%;
}
.machine-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
  align-items: baseline;
  gap: 24px;
  color: var(--text);
  text-decoration: none;
}
.machine-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.machine-main .dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin: 1px 0 0;
}
.machine-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font: 700 16px/22px var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.machine-ip {
  color: var(--muted);
  font: 400 16px/22px var(--font-mono);
  font-variant-numeric: tabular-nums;
  justify-self: start;
  white-space: nowrap;
}
.machine-row:hover .machine-name { text-decoration: underline; text-underline-offset: 3px; }
.machine-row:hover .machine-ip { color: var(--text); }
.machine-empty {
  color: var(--muted);
  font: 400 16px/24px var(--font-mono);
}

.terminal-add-user {
  margin-top: 56px;
  max-width: 640px;
}
.terminal-add-user summary {
  display: inline-block;
  color: var(--text);
  cursor: pointer;
  font: 400 16px/24px var(--font-mono);
  list-style: none;
  text-decoration: none;
}
.terminal-add-user summary::-webkit-details-marker { display: none; }
.terminal-add-user summary:hover,
.terminal-add-user summary:focus-visible {
  color: var(--text);
  outline: none;
}
.terminal-add-user form {
  margin-top: 18px;
}
.terminal-line {
  min-height: 24px;
  white-space: nowrap;
}
.terminal-line button,
.terminal-field input {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  margin: 0;
  padding: 0;
}
.terminal-line button {
  cursor: pointer;
  text-align: left;
}
.terminal-line button:hover,
.terminal-line button:focus-visible,
.terminal-field input:focus {
  color: var(--text);
  outline: none;
}
.terminal-field {
  cursor: text;
  display: inline-flex;
  min-height: 1em;
  position: relative;
  vertical-align: baseline;
}
.terminal-field input {
  caret-color: transparent;
  height: 1.5em;
  left: 0;
  opacity: 0;
  position: absolute;
  top: -0.2em;
  width: 32ch;
  z-index: 1;
}
.terminal-value {
  display: inline-block;
  min-width: 0;
  white-space: pre;
}
@keyframes terminal-cursor-blink {
  0%,
  49% { opacity: 1; }
  50%,
  100% { opacity: 0; }
}
.terminal-field::after {
  animation: terminal-cursor-blink 1s steps(1, end) infinite;
  background: var(--text);
  content: "";
  display: none;
  height: 1em;
  transform: translateY(0.14em);
  width: 0.72em;
}
.terminal-field:focus-within::after {
  display: inline-block;
}

.user-list {
  display: grid;
  gap: 6px;
  width: 100%;
}
.user-item {
  display: grid;
  gap: 8px;
}
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 220px);
  gap: 24px;
  cursor: pointer;
  list-style: none;
  text-decoration: none;
}
.user-row::-webkit-details-marker { display: none; }
.user-email,
.user-name {
  font: 400 16px/22px var(--font-mono);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-name {
  color: var(--text);
}
.user-email {
  color: var(--muted);
  justify-self: end;
  text-align: right;
}
.user-name {
  justify-self: start;
  text-align: left;
}
.user-row:hover .user-email {
  color: var(--text);
}
.user-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 18px;
  padding: 0 0 8px;
}
.user-action-status {
  color: var(--muted);
  font: 400 16px/24px var(--font-mono);
  text-decoration: none;
  min-width: 0;
}
.user-passkey-state {
  align-items: baseline;
  display: inline-flex;
  gap: 18px;
  min-width: 0;
}
.user-enroll {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font: 400 16px/24px var(--font-mono);
}
.user-method {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 18px;
  justify-content: center;
  text-decoration: none;
  width: 18px;
}
.user-method svg {
  display: block;
  height: 14px;
  width: 14px;
}
.user-method:hover,
.user-method:focus-visible {
  color: var(--text);
  outline: none;
}
.user-bracket,
.user-separator,
.user-enroll-label {
  color: var(--muted);
}
.user-delete-form {
  display: inline;
  justify-self: end;
}
.user-passkey-delete-form {
  display: inline;
}
.user-delete {
  color: var(--muted);
  cursor: pointer;
  font: 400 16px/24px var(--font-mono);
  text-decoration: none;
}
.user-passkey-delete {
  color: var(--muted);
  cursor: pointer;
  font: 400 16px/24px var(--font-mono);
  text-decoration: none;
}
.user-delete::before { content: "[ "; }
.user-delete::after { content: " ]"; }
.user-delete:hover,
.user-delete:focus-visible,
.user-passkey-delete:hover,
.user-passkey-delete:focus-visible {
  color: var(--red);
  outline: none;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 22px; padding: 0 8px;
  border: 1px solid var(--text);
  border-radius: 4px;
  font: 700 10px/20px var(--font-mono);
  text-transform: uppercase;
  text-decoration: none;
  background: transparent; color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary { color: #000; background: var(--text); }
.btn-primary:hover { background: var(--yellow); border-color: var(--yellow); color: #000; }
.btn-ghost:hover { color: var(--text); border-color: var(--text); background: transparent; }
.btn-muted { border-color: var(--border); color: var(--muted2); }
.btn-muted:hover { color: var(--text); border-color: var(--text); }
.btn:focus-visible { outline: 1px solid var(--yellow); outline-offset: 2px; }

/* ── Status dots ── */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: 1px;
  margin-right: 8px;
}
.dot--ok      { background: var(--green); }
.dot--idle    { background: var(--orange); }
.dot--offline { background: var(--muted); }
.dot--err     { background: var(--red); }

.status {
  display: inline-flex; align-items: center;
  color: var(--muted2);
  font: 400 15px/19px var(--font-mono);
}
.status--ok { color: var(--success); }
.status--idle { color: var(--orange); }
.status--offline { color: var(--muted); }
.status--err { color: var(--red); }

/* ── Tabular numerals everywhere a number appears ── */
.num, .table td, .table th, .stat-value, .stat-trend, .ip {
  font-variant-numeric: tabular-nums;
}

/* ── Plain underlined input (the "not boxed" filter style) ── */
.input-underline {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 4px 0;
  color: var(--text);
  font: 400 16px/24px var(--font-mono);
  outline: none;
  min-width: 0;
}
.input-underline::placeholder { color: var(--muted); }
.input-underline:focus { border-bottom-color: var(--yellow); }

/* tag chip — plain text with a slim border */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted2);
  font: 400 13px/20px var(--font-mono);
  cursor: pointer;
  background: transparent;
}
.chip:hover { color: var(--text); border-color: var(--text); }
.chip.active { color: #000; background: var(--yellow); border-color: var(--yellow); }

/* ── Dense table (devices / settings) ── */
.table {
  width: 100%;
  border-collapse: collapse;
  font: 400 15px/19px var(--font-mono);
}
.table th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px; line-height: 16px;
  letter-spacing: 0;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--border);
  user-select: none;
  cursor: pointer;
  white-space: nowrap;
}
.table th .sort {
  display: inline-block;
  margin-left: 4px;
  color: var(--border);
}
.table th.sort-asc .sort,
.table th.sort-desc .sort { color: var(--text); }
.table td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--muted2);
  vertical-align: top;
  white-space: nowrap;
}
.table tr:last-child td { border-bottom: 0; }
.table tr.row-clickable { cursor: pointer; }
.table tr.row-clickable:hover td { color: var(--text); background: color-mix(in srgb, var(--text) 3%, transparent); }
.table tr.row-clickable.active td { color: var(--text); background: color-mix(in srgb, var(--yellow) 4%, transparent); }
.table tr.row-clickable.active td:first-child { box-shadow: inset 2px 0 0 var(--yellow); }

/* dim dim columns */
.table td.muted, .table .muted { color: var(--muted); }
.table .ip { color: var(--muted2); }
.table .name { color: var(--text); font-weight: 700; }
.table .tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.table .tag {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted2);
  font: 400 12px/18px var(--font-mono);
}

/* ── Three-column dashboard grid ── */
.dash {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 48px;
  align-items: start;
}
@media (max-width: 1080px) {
  .dash { grid-template-columns: 1fr; gap: 32px; }
}
.dash > section { min-width: 0; }
.dash-block { margin-bottom: 32px; }

/* mini calendar */
.cal-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text);
  font: 700 15px/19px var(--font-mono);
}
.cal-head .cal-meta { color: var(--muted); font: 400 10px/16px var(--font-mono); text-transform: uppercase; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px; column-gap: 0;
  font: 400 13px/20px var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.cal-grid .cal-dow {
  color: var(--muted);
  font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
  padding: 4px 0;
  text-align: center;
}
.cal-day {
  text-align: center;
  padding: 4px 0;
  color: var(--muted2);
  border-radius: 4px;
}
.cal-day.cal-out { color: var(--border); }
.cal-day.cal-today { color: #000; background: var(--yellow); font-weight: 700; }
.cal-day.cal-has  { color: var(--text); position: relative; }
.cal-day.cal-has::after {
  content: ""; position: absolute; left: 50%; bottom: 1px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--green); transform: translateX(-50%);
}

/* link list */
.link-list { display: grid; gap: 6px; }
.link-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  text-decoration: none;
  color: var(--muted2);
  font: 400 15px/19px var(--font-mono);
}
.link-list a:hover { color: var(--text); }
.link-list a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.link-list a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-list a time, .link-list a small {
  color: var(--muted);
  white-space: nowrap;
}

/* feed */
.feed { display: grid; gap: 14px; }
.feed-item {
  display: grid;
  grid-template-columns: 52px 60px minmax(0, 1fr);
  gap: 16px;
  font: 400 15px/19px var(--font-mono);
  align-items: baseline;
}
.feed-item .feed-ts { color: var(--muted); font-variant-numeric: tabular-nums; }
.feed-item .feed-src {
  color: var(--muted);
  text-transform: uppercase;
  font: 700 10px/19px var(--font-mono);
}
.feed-item .feed-body { color: var(--muted2); min-width: 0; }
.feed-item .feed-body b { color: var(--text); font-weight: 700; }
.feed-item .feed-body a { color: var(--text); }
.feed-tabs { display: flex; gap: 16px; margin-bottom: 12px; }
.feed-tab {
  color: var(--muted);
  font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
  background: none; border: 0; padding: 0 0 4px;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
.feed-tab:hover { color: var(--text); }
.feed-tab.active { color: var(--text); border-bottom-color: var(--yellow); }

/* stat strip / list */
.stat-list { display: grid; gap: 10px; font: 400 15px/19px var(--font-mono); font-variant-numeric: tabular-nums; }
.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  gap: 12px;
  align-items: baseline;
}
.stat-row .stat-label { color: var(--muted2); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.stat-row .stat-value { color: var(--text); font-weight: 700; }
.stat-row .stat-trend { color: var(--muted); }
.stat-row .stat-trend.up { color: var(--success); }
.stat-row .stat-trend.down { color: var(--red); }

/* sparkline-as-bars (simple, monochrome) */
.bars {
  display: inline-flex; align-items: flex-end; gap: 2px; height: 16px;
}
.bars > i {
  display: inline-block; width: 3px;
  background: var(--muted);
  vertical-align: bottom;
}

/* weather strip */
.wx {
  display: grid; gap: 8px;
  font: 400 15px/19px var(--font-mono); font-variant-numeric: tabular-nums;
}
.wx-head {
  display: flex; align-items: baseline; justify-content: space-between;
  color: var(--text);
}
.wx-head b { font-weight: 700; }
.wx-head .wx-feel { color: var(--muted); font-size: 13px; }
.wx-hours {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  height: 56px;
  gap: 2px;
}
.wx-hours > i {
  display: block; background: var(--muted);
  border-radius: 1px;
}
.wx-hours > i.peak { background: var(--yellow); }
.wx-axis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  font: 400 10px/16px var(--font-mono); color: var(--muted);
  text-transform: uppercase;
}

/* drawer */
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s var(--ease-out-expo);
  z-index: 90;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(400px, 92vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.22s var(--ease-out-expo);
  z-index: 95;
  display: flex; flex-direction: column;
  padding: 24px 28px 32px;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 24px;
}
.drawer-title {
  color: var(--text);
  font: 700 16px/24px var(--font-mono);
  text-transform: uppercase;
}
.drawer-title::before { content: "# "; }
.drawer-close {
  color: var(--muted);
  font: 400 16px/24px var(--font-mono);
  cursor: pointer;
}
.drawer-close:hover { color: var(--text); }

.kv { display: grid; gap: 4px; margin-bottom: 16px; }
.kv .label { margin-bottom: 0; }
.kv .v { color: var(--muted2); font: 400 15px/19px var(--font-mono); }
.kv .v.mono { color: var(--text); font-variant-numeric: tabular-nums; }

hr.rule { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

/* form */
.form-row { display: grid; gap: 6px; margin-bottom: 20px; }
.form-row label { color: var(--muted); font: 700 10px/16px var(--font-mono); text-transform: uppercase; }
.form-row textarea, .form-row input[type=text] {
  background: transparent;
  border: 0; border-bottom: 1px solid var(--border);
  color: var(--text);
  font: 400 16px/24px var(--font-mono);
  padding: 6px 0; outline: none;
  resize: vertical;
}
.form-row textarea { min-height: 96px; border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; }
.form-row textarea:focus, .form-row input[type=text]:focus { border-color: var(--yellow); }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* secret reveal block */
.secret-block {
  border: 1px solid var(--success-border);
  background: var(--success-dim);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
}
.secret-block .label { color: var(--success); margin-bottom: 8px; }
.secret-block .v { color: var(--text); font-variant-numeric: tabular-nums; word-break: break-all; }
.secret-block .copy-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* login centered */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(360px, 100%);
  display: grid; gap: 24px;
}
.login-mark {
  color: var(--text);
  font: 700 16px/24px var(--font-mono);
  text-transform: uppercase;
  text-align: center;
}
.login-mark::before { content: "# "; }
.login-sub {
  color: var(--muted);
  font: 400 10px/16px var(--font-mono);
  text-transform: uppercase;
  text-align: center;
}
.login-providers { display: grid; gap: 8px; }
.login-providers .btn { width: 100%; min-height: 36px; padding: 0 12px; }
.login-providers .btn span.k { color: var(--muted); margin-right: auto; }
.login-providers .btn span.v { color: inherit; }

/* network */
.net-stage {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--nav-h) - 120px);
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background:
    linear-gradient(transparent 0 calc(100% - 1px), color-mix(in srgb, var(--border) 50%, transparent) calc(100% - 1px)) 0 0 / 32px 32px,
    linear-gradient(90deg, transparent 0 calc(100% - 1px), color-mix(in srgb, var(--border) 50%, transparent) calc(100% - 1px)) 0 0 / 32px 32px,
    var(--bg);
}
.net-controls {
  position: absolute; top: 16px; left: 16px;
  display: flex; gap: 16px; align-items: baseline;
}
.net-toggle {
  display: inline-flex; gap: 8px;
  color: var(--muted); font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
}
.net-toggle button {
  position: relative;
  padding: 0 3px;
  color: var(--muted);
}
.net-toggle button.active {
  color: var(--text);
}
.net-toggle button.active::after {
  content: ""; position: absolute; left: 3px; right: 3px; bottom: -2px;
  height: 1px; background: var(--yellow);
}
.minimap {
  position: absolute; right: 16px; bottom: 16px;
  width: 160px; height: 110px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: color-mix(in srgb, var(--bg) 90%, var(--surface) 10%);
}
.net-legend {
  position: absolute; left: 16px; bottom: 16px;
  display: grid; gap: 4px;
  color: var(--muted);
  font: 400 10px/16px var(--font-mono);
  text-transform: uppercase;
}

/* alert / message */
.note {
  padding: 12px 16px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--muted);
  font: 400 13px/20px var(--font-mono);
}

/* dashboard index */
.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.index-tile {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--muted2);
}
.index-tile:hover { border-color: var(--text); color: var(--text); }
.index-tile h3 { font: 700 16px/24px var(--font-mono); text-transform: uppercase; color: var(--text); }
.index-tile h3::before { content: "# "; }
.index-tile p { font: 400 13px/20px var(--font-mono); color: var(--muted); margin-top: 4px; }

/* ─────────────────────────────────────────────────────────────────
   Device detail (device-detail.html)
   All values reuse existing tokens — no new colors / fonts / radii.
───────────────────────────────────────────────────────────────── */

/* Header strip — name + meta on the left, action links on the right */
.dd-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 24px 32px;
  align-items: end;
  padding-bottom: 20px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 720px) { .dd-header { grid-template-columns: 1fr; } }
.dd-name {
  color: var(--text);
  font: 700 24px/28px var(--font-mono);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.dd-name::before { content: "# "; }
.dd-meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
  color: var(--muted2);
  font: 400 15px/19px var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.dd-meta .tag {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted2);
  font: 400 13px/20px var(--font-mono);
}
.dd-actions {
  display: flex; flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}
.dd-actions a,
.dd-actions button {
  color: var(--text);
  font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
  text-decoration: none;
  background: none; border: 0; cursor: pointer; padding: 0;
}
.dd-actions a:hover,
.dd-actions button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dd-actions .sep { color: var(--border); }
.dd-actions .danger:hover { color: var(--red); }

/* Section tabs — text + active underline. Reusable for any sub-section. */
.section-head {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  gap: 32px;
  align-items: end;
  margin-bottom: 20px;
}
@media (max-width: 720px) { .section-head { grid-template-columns: 1fr; gap: 12px; } }
.section-tabs { display: flex; flex-wrap: wrap; gap: 20px; align-items: baseline; }
.section-tab {
  background: none; border: 0; padding: 0 0 4px; cursor: pointer;
  color: var(--muted);
  font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
}
.section-tab:hover { color: var(--text); }
.section-tab.active { color: var(--text); border-bottom-color: var(--yellow); }
.section-head .right {
  color: var(--muted);
  font: 400 13px/20px var(--font-mono);
  font-variant-numeric: tabular-nums;
  justify-self: end;
}

/* Metric tile grid (sparklines) */
.dd-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px 48px;
  margin-bottom: 40px;
}
@media (max-width: 960px) { .dd-metrics { grid-template-columns: repeat(2, 1fr); gap: 28px 32px; } }
@media (max-width: 520px) { .dd-metrics { grid-template-columns: 1fr; } }
.dd-tile { display: grid; gap: 8px; min-width: 0; }
.dd-tile.span-2 { grid-column: span 2; }
@media (max-width: 520px) { .dd-tile.span-2 { grid-column: span 1; } }
.dd-tile-label {
  color: var(--muted);
  font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
}
.dd-tile-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: end;
  gap: 12px;
}
.dd-tile-value {
  color: var(--text);
  font: 700 22px/26px var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dd-tile-sub {
  color: var(--muted);
  font: 400 13px/20px var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.dd-spark { width: 100%; height: 28px; display: block; overflow: visible; }
.dd-spark polyline { fill: none; stroke: var(--text); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* CPU cores — 8 mini bars */
.dd-cores {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px 14px;
}
@media (max-width: 960px) { .dd-cores { grid-template-columns: repeat(4, 1fr); } }
.dd-core {
  display: grid; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.dd-core-head {
  display: flex; justify-content: space-between;
  color: var(--muted);
  font: 400 10px/16px var(--font-mono);
  text-transform: uppercase;
}
.dd-core-head b { color: var(--text); font-weight: 700; }
.dd-core-bar { height: 6px; background: var(--border); border-radius: 1px; overflow: hidden; }
.dd-core-bar > i { display: block; height: 100%; background: var(--text); }

/* Disk usage bar rows */
.dd-mounts { display: grid; gap: 12px; }
.dd-mount {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(140px, max-content) minmax(120px, 1fr) max-content;
  gap: 16px;
  align-items: center;
  font: 400 13px/20px var(--font-mono);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .dd-mount { grid-template-columns: 1fr max-content; grid-template-areas: "mp pct" "bar bar" "size fs"; gap: 4px 16px; }
  .dd-mount .mp { grid-area: mp; }
  .dd-mount .pct { grid-area: pct; }
  .dd-mount-bar { grid-area: bar; }
  .dd-mount .size { grid-area: size; }
  .dd-mount .fs { grid-area: fs; }
}
.dd-mount .mp { color: var(--text); font-weight: 700; }
.dd-mount .size { color: var(--muted2); }
.dd-mount .fs { color: var(--muted); text-transform: uppercase; font-size: 10px; }
.dd-mount .pct { color: var(--muted2); text-align: right; white-space: nowrap; }
.dd-mount-bar { height: 6px; background: var(--border); border-radius: 1px; overflow: hidden; min-width: 80px; }
.dd-mount-bar > i { display: block; height: 100%; background: var(--text); }
.dd-mount-bar > i.warn { background: var(--orange); }
.dd-mount-bar > i.full { background: var(--red); }

/* System info strip */
.dd-sysinfo {
  display: flex; flex-wrap: wrap; gap: 12px 32px;
  font: 400 13px/20px var(--font-mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 8px 0 48px;
}
.dd-sysinfo b { color: var(--text); font-weight: 700; }

/* Logs */
.dd-logs-filter {
  display: grid;
  grid-template-columns: max-content minmax(160px, 280px);
  gap: 12px;
  align-items: baseline;
}
.dd-logs-filter .label { margin-bottom: 0; }
.dd-logs-view {
  height: 640px;
  overflow: auto;
  font: 400 13px/22px var(--font-mono);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  /* fade older lines (top) */
  mask-image: linear-gradient(to bottom, transparent 0, black 88px, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 88px, black 100%);
  padding-top: 88px;
}
.dd-log-line {
  display: grid;
  grid-template-columns: 80px 64px 140px minmax(0, 1fr);
  gap: 14px;
  padding: 1px 0;
  color: var(--muted2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dd-log-line .ts { color: var(--muted); }
.dd-log-line .lvl {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); text-transform: uppercase; font-weight: 700; font-size: 10px;
}
.dd-log-line .unit { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.dd-log-line .msg { color: var(--muted2); overflow: hidden; text-overflow: ellipsis; }
.dd-log-line.lvl-err  .lvl { color: var(--red); }
.dd-log-line.lvl-err  .msg { color: var(--text); }
.dd-log-line.lvl-warn .lvl { color: var(--orange); }
.dd-log-line.lvl-warn .msg { color: var(--muted2); }
.dd-log-line.lvl-info .lvl { color: var(--muted); }
.dd-log-line.lvl-debug .lvl { color: var(--muted); opacity: 0.6; }

/* Footer strip */
.dd-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px; flex-wrap: wrap;
  font: 400 13px/20px var(--font-mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.dd-footer a { color: var(--text); text-decoration: none; }
.dd-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─────────────────────────────────────────────────────────────────
   Shell (shell.html) — top bar + xterm stage
───────────────────────────────────────────────────────────────── */
.shell-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 24px;
  align-items: center;
  height: var(--nav-h);
  padding: 4px clamp(20px, 3vw, 40px) 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.shell-bar .left, .shell-bar .right {
  display: flex; align-items: center; gap: 16px;
  font: 400 16px/24px var(--font-mono);
  min-width: 0;
}
.shell-bar .right { gap: 24px; }
.shell-bar .name {
  color: var(--text);
  font: 700 16px/24px var(--font-mono);
  text-transform: uppercase;
}
.shell-bar .name::before { content: "# "; }
.shell-bar .conn {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
  color: var(--muted);
}
.shell-bar .conn.connected    { color: var(--success); }
.shell-bar .conn.reconnecting { color: var(--orange); }
.shell-bar .conn.disconnected { color: var(--red); }
.shell-bar .ip { color: var(--muted); font: 400 13px/20px var(--font-mono); }
.shell-bar .close {
  color: var(--text);
  font: 700 10px/16px var(--font-mono);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  background: none; border: 0; padding: 0;
}
.shell-bar .close:hover { color: var(--yellow); }

.shell-stage {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--surface);
}
.shell-stage .terminal { padding: 16px 24px; height: 100%; }
.shell-stage .xterm-viewport,
.shell-stage .xterm-screen { background: var(--surface) !important; }
