:root {
  --bg: #0c1117;
  --panel: #141b24;
  --panel-soft: #101720;
  --panel-border: rgba(135, 160, 190, .16);
  --panel-border-bright: rgba(84, 163, 218, .34);
  --panel-hover: #1a2430;
  --text: #f6f8fb;
  --muted: #9aa8b8;
  --muted-2: #738191;
  --dim: #6f7c8f;
  --accent: #12639a;
  --accent-bright: #4fb4e7;
  --accent-soft: rgba(79, 180, 231, .12);
  --accent-deep: #082f4a;
  --gold: #d5b15f;
  --warning: #e6aa42;
  --warning-soft: rgba(230, 170, 66, .12);
  --danger: #e85d68;
  --danger-soft: rgba(232, 93, 104, .12);
  --info: #5c9ee6;
  --topbar: #07111a;
  --shadow: 0 24px 56px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { font-family: "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--text); letter-spacing: 0; }
button, input, select { font: inherit; }
button, input, select { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible { box-shadow: 0 0 0 2px rgba(77, 141, 255, .34); }

.app-shell {
  display: grid;
  grid-template: 62px 1fr / 238px 1fr;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.titlebar {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: 238px 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  background: var(--topbar);
  -webkit-app-region: drag;
  user-select: none;
}

.brand-lockup { height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-right: 1px solid var(--panel-border); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(79, 180, 231, .34); border-radius: 8px; background: #063454; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.product-name { font-size: 14px; letter-spacing: 0; font-weight: 800; }
.product-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; letter-spacing: 0; }

.connection-pill { justify-self: end; display: flex; align-items: center; gap: 7px; margin-right: 18px; padding: 7px 10px; border: 1px solid var(--panel-border); border-radius: 999px; background: rgba(30, 47, 59, .46); color: #aebdcc; font-size: 11px; letter-spacing: 0; }
.connection-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.connection-pill b { font-size: inherit; }
.connection-pill.online { color: #dff5ff; border-color: rgba(79, 180, 231, .34); }
.connection-pill.online span { background: var(--accent-bright); box-shadow: 0 0 10px rgba(79, 180, 231, .5); }
.connection-pill.offline { color: #e4a4aa; border-color: rgba(232, 93, 104, .28); }
.connection-pill.offline span { background: var(--danger); }

.window-controls { height: 100%; display: flex; -webkit-app-region: no-drag; }
.window-controls button { width: 46px; border: 0; color: #aab5c4; background: transparent; font-size: 16px; cursor: pointer; }
.window-controls button:hover { background: var(--panel-hover); color: white; }
.window-controls .close:hover { background: #c83b47; }

.sidebar { grid-row: 2; display: flex; flex-direction: column; justify-content: space-between; min-height: 0; padding: 20px 12px 16px; border-right: 1px solid var(--panel-border); background: #0f1418; }
nav { display: flex; flex-direction: column; gap: 5px; }
.nav-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.nav-group-label { padding: 0 11px 3px; color: #5f6c7d; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-left: 2px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; transition: .18s ease; }
.nav-item.sub { min-height: 34px; padding-left: 23px; font-size: 12px; }
.nav-item span { display: grid; place-items: center; width: 18px; height: 18px; color: #8994a3; font-size: 11px; font-weight: 800; border: 0; border-radius: 0; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .035); }
.nav-item.active { color: white; border-left-color: var(--accent-bright); background: var(--accent-soft); box-shadow: none; }
.nav-item.active span { color: var(--gold); }
.version { padding: 12px 13px 0; color: var(--dim); font-size: 11px; letter-spacing: 0; }

.content { grid-row: 2; min-width: 0; overflow: auto; padding: 32px 38px 40px; scrollbar-color: #2b384a transparent; }
.page { display: none; max-width: 1500px; margin: 0 auto; }
.page.active { display: block; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--dim) !important; font-size: 11px !important; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
h1 { margin: 0; font-size: 22px; letter-spacing: 0; font-weight: 650; }
h2 { margin: 0; font-size: 14px; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions, .command-actions { display: flex; align-items: center; gap: 10px; }

.button { min-height: 37px; border: 1px solid #2a3647; border-radius: 6px; padding: 9px 14px; font-size: 11px; font-weight: 750; cursor: pointer; transition: .16s ease; }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button.primary, .button.success { border-color: #1470ad; background: #1470ad; color: #fff; }
.button.primary:hover:not(:disabled), .button.success:hover:not(:disabled) { filter: brightness(1.08); }
.button.secondary { background: transparent; color: #dce5ef; border-color: var(--panel-border); }
.button.secondary:hover:not(:disabled) { background: rgba(255, 255, 255, .035); }
.button.warning { border-color: rgba(230, 170, 66, .55); background: var(--warning-soft); color: #f0bd65; }
.button.warning:hover:not(:disabled) { background: rgba(230, 170, 66, .2); }
.button.danger { border-color: rgba(232, 93, 104, .55); background: var(--danger-soft); color: #f07781; }
.button.danger:hover:not(:disabled) { background: rgba(232, 93, 104, .2); }
.button.full { width: 100%; }
.text-button { border: 0; background: transparent; color: #7fb0f2; font-size: 13px; font-weight: 700; cursor: pointer; }
.text-button:hover { color: #fff; }

.status-banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; margin-bottom: 18px; padding: 15px 17px; border: 1px solid rgba(32, 198, 179, .25); border-radius: 8px; background: rgba(32, 198, 179, .08); }
.status-banner.offline { border-color: rgba(232, 93, 104, .3); background: linear-gradient(90deg, rgba(232, 93, 104, .09), rgba(232, 93, 104, .02)); }
.status-banner.degraded { border-color: rgba(230, 170, 66, .3); background: linear-gradient(90deg, rgba(230, 170, 66, .09), rgba(230, 170, 66, .02)); }
.status-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(32, 198, 179, .12); color: #d9f5f1; font-weight: 900; }
.status-banner.offline .status-icon { background: var(--danger-soft); color: #ee727c; }
.status-banner.degraded .status-icon { background: var(--warning-soft); color: #edb85b; }
.status-banner strong { display: block; font-size: 13px; }
.status-banner span { display: block; margin-top: 3px; color: #7f8d9e; font-size: 11px; }
.status-time { color: #687588; font-size: 11px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel, .service-card { border: 1px solid var(--panel-border); border-radius: 8px; background: var(--panel); box-shadow: none; }
.metric-card { min-height: 164px; padding: 18px; }
.metric-label { color: #758297; font-size: 10px; font-weight: 800; letter-spacing: 0; }
.metric-value { margin-top: 15px; font-size: 31px; font-weight: 750; letter-spacing: 0; }
.metric-value small { color: #718095; font-size: 13px; font-weight: 600; }
.metric-state { margin-top: 20px; font-size: 25px; font-weight: 750; letter-spacing: 0; text-transform: capitalize; }
.meter { height: 4px; margin-top: 17px; overflow: hidden; border-radius: 9px; background: #263141; }
.meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1470ad, #d5b15f); transition: width .5s ease; }
.metric-trend { display: inline-block; margin-top: 15px; padding: 5px 7px; border-radius: 4px; font-size: 10px; }
.metric-trend.neutral { color: #9aa6b7; background: #202a38; }
.metric-trend.good { color: #d9f5f1; background: rgba(32, 198, 179, .08); }
.metric-trend.bad { color: #f0838c; background: var(--danger-soft); }
.metric-foot { margin-top: 12px; color: #657286; font-size: 10px; }

.two-column { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; margin-top: 14px; }
.two-column.balanced { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { padding: 20px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 17px; border-bottom: 1px solid var(--panel-border); }
.panel-header p { margin: 5px 0 0; color: #6f7c8f; font-size: 10px; }
.live-dot { color: #d9f5f1; font-size: 11px; letter-spacing: 0; white-space: nowrap; }
.live-dot::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent-bright); }
.live-dot.stale { color: #e3ae54; }
.live-dot.stale::before { background: var(--warning); }
.count-pill { min-width: 28px; padding: 5px 8px; border-radius: 999px; background: rgba(255, 255, 255, .04); border: 1px solid var(--panel-border); color: #b9c4d3; font-size: 11px; font-weight: 800; text-align: center; }
.security-mark { color: #d9f5f1; font-size: 11px; font-weight: 800; letter-spacing: 0; }

.service-summary-list { padding-top: 5px; }
.service-summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid #1d2734; }
.service-summary:last-child { border: 0; }
.service-summary .service-symbol { width: 30px; height: 30px; }
.service-summary strong { display: block; font-size: 11px; }
.service-summary p { margin: 4px 0 0; color: #687588; font-size: 9px; }
.host-list { margin: 3px 0 0; }
.host-list div { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid #1d2734; }
.host-list div:last-child { border: 0; }
.host-list dt { color: #748195; font-size: 10px; }
.host-list dd { max-width: 68%; margin: 0; overflow-wrap: anywhere; color: #d9e2ee; font-size: 10px; text-align: right; }

.health-panel, .timeline-panel, .recovery-panel, .section-panel { margin-top: 14px; }
.grade-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding-top: 17px; }
.grade-grid.five { margin-bottom: 14px; padding: 0; }
.grade-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 13px 14px; border: 1px solid #202b39; border-radius: 7px; background: #101721; }
.grade-card span { color: #8d9aac; font-size: 9px; font-weight: 800; letter-spacing: 0; }
.health-badge { display: inline-block; padding: 5px 8px; border-radius: 4px; font-size: 9px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; white-space: nowrap; }
.health-badge.good, .health-badge.healthy, .health-badge.running, .health-badge.online { color: #7ad8ad; background: rgba(38, 159, 104, .12); border: 1px solid rgba(77, 192, 136, .32); }
.health-badge.degraded, .health-badge.warning, .health-badge.starting, .health-badge.restarting, .health-badge.stopping { color: #efbb61; background: var(--warning-soft); }
.health-badge.critical, .health-badge.offline, .health-badge.failed, .health-badge.crashed, .health-badge.error { color: #f07781; background: var(--danger-soft); }
.health-badge.unknown, .health-badge.unavailable, .health-badge.stopped { color: #a6b1c0; background: #202a38; }

.timeline { padding-top: 5px; }
.timeline-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid #1d2734; }
.timeline-item:last-child { border: 0; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: #4b5668; }
.timeline-dot.success, .timeline-dot.info { background: var(--accent-bright); box-shadow: 0 0 10px rgba(32, 198, 179, .35); }
.timeline-dot.warning { background: var(--warning); }
.timeline-dot.error, .timeline-dot.critical { background: var(--danger); }
.timeline-item strong { font-size: 11px; }
.timeline-item p { margin: 4px 0 0; color: #687588; font-size: 10px; white-space: pre-wrap; }
.timeline-item time { color: #5f6b7d; font-size: 9px; white-space: nowrap; }
.empty-row, .empty-state-small { padding: 28px 10px; color: #667386; font-size: 10px; text-align: center; }

.command-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.command-copy { display: flex; align-items: center; gap: 13px; }
.command-copy p { margin: 5px 0 0; color: #748195; font-size: 10px; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #657286; box-shadow: 0 0 0 5px rgba(101, 114, 134, .1); }
.status-dot.running, .status-dot.healthy, .status-dot.online { background: var(--accent-bright); box-shadow: 0 0 0 5px rgba(32, 198, 179, .08); }
.status-dot.restarting, .status-dot.starting, .status-dot.stopping { background: var(--warning); box-shadow: 0 0 0 5px var(--warning-soft); }
.status-dot.offline, .status-dot.failed, .status-dot.crashed { background: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }
.service-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.service-card { min-width: 0; padding: 20px; }
.service-card-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding-bottom: 17px; border-bottom: 1px solid #202a38; }
.service-card-head h2 { font-size: 13px; }
.service-card-head p { margin: 4px 0 0; color: #687588; font-size: 9px; line-height: 1.4; }
.service-symbol { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(79, 180, 231, .26); border-radius: 8px; background: rgba(79, 180, 231, .1); color: #fff; font-size: 11px; font-weight: 900; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 15px 0 0; background: #202a38; }
.detail-grid.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.detail-grid div { min-width: 0; padding: 13px; background: #101721; }
.detail-grid dt { color: #69768a; font-size: 9px; }
.detail-grid dd { margin: 6px 0 0; overflow-wrap: anywhere; color: #dce5f0; font-size: 11px; }

.telemetry-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding-top: 17px; }
.telemetry-value { min-width: 0; padding: 14px; border: 1px solid #202a38; border-radius: 7px; background: #0f1620; }
.telemetry-value span { display: block; color: #738094; font-size: 9px; }
.telemetry-value strong { display: block; margin-top: 8px; color: #e4edf8; font-size: 16px; }
.telemetry-value.total { border-color: rgba(32, 198, 179, .22); background: rgba(32, 198, 179, .08); }
.telemetry-value.total strong { color: #d9f5f1; }
.stage-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #202a38; }
.stage-chip { padding: 6px 8px; border-radius: 4px; background: #1a2432; color: #8290a3; font-family: Consolas, monospace; font-size: 9px; }

.quality-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.quality-card { min-height: 255px; }
.quality-score { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 18px 0 12px; border-bottom: 1px solid #202a38; }
.quality-score strong { color: #f4f8fd; font-size: 26px; font-weight: 760; }
.quality-score span { color: #718095; font-size: 10px; }
.quality-factors { min-height: 86px; margin: 14px 0 0; padding: 0 0 0 17px; color: #c8d5e4; font-size: 11px; line-height: 1.55; }
.quality-factors li { margin-bottom: 6px; }
.quality-rule { margin: 14px 0 0; padding-top: 13px; border-top: 1px solid #202a38; color: #748195; font-size: 10px; line-height: 1.6; }

.metric-list { margin: 5px 0 0; }
.metric-list div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 2px; border-bottom: 1px solid #1d2734; }
.metric-list div:last-child { border: 0; }
.metric-list dt { color: #758297; font-size: 9px; }
.metric-list dd { margin: 0; color: #e1e9f3; font-family: Consolas, "Courier New", monospace; font-size: 10px; text-align: right; }
.table-scroll { overflow: auto; margin-top: 16px; scrollbar-color: #2b384a transparent; }
.data-table { width: 100%; min-width: 1400px; border-collapse: collapse; }
.traffic-table { min-width: 760px; }
.data-table th { padding: 10px; border-bottom: 1px solid #2a3646; color: #718095; font-size: 8px; letter-spacing: 0; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { max-width: 220px; padding: 11px 10px; border-bottom: 1px solid #1c2633; overflow: hidden; color: #cdd7e4; font-family: Consolas, "Courier New", monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(92, 158, 230, .04); }
.data-table tr.recent-disconnect td { color: #7e8a9b; background: rgba(232, 93, 104, .025); }
.data-table .empty-cell { padding: 32px; color: #667386; font-family: inherit; text-align: center; }

.vocoder-hero { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); align-items: center; gap: 0; margin-bottom: 14px; padding: 0; overflow: hidden; }
.vocoder-hero > div { min-height: 104px; padding: 22px; border-right: 1px solid #202a38; }
.vocoder-hero > div:last-child { border: 0; }
.vocoder-hero strong { display: block; margin-top: 12px; font-size: 22px; }
.vocoder-hero .large-grade { color: #a6b1c0; font-size: 18px; }
.vocoder-hero .large-grade.good { color: #7ad8ad; }
.vocoder-hero .large-grade.degraded { color: #efbb61; }
.vocoder-hero .large-grade.critical { color: #f07781; }
.vocoder-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 17px 0 0; background: #202a38; }
.vocoder-grid div { display: flex; justify-content: space-between; gap: 16px; min-width: 0; padding: 13px; background: #101721; }
.vocoder-grid dt { color: #748195; font-size: 9px; }
.vocoder-grid dd { margin: 0; color: #e0e9f4; font-family: Consolas, "Courier New", monospace; font-size: 10px; text-align: right; }

.community-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding-top: 18px; }
.community-card { min-width: 0; padding: 17px; border: 1px solid #202b39; border-radius: 8px; background: #101721; }
.community-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.community-head strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.community-online { margin-top: 18px; color: #f4f7fb; font-size: 34px; font-weight: 800; line-height: 1; }
.community-card p { margin: 7px 0 0; color: #8794a6; font-size: 10px; }
.community-card small { display: block; margin-top: 16px; overflow: hidden; color: #657286; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.management-layout { display: grid; grid-template-columns: minmax(320px, .74fr) minmax(0, 1.26fr); gap: 14px; margin-top: 14px; }
.management-actions, .upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 12px 0; }
.management-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 16px; }
.json-editor { width: 100%; min-height: 260px; margin-top: 12px; padding: 12px; border: 1px solid #202b39; border-radius: 6px; background: #0b1119; color: #dce7f2; font: 10px/1.55 Consolas, "Courier New", monospace; resize: vertical; }
.management-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.management-columns h2 { margin-bottom: 9px; color: #dce5ef; font-size: 12px; }
.compact-list, .active-server-list { padding-top: 4px; }
.compact-row, .active-server-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid #1d2734; }
.compact-row:last-child, .active-server-row:last-child { border-bottom: 0; }
.compact-row strong, .active-server-row strong { display: block; color: #edf5fc; font-size: 11px; }
.compact-row small, .active-server-row small { display: block; margin-top: 4px; overflow-wrap: anywhere; color: #738195; font-size: 9px; }
.active-server-row .button { min-height: 29px; padding: 6px 9px; }

.scanner-layout { display: grid; grid-template-columns: minmax(340px, .82fr) minmax(0, 1.18fr); gap: 14px; }
.scanner-community-list, .active-channel-list { padding-top: 5px; }
.scanner-community { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid #1d2734; cursor: pointer; }
.scanner-community:last-child { border-bottom: 0; }
.scanner-community input { width: 17px; height: 17px; accent-color: var(--accent-bright); }
.scanner-community strong { display: block; min-width: 0; overflow: hidden; color: #ecf4fb; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.scanner-community small { display: block; margin-top: 4px; color: #738195; font-size: 9px; }
.scanner-monitor { min-height: 500px; }
.scanner-priority { margin: 7px 0 5px; padding: 8px 10px; border: 1px solid #1d2734; border-radius: 6px; color: #8491a5; font-size: 10px; letter-spacing: 0; text-transform: uppercase; }
.scanner-priority.active { border-color: rgba(69, 190, 255, .45); background: rgba(69, 190, 255, .08); color: #dff6ff; }
.active-channel { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 3px; border-bottom: 1px solid #1d2734; }
.active-channel.priority { padding-left: 10px; border-left: 3px solid var(--accent-bright); background: rgba(69, 190, 255, .07); }
.active-channel:last-child { border: 0; }
.active-channel strong { display: block; color: #fff; font-size: 12px; }
.active-channel small { display: block; margin-top: 5px; color: #8391a5; font-size: 10px; }
.active-channel time { color: var(--gold); font-size: 9px; white-space: nowrap; }

.schedule-layout, .settings-layout, .builder-layout { display: grid; grid-template-columns: minmax(280px, .68fr) minmax(280px, .68fr) minmax(0, 1.1fr); gap: 14px; }
.settings-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.builder-layout { grid-template-columns: minmax(360px, .95fr) minmax(320px, .75fr); }
.lower-settings { margin-top: 14px; }
.schedule-form-panel form, #settingsForm { padding-top: 18px; }
.field { display: block; margin-bottom: 16px; }
.field > span, .compact-field > span { display: block; margin-bottom: 7px; color: #8390a2; font-size: 9px; font-weight: 700; }
.field input, .field select, .compact-field select { width: 100%; height: 39px; border: 1px solid var(--panel-border); border-radius: 6px; padding: 0 11px; background: #10151a; color: #fff; font-size: 12px; }
.field input:focus, .field select:focus, .compact-field select:focus { border-color: #5d91d6; }
.toggle-field { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; color: #c8d3df; font-size: 11px; cursor: pointer; }
.toggle-field input { width: 16px; height: 16px; accent-color: var(--accent); }
.day-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 0 0 18px; padding: 0; border: 0; }
.day-picker legend { grid-column: 1 / -1; margin-bottom: 7px; color: #8390a2; font-size: 9px; font-weight: 700; }
.day-picker label { position: relative; }
.day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker span { display: grid; place-items: center; height: 34px; border: 1px solid #2a3647; border-radius: 5px; background: #0c121b; color: #7b889a; font-size: 9px; cursor: pointer; }
.day-picker input:checked + span { border-color: rgba(32, 198, 179, .32); background: rgba(32, 198, 179, .08); color: #d9f5f1; }
.day-picker input:focus-visible + span { box-shadow: 0 0 0 2px rgba(77, 141, 255, .34); }
.schedule-list { padding-top: 5px; }
.schedule-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; padding: 14px 2px; border-bottom: 1px solid #1d2734; }
.schedule-item:last-child { border: 0; }
.schedule-clock { display: grid; place-items: center; width: 44px; height: 38px; border-radius: 6px; background: rgba(32, 198, 179, .08); color: #d9f5f1; font-family: Consolas, monospace; font-size: 12px; font-weight: 800; }
.schedule-item.quick .schedule-clock { background: var(--warning-soft); color: #efbb61; }
.schedule-item strong { display: block; font-size: 11px; }
.schedule-item p { margin: 4px 0 0; color: #69768a; font-size: 9px; }
.icon-button { width: 31px; height: 31px; border: 1px solid rgba(232, 93, 104, .38); border-radius: 5px; background: var(--danger-soft); color: #ec737d; cursor: pointer; }
.icon-button:hover { background: rgba(232, 93, 104, .2); }
.compact-field { display: flex; align-items: center; gap: 8px; }
.compact-field > span { margin: 0; }
.compact-field select { width: 118px; height: 37px; }

.log-layout { display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(0, .86fr); gap: 14px; }
.log-panel { min-height: 520px; }
.log-list { max-height: calc(100vh - 260px); overflow: auto; margin-top: 8px; scrollbar-color: #2b384a transparent; }
.log-entry { display: grid; grid-template-columns: 145px 70px 1fr; gap: 14px; padding: 12px 4px; border-bottom: 1px solid #1c2633; font-family: Consolas, "Courier New", monospace; font-size: 9px; }
.log-entry:last-child { border: 0; }
.log-entry time { color: #667386; }
.log-level { font-weight: 800; text-transform: uppercase; }
.log-level.info, .log-level.success { color: #5bd795; }
.log-level.warn, .log-level.warning { color: #efbb61; }
.log-level.error, .log-level.fatal, .log-level.critical { color: #f07781; }
.log-message { min-width: 0; overflow-wrap: anywhere; color: #c7d1de; white-space: pre-wrap; }
.radio-log-list { max-height: calc(100vh - 260px); overflow: auto; margin-top: 8px; scrollbar-color: #2b384a transparent; }
.radio-log-entry { padding: 14px 4px; border-bottom: 1px solid #1c2633; }
.radio-log-entry:last-child { border: 0; }
.radio-log-top { display: flex; justify-content: space-between; gap: 15px; }
.radio-log-top strong { min-width: 0; overflow: hidden; color: #ecf4fb; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.radio-log-top time { color: #6d7b8f; font-size: 9px; white-space: nowrap; }
.radio-log-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.radio-log-meta span { padding: 5px 7px; border: 1px solid #223044; border-radius: 4px; background: #0f1620; color: #9eb0c5; font-family: Consolas, "Courier New", monospace; font-size: 9px; }
.radio-log-entry p { margin: 10px 0 0; color: #c7d1de; font-size: 10px; line-height: 1.55; white-space: pre-wrap; }

.input-action { display: flex; gap: 8px; }
.input-action input { flex: 1; min-width: 0; }
.field-note { margin: -7px 0 16px; overflow-wrap: anywhere; color: #708095; font-size: 9px; line-height: 1.5; }
.builder-form-panel form { padding-top: 18px; }
.oracle-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.oracle-command-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.oracle-command-controls .toggle-field { margin-bottom: 0; }
.oracle-command-controls .compact-field select { width: 144px; }
.oracle-trace { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.oracle-trace div { min-width: 0; border: 1px solid var(--panel-border); border-radius: 8px; background: #101720; padding: 13px; }
.oracle-trace span { display: block; margin-bottom: 8px; color: #748195; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.oracle-trace p { min-height: 58px; margin: 0; overflow-wrap: anywhere; color: #d9e2ee; font-size: 11px; line-height: 1.45; }
.resource-drop-zone { display: grid; place-items: center; min-height: 92px; margin-bottom: 8px; border: 1px dashed rgba(79, 180, 231, .38); border-radius: 7px; background: rgba(79, 180, 231, .07); color: #dce8f5; text-align: center; cursor: pointer; transition: .16s ease; }
.resource-drop-zone strong { display: block; font-size: 13px; }
.resource-drop-zone small { display: block; max-width: 100%; margin-top: 6px; padding: 0 12px; overflow-wrap: anywhere; color: #7f8fa3; font-size: 10px; line-height: 1.4; }
.resource-drop-zone.dragging, .resource-drop-zone:focus-visible { border-color: rgba(213, 177, 95, .75); background: rgba(213, 177, 95, .09); }
.build-log { max-height: 260px; overflow: auto; margin-top: 16px; padding: 12px; border: 1px solid #202a38; border-radius: 7px; background: #0f1620; scrollbar-color: #2b384a transparent; }
.build-log-line { padding: 7px 0; border-bottom: 1px solid #1d2734; overflow-wrap: anywhere; color: #aebaca; font-family: Consolas, "Courier New", monospace; font-size: 10px; line-height: 1.45; white-space: pre-wrap; }
.build-log-line:last-child { border-bottom: 0; }
.settings-note { margin-top: 14px; }
.settings-note p { margin: 8px 0 0; color: #748195; font-size: 10px; line-height: 1.7; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 420px; padding: 12px 15px; border: 1px solid #2d3b4d; border-radius: 7px; background: #151e2a; box-shadow: 0 14px 40px rgba(0, 0, 0, .35); color: #dbe5f1; font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(232, 93, 104, .5); color: #f19199; }
.toast.success { border-color: rgba(32, 198, 179, .42); color: #d9f5f1; }
.busy-overlay { position: fixed; inset: 62px 0 0 238px; z-index: 25; display: none; place-items: center; align-content: center; gap: 12px; background: rgba(5, 8, 13, .72); backdrop-filter: blur(2px); }
.busy-overlay.visible { display: grid; }
.busy-overlay strong { font-size: 12px; }
.spinner { width: 28px; height: 28px; border: 3px solid #263242; border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1250px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .service-card-grid { grid-template-columns: 1fr; }
  .detail-grid.wide { grid-template-columns: repeat(2, 1fr); }
  .grade-grid { grid-template-columns: repeat(3, 1fr); }
  .telemetry-grid { grid-template-columns: repeat(3, 1fr); }
  .vocoder-grid { grid-template-columns: repeat(2, 1fr); }
  .community-grid { grid-template-columns: repeat(2, 1fr); }
  .management-layout { grid-template-columns: 1fr; }
  .management-detail-grid, .management-columns { grid-template-columns: 1fr; }
  .schedule-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oracle-trace { grid-template-columns: 1fr; }
  .schedule-layout > section:last-child { grid-column: 1 / -1; }
}

@media (max-width: 1120px) {
  .content { padding: 26px 24px 36px; }
  .two-column, .two-column.balanced, .quality-grid, .scanner-layout, .log-layout, .schedule-layout, .settings-layout, .builder-layout, .management-layout, .oracle-layout { grid-template-columns: 1fr; }
  .management-detail-grid, .management-columns { grid-template-columns: 1fr; }
  .schedule-layout > section:last-child { grid-column: auto; }
  .vocoder-hero { grid-template-columns: repeat(2, 1fr); }
  .community-grid { grid-template-columns: 1fr; }
  .vocoder-hero > div:nth-child(2) { border-right: 0; }
  .vocoder-hero > div:nth-child(-n+2) { border-bottom: 1px solid #202a38; }
}

.d-none { display: none !important; }

#appShell:not(.d-none) {
  display: block;
  width: 100%;
  height: 100%;
}

.web-host .app-shell {
  min-height: 100vh;
}

.web-host .titlebar,
.web-host .brand-lockup {
  -webkit-app-region: no-drag;
}

.web-host .window-controls {
  display: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.auth-card {
  width: min(420px, 94vw);
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, #141b24, #101720);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 8px;
}

.auth-card p:not(.eyebrow) {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-brand {
  margin-bottom: 18px;
}

.web-host .resource-drop-zone {
  cursor: text;
}

@media (max-width: 760px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template: auto auto 1fr / 1fr;
    height: auto;
    min-height: 100vh;
  }

  .titlebar {
    grid-column: 1;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .brand-lockup {
    border-right: 0;
    padding: 0;
  }

  .connection-pill {
    justify-self: start;
    margin: 0;
  }

  .sidebar {
    grid-row: 2;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }

  .sidebar nav,
  .sidebar-bottom {
    display: flex;
    flex-direction: row;
    gap: 6px;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .version {
    display: none;
  }

  .content {
    grid-row: 3;
    padding: 20px 14px 28px;
  }

  .metric-grid,
  .grade-grid,
  .telemetry-grid,
  .vocoder-grid,
  .oracle-trace,
  .detail-grid,
  .detail-grid.wide {
    grid-template-columns: 1fr;
  }

  .command-panel,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions,
  .command-actions {
    flex-wrap: wrap;
  }

  .busy-overlay {
    inset: 0;
  }
}

/* 2026 Nexus control room refresh, aligned with the Spartan CAD system panel. */
:root {
  --bg: #101418;
  --panel: #151a1f;
  --panel-soft: #11171c;
  --panel-border: rgba(142, 171, 205, .14);
  --panel-border-bright: rgba(142, 171, 205, .28);
  --panel-hover: #1b232b;
  --accent: #27577c;
  --accent-bright: #4d8dff;
  --accent-soft: rgba(77, 141, 255, .10);
  --accent-deep: #183d59;
  --gold: #20c6b3;
  --topbar: #10161b;
}

body { background: var(--bg); }
.sidebar { background: #0f1418; }
.content { padding: 34px 38px 44px; }
.panel, .metric-card, .service-card { background: var(--panel); }
.panel, .metric-card, .service-card, .service-instance-card { transition: border-color .16s ease, background .16s ease; }
.panel:hover, .metric-card:hover, .service-card:hover { border-color: var(--panel-border-bright); }
.button.primary, .button.success { border-color: #27577c; background: #27577c; }
.nav-item.active { border-left-color: #4d8dff; background: rgba(77, 141, 255, .10); }
.nav-item.active span { color: #20c6b3; }
.meter i { background: linear-gradient(90deg, #4d8dff, #20c6b3); }

input, select, textarea {
  min-height: 40px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background-color: #10151a;
  color: #f6f8fb;
}
input, textarea { padding: 10px 12px; }
select {
  appearance: none;
  padding: 9px 36px 9px 12px;
  background-image: linear-gradient(45deg, transparent 50%, #8291a1 50%), linear-gradient(135deg, #8291a1 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input::placeholder, textarea::placeholder { color: #6f7e8d; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: #5d91d6; box-shadow: 0 0 0 2px rgba(77, 141, 255, .08); }
select option { background: #151a1f; color: #fff; }
.compact-field input { width: min(320px, 32vw); }

.records-layout {
  display: grid;
  grid-template-columns: minmax(330px, .85fr) minmax(520px, 1.5fr);
  gap: 16px;
  align-items: stretch;
}
.records-panel, .record-detail-panel { min-height: 610px; }
.record-list {
  max-height: 535px;
  margin: 0 -20px -20px;
  overflow: auto;
}
.record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 68px;
  padding: 13px 20px;
  border: 0;
  border-bottom: 1px solid rgba(145, 171, 200, .09);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.record-row:hover { background: rgba(96, 145, 186, .055); }
.record-row.active { background: rgba(77, 141, 255, .10); box-shadow: inset 2px 0 #4d8dff; }
.record-copy { min-width: 0; }
.record-copy strong, .record-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-copy strong { color: #dce5ed; font-size: 11px; font-weight: 650; }
.record-copy small { margin-top: 6px; color: #708294; font-size: 9px; }
.record-metrics { flex: 0 0 auto; text-align: right; }
.record-metrics b, .record-metrics small { display: block; }
.record-metrics b { color: #edf4fa; font-size: 16px; }
.record-metrics small { margin-top: 2px; color: #687b8d; font-size: 8px; text-transform: uppercase; }
.panel-subheading { margin: 20px -20px 0; padding: 17px 20px 13px; border-top: 1px solid var(--panel-border); border-bottom: 1px solid var(--panel-border); }
.panel-subheading h2 { font-size: 12px; }
.panel-subheading p { margin: 5px 0 0; color: #718294; font-size: 9px; }
.record-detail-panel > .compact-list { margin: 0 -20px -20px; }
.record-link { width: 100%; border: 0; border-bottom: 1px solid rgba(145, 171, 200, .09); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.record-link:hover { background: rgba(96, 145, 186, .055); }
.metric-grid.compact { margin-bottom: 16px; }
.metric-grid.compact .metric-card { min-height: 112px; }
.metric-grid.compact .metric-value { margin-top: 12px; font-size: 26px; }

.service-console-panel { margin-top: 14px; }
.service-console-panel .panel-header { align-items: center; }
.service-console-panel .heading-actions select { min-width: 150px; }
.service-console {
  height: 360px;
  margin: 16px 0 0;
  overflow: auto;
  border: 1px solid #26313a;
  border-radius: 7px;
  background: #080b0e;
  color: #c7d2dc;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
}
.console-line { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 3px 10px; border-bottom: 1px solid rgba(255,255,255,.025); }
.console-line > span { color: #609bc7; font-size: 8px; font-weight: 800; padding-top: 3px; }
.console-line.error > span { color: #ed707b; }
.console-line code { color: inherit; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-meta { margin-top: 9px; color: #647688; font-size: 9px; }
#vocoder-page.active { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--panel-border); }
#vocoder-page.active .page-heading .eyebrow { color: #20c6b3 !important; }

@media (max-width: 1120px) {
  .records-layout { grid-template-columns: 1fr; }
  .records-panel, .record-detail-panel { min-height: 0; }
  .compact-field input { width: 100%; }
}
