:root {
    --bg: #0b0f14;
    --surface: #121821;
    --surface-2: #18212d;
    --line: #2a3442;
    --line-strong: #415063;
    --text: #edf3f8;
    --muted: #93a2b4;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #facc15;
    --blue: #3b82f6;
    --purple: #a855f7;
    --cyan: #22d3ee;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, rgba(34, 211, 238, .08), transparent 260px),
        linear-gradient(135deg, #0b0f14 0%, #111827 48%, #080b10 100%);
    color: var(--text);
}

.app {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 20px 20px 132px;
}

.topbar,
.lamp-card,
.command-panel,
.status-panel,
.panel {
    background: rgba(18, 24, 33, .94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .24);
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(220px, 360px);
    gap: 18px;
    align-items: center;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 92px;
}

.brand-lockup img {
    display: block;
    width: min(100%, 360px);
    max-height: 118px;
    object-fit: contain;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .42));
}

.brand-fallback {
    width: min(100%, 330px);
    border: 2px solid rgba(250, 204, 21, .9);
    border-left-width: 10px;
    transform: skew(-10deg);
    padding: 10px 14px 9px;
    background: linear-gradient(90deg, rgba(250, 204, 21, .18), rgba(15, 21, 29, .92));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}

.brand-fallback strong,
.brand-fallback span {
    display: block;
    transform: skew(10deg);
    text-transform: uppercase;
    letter-spacing: 0;
}

.brand-fallback strong {
    font-size: clamp(28px, 3.1vw, 46px);
    font-style: italic;
    line-height: .9;
}

.brand-fallback span {
    width: max-content;
    margin-top: 4px;
    padding: 2px 8px 3px;
    background: var(--yellow);
    color: #050505;
    font-size: clamp(15px, 1.4vw, 22px);
    font-weight: 950;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-status > div {
    min-width: 190px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
}

.topbar-status strong {
    display: block;
    margin-top: 3px;
    font-size: 16px;
    color: var(--text);
}

.race-mode {
    position: relative;
    min-width: 250px;
    padding: 12px 14px 12px 18px !important;
    border: 1px solid var(--line-strong) !important;
    background: #0f151d !important;
    overflow: hidden;
}

.race-mode::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 7px;
    background: var(--blue);
}

.race-mode strong {
    display: block;
    margin-top: 4px;
    font-size: 21px !important;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.race-mode small {
    display: block;
    max-width: 320px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.25;
}

.race-mode.mode-prep {
    border-color: rgba(59, 130, 246, .56) !important;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .16);
}

.race-mode.mode-prep::before { background: var(--blue); }
.race-mode.mode-prep strong { color: #bfdbfe !important; }

.race-mode.mode-locked {
    border-color: rgba(250, 204, 21, .68) !important;
    box-shadow: inset 0 0 0 1px rgba(250, 204, 21, .16);
}

.race-mode.mode-locked::before { background: var(--yellow); }
.race-mode.mode-locked strong { color: #fde68a !important; }

.race-mode.mode-running {
    border-color: rgba(34, 197, 94, .72) !important;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, .18), 0 0 24px rgba(34, 197, 94, .1);
}

.race-mode.mode-running::before { background: var(--green); }
.race-mode.mode-running strong { color: #bbf7d0 !important; }

.race-mode.mode-redflag {
    border-color: rgba(239, 68, 68, .82) !important;
    background: rgba(127, 29, 29, .2) !important;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .22), 0 0 30px rgba(239, 68, 68, .14);
}

.race-mode.mode-redflag::before { background: var(--red); }
.race-mode.mode-redflag strong { color: #fecaca !important; }

.main-nav {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
    color: var(--muted);
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
    border-color: rgba(34, 211, 238, .58);
    color: var(--text);
    background: rgba(34, 211, 238, .1);
}

.dashboard-app,
.admin-app {
    max-width: 1280px;
}

.dashboard-hero {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px) minmax(200px, 320px);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 16px;
    align-items: start;
}

.workflow-panel,
.dashboard-summary,
.service-panel {
    padding: 18px;
}

.workflow-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.workflow-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
    color: var(--text);
    text-decoration: none;
}

.workflow-card:not(.is-disabled):hover {
    border-color: rgba(34, 211, 238, .58);
    background: rgba(34, 211, 238, .08);
}

.workflow-card.is-done {
    border-color: rgba(34, 197, 94, .46);
}

.workflow-card.is-disabled {
    opacity: .56;
}

.workflow-card.is-locked {
    border-color: rgba(250, 204, 21, .4);
}

.workflow-number,
.workflow-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 8px;
    font-weight: 900;
}

.workflow-number {
    width: 34px;
    background: rgba(34, 211, 238, .12);
    color: var(--cyan);
}

.workflow-body strong,
.workflow-body small {
    display: block;
}

.workflow-body strong {
    font-size: 18px;
}

.workflow-body small {
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.35;
}

.workflow-state {
    min-width: 82px;
    padding: 0 10px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.workflow-card.is-done .workflow-state {
    border-color: rgba(34, 197, 94, .44);
    color: #bbf7d0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.summary-grid > div {
    min-height: 74px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
}

.summary-grid strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
}

.network-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.network-state-card {
    min-height: 116px;
}

.network-state-card strong {
    display: block;
    margin-top: 8px;
    font-size: 22px;
}

.network-state-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.4;
}

.network-phase-ok {
    border-color: rgba(34, 197, 94, .48);
}

.network-phase-warn {
    border-color: rgba(250, 204, 21, .48);
}

.network-phase-bad {
    border-color: rgba(239, 68, 68, .48);
}

.wifi-list {
    display: grid;
    gap: 8px;
    max-height: 300px;
    overflow: auto;
    padding-right: 4px;
}

.wifi-network {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 54px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
    color: var(--text);
    text-align: left;
}

.wifi-network:hover,
.wifi-network.is-selected {
    border-color: rgba(34, 211, 238, .72);
    background: rgba(34, 211, 238, .08);
}

.wifi-network.is-active {
    border-color: rgba(34, 197, 94, .55);
}

.wifi-network.is-empty {
    justify-content: center;
    color: var(--muted);
}

.wifi-network strong,
.wifi-network small {
    display: block;
}

.wifi-network small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.wifi-network em {
    flex: 0 0 auto;
    color: #bae6fd;
    font-style: normal;
    font-weight: 900;
}

.network-hint {
    padding: 12px;
    border: 1px solid rgba(250, 204, 21, .45);
    border-radius: 8px;
    background: rgba(250, 204, 21, .08);
    color: #fde68a;
    font-weight: 800;
    line-height: 1.45;
}

.box-summary-grid {
    margin: 16px 0;
}

.box-time-action-card .button-link {
    width: 100%;
    margin-top: 7px;
}

.box-time-action-card .button-link:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.box-time-drift-card.is-clock-warn {
    border-color: rgba(250, 204, 21, .58);
    background: rgba(250, 204, 21, .08);
}

.box-time-drift-card.is-clock-warn strong {
    color: #fde68a;
}

.box-time-drift-card.is-clock-bad {
    border-color: rgba(239, 68, 68, .68);
    background: rgba(127, 29, 29, .18);
}

.box-time-drift-card.is-clock-bad strong {
    color: #fecaca;
}

.box-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr);
}

.box-service-links {
    margin-bottom: 16px;
}

.box-hardware-grid {
    margin-top: 0;
}

.system-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    word-break: break-all;
}

.system-log {
    margin: 16px 0 0;
    max-height: 260px;
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b1017;
    color: #cbd5e1;
    white-space: pre-wrap;
}

.recovery-banner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin: 16px 0;
}

.recovery-banner h2 {
    margin: 0;
}

.recovery-banner p {
    margin: 6px 0 0;
    color: var(--text);
}

.recovery-banner small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.recovery-ok {
    border-color: rgba(34, 197, 94, .42);
    background: rgba(34, 197, 94, .06);
}

.recovery-warn {
    border-color: rgba(250, 204, 21, .48);
    background: rgba(250, 204, 21, .08);
}

.recovery-danger {
    border-color: rgba(239, 68, 68, .58);
    background: rgba(127, 29, 29, .18);
}

.dashboard-actions,
.service-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.service-panel {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-top: 16px;
}

.service-links a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
    color: var(--muted);
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
}

.service-links a:hover {
    border-color: rgba(34, 211, 238, .58);
    color: var(--text);
    background: rgba(34, 211, 238, .1);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .12em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
    margin-bottom: 4px;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1;
}

h2 {
    margin: 0;
    font-size: clamp(24px, 3vw, 38px);
}

h3 {
    margin-bottom: 14px;
    font-size: 19px;
}

.label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .11em;
}

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

button {
    border: 0;
    border-radius: 8px;
    min-height: 48px;
    padding: 0 16px;
    color: white;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    transition: transform .08s ease, filter .08s ease, box-shadow .08s ease;
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px) scale(.99); }
button:disabled {
    cursor: not-allowed;
    filter: grayscale(.45);
}
button.start { background: var(--green); }
button.finish { background: var(--red); }
button.dnf { background: var(--yellow); color: #181100; }
button.dns { background: var(--blue); }
button.dsq { background: var(--purple); }

button.ghost {
    border: 1px solid var(--line-strong);
    background: #101721;
    color: var(--text);
    font-size: 14px;
}

button.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    border: 1px solid var(--line-strong);
    background: #101721;
    color: var(--text);
    font-size: 18px;
    line-height: 1;
}

button.icon-button:disabled {
    cursor: not-allowed;
    opacity: .35;
    filter: none;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0 14px;
    background: #101721;
    color: var(--text);
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
}

.button-link:hover {
    border-color: rgba(34, 211, 238, .58);
    background: rgba(34, 211, 238, .1);
}

button.danger {
    border-color: rgba(239, 68, 68, .55);
    color: #fecaca;
}

.signal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.lamp-card {
    min-height: 132px;
    padding: 15px 16px;
    overflow: hidden;
    position: relative;
}

.lamp-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-left: 6px solid var(--yellow);
    pointer-events: none;
}

.lamp-card.open::before { border-color: var(--green); }
.lamp-card.blocked::before { border-color: var(--red); }

.lamp-card.open {
    border-color: rgba(34, 197, 94, .72);
    background: linear-gradient(135deg, rgba(34, 197, 94, .18), rgba(18, 24, 33, .96) 45%);
}

.lamp-card.closed {
    border-color: rgba(250, 204, 21, .45);
}

.lamp-card.blocked {
    border-color: rgba(239, 68, 68, .7);
    background: linear-gradient(135deg, rgba(239, 68, 68, .16), rgba(18, 24, 33, .96) 45%);
}

.lamp-head {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    background: var(--yellow);
    box-shadow: 0 0 18px rgba(250, 204, 21, .8);
}

.lamp-card.open .dot {
    background: var(--green);
    box-shadow: 0 0 22px rgba(34, 197, 94, .85);
}

.lamp-card.blocked .dot {
    background: var(--red);
    box-shadow: 0 0 22px rgba(239, 68, 68, .85);
}

.lamp-rider {
    margin-top: 11px;
    font-size: clamp(21px, 2.2vw, 32px);
    font-weight: 950;
    line-height: 1.04;
}

.countdown {
    margin-top: 8px;
    font-size: clamp(26px, 3.6vw, 48px);
    font-weight: 950;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.countdown.in-window { color: #86efac; }
.countdown.late { color: #fbbf24; }

.lamp-card .muted {
    margin-bottom: 0;
}

.lamp-card button {
    min-height: 38px;
    font-size: 14px;
}

.start-window-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(15, 21, 29, .72);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.start-window-control strong {
    min-width: 42px;
    color: var(--text);
    text-align: center;
}

.start-window-control .icon-button {
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    margin: 0;
    font-size: 17px;
}

.start-window-control .ghost {
    min-height: 30px;
    margin: 0 0 0 4px;
    padding: 0 10px;
    font-size: 12px;
}

.control-deck {
    display: grid;
    grid-template-columns: minmax(420px, 1.2fr) minmax(300px, .85fr) minmax(300px, .85fr);
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
}

.command-panel,
.status-panel,
.panel {
    padding: 18px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.best-chip {
    min-width: 180px;
    padding: 10px 12px;
    border: 1px solid rgba(34, 197, 94, .35);
    border-radius: 8px;
    background: rgba(34, 197, 94, .11);
    color: #bbf7d0;
    text-align: right;
    font-size: 18px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.controls {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr repeat(3, .8fr);
    gap: 10px;
}

.hardware-pulse-row {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr repeat(3, .8fr);
    gap: 10px;
    min-height: 8px;
    margin-top: 8px;
}

.hardware-pulse {
    display: block;
    height: 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .18);
    opacity: .55;
}

.hardware-pulse.active {
    background: #22d3ee;
    opacity: 1;
    box-shadow: 0 0 18px rgba(34, 211, 238, .86), 0 0 4px rgba(207, 250, 254, .95);
}

.action-button {
    position: relative;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 3px;
    min-height: 72px;
    padding: 10px 12px;
    overflow: hidden;
}

.action-button span {
    line-height: 1;
}

.action-button small {
    min-height: 16px;
    font-size: 12px;
    font-weight: 950;
    opacity: .88;
    font-variant-numeric: tabular-nums;
}

.action-button.inactive,
.action-button:disabled {
    opacity: .38;
    box-shadow: none;
}

.action-button.inactive:hover,
.action-button:disabled:hover {
    filter: grayscale(.45);
}

.red-flag-button {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(239, 68, 68, .6);
    background: rgba(127, 29, 29, .78);
    color: #fecaca;
    font-size: 17px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.red-flag-button.active {
    background: var(--red);
    color: #fff;
    box-shadow: 0 0 28px rgba(239, 68, 68, .3);
}

.danger-drawer {
    margin-top: 10px;
}

.danger-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    width: auto;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    background: #101721;
    color: var(--muted);
    font-size: 13px;
}

.danger-toggle:hover,
.danger-toggle.active,
.danger-toggle.armed {
    border-color: rgba(239, 68, 68, .52);
    color: #fecaca;
    background: rgba(127, 29, 29, .28);
}

.lock-icon {
    position: relative;
    display: inline-block;
    width: 15px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.lock-icon::before {
    content: "";
    position: absolute;
    left: 2px;
    top: -10px;
    width: 7px;
    height: 9px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.danger-panel {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid rgba(239, 68, 68, .42);
    border-radius: 8px;
    background: rgba(127, 29, 29, .12);
}

.red-action {
    border-color: rgba(239, 68, 68, .58) !important;
    color: #fecaca !important;
}

.message {
    min-height: 24px;
    margin: 12px 0 0;
    color: #fecaca;
    font-weight: 800;
}

.license-demo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-color: rgba(245, 158, 11, .55);
    background: linear-gradient(135deg, rgba(245, 158, 11, .16), rgba(15, 23, 42, .88));
}

.license-demo-banner h2 {
    margin: 4px 0 6px;
}

.license-demo-banner p {
    margin: 0;
    color: var(--muted);
}

.status-panel {
    display: grid;
    gap: 16px;
}

.status-panel h3 {
    margin: 6px 0 0;
    font-size: clamp(20px, 2.2vw, 30px);
    line-height: 1.1;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.status-grid > div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
}

.status-grid strong,
.status-grid small {
    display: block;
}

.status-grid strong {
    margin-top: 5px;
    font-size: 20px;
    line-height: 1.08;
}

.status-grid small {
    margin-top: 5px;
    color: var(--muted);
}

.onthefly-panel {
    min-height: 100%;
}

.on-the-fly {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.otf-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--line-strong);
    background: #0f151d;
    color: inherit;
    font-size: 15px;
    text-align: left;
}

.otf-item:hover,
.otf-item.selected {
    border-color: rgba(34, 197, 94, .78);
    background: rgba(34, 197, 94, .12);
}

.otf-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otf-item small {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .1em;
}

td {
    font-size: 14px;
}

tr.active-row td {
    color: #fde68a;
    background: rgba(250, 204, 21, .08);
    font-weight: 850;
}

tr.window-row td {
    background: rgba(34, 197, 94, .08);
}

tr.ok td { color: #bbf7d0; }
tr.dnf td,
tr.dsq td,
tr.dns td,
tr.dnq td { color: #fecaca; }

.subtle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    border-radius: 999px;
    padding: 4px 9px;
    background: #263241;
    color: var(--text);
    font-size: 11px;
    font-weight: 950;
}

.badge.ok { background: rgba(34, 197, 94, .18); color: #bbf7d0; }
.badge.running { background: rgba(250, 204, 21, .18); color: #fde68a; }
.badge.pending { background: rgba(148, 163, 184, .15); color: #cbd5e1; }
.badge.dnf,
.badge.dns,
.badge.dsq,
.badge.dnq { background: rgba(239, 68, 68, .16); color: #fecaca; }

.empty {
    color: var(--muted);
    padding: 10px 0;
}

.expected-row td {
    border-top: 2px solid rgba(34, 197, 94, .82);
    border-bottom: 2px solid rgba(34, 197, 94, .82);
    background: rgba(34, 197, 94, .08);
}

.expected-row td:first-child {
    border-left: 2px solid rgba(34, 197, 94, .82);
    border-radius: 8px 0 0 8px;
}

.expected-row td:last-child {
    border-right: 2px solid rgba(34, 197, 94, .82);
    border-radius: 0 8px 8px 0;
}

@media (max-width: 1180px) {
    .topbar,
    .dashboard-grid,
    .control-deck,
    .grid {
        grid-template-columns: 1fr;
    }

    .brand-lockup {
        justify-content: flex-start;
    }

    .topbar-status {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .topbar-status > div {
        flex: 1 1 220px;
    }
}

@media (max-width: 760px) {
    .app {
        padding: 14px 14px 24px;
    }

    .workflow-card {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .workflow-state {
        grid-column: 2;
        justify-content: flex-start;
        width: max-content;
        min-width: 0;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .network-overview {
        grid-template-columns: 1fr;
    }

    .service-panel {
        display: grid;
    }

    .recovery-banner {
        display: grid;
    }

    .signal-grid {
        grid-template-columns: 1fr;
    }

    .controls,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .panel-head {
        display: grid;
    }

    .best-chip {
        min-width: 0;
        text-align: left;
    }

    button {
        width: 100%;
    }

    button.icon-button {
        width: 38px;
    }
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(320px, .7fr) minmax(0, 1.3fr);
    gap: 16px;
    align-items: start;
}

.network-layout {
    grid-template-columns: minmax(360px, .9fr) minmax(0, 1.1fr);
}

.admin-stack {
    display: grid;
    gap: 16px;
}

.admin-form {
    display: grid;
    gap: 12px;
}

.danger-zone {
    border-color: rgba(239, 68, 68, .45);
}

.admin-form label,
.class-row {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .08em;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0 11px;
    background: #0f151d;
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus {
    outline: 2px solid rgba(34, 211, 238, .35);
    border-color: rgba(34, 211, 238, .7);
}

.search-input {
    max-width: 260px;
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.check-row {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 14px !important;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.class-list {
    display: grid;
    gap: 10px;
}

.class-row {
    grid-template-columns: 80px minmax(0, 1fr) 110px 70px 100px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
}

.class-row button {
    min-height: 42px;
    font-size: 13px;
}

#adminRiders tr {
    cursor: pointer;
}

#adminRiders tr:hover td {
    background: rgba(34, 211, 238, .08);
}

.startlist-actions {
    white-space: nowrap;
}

.startlist-actions .icon-button + .icon-button {
    margin-left: 6px;
}

.corrections-layout {
    grid-template-columns: minmax(320px, .62fr) minmax(0, 1fr);
}

.corrections-layout .audit-panel {
    grid-column: 1 / -1;
}

#correctionRows tr {
    cursor: pointer;
}

#correctionRows tr:hover td {
    background: rgba(34, 211, 238, .08);
}

.audit-list {
    display: grid;
    gap: 9px;
}

.audit-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
}

.audit-item strong,
.audit-item span {
    display: block;
}

.audit-item strong {
    margin-bottom: 3px;
}

.audit-item span,
.audit-meta {
    color: var(--muted);
    font-size: 12px;
}

.audit-meta {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.events-layout {
    grid-template-columns: minmax(320px, .55fr) minmax(0, 1.2fr);
}

.backup-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .55fr);
}

.access-layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.segmented {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
}

.segmented button {
    min-height: 36px;
    font-size: 13px;
}

.segmented button.active {
    border-color: rgba(34, 211, 238, .58);
    background: rgba(34, 211, 238, .14);
    color: var(--text);
}

.result-actions {
    width: auto;
    grid-template-columns: auto auto;
}

.result-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.results-list {
    display: grid;
    gap: 16px;
}

.result-group {
    overflow: auto;
}

.event-list {
    display: grid;
    gap: 14px;
}

.event-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f151d;
}

.event-card.active {
    border-color: rgba(34, 197, 94, .62);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, .12);
}

.event-card-head,
.run-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
}

.event-card h3 {
    margin: 0 0 5px;
    font-size: 24px;
}

.run-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.run-row {
    min-height: 54px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(18, 24, 33, .8);
}

.run-row.active {
    border-color: rgba(34, 197, 94, .55);
    background: rgba(34, 197, 94, .1);
}

.run-row strong,
.run-row span {
    display: block;
}

.run-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.run-row button,
.run-create button {
    min-height: 38px;
    font-size: 13px;
}

.run-create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 10px;
}

.board-app {
    width: min(1800px, 100%);
    padding-bottom: 28px;
}

.board-topbar {
    margin-bottom: 18px;
}

.board-panel {
    overflow: auto;
}

.board-table th,
.board-table td {
    padding: 14px 12px;
    font-size: clamp(15px, 1.2vw, 22px);
}

.board-table th {
    font-size: clamp(11px, .9vw, 15px);
}

.board-table .badge {
    min-width: 86px;
    font-size: clamp(11px, .9vw, 14px);
}

@media (max-width: 1050px) {
    .admin-layout,
    .network-overview,
    .corrections-layout,
    .events-layout,
    .backup-layout,
    .access-layout,
    .class-row {
        grid-template-columns: 1fr;
    }

    .corrections-layout .audit-panel {
        grid-column: auto;
    }

    .audit-item {
        grid-template-columns: 1fr;
    }

    .audit-meta {
        text-align: left;
    }

    .event-card-head,
    .run-row,
    .run-create,
    .result-toolbar {
        grid-template-columns: 1fr;
    }

    .result-toolbar {
        display: grid;
    }

    .result-summary {
        grid-template-columns: 1fr;
    }
}

@media print {
    body {
        background: #fff;
        color: #111;
    }

    .app {
        width: 100%;
        padding: 0;
    }

    .topbar,
    .panel,
    .status-grid > div {
        background: #fff;
        color: #111;
        box-shadow: none;
        border-color: #bbb;
    }

    .main-nav,
    .brand-lockup,
    .result-toolbar,
    .mini-monitor-shell {
        display: none !important;
    }

    .results-list {
        gap: 10px;
    }

    th,
    td {
        color: #111;
        border-color: #ccc;
    }
}
