/* ── Inter self-hosted (weights 400/600/700/800) ─────────────────────── */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2') format('woff2'); unicode-range: U+1F00-1FFF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2') format('woff2'); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2') format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
    color-scheme: light;
    --bg: #eef3f8;
    --panel: #ffffff;
    --ink: #16202a;
    --muted: #667085;
    --line: #cbd5e1;
    --accent: #0ea5e9;
    --accent-dark: #0284c7;
    --good: #0f8f63;
    --bad: #bf2f2f;
    --nav: #0b1220;
    --nav-soft: #121b2d;
    --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(circle at top left, rgba(14,165,233,0.12), transparent 28rem) var(--bg); color: var(--ink); font: 14px/1.45 'Inter', system-ui, -apple-system, Segoe UI, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ── Shell ───────────────────────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; padding: 24px 28px; overflow-x: auto; }

/* ── Site footer (row 5) ─────────────────────────────────────────────── */
.site-footer { flex-shrink: 0; padding: 14px 28px; text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer .sep { margin: 0 8px; opacity: .5; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--nav); text-decoration: underline; }

/* ── Site header (row 1) ─────────────────────────────────────────────── */
.site-header { background: linear-gradient(180deg, var(--nav), var(--nav-soft)); box-shadow: 0 10px 30px rgba(2,6,23,0.28); color: white; height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 16px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 38px; width: auto; object-fit: contain; object-position: left center; display: block; }
.brand div { display: grid; gap: 1px; }
.brand strong { color: white; font-size: 14px; }
.brand span { color: #9fb4d0; font-size: 11px; }
.header-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.signout-btn { background: transparent; border: 1px solid rgba(255,255,255,.18); color: #9fb4d0; padding: 6px 11px; border-radius: 6px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.signout-btn:hover { border-color: rgba(255,255,255,.35); color: white; }
.user-chip { color: #dbeafe; font-size: 13px; padding: 5px 10px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; white-space: nowrap; }
.operator-jump { display: flex; align-items: center; gap: 6px; color: #9fb4d0; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.operator-jump input, .operator-jump select { min-height: 32px; padding: 5px 9px; font-size: 13px; font-weight: 700; text-transform: none; color: var(--ink); border-radius: 5px; border: 1px solid var(--line); background: white; }
.operator-jump input { width: 120px; }
.operator-jump select { width: 170px; }
.apply-alert { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 12px; border-radius: 6px; background: var(--bad); color: white; font-weight: 800; font-size: 13px; white-space: nowrap; box-shadow: 0 4px 12px rgba(191,47,47,.3); }
.apply-alert span { font-size: 11px; opacity: .85; }
.ops-alert { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 12px; border-radius: 6px; background: #8a3ffc; color: white; font-weight: 800; font-size: 13px; box-shadow: 0 4px 12px rgba(80,49,170,.25); }

/* ── Primary nav tabs (row 2) ────────────────────────────────────────── */
.nav-primary { background: #0f172a; display: flex; align-items: stretch; padding: 0 20px; gap: 0; flex-shrink: 0; }
.nav-primary a { color: #8fa3bf; padding: 0 18px; height: 44px; font-weight: 700; font-size: 14px; display: flex; align-items: center; border-bottom: 3px solid transparent; white-space: nowrap; transition: color .15s; }
.nav-primary a:hover { color: #c8d9f0; }
.nav-primary a.active { color: white; border-bottom-color: var(--accent); }

/* ── Secondary subnav (row 3) ────────────────────────────────────────── */
.nav-secondary { background: white; border-bottom: 2px solid var(--line); display: flex; align-items: center; padding: 0 20px; flex-wrap: wrap; min-height: 42px; flex-shrink: 0; }
.nav-secondary a { color: #4b5c6e; padding: 0 14px; height: 42px; font-weight: 700; font-size: 13px; display: flex; align-items: center; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.nav-secondary a:hover { color: var(--accent); }
.nav-secondary a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-secondary a.subnav-action { background: var(--accent); color: white; border-radius: 6px; height: 30px; padding: 0 12px; margin: 0 8px 0 0; border-bottom: none; font-size: 12px; }
.nav-secondary a.subnav-action:hover { background: var(--accent-dark); color: white; }
.nav-secondary a.subnav-action.active { border-bottom: none; background: var(--accent-dark); color: white; }
.nav-secondary a.subnav-alert { color: var(--bad); }
.nav-secondary a.subnav-alert.active { border-bottom-color: var(--bad); }
.subnav-sep { width: 1px; height: 20px; background: var(--line); margin: 0 8px; flex-shrink: 0; }

/* ── Page header (title + page-level actions) ────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header > div { min-width: 0; }
.eyebrow { margin: 0 0 2px; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
h1, h2 { margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 17px; margin-bottom: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.page-actions .button-link, .page-actions button { min-height: 36px; }

/* ── Status chips row ────────────────────────────────────────────────── */
.operator-status { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.status-chip { display: grid; gap: 2px; min-height: 70px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 4px 16px rgba(15,23,42,.04); min-width: 0; }
.status-chip span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.status-chip strong { font-size: 17px; line-height: 1.15; overflow-wrap: anywhere; }
.status-chip small { color: var(--muted); overflow-wrap: anywhere; }
.status-chip.good { border-color: #b8e3cf; }
.status-chip.good strong { color: var(--good); }
.status-chip.bad { border-color: #ffc4c4; background: #fffafa; }
.status-chip.bad strong { color: var(--bad); }

/* ── Components ──────────────────────────────────────────────────────── */
.workflow-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 10px; }
.workflow-card { display: grid; gap: 3px; min-height: 96px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fafc; box-shadow: 0 8px 24px rgba(15,23,42,.03); }
.workflow-card span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.workflow-card strong { font-size: 17px; line-height: 1.15; overflow-wrap: anywhere; }
.workflow-card small { color: var(--muted); overflow-wrap: anywhere; }
.workflow-card:hover { border-color: #7dd3f7; background: white; }
.workflow-card.primary { border-color: #bae6fd; background: #f0f9ff; }
.workflow-card.danger { border-color: #ffc4c4; background: #fffafa; }
.workflow-card.danger strong { color: var(--bad); }
.section-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; }
.action-queue { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; }
.action-item { display: grid; gap: 4px; min-height: 126px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fafc; }
.action-item span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.action-item strong { font-size: 17px; line-height: 1.15; overflow-wrap: anywhere; }
.action-item small { color: var(--muted); overflow-wrap: anywhere; }
.action-item em { align-self: end; color: var(--accent); font-style: normal; font-weight: 800; }
.action-item.warning { border-color: #f7d28a; background: #fff8e8; }
.action-item.critical { border-color: #ffc4c4; background: #fffafa; }
.action-item.critical strong { color: var(--bad); }
.action-item.normal { border-color: #b8e3cf; background: #f0fbf6; }
.action-item.normal strong { color: var(--good); }
.bulk-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 14px; }
.bulk-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fafc; }
.bulk-card h2 { margin-bottom: 6px; }
.bulk-card code { display: block; overflow-wrap: anywhere; white-space: normal; }
.bulk-facts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.capacity-meter { width: 120px; max-width: 100%; height: 7px; border-radius: 999px; background: #e8edf5; overflow: hidden; margin: 6px 0 2px; }
.capacity-meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.time-window-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.schedule-presets { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.schedule-presets button { min-height: 34px; padding: 7px 10px; }

.notice { padding: 12px 14px; border-radius: var(--radius); background: #e0f2fe; border: 1px solid #bae6fd; margin-bottom: 16px; }
.notice.danger { background: #fff0f0; border-color: #ffc4c4; color: var(--bad); }
.alert-success { padding: 12px 14px; border-radius: var(--radius); background: #e0f2fe; border: 1px solid #bae6fd; margin-bottom: 16px; }
.alert-danger { padding: 12px 14px; border-radius: var(--radius); background: #fff0f0; border: 1px solid #ffc4c4; color: var(--bad); margin-bottom: 16px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metrics.compact { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
.metrics article, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(15,23,42,.04); }
.metrics article { padding: 16px; display: grid; gap: 8px; }
.metrics span, .muted { color: var(--muted); }
.metrics strong { font-size: 24px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { padding: 18px; margin-bottom: 18px; }
.wizard-panel { padding: 20px; }
.wizard-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.wizard-heading h2 { margin-bottom: 4px; }
.wizard-heading p { margin: 0; }
.step-badge { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #e0f2fe; color: var(--accent); font-weight: 800; flex: 0 0 auto; }
.wizard-summary { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; margin: 0 0 16px; }
.wizard-summary div { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #f8fafc; display: grid; gap: 2px; min-width: 0; }
.wizard-summary span { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.wizard-summary strong, .wizard-summary small { overflow-wrap: anywhere; }
.wizard-summary small { color: var(--muted); }
.wizard-checks { display: grid; gap: 8px; margin-bottom: 16px; }
.wizard-check { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #f8fafc; display: grid; gap: 2px; }
.wizard-check strong { font-size: 13px; }
.wizard-check span { color: var(--muted); }
.wizard-check.good { border-color: #b8e3cf; background: #f0fbf6; }
.wizard-check.warn { border-color: #f7d28a; background: #fff8e8; }
.wizard-check.bad { border-color: #ffc4c4; background: #fff0f0; }
.is-hidden { display: none !important; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
code, pre { background: #0b1220; color: #e5edf7; border-radius: 6px; }
code { padding: 2px 5px; }
pre { padding: 14px; overflow: auto; max-height: 420px; }
.diff-box { background: #0b1220; border-radius: 6px; padding: 10px; margin: 10px 0; max-height: 260px; overflow: auto; }
.diff-line { display: grid; grid-template-columns: 64px 1fr; gap: 8px; color: #d6e3f2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.diff-line span { color: #94a3b8; }
.diff-line.added code { color: #bbf7d0; }
.diff-line.removed code { color: #fecaca; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #e8edf5; color: #314155; font-size: 12px; }
.pill.good { background: #e7f7ef; color: var(--good); }
.pill.bad { background: #fff0f0; color: var(--bad); }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 14px; align-items: end; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; color: var(--ink); background: white; }
textarea { resize: vertical; min-height: 120px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; }
.span-all { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
button, .button-link { border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; background: white; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 700; }
button.primary:hover { background: var(--accent-dark); }
.danger-button { color: var(--bad); border-color: #ffc4c4; }
.danger-confirm { margin-bottom: 8px; color: var(--bad); font-size: 12px; }
.danger-confirm input { border-color: #ffc4c4; }
details summary { cursor: pointer; font-weight: 700; margin: 8px 0; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.inline-edit { grid-template-columns: repeat(2, minmax(140px, 1fr)); margin: 12px 0; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: grid; gap: 8px; }
legend { color: var(--muted); font-weight: 700; padding: 0 4px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top right, rgba(14,165,233,0.18), transparent 45rem) var(--nav); }
.login-logo { display: block; max-width: 340px; height: auto; min-width: 0; }
.login-card { width: min(500px, calc(100vw - 32px)); min-width: 0; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; display: grid; gap: 16px; box-shadow: 0 18px 50px rgba(2,6,23,0.35); }

/* Tabs — page-level (status page, etc.) */
.page-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.page-tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; padding: 10px 18px; background: none; cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: -2px; font-size: 14px; }
.page-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.page-tab-panel { display: none; }
.page-tab-panel.active { display: block; }
.tab-refresh { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 13px; }
.tab-refresh select { width: auto; padding: 5px 8px; font-size: 13px; }

/* Tabs — form-embedded */
.tab-bar { grid-column: 1 / -1; display: flex; gap: 2px; border-bottom: 2px solid var(--line); padding-bottom: 0; margin-bottom: 4px; }
.tab-bar button { border: none; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; padding: 7px 13px; background: none; cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: -2px; font-size: 13px; }
.tab-bar button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: contents; }

/* Status page */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; }
.status-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; }
.status-card .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.status-card .value { font-size: 20px; font-weight: 700; }
.status-card .sub { color: var(--muted); font-size: 12px; }

/* Pagination */
.pagination { display: flex; list-style: none; gap: 4px; padding: 0; margin: 14px 0 0; flex-wrap: wrap; }
.pagination li > a, .pagination li > span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
.pagination li > a:hover { background: #f0f9ff; border-color: var(--accent); color: var(--accent); }
.pagination li.active > span { background: var(--accent); border-color: var(--accent); color: white; }
.pagination li.disabled > span { color: var(--muted); cursor: default; }

@media (max-width: 900px) {
    .site-header { height: auto; padding: 12px 16px; flex-wrap: wrap; }
    .operator-jump { display: none; }
    .nav-primary { padding: 0 12px; overflow-x: auto; }
    .nav-secondary { padding: 0 12px; overflow-x: auto; flex-wrap: nowrap; }
    main { padding: 16px; }
    .metrics, .grid.two, .form-grid, .permission-grid, .wizard-summary, .operator-status, .workflow-grid, .bulk-grid, .action-queue { grid-template-columns: 1fr; }
}

/* Activation warning bar */
.notice.warning { background: #fff8e8; border-color: #f7d28a; }
.activation-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; background: #dc2626; color: #fff; margin: 0; font-size: .875rem; font-weight: 500; }
.activation-bar strong { font-weight: 700; }
.activation-bar a { color: #fff; text-decoration: underline; white-space: nowrap; }
.activation-bar a:hover { opacity: .85; }

/* Activation modal */
dialog.activation-modal { border: none; border-radius: 8px; padding: 0; max-width: 480px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.activation-modal::backdrop { background: rgba(0,0,0,.55); }
.activation-modal-header { background: #dc2626; color: #fff; padding: 20px 24px 16px; border-radius: 8px 8px 0 0; }
.activation-modal-header h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.activation-modal-body { padding: 20px 24px; }
.activation-modal-body p { margin: 0 0 12px; color: var(--text); line-height: 1.5; }
.activation-modal-body p:last-child { margin-bottom: 0; }
.activation-modal-footer { padding: 12px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.demo-banner { border-radius: 0; border-left: none; border-right: none; text-align: center; margin: 0; }
