:root {
  --bg: #f2f2f3;
  --sidebar-bg: #0e0e10;
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  --text: #111112;
  --text-dim: #7a7a80;
  --text-on-dark: #f2f2f3;
  --text-dim-on-dark: #8d8d93;
  --orange: #111112;
  --orange-dim: rgba(17, 17, 18, 0.06);
  --purple: #3a3a3d;
  --purple-dim: rgba(58, 58, 61, 0.08);
  --green: #16a34a;
  --green-dim: rgba(22, 163, 74, 0.10);
  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.10);
  --yellow: #a16207;
  --yellow-dim: rgba(161, 98, 7, 0.10);
  --blue: #2563eb;
  --blue-dim: rgba(37, 99, 235, 0.10);
  --radius: 22px;
  --radius-sm: 12px;
  --font-display: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }

/* ---------- Shell layout ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  min-width: 232px;
  background: var(--sidebar-bg);
  color: var(--text-on-dark);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 26px;
}

.brand-mark-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand-word {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim-on-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-on-dark); }

.nav-item.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim-on-dark);
}

.sidebar-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim-on-dark); }

.ws-live .dot { background: var(--green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.7); }
.ws-live { color: var(--green); }
.ws-connecting .dot { background: var(--yellow); }
.ws-connecting { color: var(--yellow); }
.ws-down .dot { background: var(--red); }
.ws-down { color: var(--red); }

.source-status.source-live .dot,
.sidebar-status.source-live .dot { background: var(--green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.7); }
.source-live { color: var(--green) !important; }
.source-offline { color: var(--text-dim-on-dark); }

.source-status.source-holding .dot,
.sidebar-status.source-holding .dot { background: var(--blue); box-shadow: 0 0 6px rgba(37, 99, 235, 0.7); }
.source-holding { color: var(--blue) !important; }

/* ---------- Content area ---------- */

.content {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 48px;
  max-width: 1320px;
}

.content-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 24px;
}

.greeting-eyebrow {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.greeting-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 10px 18px 10px 10px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.quick-pill:hover { transform: translateY(-1px); }

.quick-pill-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  font-size: 14px;
}

.quick-pill-primary { background: var(--orange); color: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25); }
.quick-pill-purple { background: var(--purple); color: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18); }
.quick-pill-dark { background: var(--sidebar-bg); color: #fff; border: 1px solid rgba(255, 255, 255, 0.14); }
.quick-pill-dark .quick-pill-icon { background: rgba(255, 255, 255, 0.12); }

/* ---------- Generic cards ---------- */

.card {
  border-radius: var(--radius);
  padding: 20px;
}

.card-white {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.05);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title-row h2 { font-size: 16px; font-weight: 700; }

.pill-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--orange-dim);
  color: var(--orange);
}

.pill-tag-muted { background: rgba(15, 23, 42, 0.06); color: var(--text-dim); }

/* ---------- Hero (video + stats) ---------- */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
}

.source-panels {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b0c11;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrap video,
.video-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0b0c11;
}

.video-wrap img { object-fit: cover; z-index: 0; }
.video-wrap video { z-index: 1; }

.video-placeholder {
  position: relative;
  z-index: 2;
  color: #9aa0b4;
  font-size: 13px;
  text-align: center;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.video-placeholder-icon { color: var(--red); font-size: 20px; opacity: 0.7; }

.video-overlay-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
}

.live-pill .dot {
  width: 6px; height: 6px; border-radius: 50%; background: #fff;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.latency-pill {
  background: rgba(0, 0, 0, 0.5);
  color: #d7d9e4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 999px;
}

.video-overlay-bottom {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.video-overlay-bottom span {
  background: rgba(0, 0, 0, 0.5);
  color: #eef0f6;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.preview-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 560px) {
  .preview-info { grid-template-columns: repeat(2, 1fr); }
}

.preview-info-item { font-size: 13px; }

.preview-info-label {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preview-info-value {
  font-weight: 700;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Stat stack ---------- */

.stat-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stat-card {
  color: #fff;
  position: relative;
  overflow: hidden;
}

.stat-card.accent-orange { background: linear-gradient(150deg, #1a1a1c, #48484d); }
.stat-card.accent-purple { background: linear-gradient(150deg, #48484d, #78787e); }

.stat-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.stat-card-label { font-size: 12px; font-weight: 700; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.04em; }

.stat-card-value {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.card-unit { font-size: 14px; font-weight: 600; opacity: 0.85; }

/* ---------- Speed test ---------- */

.speedtest-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 14px 0 10px;
}

@media (max-width: 700px) {
  .speedtest-grid { grid-template-columns: repeat(2, 1fr); }
}

.speedtest-stat {
  background: #f8f9fc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.speedtest-stat-value {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.speedtest-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.stat-card-sub { margin-top: 8px; font-size: 12px; opacity: 0.85; font-weight: 600; }

/* ---------- Triple grid (network / attention) ---------- */

.triple-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  align-items: stretch;
}

@media (max-width: 1080px) {
  .triple-grid { grid-template-columns: 1fr; }
}

.net-host-card canvas { width: 100%; height: 140px; display: block; }

.net-host-graph-legend {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.legend-item { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.legend-item b { color: var(--text); font-variant-numeric: tabular-nums; }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-tx i { background: var(--orange); }
.legend-rx i { background: var(--purple); }

.net-readout-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  background: rgba(15, 23, 42, 0.03);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* ---------- Accent cards (purple / orange) ---------- */

.accent-card {
  color: #fff;
  display: flex;
  flex-direction: column;
}

.accent-card .card-title-row h2 { color: #fff; }

.accent-card-purple { background: linear-gradient(160deg, #2c2c2e, #0c0c0d); }
.accent-card-orange { background: linear-gradient(160deg, #48484d, #1a1a1c); }
.accent-card-orange.accent-card-alert { background: linear-gradient(160deg, #6b2323, #3a1212); }
.accent-card-orange.accent-card-holding { background: linear-gradient(160deg, #2563eb, #1e3a8a); }

.accent-card .empty-state { color: rgba(255, 255, 255, 0.8); }

.attention-body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.attention-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.attention-icon-alert { background: rgba(255, 255, 255, 0.28); }

.attention-text { font-size: 13px; line-height: 1.5; opacity: 0.95; }

.btn-light {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  align-self: flex-start;
}
.btn-light:hover { background: rgba(255, 255, 255, 0.32); }

/* ---------- Reachability list (inside purple accent card) ---------- */

.net-dest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.net-dest-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
}

.net-dest-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.platform-avatar-sm {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 7px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.net-dest-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.net-dest-canvas {
  grid-column: 1 / -1;
  width: 100%;
  height: 30px;
  display: block;
  opacity: 0.9;
}

.net-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.net-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.net-good .dot { background: #baffd9; }
.net-warn .dot { background: #ffe7a3; }
.net-bad .dot { background: #ffc2c2; }
.net-idle .dot { background: rgba(255, 255, 255, 0.6); }

/* ---------- Pull links ---------- */

.pull-link-group {
  margin-bottom: 18px;
}

.pull-link-group:last-child { margin-bottom: 0; }

.pull-link-source-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pull-link-group .link-row:last-child,
.link-row:last-child { margin-bottom: 0; }

.link-row-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  width: 40px;
  min-width: 40px;
}

.link-input {
  flex: 1;
  min-width: 0;
  background: #f4f5fa;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: "SF Mono", Consolas, monospace;
  padding: 9px 10px;
}

.link-input:focus { outline: 1px solid var(--purple); }

/* ---------- Source boxes (main dashboard) ---------- */

.source-box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.source-box {
  background: #f8f9fc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.source-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.source-box-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #0b0c11;
  margin: -1px -1px 1px;
}

.source-box-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

.source-box-thumb-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6a6a70;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.source-box-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
}

.source-box-badge-live { background: var(--red); color: #fff; }
.source-box-badge-off { background: rgba(0, 0, 0, 0.55); color: #d7d9e4; }

.source-box-name {
  font-weight: 700;
  font-size: 14px;
}

.source-box-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.source-box-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.source-box-actions .btn { flex: 1 1 auto; }

/* ---------- Destinations panel ---------- */

.dest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.dest-card {
  background: #f8f9fc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dest-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

/* Per-destination live preview thumbnail */

.dest-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #0b0c11;
  cursor: pointer;
  margin: -2px -2px 2px;
}

.dest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
  transition: opacity 0.15s, transform 0.3s;
}

.dest-thumb:hover img { opacity: 1; transform: scale(1.03); }

.dest-thumb-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6a6a70;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dest-thumb-live,
.dest-thumb-off {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
}

.dest-thumb-live { background: var(--red); color: #fff; }
.dest-thumb-off { background: rgba(0, 0, 0, 0.55); color: #d7d9e4; }
.dest-thumb-holding { background: var(--blue); color: #fff; }

.dest-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.15s;
}

.dest-thumb:hover .dest-thumb-play { opacity: 1; }

.dest-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.dest-card-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.platform-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 10px;
  background: var(--orange-dim);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.dest-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.platform-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-dim);
  font-size: 11px;
  text-transform: capitalize;
  margin-top: 2px;
}

.source-badge {
  margin-left: 4px;
  text-transform: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-running { background: var(--green-dim); color: #178a45; }
.status-stopped { background: rgba(15, 23, 42, 0.06); color: var(--text-dim); }
.status-error   { background: var(--red-dim); color: var(--red); }
.status-holding { background: var(--blue-dim); color: var(--blue); }

.health-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.03);
}

.health-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); }

.health-good .dot { background: var(--green); }
.health-good { color: #178a45; }
.health-stalled .dot { background: var(--yellow); }
.health-stalled { color: #a5690a; }
.health-warning .dot { background: var(--red); }
.health-warning { color: var(--red); }
.health-idle { color: var(--text-dim); }
.health-holding .dot { background: var(--blue); }
.health-holding { color: var(--blue); }

.dest-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: rgba(15, 23, 42, 0.03);
  border-radius: var(--radius-sm);
  padding: 10px 4px;
}

.dest-stat { text-align: center; }

.dest-stat-value {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dest-stat-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.dest-error {
  font-size: 11px;
  color: var(--red);
  background: var(--red-dim);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dest-meta { font-size: 11px; color: var(--text-dim); }

.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 24px 0 8px;
}

.hidden { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: var(--font-body);
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22); }
.btn-secondary { background: rgba(15, 23, 42, 0.06); color: var(--text); }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-small { padding: 6px 12px; font-size: 12px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 26, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 420px;
  max-width: 90vw;
  padding: 22px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.3);
}

.modal-wide { width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 { font-size: 16px; }

#destForm label,
.auth-form label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
  font-weight: 600;
}

#destForm input[type="text"],
#destForm select,
.auth-form input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  background: #f4f5fa;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
}

/* ---------- Login page ---------- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.auth-wrap { width: 100%; max-width: 380px; padding: 20px; }

.auth-card { padding: 28px 24px; }

.auth-brand {
  justify-content: center;
  margin-bottom: 20px;
}

.auth-error {
  color: var(--red);
  font-size: 13px;
  margin: -4px 0 12px;
}

.auth-submit { width: 100%; }

/* ---------- Users page: inline forms (change password, add user) ---------- */

.auth-form-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-form-inline label { margin-bottom: 0; min-width: 180px; }
.auth-form-inline .checkbox-label { min-width: auto; padding-bottom: 9px; }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
.checkbox-label input { width: auto !important; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.preview-video-wrap { aspect-ratio: 16 / 9; }
.preview-modal-actions { justify-content: space-between; }

.logs-content {
  background: #0f1115;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 400px;
  overflow-y: auto;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  color: #b8bccb;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
}
.toast.error { background: var(--red); }

/* ---------- Audio meter ---------- */

.audio-meter {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}

.audio-meter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.audio-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: var(--yellow-dim);
  color: var(--yellow);
}

.audio-badge-clip { background: var(--red-dim); color: var(--red); }

.audio-meter-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.audio-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #48484d, #111112);
  transition: width 0.2s ease, background 0.2s ease;
}

.audio-meter-fill.audio-fill-silent { background: var(--yellow); }
.audio-meter-fill.audio-fill-clip { background: var(--red); }

.audio-meter-value {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- System health ---------- */

.sys-canvas { width: 100%; height: 90px; display: block; }

.disk-readout {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 4px;
}

/* ---------- Automation panel ---------- */

.automation-hint {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 14px;
}

.automation-examples {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.automation-example {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}

.automation-example-label {
  color: var(--text-dim);
  font-weight: 700;
  min-width: 150px;
}

.automation-example code {
  background: #0f1115;
  color: #c9cbd6;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11.5px;
}

/* ---------- Failover UI ---------- */

.failover-details {
  margin-bottom: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.failover-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.failover-details label { margin-top: 10px; }
.failover-details[open] summary { margin-bottom: 4px; }

/* ---------- Holding screen panel ---------- */

.holding-type-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.04);
  padding: 4px;
  border-radius: 999px;
  width: fit-content;
}

.holding-type-tab {
  border: none;
  background: transparent;
  padding: 7px 18px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  cursor: pointer;
}

.holding-type-tab.active { background: #fff; color: var(--text); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1); }

.holding-panel label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 14px;
}

.holding-panel input[type="text"] {
  display: block;
  width: 100%;
  max-width: 480px;
  margin-top: 4px;
  padding: 9px 11px;
  background: #f4f5fa;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
}

.holding-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.holding-upload-status {
  font-size: 12px;
  color: var(--text-dim);
}

.holding-save-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  align-self: center;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 10px;
}

.upload-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--orange);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.upload-progress-label {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 90px;
  text-align: right;
}

.failover-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--yellow-dim);
  color: var(--yellow);
}
