/* ServerDeck — screen-specific layouts */

/* ===================== HUB (live-first) ===================== */
.hub-top {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 26px; min-height: 66px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 55%, transparent), var(--shadow-sm);
}
.hub-top .brand { padding: 2px 2px 2px 0; }
.hub-top .search { width: 320px; }

.estate-status {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 6px 13px 6px 11px; border-radius: 30px;
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 24%, transparent);
}
.estate-status .es-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none;
  box-shadow: 0 0 0 0 var(--success); animation: livepulse 2.4s infinite;
}
.estate-status .es-text { font-size: 12px; font-weight: 600; color: var(--success); letter-spacing: -.01em; }

.hub-clock {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 7px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.hub-clock .ic { width: 15px; height: 15px; opacity: .65; }
.hub-clock .lcd { font-weight: 700; color: var(--text); font-size: 13px; letter-spacing: .03em; font-variant-numeric: tabular-nums; }

/* Centred version chip — panel + bundled agent (what the estate should run) */
.hub-version {
  display: flex; align-items: center; gap: 7px; flex: none;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  color: var(--text-2); white-space: nowrap;
  padding: 6px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
.hub-version .hv-mark { color: #2DAAE1; font-size: 9px; line-height: 1; }
.hub-version .hv-text { color: var(--text); }
/* On cramped widths the chip yields gracefully rather than crowding the bar */
@media (max-width: 1180px) { .hub-version { display: none; } }

/* live-first operations band: feed (hero) + risk rail, locked to equal height */
.hub-ops {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(0, 1.6fr) minmax(250px, 0.92fr);
  grid-template-rows: 340px;
  align-items: stretch;
}
.hub-ops > .live-card,
.hub-ops > .hub-risk-col { min-height: 0; height: 340px; }
.hub-ops .hub-risk-col { display: flex; flex-direction: column; min-width: 0; }
.hub-ops .live-card { display: flex; flex-direction: column; }
.hub-ops .live-feed { flex: 1; min-height: 0; }
.risk-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.risk-card .card-head { flex: none; }
.risk-scroll { flex: 1; min-height: 0; overflow-y: auto; }
@media (max-width: 720px) {
  .hub-ops { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .hub-ops > .live-card { height: 320px; }
  .hub-ops > .hub-risk-col { height: auto; }
  .risk-card { height: auto; max-height: 440px; }
}

/* KPI strip */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
@media (max-width: 760px) { .kpi-strip { grid-template-columns: repeat(2, 1fr); } }

/* area tiles — the "spokes" (launcher band) */
.areas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px)  { .areas { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .areas { grid-template-columns: 1fr; } }
.area-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--tile-pad); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .16s var(--ease), border-color .16s, box-shadow .16s; text-align: left; display: block;
}
.area-tile:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.area-tile::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120px 80px at 100% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
  opacity: 0; transition: opacity .2s;
}
.area-tile:hover::after { opacity: 1; }
.area-tile .at-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 12px; }
.area-tile .at-ic .ic { width: 17px; height: 17px; }
.area-tile .at-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.area-tile .at-metric { font-size: 24px; font-weight: 800; letter-spacing: -.03em; margin-top: 8px; font-feature-settings: "tnum" 1; }
.area-tile .at-metric small { font-size: 13px; font-weight: 600; color: var(--text-3); }
.area-tile .at-sub { font-size: 11.5px; color: var(--text-2); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.area-tile .at-arrow { position: absolute; top: var(--tile-pad); right: var(--tile-pad); color: var(--text-3); transition: transform .16s, color .16s; }
.area-tile:hover .at-arrow { transform: translateX(3px); color: var(--accent); }

/* LIVE NOW column (heart) */
.live-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); display: flex; flex-direction: column; min-height: 300px; overflow: hidden; }
.live-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.live-head .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: livepulse 2s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.live-head .lt { font-weight: 700; font-size: 14px; white-space: nowrap; }
.live-head > div:first-of-type { flex: none; }
.live-head .lsub { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.live-feed { flex: 1; overflow-y: auto; padding: 6px 0; }
.feed-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); position: relative; }
.feed-item:last-child { border-bottom: none; }
.feed-ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.feed-ic .ic { width: 16px; height: 16px; }
.feed-ic.accent { background: var(--accent-soft); color: var(--accent); }
.feed-ic.ok { background: var(--success-soft); color: var(--success); }
.feed-ic.warn { background: var(--warning-soft); color: var(--warning); }
.feed-ic.danger { background: var(--danger-soft); color: var(--danger); }
.feed-ic.muted { background: var(--surface-2); color: var(--text-3); }
.feed-body { flex: 1; min-width: 0; }
.feed-body .fb-actor { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); display: flex; gap: 8px; align-items: center; }
.feed-body .fb-text { font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.feed-body .fb-text b { font-weight: 700; }
.feed-progress { height: 4px; border-radius: 4px; background: var(--meter-track); margin-top: 8px; overflow: hidden; }
.feed-progress > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .9s var(--ease); }
.feed-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

/* ticker strip in live head */
.ticker { display: flex; gap: 6px; overflow: hidden; }
.ticker .tk { font-family: var(--font-mono); font-size: 10px; padding: 1px 7px; border-radius: 20px; background: var(--surface-2); color: var(--text-3); }

/* risk rail */
.hub-risk-col { display: flex; flex-direction: column; gap: var(--gap); }
.risk-item { padding: 13px 15px; border-bottom: 1px solid var(--line); }
.risk-item:last-child { border-bottom: none; }
.risk-item .ri-top { display: flex; align-items: center; gap: 8px; }
.sev { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
.sev.critical { color: var(--danger); background: var(--danger-soft); }
.sev.warning { color: var(--warning); background: var(--warning-soft); }
.sev.info { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 13%, transparent); }
.risk-item .ri-title { font-weight: 700; font-size: 13px; flex: 1; }
.risk-item .ri-res { font-family: var(--font-mono); font-size: 11px; color: var(--accent); margin-top: 3px; }
.risk-item .ri-msg { font-size: 11.5px; color: var(--text-2); margin-top: 4px; line-height: 1.4; }
.risk-item .ri-act { display: flex; gap: 7px; margin-top: 9px; }
.risk-item .ri-age { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }

/* quick actions */
.quick-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ===================== SERVER CARDS GRID ===================== */
.srv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.srv-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px;
  box-shadow: var(--shadow-sm); transition: transform .16s var(--ease), border-color .16s, box-shadow .16s; display: block; text-align: left;
}
.srv-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.srv-card.is-offline { opacity: .72; }
.srv-card .sc-head { display: flex; align-items: center; gap: 9px; }
.srv-card .sc-name { font-weight: 700; font-size: 14px; font-family: var(--font-mono); letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-card .sc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 11px 0 13px; }
.srv-card .sc-meters { display: flex; flex-direction: column; gap: 9px; }
.srv-card .sc-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.srv-card .sc-foot .sites { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.srv-card .sc-foot .acts { margin-left: auto; display: flex; gap: 6px; }

/* score chip */
.score { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.score.good { color: var(--success); background: var(--success-soft); }
.score.mid { color: var(--warning); background: var(--warning-soft); }
.score.bad { color: var(--danger); background: var(--danger-soft); }

/* ===================== DETAIL ===================== */
.detail-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-head .dh-id { font-family: var(--font-mono); font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.detail-head .dh-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gap); }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-2); font-weight: 500; }
.kv .v { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.kv .v.reveal { color: var(--text-3); letter-spacing: 2px; }

/* big live chart */
.chart-card { padding: var(--pad-card); }
.chart { width: 100%; height: 130px; }

/* credential row */
.cred-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cred-row:last-child { border-bottom: none; }
.cred-row .cr-k { width: 130px; color: var(--text-2); font-weight: 600; font-size: 12px; flex: none; }
.cred-row .cr-v { flex: 1; font-family: var(--font-mono); font-size: 12.5px; }
.cred-row .cr-v.masked { letter-spacing: 2px; color: var(--text-3); }
.logged-cue { font-size: 10.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }

/* ===================== CONTROL PANEL (Appearance) ===================== */
.cog-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); display: grid; place-items: center; color: var(--text-2); transition: transform .2s var(--ease), color .15s;
}
.cog-fab:hover { color: var(--accent); transform: rotate(40deg); }
.cog-fab .ic { width: 22px; height: 22px; }
.panel {
  position: fixed; right: 20px; bottom: 78px; z-index: 61; width: 318px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); padding: 16px; transform-origin: bottom right;
  animation: popin .22s var(--ease);
}
@keyframes popin { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
.panel.hidden { display: none; }
.panel-h { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.panel-h .pt { font-weight: 700; font-size: 14px; flex: 1; }
.panel-section { padding: 13px 0; border-bottom: 1px solid var(--line); }
.panel-section:last-child { border-bottom: none; padding-bottom: 2px; }
.panel-section > .ps-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 9px; }
.seg-full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; border: 1px solid var(--line); }
.seg-full button { padding: 8px 6px; border-radius: var(--r-xs); font-weight: 600; font-size: 11.5px; color: var(--text-2); transition: all .14s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-full button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-full button .ic { width: 15px; height: 15px; }
.swatches { display: flex; gap: 9px; }
.swatch { width: 30px; height: 30px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; transition: transform .14s; position: relative; }
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.theme-card { border: 1.5px solid var(--line); border-radius: var(--r-sm); overflow: hidden; cursor: pointer; transition: border-color .14s, transform .14s; }
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--accent); }
.theme-card .tc-prev { height: 38px; display: flex; }
.theme-card .tc-lbl { font-size: 11px; font-weight: 600; text-align: center; padding: 6px 0; }

/* ===================== NEW SERVER (provisioning) ===================== */
.ns-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--gap); align-items: start; margin-top: 18px; }
@media (max-width: 980px) { .ns-grid { grid-template-columns: 1fr; } }
.ns-sec-lbl { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 14px; }
.ns-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ns-fields .input { width: 100%; box-sizing: border-box; }
.ns-seg { max-width: none; }

.pick-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.pick-chip { display: inline-flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 600; transition: border-color .14s, background .14s; }
.pick-chip input { position: absolute; opacity: 0; pointer-events: none; }
.pick-chip .pc-flag { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface-3); border-radius: 5px; padding: 2px 6px; }
.pick-chip .pc-code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
.pick-chip:hover { border-color: var(--line-strong); }
.pick-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pick-chip:has(input:checked) .pc-code { color: var(--accent); }

.pick-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick-cards.plans { grid-template-columns: 1fr 1fr; }
.pick-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 15px 16px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; transition: border-color .14s, background .14s; }
.pick-card input { position: absolute; opacity: 0; pointer-events: none; }
.pick-card:hover { border-color: var(--line-strong); }
.pick-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pick-card .pk-name { font-weight: 700; font-size: 14px; }
.pick-card .pk-sub, .pick-card .pk-specs { font-size: 12px; color: var(--text-2); }
.pick-card.plan { flex-direction: row; align-items: center; flex-wrap: wrap; }
.pick-card.plan .pk-name { flex: 1 0 100%; }
.pick-card.plan .pk-specs { flex: 1; }
.pick-card .pk-price { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.pick-card .pk-price small { font-size: 11px; font-weight: 600; color: var(--text-3); }

.ns-sticky { position: sticky; top: 18px; }
.ns-sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; padding: 6px 0; color: var(--text-2); }
.ns-sum-row b { color: var(--text); font-weight: 700; }
.ns-sum-row.total { font-size: 14px; }
.ns-sum-row.total b { font-size: 22px; letter-spacing: -.02em; }
.ns-sum-row.total b small { font-size: 12px; font-weight: 600; color: var(--text-3); }
.t3 { color: var(--text-3); }

/* ===================== TV DASHBOARD ===================== */
/* ── TV / NOC Dashboard ──────────────────────────────────────── */
.tv {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--tv-bg); color: var(--tv-fg);
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 22px 14px; overflow: hidden;
  /* Light theme — readable on any screen in daylight */
  --tv-bg: #F0F2F7; --tv-panel: #FFFFFF; --tv-panel-2: #E8EBF2; --tv-line: #D8DCE8;
  --tv-fg: #111827; --tv-fg-2: #5A6278; --tv-fg-3: #9BA3B8;
  --tv-ok: #16A34A; --tv-warn: #D97706; --tv-bad: #DC2626; --tv-accent: #2563EB;
}
[data-theme="dark"] .tv, [data-theme="clay"] .tv {
  /* Force light even in dark mode — TV screens need light theme */
  --tv-bg: #F0F2F7; --tv-panel: #FFFFFF; --tv-panel-2: #E8EBF2; --tv-line: #D8DCE8;
  --tv-fg: #111827; --tv-fg-2: #5A6278; --tv-fg-3: #9BA3B8;
  --tv-ok: #16A34A; --tv-warn: #D97706; --tv-bad: #DC2626; --tv-accent: #2563EB;
}
/* scanline removed for light theme */
.tv > * { position: relative; z-index: 2; }

/* Header */
.tv-head { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.tv-brand { display: flex; align-items: center; gap: 13px; flex-shrink: 0; }
.tv-brand .brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.tv-brand .brand-mark img { width: 28px; height: 28px; }
.tv-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--tv-fg); }
.tv-title small { display: block; font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--tv-fg-3); margin-top: 4px; }
.tv-live { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--tv-bad); flex-shrink: 0; }
.tv-live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--tv-bad); animation: tvpulse 1.6s infinite; }
.tv-banner { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 10px; flex-shrink: 0; }
.tv-banner .ic { width: 16px; height: 16px; }
.tv-banner.ok  { color: var(--tv-ok);  background: rgba(52,210,123,.1);  border: 1px solid rgba(52,210,123,.25); }
.tv-banner.bad { color: var(--tv-bad); background: rgba(255,92,106,.12); border: 1px solid rgba(255,92,106,.3); }
.tv-banner.bad .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--tv-bad); animation: tvpulse 1.6s infinite; }
.tv-chips { display: flex; gap: 7px; flex-shrink: 0; }
.tv-chip { font-size: 11px; font-weight: 800; letter-spacing: .07em; padding: 4px 10px; border-radius: 7px; }
.tv-chip.bad    { color: var(--tv-bad);    background: rgba(255,92,106,.15);  border: 1px solid rgba(255,92,106,.3); }
.tv-chip.warn   { color: var(--tv-warn);   background: rgba(242,178,62,.12);  border: 1px solid rgba(242,178,62,.25); }
.tv-chip.accent { color: var(--tv-accent); background: rgba(110,139,255,.15); border: 1px solid rgba(110,139,255,.3); }
.tv-chip.muted  { color: var(--tv-fg-3);   background: rgba(0,0,0,.04); border: 1px solid var(--tv-line); }
.tv-clock { font-family: var(--font-mono); text-align: right; flex-shrink: 0; }
.tv-clock .big { font-size: 34px; font-weight: 700; letter-spacing: .01em; line-height: 1; color: var(--tv-fg); }
.tv-clock .sm  { font-size: 11px; color: var(--tv-fg-2); margin-top: 4px; letter-spacing: .04em; }
.tv-exit { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--tv-panel-2); border: 1px solid var(--tv-line); color: var(--tv-fg-3); cursor: pointer; flex-shrink: 0; }
.tv-exit:hover { color: var(--tv-fg); border-color: var(--tv-fg-3); }
.tv-exit .ic { width: 18px; height: 18px; }

/* KPIs (6 cols) */
.tv-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; flex-shrink: 0; }
.tvk { background: var(--tv-panel); border: 1px solid var(--tv-line); border-radius: 14px; padding: 15px 18px; position: relative; overflow: hidden; }
.tvk::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tv-fg-3); }
.tvk.ok::before { background: var(--tv-ok); } .tvk.warn::before { background: var(--tv-warn); } .tvk.bad::before { background: var(--tv-bad); }
.tvk.accent::before { background: var(--tv-accent); } .tvk.neutral::before { background: var(--tv-fg-3); }
.tvk-lbl  { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tv-fg-3); }
.tvk-num  { font-size: 42px; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: 9px 0 6px; color: var(--tv-fg); display: flex; align-items: baseline; gap: 6px; }
.tvk.ok   .tvk-num { color: var(--tv-ok); } .tvk.warn .tvk-num { color: var(--tv-warn); } .tvk.bad .tvk-num { color: var(--tv-bad); } .tvk.accent .tvk-num { color: var(--tv-accent); }
.tvk-sub  { font-size: 19px; font-weight: 700; color: var(--tv-fg-3); letter-spacing: -.02em; }
.tvk-foot { font-size: 11px; font-family: var(--font-mono); color: var(--tv-fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Body */
.tv-body { flex: 1; display: grid; grid-template-columns: 1.5fr 1.1fr 1fr; gap: 14px; min-height: 0; }
.tv-panel { background: var(--tv-panel); border: 1px solid var(--tv-line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.tv-panel .tp-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tv-fg-2); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tv-panel .tp-lbl .ic { width: 15px; height: 15px; color: var(--tv-fg-3); }
.tv-panel .tp-lbl .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--tv-ok); animation: tvpulse 1.6s infinite; flex-shrink: 0; }
.tv-panel .tp-meta { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--tv-fg-3); font-family: var(--font-mono); letter-spacing: 0; text-transform: none; }

/* Fleet panel */
.tv-panel-fleet { gap: 10px; }
.tv-pool-avg { border-top: 1px solid var(--tv-line); padding-top: 12px; flex-shrink: 0; }

/* Server card grid */
.tv-srvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; flex: 1; min-height: 0; overflow-y: auto; align-content: start; }
.tv-srvgrid::-webkit-scrollbar { width: 4px; } .tv-srvgrid::-webkit-scrollbar-thumb { background: var(--tv-line); border-radius: 4px; }
.tvsrv { background: var(--tv-panel-2); border: 1px solid var(--tv-line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.tvsrv.hi-alert { border-color: rgba(255,92,106,.35); }
.tvsrv.stale { border-color: rgba(242,178,62,.25); opacity: .85; }
.tvsrv.offline { border-color: rgba(255,92,106,.25); opacity: .65; }
.tvsrv.provisioning { border-color: rgba(110,139,255,.3); }
.tvsrv.degraded { border-color: rgba(242,178,62,.3); }
.tvsrv-top { display: flex; align-items: center; gap: 7px; }
.tvsrv-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--tv-fg-3); }
.tvsrv.online .tvsrv-dot { background: var(--tv-ok); }
.tvsrv.offline .tvsrv-dot { background: var(--tv-bad); }
.tvsrv.degraded .tvsrv-dot { background: var(--tv-warn); animation: tvpulse 1.6s infinite; }
.tvsrv.provisioning .tvsrv-dot { background: var(--tv-accent); animation: tvpulse 1.6s infinite; }
.tvsrv-name  { flex: 1; font-size: 11.5px; font-weight: 700; color: var(--tv-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvsrv-badge { font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--tv-fg-3); background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }
.tvsrv-state { font-size: 11px; color: var(--tv-fg-3); }
.tvsrv-state.bad { color: var(--tv-bad); font-weight: 600; }
.tvsrv-meters { display: flex; flex-direction: column; gap: 4px; }
.tvsrv-meter { display: grid; grid-template-columns: 26px 1fr 30px; align-items: center; gap: 6px; }
.tvsrv-mlbl { font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; color: var(--tv-fg-3); }
.tvsrv-track { height: 4px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.tvsrv-fill { height: 100%; border-radius: 3px; transition: width .9s; background: var(--tv-ok); }
.tvsrv-fill.mid { background: var(--tv-warn); } .tvsrv-fill.hi { background: var(--tv-bad); }
.tvsrv-mpct { font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-align: right; color: var(--tv-fg-2); }
.tvsrv-mpct.mid { color: var(--tv-warn); } .tvsrv-mpct.hi { color: var(--tv-bad); }
.tvsrv-foot { font-family: var(--font-mono); font-size: 9.5px; color: var(--tv-fg-3); }
.tvsrv-foot.warn { color: var(--tv-warn); }

/* Pool avg bars */
.tv-cap { display: flex; flex-direction: column; gap: 10px; }
.tv-cap .cap-row { display: grid; grid-template-columns: 70px 1fr 46px; align-items: center; gap: 12px; }
.tv-cap .cap-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--tv-fg-2); }
.tv-cap .cap-track { height: 11px; border-radius: 6px; background: var(--tv-panel-2); overflow: hidden; }
.tv-cap .cap-fill  { height: 100%; border-radius: 6px; transition: width 1s; background: var(--tv-ok); }
.tv-cap .cap-fill.mid { background: var(--tv-warn); } .tv-cap .cap-fill.hi { background: var(--tv-bad); }
.tv-cap .cap-val { font-family: var(--font-mono); font-size: 15px; font-weight: 700; text-align: right; color: var(--tv-fg); }

/* Issues panel */
.tv-issues { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; overflow-y: auto; }
.tv-issues::-webkit-scrollbar { width: 4px; } .tv-issues::-webkit-scrollbar-thumb { background: var(--tv-line); border-radius: 4px; }
.tvi-section { flex-shrink: 0; }
.tvi-hdr { font-size: 9.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--tv-fg-3); display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--tv-line); }
.tvi-hdr-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.tvi-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--tv-fg-2); }
.tvi-item { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-radius: 8px; background: var(--tv-panel-2); margin-bottom: 4px; }
.tvi-ic { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; flex-shrink: 0; margin-top: 1px; }
.tvi-ic .ic { width: 12px; height: 12px; }
.tvi-ic.critical { background: rgba(255,92,106,.15); color: var(--tv-bad); }
.tvi-ic.warning  { background: rgba(242,178,62,.12);  color: var(--tv-warn); }
.tvi-ic.info     { background: rgba(110,139,255,.14); color: var(--tv-accent); }
.tvi-ic.muted    { background: rgba(255,255,255,.05); color: var(--tv-fg-3); }
.tvi-body  { flex: 1; min-width: 0; }
.tvi-title { font-size: 12px; font-weight: 700; color: var(--tv-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvi-sub   { font-family: var(--font-mono); font-size: 10.5px; color: var(--tv-fg-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvi-allclear { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.tvi-allclear .ic { width: 36px; height: 36px; color: var(--tv-ok); opacity: .7; }
.tvi-allclear-title { font-size: 14px; font-weight: 700; color: var(--tv-ok); }
.tvi-allclear-sub   { font-size: 11px; color: var(--tv-fg-3); font-family: var(--font-mono); }
.tvi-none { font-size: 12px; color: var(--tv-fg-3); padding: 24px; text-align: center; font-style: italic; }

/* Live feed */
.tv-feed { display: flex; flex-direction: column; gap: 1px; flex: 1; min-height: 0; overflow-y: auto; }
.tv-feed::-webkit-scrollbar { width: 4px; } .tv-feed::-webkit-scrollbar-thumb { background: var(--tv-line); border-radius: 4px; }
.tvfi { display: flex; gap: 11px; align-items: flex-start; padding: 10px 4px; border-bottom: 1px solid var(--tv-line); }
.tvfi:last-child { border-bottom: none; }
.tvfi-ic { width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center; background: var(--tv-panel-2); color: var(--tv-fg-2); }
.tvfi-ic .ic { width: 14px; height: 14px; }
.tvfi.ok     .tvfi-ic { color: var(--tv-ok);     background: rgba(52,210,123,.12); }
.tvfi.accent .tvfi-ic { color: var(--tv-accent); background: rgba(110,139,255,.14); }
.tvfi.danger .tvfi-ic { color: var(--tv-bad);    background: rgba(255,92,106,.14); }
.tvfi.warn   .tvfi-ic { color: var(--tv-warn);   background: rgba(242,178,62,.14); }
.tvfi-body  { flex: 1; min-width: 0; }
.tvfi-text  { font-size: 12.5px; color: var(--tv-fg); line-height: 1.4; }
.tvfi-text b { font-weight: 700; }
.tvfi-meta  { font-family: var(--font-mono); font-size: 10.5px; color: var(--tv-fg-3); margin-top: 3px; }
.tvfi.enter { animation: feedin .35s var(--ease); }

/* Footer */
.tv-foot { display: flex; align-items: center; gap: 20px; font-size: 11.5px; color: var(--tv-fg-2); font-family: var(--font-mono); flex-shrink: 0; }
.tv-foot .tvf { display: flex; align-items: center; gap: 7px; }
.tv-foot .tvf .ic { width: 13px; height: 13px; color: var(--tv-fg-3); }

@keyframes tvpulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes feedin  { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

/* utility: hide on small */
.icon-only { display: none; }

/* ===================== SITE DETAIL (everything-in-one-screen) ===================== */
.alert-banner {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.alert-banner.warn { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); background: var(--warning-soft); }
.alert-banner.warn > .ic { color: var(--warning); width: 22px; height: 22px; flex: none; }

/* detail tab header — roomy, aligned with content */
.detail-card { overflow: hidden; margin-top: 4px; }
.detail-tabs { padding: 5px 12px 0; gap: 2px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.detail-tabs::-webkit-scrollbar { height: 0; }
.detail-tabs .tab { padding: 14px 16px; white-space: nowrap; }
.tab:focus { outline: none; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; border-radius: 8px; }
.tab-body { padding: 24px; }
[data-density="compact"] .tab-body { padding: 16px; }
.site-kpis { margin-bottom: var(--gap); }

/* overview grid (shared by domain / settings / access tabs) */
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
@media (max-width: 920px) { .ov-grid { grid-template-columns: 1fr; } }
.ov-facts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 32px; }
@media (max-width: 880px) { .ov-facts { grid-template-columns: 1fr; } }
.site-chart { width: 100%; height: 150px; display: block; margin: 4px 0 2px; }
.ov-chart-legend { display: flex; gap: 26px; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.ov-chart-legend b { color: var(--text); font-weight: 700; margin-right: 3px; }
.segmented.sm button { padding: 4px 10px; font-size: 11px; }
.set-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }

/* db / deploy summary bar */
.db-bar { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; padding: 4px 2px 2px; }
.db-stat { display: flex; flex-direction: column; gap: 3px; }
.db-stat .dbs-k { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.db-stat .dbs-v { font-size: 13px; font-weight: 600; }
.db-stat .dbs-v.mono { font-family: var(--font-mono); font-size: 12px; }

/* SQL console */
.sql-console { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.sql-head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.sql-head .ic { width: 16px; height: 16px; color: var(--text-2); }
.sql-input { display: flex; gap: 10px; padding: 13px 14px; align-items: flex-start; }
.sql-prompt { color: var(--accent); font-weight: 700; font-size: 13px; padding-top: 2px; flex: none; }
.sql-ta { flex: 1; border: none; outline: none; resize: vertical; background: none; color: var(--text); font-size: 13px; line-height: 1.6; }
.sql-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* logs */
.logs-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.log-file { font-size: 11.5px; color: var(--text-3); }
.log-live { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; color: var(--success); }
.log-live .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: tvpulse 2s infinite; }
.log-term {
  background: var(--term-bg, #0C0E14); color: #cfd6e6; border-radius: var(--r-md); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.85; padding: 14px 16px; max-height: 420px; overflow: auto;
}
.log-term .lg { white-space: pre-wrap; word-break: break-word; }
.log-term .lg + .lg { margin-top: 1px; }
.lg-dim { color: #6b7689; }
.lg-m { color: #7aa2f7; font-weight: 600; }
.lg-ok { color: #9ece6a; }
.lg-warn { color: #e0af68; }
.lg-err { color: #f7768e; font-weight: 600; }

/* deployments */
.dep-list { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.dep-row {
  display: grid; grid-template-columns: 104px 78px 1fr auto 56px 76px auto; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); transition: background .12s;
}
.dep-row:last-child { border-bottom: none; }
.dep-row:hover { background: var(--surface-2); }
.dep-row.head { background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); }
.dep-hash { font-size: 12px; color: var(--text-2); }
.dep-msg { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep-meta { display: flex; align-items: center; gap: 10px; font-size: 11.5px; }
.dep-branch { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.dep-branch .ic { width: 13px; height: 13px; }
.dep-dur { font-size: 11.5px; color: var(--text-3); text-align: right; }
.dep-when { font-size: 11.5px; white-space: nowrap; }
@media (max-width: 1100px) { .dep-row { grid-template-columns: 100px 1fr auto; } .dep-row .dep-meta, .dep-row .dep-dur, .dep-row .dep-when { display: none; } }

/* domain rows */
.dom-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dom-row:last-of-type { border-bottom: none; }
.dom-row .grow { flex: 1; }

/* settings */
.set-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.set-fields .input { width: 100%; box-sizing: border-box; }

/* toggle switch */
.tgl-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tgl-row:last-child { border-bottom: none; }
.tgl-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tgl-txt b { font-size: 13px; font-weight: 600; }
.tgl-txt span { font-size: 11.5px; color: var(--text-3); }
.tgl { width: 40px; height: 23px; border-radius: 20px; background: var(--line-strong); position: relative; flex: none; transition: background .18s var(--ease); }
.tgl i { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s var(--ease); }
.tgl.on { background: var(--accent); }
.tgl.on i { transform: translateX(17px); }

/* ============================================================
   RESPONSIVE — make ServerDeck work on every screen size
   ============================================================ */
.dh-actions { display: flex; gap: 8px; align-self: center; flex-wrap: wrap; }
.crumb { min-width: 0; }

/* large desktop → laptop: tighten chrome */
@media (max-width: 1180px) {
  .page { padding: 22px 22px 56px; }
  .hub-top, .topbar { padding-left: 20px; padding-right: 20px; }
}

/* tablet landscape: collapse the persistent sidebar to an icon rail */
@media (max-width: 980px) {
  .shell.sidebar { grid-template-columns: 64px 1fr; }
  [data-density="compact"] .shell.sidebar { grid-template-columns: 64px 1fr; }
  .sidebar-nav .brand { justify-content: center; padding: 16px 0; }
  .sidebar-nav .brand > span:last-child,
  .nav-item .lbl, .nav-item .nav-count, .nav-item .nav-badge,
  .nav-group-label, .nav-foot .who, .nav-foot > .ic { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-scroll { padding: 8px 8px 12px; }
  .nav-group-label { padding: 8px 0 4px; }
  .nav-foot { justify-content: center; padding: 12px 0; }
  .areas { grid-template-columns: 1fr 1fr; }
}

/* tablet portrait */
@media (max-width: 860px) {
  .detail-head .dh-id { font-size: 20px; }
  .detail-head .dh-actions { width: 100%; }
  .detail-head .dh-actions .btn { flex: 1; min-width: max-content; }
  .detail-grid { grid-template-columns: 1fr; }
  .ns-fields, .set-fields { grid-template-columns: 1fr; }
}

/* phones: top bars stack, search goes full-width, secondary chrome hides */
@media (max-width: 760px) {
  .page { padding: 16px 14px 48px; }
  .hub-top, .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 8px; min-height: 0; }
  .hub-top .search, .topbar .search { order: 9; width: 100%; flex: 1 0 100%; }
  .topbar.sub { padding: 9px 14px; }
  .hub-clock, .kbd { display: none; }
  .estate-status .es-text, .user-chip .uc-text, .hb-div { display: none; }
  .user-chip { padding: 4px; }
  .quick-actions { width: 100%; }
  .quick-actions .btn { flex: 1; }
  .areas { grid-template-columns: 1fr; }
  .live-card { min-height: 300px; }
  .ov-chart-legend { gap: 14px; }
  .db-bar { gap: 16px; }
}

/* small phones */
@media (max-width: 520px) {
  .kpi-strip, .site-kpis { grid-template-columns: 1fr; }
  .topbar.sub .crumb { display: none; }
  .topbar.sub { justify-content: flex-end; }
  .detail-head .dh-actions { flex-direction: column; }
  .detail-head .dh-actions .btn { width: 100%; }
  .page-title { font-size: 21px; }
  .stat .num { font-size: 25px; }
  .back-btn span { display: none; }
  .back-btn { padding: 8px; }
}

/* ── Servers page sub-navigation ─────────────────────────── */
.srv-subnav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
@media (max-width: 700px) { .srv-subnav { grid-template-columns: 1fr; } }

.srv-subnav-card {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  cursor: pointer;
}
.srv-subnav-card:hover {
  border-color: var(--accent); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.srv-subnav-card > .ic { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.srv-subnav-card > .ic:last-child { color: var(--text-3); margin-left: auto; flex-shrink: 0; }
.srv-subnav-card:hover > .ic:last-child { color: var(--accent); }
.snc-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.snc-body span:first-child { font-size: 13px; font-weight: 700; color: var(--text); }
.snc-body .t2 { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
