.transcoder-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 240px);
  align-items: center;
  gap: 12px 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.transcoder-label { overflow-wrap: anywhere; }
.transcoder-label small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.transcoder-field input:not([type="checkbox"]), .transcoder-field select {
  width: 100%; min-width: 0; min-height: 40px; padding: 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit;
}
.transcoder-field input[type="checkbox"] { justify-self: end; width: 20px; height: 20px; accent-color: var(--primary); }
.transcoder-field :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.transcoder-field :disabled { opacity: 0.5; }
.transcoder-feedback:empty { display: none; }
.transcoder-label .transcoder-restart-label { color: var(--warning); }
.settings-restart-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-left: 3px solid var(--warning);
  background: rgb(243 189 79 / 0.08);
  overflow-wrap: anywhere;
}
.settings-restart-banner strong { display: block; color: var(--warning); font-size: 14px; }
.settings-restart-copy > span { display: block; margin-top: 4px; color: var(--text); font-size: 13px; }
.restart-now { display: flex; align-items: center; justify-content: center; gap: 6px; width: 124px; min-height: 40px; padding: 8px; border: 1px solid var(--warning); border-radius: 5px; background: transparent; color: var(--warning); font: inherit; font-size: 12px; cursor: pointer; }
.restart-now .ui-icon { width: 16px; height: 16px; }
.restart-now:disabled { opacity: 0.6; cursor: wait; }
.restart-now:focus-visible { outline: 2px solid var(--warning); outline-offset: 3px; }
@media (max-width: 599px) {
  .transcoder-field { grid-template-columns: minmax(0, 1fr) auto; }
  .transcoder-field input:not([type="checkbox"]), .transcoder-field select { grid-column: 1 / -1; }
}
:root {
  color-scheme: dark;
  --background: #100c0e;
  --surface: #231a1e;
  --surface-raised: #302127;
  --border: #3e2b33;
  --text: #f5f0f2;
  --muted: #a9959e;
  --primary: #ee8b9d;
  --primary-soft: #342229;
  --cpu: #ee8b9d;
  --ram: #4bc7b1;
  --download: #79b8ed;
  --upload: #e6bd72;
  --warning: #f3bd4f;
  --danger: #f26666;
  --success: #43d3a2;
  --on-primary: #241318;
  --chrome: rgb(16 12 14 / 0.94);
  --hairline: rgb(255 255 255 / 0.07);
  --hairline-strong: rgb(255 255 255 / 0.2);
  --track: rgb(255 255 255 / 0.08);
  --wash: rgb(255 255 255 / 0.025);
  --card-border: rgb(169 149 158 / 0.07);
  --crosshair: #b8b8b8;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --font: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
  font-family: var(--font);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  --tab-bottom-padding: max(7px, env(safe-area-inset-bottom));
  --tab-bar-height: calc(60px + var(--tab-bottom-padding));
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  margin: 0;
  color: var(--text);
  background-color: var(--background);
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--primary) 2%, transparent), transparent 360px);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  height: var(--tab-bar-height);
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px
    max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--hairline);
  background: var(--chrome);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.view-banner {
  min-height: 54px;
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: 10px;
}

.live-indicator {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
}

.brand,
.header-actions,
.metric-header,
.section-heading {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 10px;
}

.brand-icon {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 7px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: var(--on-primary);
  background: var(--primary);
  font-size: 21px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  line-height: 1.15;
}

.brand p {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-live {
  color: var(--success);
}

.status-degraded,
.status-waiting {
  color: var(--warning);
}

.status-offline {
  color: var(--danger);
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-button:active {
  background: var(--surface-raised);
}

.icon-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-button[disabled] {
  cursor: wait;
  opacity: 0.55;
}

.page-shell {
  width: min(100%, 1180px);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right)) 24px
    max(16px, env(safe-area-inset-left));
}

.bottom-tabs {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--tab-bar-height);
  padding: 7px max(12px, env(safe-area-inset-right)) var(--tab-bottom-padding)
    max(12px, env(safe-area-inset-left));
  border-top: 1px solid var(--track);
  background: var(--chrome);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}

.standalone body {
  --tab-bottom-padding: 12px;
}

@media (max-width: 759px) {
  body {
    --tab-bottom-padding: calc(max(7px, env(safe-area-inset-bottom)) + 4px);
  }

  .standalone body {
    --tab-bottom-padding: 16px;
  }
}

.settings-status:empty {
  display: none;
}

@supports (-webkit-touch-callout: none) {
  .standalone body {
    position: relative;
    height: 100vh;
    height: 100lvh;
  }

  .standalone .bottom-tabs {
    position: absolute;
  }
}

.tab-list {
  display: grid;
  width: min(100%, 480px);
  min-height: 52px;
  margin: 0 auto;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}

.tab-button {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  padding: 3px 4px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab-button.active {
  color: var(--primary);
}

.settings-section { max-width: 680px; margin-inline: auto; }
.activity-heading { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 12px; margin-bottom: 24px; }
.activity-heading h2 { text-align: center; margin: 0; font-size: 22px; }
#activity-heading:focus { outline: none; }
.icon-history { --icon-source: url("/icons/history.svg"); }
.icon-library { --icon-source: url("/icons/library.svg"); }
.icon-refresh { --icon-source: url("/icons/refresh-cw.svg"); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.library-section { max-width: 900px; margin-inline: auto; }
.library-sources { display: flex; gap: 0; border: 0; margin: 0 0 16px; padding: 0; }
.library-sources label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-bottom: 2px solid var(--border); cursor: pointer; }
.library-sources label:has(input:checked) { border-color: var(--primary); }
.library-sources input { accent-color: var(--primary); }
.library-query-label { display: block; }
#library-query { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface); font: inherit; }
.library-list { list-style: none; margin: 0; padding: 0; }
.library-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.library-copy { display: grid; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.library-copy strong { font-size: 16px; font-weight: 500; }
.library-row button { flex: 0 0 auto; }
.library-row button:disabled, .dialog-actions button:disabled { opacity: 0.45; cursor: default; }
.library-copy .metric-detail, #replacement-file { text-align: left; }
.library-series-heading { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.library-series-heading h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.library-operation-heading { margin-top: 32px; }
.library-operation-heading h3 { font-size: 18px; }
#replacement-dialog { max-width: min(480px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 24px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); overflow-wrap: anywhere; line-height: 1.5; }
#replacement-dialog::backdrop { background: rgb(0 0 0 / 0.65); }
#replacement-dialog h2 { font-size: 22px; margin-top: 0; }
.dialog-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-inline: -24px; }
.dialog-actions .settings-command { width: 100%; min-width: 0; margin: 0; padding: 10px 4px; white-space: normal; text-align: center; justify-content: center; }
.dialog-actions button:focus:not(:focus-visible) { outline: none; }
.dialog-actions button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#replacement-cancel { grid-column: 2 / 4; }
#replacement-confirm { grid-column: 4 / 6; }
#replacement-heading:focus { outline: none; }
#replacement-confirm { color: var(--danger); }
.icon-filter { --icon-source: url("/icons/list-filter.svg"); }
.icon-move-up { --icon-source: url("/icons/arrow-left.svg"); transform: rotate(90deg); }
.icon-move-down { --icon-source: url("/icons/arrow-left.svg"); transform: rotate(-90deg); }
.history-filter { position: relative; }
#activity-filter { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); }
#activity-filter.filter-active { color: var(--primary); }
#activity-filter-menu { position: absolute; z-index: 5; right: 0; top: 48px; width: 150px; margin: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
#activity-filter-menu legend { font-size: 12px; color: var(--muted); }
#activity-filter-menu label { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
#activity-filter-menu input { accent-color: var(--primary); }
#playback-history { grid-column: 3; grid-row: 1; justify-self: end; }
#playback-history, #activity-back, #settings-back { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-row { padding: 0 0 20px; overflow-wrap: anywhere; }
.activity-row-heading { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 16px; cursor: pointer; list-style: none; }
.activity-row-heading::-webkit-details-marker { display: none; }
.activity-row-heading:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.activity-poster { position: relative; display: grid; place-items: center; width: 48px; height: 72px; background: var(--surface); color: var(--muted); border-radius: 4px; overflow: hidden; }
.activity-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.activity-copy { display: grid; gap: 4px; min-width: 0; }
.activity-title { font-size: 17px; font-weight: 500; line-height: 1.3; }
.activity-subtitle, .activity-user { color: var(--muted); font-size: 14px; line-height: 1.4; }
.activity-detail, .activity-times { color: var(--muted); font-size: 12px; margin: 8px 0 0 64px; line-height: 1.5; }
.activity-section .inline-message:empty { display: none; }
.freshness { color: var(--muted); font-size: 12px; margin: 0 0 16px; overflow-wrap: anywhere; }
.freshness-group { display: flex; flex-wrap: wrap; gap: 0 20px; }
.freshness.is-stale, .stale-data .disk-value { color: var(--warning); }
.resource-section.stale-data .metric-grid > :not(.ifd-panel), .resource-section.stale-data .disk-list, .node-grid.stale-data, .session-card.stale-data { opacity: 0.55; }
.disk-summary { flex-wrap: wrap; }
.node-card.stale-data .node-stats, .node-card.stale-data .node-resources { opacity: 0.6; }
.network-panel.stale-data .network-values, .network-panel.stale-data .chart-wrap { opacity: 0.6; }
.settings-menu-item { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 20px 4px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; font-size: 17px; }
.settings-menu-item > span:last-child { color: var(--muted); font-size: 26px; }
.settings-editor-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.settings-editor-heading h3 { margin: 0; font-size: 18px; }
.settings-command { margin-left: auto; padding: 10px 0 10px 12px; border: 0; background: transparent; color: var(--primary); cursor: pointer; font-size: 13px; }
.settings-fieldset { min-width: 0; margin: 0 0 24px; padding: 0; border: 0; }
.notification-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.notification-settings button { min-height: 44px; }
.notification-group, .settings-group { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.notification-group:last-child, .settings-group:last-child { padding-bottom: 0; border-bottom: 0; }
.notification-heading, .settings-group-heading { margin: 0; color: var(--text); font-size: 14px; font-weight: 700; }
.notification-group .settings-height { margin: 12px 0 16px 20px; grid-template-columns: minmax(0, 1fr) auto; }
.notification-group .settings-height:has(input:disabled) { opacity: 0.45; }
.notification-group .settings-toggle:last-child, .settings-group .settings-toggle:last-child { border-bottom: 0; }
.settings-group .transcoder-field:last-child, .settings-group .settings-order-row:last-child { border-bottom: 0; }
.settings-group .settings-height { margin-top: 12px; grid-template-columns: minmax(0, 1fr) auto; }
.settings-group .settings-duration { flex-wrap: wrap; }
.settings-group .settings-duration:last-child { margin-bottom: 0; }
.settings-fieldset legend { padding: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.settings-order-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px 44px; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.settings-order-row .icon-button { width: 44px; height: 44px; }
.settings-order-row button:disabled { opacity: 0.25; cursor: default; }
.settings-order-row.is-hidden > span:first-child { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }
.icon-eye { --icon-source: url("/icons/eye.svg"); }
.icon-eye-off { --icon-source: url("/icons/eye-off.svg"); }
.tab-button[hidden] { display: none; }
.settings-toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 10px 0; border-bottom: 1px solid var(--hairline); cursor: pointer; }
.settings-toggle span { overflow-wrap: anywhere; }
.settings-child { padding-left: 20px; color: var(--muted); font-size: 14px; }
.settings-toggle input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }
.settings-toggle:has(input:disabled) { opacity: 0.45; }
.settings-height { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 28px; }
.settings-height input { grid-column: 1 / -1; width: 100%; min-height: 32px; accent-color: var(--primary); }
.settings-height output, .settings-status { color: var(--muted); font-size: 12px; }

.settings-duration {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.settings-duration select {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.settings-duration select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.settings-status { min-height: 36px; margin-top: 16px; }
.settings-section button:focus-visible, .settings-section input:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.metric-grid > .disk-panel { grid-column: 1 / -1; margin-bottom: 0; }
.cpu-processes { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.cpu-processes h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
#cpu-process-list { min-height: 66px; color: var(--muted); font-size: 12px; }
.cpu-process-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 12px; min-height: 22px; align-items: center; }
.cpu-process-row span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cpu-process-row span:last-child { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.tab-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.ui-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask: var(--icon-source) center / contain no-repeat;
  mask: var(--icon-source) center / contain no-repeat;
}

.icon-system {
  --icon-source: url("/icons/chart-no-axes-column-increasing.svg");
}

.icon-playing {
  --icon-source: url("/icons/circle-play.svg");
}

.icon-nodes {
  --icon-source: url("/icons/server.svg");
}

.icon-settings {
  --icon-source: url("/icons/settings.svg");
}

.icon-stats {
  --icon-source: url("/icons/chart-line.svg");
}

.icon-back {
  --icon-source: url("/icons/arrow-left.svg");
}

.tab-icon {
  width: 25px;
  height: 25px;
}

.tab-icon-wrap {
  position: relative;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
}

.tab-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  place-items: center;
  border: 2px solid var(--background);
  border-radius: 10px;
  color: #fff;
  background: #ff453a;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transform: translate(50%, -50%);
}

.resource-section,
.nodes-section,
.sessions-section {
  margin-bottom: 32px;
}

.session-source.source-plex {
  color: #f3bd4f;
  border-color: rgb(243 189 79 / 0.35);
}

.session-source.source-silo {
  color: var(--primary);
  border-color: var(--primary-soft);
}

#session-message {
  margin-bottom: 16px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.section-heading > div:first-child {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  min-width: 0;
  text-align: center;
}

.section-heading > :last-child:not(div) {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

@media (max-width: 599px) {
  .section-heading > div:first-child {
    grid-column: 1 / -1;
  }

  .section-heading > .count-badge:last-child,
  .section-heading > .settings-command:last-child {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.range-label,
.count-badge {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.count-badge {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.metric-grid,
.node-grid,
.sessions-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.node-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: none;
}

.node-header,
.node-route,
.node-stat {
  display: flex;
  align-items: center;
}

.node-header {
  justify-content: space-between;
  gap: 12px;
}

.node-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.node-name {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-role,
.node-route-label,
.node-stat-label,
.node-resources {
  color: var(--muted);
  font-size: 10px;
}

.node-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
}

.node-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.node-healthy {
  color: var(--success);
}

.node-unhealthy {
  color: var(--danger);
}

.node-disabled {
  color: var(--muted);
}

.node-route {
  gap: 8px;
}

.node-route-value {
  color: var(--primary);
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.node-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.node-stat {
  min-width: 0;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--wash);
  font-size: 10px;
}

.node-stat strong {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-resources {
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}

.metric-panel {
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: none;
}

.ifd-panel { grid-column: 1 / -1; }
.ifd-section-heading, .ifd-files-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ifd-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 0 8px; }
.ifd-values > div { display: flex; flex-wrap: wrap; align-content: start; align-items: baseline; gap: 5px; min-width: 0; }
.ifd-values .network-direction { flex-basis: 100%; }
.ifd-values strong { font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ifd-fetched { color: var(--download); }
.ifd-served { color: var(--upload); }
.ifd-connections strong { color: var(--primary); }
.ifd-values strong small { font-size: 11px; font-weight: 500; white-space: nowrap; }
.ifd-files { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ifd-files h3 { margin: 0 0 12px; font-size: 12px; }
.ifd-file-list { list-style: none; margin: 0; padding: 0; }
.ifd-file-list li { padding: 10px 0; border-top: 1px solid var(--hairline); }
.ifd-file-name { display: block; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.ifd-file-details { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 5px; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); }
.ifd-file-speed { color: var(--download); }
.ifd-panel.ifd-stale .ifd-values, .ifd-panel.ifd-stale .chart-wrap { opacity: 0.55; }

.disk-panel {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: none;
}

.disk-heading,
.metric-section-heading {
  margin-bottom: 14px;
}

.disk-heading h3,
.metric-section-heading h3 {
  margin: 0;
  font-size: 15px;
}

.disk-list,
.disk-row {
  display: grid;
  gap: 9px;
}

.disk-list {
  gap: 14px;
}

.disk-row {
  --disk-color: var(--ram);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.disk-summary {
  display: grid;
  min-width: 0;
  gap: 8px;
  font-size: 11px;
}

.disk-free {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.disk-free-amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.disk-free-number {
  color: var(--disk-color);
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.disk-free-unit,
.disk-free-label {
  color: var(--muted);
  font-size: 11px;
}

.disk-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disk-value,
.disk-empty {
  color: var(--muted);
  font-size: 11px;
}

.disk-value {
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.disk-track {
  height: 9px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--track);
}

.disk-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--disk-color);
}

.disk-libraries {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(40px, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  margin: 4px 0 0;
  padding: 0;
  font-size: 11px;
  list-style: none;
}

.disk-library {
  display: contents;
}

.disk-library-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disk-library-bar {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--disk-color) var(--share, 0%), var(--track) var(--share, 0%));
}

.disk-library-size {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.disk-row:has(.disk-warning) {
  --disk-color: var(--warning);
}

.disk-row:has(.disk-danger) {
  --disk-color: var(--danger);
}

.metric-header {
  min-height: 48px;
  justify-content: space-between;
  gap: 14px;
}

.metric-header > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.metric-name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-header strong {
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cpu-panel .metric-header strong {
  color: var(--cpu);
}

.ram-panel .metric-header strong {
  color: var(--ram);
}

.cpu-panel,
.network-panel,
.ram-panel {
  grid-column: 1 / -1;
}

.network-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

/* Fixed, equal columns: a longer reading never wraps or moves the panel.
   Qualified to outrank .metric-header > div, which makes it a flex row. */
.network-header .network-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 150px));
  align-items: end;
  gap: 16px;
  min-width: 0;
}

#network-detail {
  white-space: nowrap;
  text-align: right;
}

@media (max-width: 459px) {
  .network-header { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #network-detail { text-align: left; }
}

.network-value {
  display: grid;
  gap: 4px;
}

.network-direction {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.network-value {
  min-width: 0;
}

.network-value strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-download strong,
.network-download .network-direction {
  color: var(--download);
}

.network-upload strong,
.network-upload .network-direction {
  color: var(--upload);
}

.metric-detail {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

#server-build {
  text-align: center;
}

.chart-wrap {
  position: relative;
  height: var(--chart-height, 140px);
  margin-top: 14px;
  padding-left: 25px;
}

.chart {
  display: block;
  width: 100%;
  height: var(--chart-height, 140px);
  overflow: visible;
  cursor: crosshair;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.chart-hit-area {
  fill: transparent;
  pointer-events: all;
}

.chart-grid {
  stroke: rgb(215 193 203 / 0.1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-baseline {
  stroke: var(--hairline-strong);
}

.chart-threshold-warning {
  fill: rgb(243 189 79 / 0.035);
}

.chart-threshold-danger {
  fill: rgb(242 102 102 / 0.05);
}

.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-provisional {
  opacity: 0.45;
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  vector-effect: non-scaling-stroke;
}

.chart-point {
  stroke: var(--surface);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.chart-crosshair {
  pointer-events: none;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.chart-scrub-point {
  pointer-events: none;
  stroke: none;
}

.chart-scale {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  width: 22px;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.chart-footer {
  display: flex;
  justify-content: space-between;
  padding-left: 25px;
  color: var(--muted);
  font-size: 9px;
}

.inline-message {
  margin-top: 10px;
  color: var(--warning);
  font-size: 12px;
}

.session-selectable {
  container-type: inline-size;
  display: grid;
  grid-template-columns: 0px minmax(0, 1fr);
  min-width: 0;
  transition: grid-template-columns 180ms ease-out;
}
.selection-mode .session-selectable { grid-template-columns: 44px minmax(0, 1fr); }
.session-selection {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  visibility: hidden;
  cursor: pointer;
}
.selection-mode .session-selection { visibility: visible; }
.session-selection input {
  appearance: none;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: var(--background);
  cursor: pointer;
}
.session-selection input:checked { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 5px var(--background); }
.session-selection input:disabled { opacity: 0.35; cursor: default; }
.session-selection input:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.session-selectable .session-card {
  height: 100%;
  min-width: 0;
}
.playback-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
}
#session-count, #node-summary {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  font-size: 12px;
  text-align: center;
}
#node-summary {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  place-items: center;
  min-height: 44px;
}
.playback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  min-width: 0;
}
.playback-actions button {
  max-width: 100%;
  overflow-wrap: anywhere;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
#playback-terminate { background: #9f293b; color: #fff; min-height: 36px; padding: 4px 12px; align-self: center; }
#playback-select {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
}
.icon-select-sessions { --icon-source: url("/icons/x.svg"); }
#playback-select[aria-pressed="true"] .icon-select-sessions { --icon-source: url("/icons/x.svg"); }
#playback-select:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.playback-actions button:disabled { opacity: 0.5; cursor: default; }
.session-stop-status { color: var(--warning); font-size: 11px; }
.session-stop-status:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .session-selectable { transition: none; }
}

/*
 * Now Playing card text is multiplied by --session-text-scale, from
 * Settings > Playing > Text Size. At 1 (100%, the default) every size is the
 * original one; the poster and spacing do not change.
 */
.session-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  clip-path: inset(0 round 16px);
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 130px;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: none;
}

.session-card > .session-backdrop {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  border-radius: 15px;
  clip-path: inset(0 round 15px);
  pointer-events: none;
}

.session-backdrop > img {
  position: absolute;
  inset: -35%;
  width: 170%;
  height: 170%;
  object-fit: cover;
  filter: blur(45px) saturate(1.25);
  opacity: 0.75;
  pointer-events: none;
}

.session-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, color-mix(in srgb, var(--background) 55%, transparent), color-mix(in srgb, var(--background) 72%, transparent));
  pointer-events: none;
}

.session-card .session-subtitle,
.session-card .session-footer {
  color: #ded4da;
}

.poster {
  position: relative;
  width: 76px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--primary);
  background: var(--background);
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-size: 18px;
}

.paused .poster img {
  opacity: 0.45;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  background: rgb(0 0 0 / 0.32);
  font-size: 18px;
}

.session-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.session-title,
.session-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-title {
  font-size: calc(14px * var(--session-text-scale, 1));
  font-weight: 800;
}

.session-subtitle {
  margin-top: calc(3px * var(--session-text-scale, 1));
  color: var(--muted);
  font-size: calc(11px * var(--session-text-scale, 1));
}

.session-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

/* In ems of the 9px tag text, so 100% matches .tag exactly. */
.session-tags .tag {
  max-width: 16.111em;
  padding: 0.333em 0.667em;
  font-size: calc(9px * var(--session-text-scale, 1));
}

.tag {
  max-width: 145px;
  overflow: hidden;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  background: var(--wash);
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-method {
  border-color: rgb(67 211 162 / 0.28);
  color: var(--success);
  background: rgb(67 211 162 / 0.08);
}

.silo-session-tags { align-items: center; }
.silo-session-tags .tag {
  line-height: 1.556;
  padding-block: 0.444em 0.222em;
}
.tag-jellyfin {
  color: #b568cc;
  border-color: rgb(181 104 204 / 0.35);
  background: rgb(181 104 204 / 0.12);
}
.tag-hardware {
  color: #99edf3;
  border-color: rgb(45 172 187 / 0.35);
  background: rgb(45 172 187 / 0.12);
}

.tag-transcode {
  border-color: rgb(243 189 79 / 0.3);
  color: var(--warning);
  background: rgb(243 189 79 / 0.08);
}

.session-footer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 10px;
  color: var(--muted);
  font-size: calc(10px * var(--session-text-scale, 1));
  /* Capped by the text column's width (card less poster and padding, 115px)
     so the avatar, some of the username and the start/end block always fit
     on one row, however large the text is set. */
  font-size: min(calc(10px * var(--session-text-scale, 1)), calc((100cqi - 115px) / 16));
}

.avatar {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--on-primary);
  background: var(--primary);
  font-size: 9px;
  font-weight: 900;
}

/* 22px circle with 9px text at 100%, scaling with the footer. */
.session-footer .avatar {
  width: 2.444em;
  height: 2.444em;
  font-size: 0.9em;
  line-height: 1;
}

.session-user {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Start time and estimated end time: a right-aligned two-line block that the
   footer centres vertically against the avatar and username. It never wraps:
   the footer's font size is capped by the card width (see .session-footer). */
.session-when {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15em;
  margin-left: auto;
  line-height: 1.25;
  text-align: right;
}

.session-time,
.session-ends {
  white-space: nowrap;
}

.session-ends {
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 3px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--track);
}

.progress-fill {
  height: 100%;
  background: var(--primary);
}

.empty-state {
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 14px;
}

.empty-icon {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
}

@media (min-width: 760px) {
  .topbar {
    padding-right: 28px;
    padding-left: 28px;
  }

  .page-shell {
    padding: 32px 28px;
  }

  .metric-grid,
  .node-grid,
  .sessions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .icon-button:active {
    transform: translateY(1px);
  }
}
/* Stats tab */
.stats-section { max-width: 760px; margin-inline: auto; }
.stats-root { display: grid; gap: 12px; }
.stats-filters { display: grid; gap: 8px; }
.stats-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stats-filter {
  min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.stats-filter.active { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.stats-filter:focus-visible, .stats-user:focus-visible, .stats-top-name:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stats-card {
  min-width: 0; padding: 16px;
  border: 1px solid var(--card-border); border-radius: 16px;
  background: var(--surface);
}
.stats-card-title {
  display: flex; justify-content: space-between; gap: 12px; margin: 0 0 12px;
  color: var(--primary); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
}
.stats-top-unit { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 600; }
.stats-empty, .stats-muted { color: var(--muted); font-size: 12px; }
.stats-empty { margin: 0; }
.stats-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .stats-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats-tile { display: grid; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--card-border); }
.stats-tile-value { font-size: 24px; font-variant-numeric: tabular-nums; }
.stats-tile-label { color: var(--muted); font-size: 12px; }
.stats-chart { position: relative; }
.stats-chart svg { display: block; overflow: visible; touch-action: pan-y; }
.stats-grid { stroke: var(--hairline); stroke-width: 1; }
.stats-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.stats-crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.stats-tooltip {
  position: absolute; z-index: 2; display: grid; gap: 2px; padding: 6px 9px; pointer-events: none;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-raised);
  color: var(--text); font-size: 11px; white-space: nowrap; box-shadow: 0 6px 18px rgb(0 0 0 / 0.35);
}
.stats-tooltip span { color: var(--muted); }
.stats-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; font-size: 12px; }
.stats-legend-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.stats-swatch { width: 10px; height: 10px; border-radius: 3px; }
.stats-peak { margin: 8px 0 0; }
.stats-segments { display: flex; gap: 2px; height: 18px; overflow: hidden; border-radius: 6px; background: var(--hairline); }
.stats-segment { min-width: 4px; }
.stats-legend-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 0; }
.stats-legend-item { display: grid; gap: 2px; }
.stats-legend-value { font-size: 20px; font-variant-numeric: tabular-nums; }
.stats-legend-count { color: var(--muted); font-size: 11px; }
.stats-meters { display: grid; grid-template-columns: minmax(0, max-content) minmax(40px, 1fr) auto; align-items: center; gap: 8px 12px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.stats-meter { display: contents; }
.stats-meter-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(200px, 40vw); }
.stats-meter-track { height: 8px; border-radius: 4px; background: var(--hairline); }
.stats-meter-fill { display: block; height: 100%; border-radius: 4px; background: var(--series-1); }
.stats-meter-value { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-top-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; }
.stats-top-body:has(> .stats-top-list:only-child) { grid-template-columns: minmax(0, 1fr); }
.stats-poster { position: relative; display: grid; place-items: center; width: 72px; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 8px; background: var(--surface-raised); }
.stats-poster.small { width: 44px; border-radius: 6px; }
.stats-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stats-poster-fallback { width: 22px; height: 22px; color: var(--muted); }
.stats-top-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.stats-top-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.stats-top-row.first { color: var(--text); font-size: 15px; font-weight: 700; }
.stats-top-rank { color: var(--muted); font-size: 12px; font-weight: 600; }
.stats-top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
button.stats-top-name { cursor: pointer; text-decoration: underline; text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
.stats-top-value { color: var(--upload); font-variant-numeric: tabular-nums; }
.stats-recent, .stats-users, .stats-accounts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.stats-recent-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.stats-recent-copy { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.stats-recent-copy > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-recent-meta { display: grid; gap: 4px; justify-items: end; }
.stats-chip { padding: 2px 8px; border-radius: 999px; background: var(--surface-raised); color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.stats-chip.method-direct_play { box-shadow: inset 3px 0 0 var(--series-3); }
.stats-chip.method-direct_stream { box-shadow: inset 3px 0 0 var(--series-1); }
.stats-chip.method-transcode { box-shadow: inset 3px 0 0 var(--series-2); }
.stats-user-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.stats-search, .stats-sort {
  min-height: 42px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
.stats-user-count { margin: 0; }
.stats-user {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
  padding: 12px 14px; border: 1px solid var(--card-border); border-radius: 14px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.stats-user-copy, .stats-user-figures { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.stats-user-copy > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-user-figures { justify-items: end; text-align: right; }
.stats-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.stats-avatar.large { width: 52px; height: 52px; font-size: 20px; }
.stats-person-header { display: grid; grid-template-columns: 44px auto minmax(0, 1fr); gap: 12px; align-items: center; }
.stats-person-name { margin: 0; overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.stats-account { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }

/* ===== Themes =====
   Each theme redefines the colour tokens above. Data-series colours stay
   inside a colourblind-checked set; themes restyle everything around them. */
:root[data-theme="silo"] {
  --background: #141417; --surface: #1c1c20; --surface-raised: #232328; --border: #28282e;
  --text: #e8e8ec; --muted: #a4a4ae; --primary: #e8e8ec; --primary-soft: #2e2e35;
  --cpu: #5f74ee; --ram: #169e88; --download: #3f97cf; --upload: #bf7f22;
  --warning: #e0b04a; --danger: #ef4444; --success: #3fb67a; --on-primary: #141417;
  --chrome: rgb(15 15 18 / 0.94); --hairline: rgb(255 255 255 / 0.06); --hairline-strong: rgb(255 255 255 / 0.18);
  --track: rgb(255 255 255 / 0.07); --wash: rgb(255 255 255 / 0.02); --card-border: #28282e;
  --crosshair: #a4a4ae; --series-1: #5f74ee; --series-2: #bf7f22; --series-3: #169e88;
  --font: "Plus Jakarta Sans", "Avenir Next", Avenir, system-ui, sans-serif;
}

:root[data-theme="midnight"] {
  --background: #0b0f17; --surface: #151c28; --surface-raised: #1d2635; --border: #2a3547;
  --text: #eef2f8; --muted: #93a1b5; --primary: #6cb6ff; --primary-soft: #1a2a40;
  --cpu: #6cb6ff; --ram: #4fd1c5; --download: #a78bfa; --upload: #f6c177;
  --on-primary: #0b1220; --chrome: rgb(11 15 23 / 0.94); --card-border: rgb(147 161 181 / 0.1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f6f3f4; --surface: #ffffff; --surface-raised: #f1eaed; --border: #e2d6db;
  --text: #22171b; --muted: #6f5f66; --primary: #c2445e; --primary-soft: #f8e3e8;
  --cpu: #c2445e; --ram: #12806e; --download: #2a78d6; --upload: #b8760a;
  --warning: #a86a00; --danger: #c93b3b; --success: #12805d; --on-primary: #ffffff;
  --chrome: rgb(255 255 255 / 0.94); --hairline: rgb(0 0 0 / 0.08); --hairline-strong: rgb(0 0 0 / 0.25);
  --track: rgb(0 0 0 / 0.08); --wash: rgb(0 0 0 / 0.03); --card-border: rgb(0 0 0 / 0.08);
  --crosshair: #555555; --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
}

:root[data-theme="contrast"] {
  --background: #000000; --surface: #000000; --surface-raised: #1a1a1a; --border: #ffffff;
  --text: #ffffff; --muted: #e6e6e6; --primary: #ffd600; --primary-soft: #332b00;
  --cpu: #ffd600; --ram: #00e5ff; --download: #00e5ff; --upload: #ffd600;
  --warning: #ffd600; --danger: #ff6b6b; --success: #00ff85; --on-primary: #000000;
  --chrome: #000000; --hairline: rgb(255 255 255 / 0.4); --hairline-strong: #ffffff;
  --track: rgb(255 255 255 / 0.3); --wash: rgb(255 255 255 / 0.06); --card-border: #ffffff; --crosshair: #ffffff;
}
:root[data-theme="contrast"] body { background-image: none; }
:root[data-theme="contrast"] :focus-visible { outline: 3px solid var(--primary) !important; outline-offset: 2px; }

:root[data-theme="console"],
:root[data-theme="matrix"] {
  --font: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
:root[data-theme="console"] {
  --background: #050805; --surface: #0a110a; --surface-raised: #0f1a0f; --border: #1f4d1f;
  --text: #b6ffb6; --muted: #5fae5f; --primary: #33ff66; --primary-soft: #0f2a14;
  --cpu: #33ff66; --ram: #7dff9c; --download: #33ff66; --upload: #ffb000;
  --warning: #ffb000; --danger: #ff5555; --success: #33ff66; --on-primary: #021a07;
  --chrome: rgb(5 8 5 / 0.96); --hairline: rgb(51 255 102 / 0.12); --hairline-strong: rgb(51 255 102 / 0.35);
  --track: rgb(51 255 102 / 0.1); --wash: rgb(51 255 102 / 0.03); --card-border: #1f4d1f; --crosshair: #33ff66;
}
:root[data-theme="matrix"] {
  --background: #000000; --surface: rgb(0 14 4 / 0.78); --surface-raised: #03200a; --border: #0a3d12;
  --text: #c8ffd4; --muted: #3fbf5f; --primary: #00ff41; --primary-soft: #012b0c;
  --cpu: #00ff41; --ram: #7dffa0; --download: #00ff41; --upload: #d4ffd9;
  --warning: #e8ff4a; --danger: #ff4a4a; --success: #00ff41; --on-primary: #001a06;
  --chrome: rgb(0 0 0 / 0.9); --hairline: rgb(0 255 65 / 0.12); --hairline-strong: rgb(0 255 65 / 0.35);
  --track: rgb(0 255 65 / 0.1); --wash: rgb(0 255 65 / 0.03); --card-border: #0a3d12; --crosshair: #00ff41;
}
:root[data-theme="console"] *, :root[data-theme="matrix"] *,
:root[data-theme="console"] *::before, :root[data-theme="matrix"] *::before { border-radius: 0 !important; }
:root[data-theme="console"] body, :root[data-theme="matrix"] body { background-image: none; }
:root[data-theme="console"] :is(h1, h2, h3, strong, .eyebrow, .tab-button.active),
:root[data-theme="matrix"] :is(h1, h2, h3, strong, .eyebrow, .tab-button.active) {
  text-shadow: 0 0 6px color-mix(in srgb, var(--primary) 45%, transparent);
}
:root[data-theme="console"] h2::before, :root[data-theme="matrix"] h2::before { content: "> "; color: var(--primary); }
:root[data-theme="console"][data-effects="on"] h2::after,
:root[data-theme="matrix"][data-effects="on"] h2::after {
  content: "_"; color: var(--primary); animation: theme-cursor 1.1s steps(1) infinite;
}
@keyframes theme-cursor { 50% { opacity: 0; } }
/* CRT scanlines over everything, never intercepting taps. */
:root[data-theme="console"][data-effects="on"]::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgb(0 0 0 / 0.18) 0 1px, transparent 1px 3px);
}
/* Matrix code rain sits behind the page; the body lets it show through. */
:root[data-theme="matrix"] body { background: transparent; }
#theme-rain { position: fixed; inset: 0; z-index: -1; width: 100vw; height: 100vh; pointer-events: none; opacity: 0.4; }

:root[data-theme="synthwave"] {
  --background: #14081f; --surface: #20102f; --surface-raised: #2b1640; --border: #3d2160;
  --text: #fbeaff; --muted: #b79cc9; --primary: #ff4fd8; --primary-soft: #3a1240;
  --cpu: #ff4fd8; --ram: #2de2e6; --download: #2de2e6; --upload: #ffd319;
  --warning: #ffd319; --on-primary: #2a0626; --chrome: rgb(20 8 31 / 0.94); --card-border: rgb(255 79 216 / 0.14);
}
:root[data-theme="synthwave"] body {
  background-image:
    linear-gradient(180deg, rgb(255 79 216 / 0.08), transparent 45%),
    linear-gradient(0deg, rgb(45 226 230 / 0.07), transparent 35%);
}
:root[data-theme="synthwave"] :is(h2, .eyebrow) { text-shadow: 0 0 10px rgb(255 79 216 / 0.45); }

@media (prefers-reduced-motion: reduce) {
  :root[data-effects="on"] h2::after { animation: none; }
}

/* Appearance settings */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 8px 0; }
.theme-card {
  display: grid; gap: 10px; padding: 12px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.theme-card[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.theme-card:focus-visible, .accent-swatch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; height: 54px; padding: 6px; border-radius: 8px; }
.theme-preview span { border-radius: 4px; }
.theme-preview span:first-child { grid-row: span 2; }
.theme-card strong { font-size: 14px; }
.theme-card small { color: var(--muted); font-size: 11px; }
.accent-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0; }
.accent-swatch {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 2px solid var(--border); border-radius: 50%; background: var(--swatch); cursor: pointer;
}
.accent-swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--background) inset; }
.accent-swatch.default { background: conic-gradient(var(--primary) 0 50%, var(--surface-raised) 0); }
.accent-custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.accent-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.settings-note { display: block; margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.stats-text-button {
  min-height: 32px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--primary); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.stats-text-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stats-person-header { grid-template-columns: 44px auto minmax(0, 1fr) auto; }
.stats-account-side { display: grid; justify-items: end; gap: 4px; }
.stats-link-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
.stats-link-form .stats-filter:disabled { opacity: 0.4; cursor: default; }
.stats-notice { margin: 10px 0 0; }

/* Sign-in page */
.auth-body { display: block; min-height: 100dvh; overflow: auto; }
.auth-body::after { content: none; }
.auth-shell {
  display: grid; place-items: center; min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(60rem 40rem at 15% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
    radial-gradient(50rem 35rem at 110% 110%, color-mix(in srgb, var(--ram) 12%, transparent), transparent 60%);
}
.auth-card {
  display: grid; gap: 18px; width: min(100%, 420px); padding: 32px 28px;
  border: 1px solid var(--card-border); border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.35);
  backdrop-filter: blur(14px);
}
.auth-logo { width: 56px; height: 56px; border-radius: 14px; }
.auth-title { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.04em; }
.auth-subtitle { margin: -10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.auth-step-title { margin: 0 0 12px; font-size: 18px; }
.auth-form { display: grid; gap: 16px; }
.auth-field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.auth-field input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--background); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
.auth-field input:focus-visible, .auth-submit:focus-visible, .auth-link:focus-visible, .auth-reveal:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.auth-password { position: relative; display: block; }
.auth-password input { padding-right: 68px; }
.auth-reveal {
  position: absolute; top: 50%; right: 6px; min-height: 34px; padding: 0 10px; transform: translateY(-50%);
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.auth-submit {
  min-height: 48px; border: 0; border-radius: 10px; background: var(--primary); color: var(--on-primary);
  font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
}
.auth-submit:disabled { opacity: 0.6; cursor: wait; }
.auth-error {
  margin: 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 13px;
}
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.auth-link { padding: 4px 0; border: 0; background: none; color: var(--primary); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-footnote { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.account-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 16px; padding: 12px 16px; border: 1px solid var(--card-border); border-radius: 14px;
  background: var(--surface); color: var(--muted); font-size: 14px;
}
.account-bar strong { color: var(--text); }

.restart-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

.launch-card {
  display: grid; gap: 12px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--card-border); border-radius: 14px;
  background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.5;
}
.launch-card h3 { margin: 0; color: var(--text); font-size: 15px; }
.launch-card p { margin: 0; }
.launch-secret-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.launch-secret {
  width: 100%; min-width: 0; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--background); color: var(--text); font: 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.launch-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.launch-footer .settings-command { margin-left: 0; padding-left: 0; }
.launch-status:empty { display: none; }
.stats-person-header.renaming { grid-template-columns: 44px minmax(0, 1fr); align-items: start; }
.stats-rename-form { display: grid; gap: 8px; min-width: 0; }
.stats-rename-input {
  width: 100%; min-width: 0; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--primary); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 20px; font-weight: 700;
}
.stats-rename-input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stats-rename-actions { display: flex; justify-content: flex-end; gap: 8px; }
.stats-rename-error { margin: 0; color: var(--danger); font-size: 13px; }

.icon-rotate { --icon-source: url("/icons/rotate-ccw.svg"); }
.settings-actions { display: flex; justify-content: flex-end; margin: -4px 0 12px; }
.restart-server {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.restart-server .ui-icon { width: 15px; height: 15px; }
.restart-server:hover { border-color: var(--muted); }
.restart-server:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.restart-server:disabled { opacity: 0.5; cursor: default; }
.settings-restart-confirm {
  display: grid; gap: 12px; margin-bottom: 16px; padding: 14px 16px;
  border-left: 3px solid var(--warning); background: color-mix(in srgb, var(--warning) 8%, transparent);
}
.settings-restart-confirm p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.5; }

/* Title pages (stats.js renderTitle) and the links that open them. */
.stats-link { justify-self: start; overflow: hidden; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; text-decoration: underline; text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
.stats-link.strong { font-weight: 700; }
.stats-link:hover { text-decoration-color: currentColor; }
.stats-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stats-person-header.stats-title-header { grid-template-columns: 44px auto minmax(0, 1fr); }
.stats-title-copy { display: grid; gap: 2px; min-width: 0; }
.activity-title-stats { margin: 10px 0 0 64px; }
.stats-recent-copy > .stats-wrap { white-space: normal; }

/* Libraries view (stats.js renderLibraries). */
.stats-added-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 104px; gap: 12px; margin: 0; padding: 0 0 6px; overflow-x: auto; list-style: none; scroll-snap-type: x proximity; }
.stats-added-item { scroll-snap-align: start; min-width: 0; }
.stats-added-body { display: grid; gap: 3px; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-size: 12px; text-align: left; }
button.stats-added-body { cursor: pointer; }
button.stats-added-body:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.stats-added-body .stats-poster { width: 100%; margin-bottom: 4px; }
.stats-added-body > strong, .stats-added-body > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px 16px; margin: 0; }
.stats-figure dt { color: var(--muted); font-size: 12px; }
.stats-figure dd { margin: 2px 0 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-footnote { margin: 0; font-size: 12px; }
.library-intro { margin: 0 0 12px; text-align: left; } .library-setup { margin: 0 0 12px; }
