/* Admin console styling. Follows the approved mockups: dark navy sidebar, light content
   surface, blue primary action, and coloured status pills. Plain CSS on purpose — no build
   step, so the whole product still ships as one `dotnet run`. */

:root {
    --navy: #0f2544;
    --navy-2: #16345c;
    --blue: #1f6feb;
    --blue-dark: #1a5fd0;
    --ink: #16202f;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --canvas: #f5f7fb;
    --ok: #16a34a;
    --ok-bg: #dcfce7;
    --warn: #b45309;
    --warn-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0 0 2px; }
h2 { font-size: 16px; margin: 0 0 14px; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }

/* ---- Shell ---- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--navy);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--blue); color: #fff;
    display: grid; place-items: center; font-size: 17px;
}
.brand-mark.big { width: 56px; height: 56px; font-size: 26px; border-radius: 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { color: #fff; font-weight: 600; }
.brand-sub { font-size: 11.5px; color: #94a3b8; }

.nav { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; margin-bottom: 2px;
    border-radius: 8px; color: #cbd5e1; font-size: 13.5px;
}
.nav-link:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--blue); color: #fff; }
.nav-link.disabled { color: #5b7398; cursor: default; }
.nav-link.disabled:hover { background: transparent; color: #5b7398; }
.nav-icon { width: 18px; text-align: center; }
.soon {
    margin-left: auto; font-size: 10px; text-transform: uppercase;
    letter-spacing: .04em; background: var(--navy-2); color: #7f9bc4;
    padding: 2px 6px; border-radius: 5px;
}

.sidebar-foot { font-size: 12px; color: #94a3b8; padding: 12px 10px 0; border-top: 1px solid var(--navy-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-ok { background: #22c55e; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 60px; background: var(--surface); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar-title { font-weight: 600; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--blue); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.user-meta { line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11.5px; color: var(--muted); }

.content { padding: 24px; flex: 1; }

/* ---- Page furniture ---- */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.page-head p { margin: 0; }
.back { font-size: 12.5px; display: inline-block; margin-bottom: 6px; }

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}

.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tile-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 28px; font-weight: 600; margin: 6px 0 2px; }
.tile-sub { font-size: 12.5px; }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; }
.empty h2 { margin-bottom: 6px; }

/* ---- Tabs ---- */

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab {
    background: none; border: none; border-bottom: 2px solid transparent;
    padding: 8px 12px; cursor: pointer; color: var(--muted); font-size: 13.5px;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

/* ---- Tables ---- */

.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfd; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid.compact th, .grid.compact td { padding: 8px 12px; }
.row-disabled { opacity: .55; }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.actions { white-space: nowrap; text-align: right; }

.health-list { list-style: none; margin: 0; padding: 0; }
.health-list li { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.health-list li:last-child { border-bottom: none; }

/* ---- Badges & pills ---- */

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-healthy { background: var(--ok-bg); color: var(--ok); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
.badge-failed  { background: var(--danger-bg); color: var(--danger); }
.badge-unknown { background: #eef2f7; color: var(--muted); }

.pill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill-active { background: #dbeafe; color: var(--blue); }

/* ---- Buttons ---- */

.btn {
    display: inline-block; border: 1px solid transparent; border-radius: 8px;
    padding: 8px 14px; font-size: 13.5px; cursor: pointer; background: none;
    font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; text-decoration: none; }
.btn-block { width: 100%; margin-top: 6px; }
a.btn:hover { text-decoration: none; }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Forms ---- */

.field { margin-bottom: 16px; max-width: 620px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-inline label { margin: 0; font-weight: 500; }
.field-inline .help { width: 100%; }
.input {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line);
    border-radius: 8px; font: inherit; background: #fff;
}
.input:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
.help { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.req { color: var(--danger); margin-left: 2px; }

/* ---- Wizard ---- */

.wizard { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.wizard-step {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--muted); font-family: inherit;
}
.wizard-step.active { border-color: var(--blue); color: var(--blue); font-weight: 600; }
.wizard-num {
    width: 20px; height: 20px; border-radius: 50%; background: #eef2f7;
    display: grid; place-items: center; font-size: 11px;
}
.wizard-step.active .wizard-num { background: var(--blue); color: #fff; }

/* ---- Alerts & test results ---- */

.alert { border-radius: 8px; padding: 11px 14px; margin-bottom: 14px; font-size: 13.5px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-ok { background: var(--ok-bg); color: #14532d; }
.alert-warn { background: var(--warn-bg); color: #78350f; }
.alert-error { background: var(--danger-bg); color: #7f1d1d; }

.test-result { border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.test-result.ok { background: var(--ok-bg); color: #14532d; }
.test-result.warn { background: var(--warn-bg); color: #78350f; }
.test-result.fail { background: var(--danger-bg); color: #7f1d1d; }
.detail-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12.5px; }

/* ---- New-connection picker ---- */

.new-connection { position: relative; }
.picker {
    position: absolute; right: 0; top: 42px; z-index: 20; width: 320px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: 0 12px 28px rgba(15, 37, 68, .14); overflow: hidden;
}
.picker-item {
    display: block; width: 100%; text-align: left; background: none;
    border: none; border-bottom: 1px solid var(--line); padding: 12px 14px;
    cursor: pointer; font-family: inherit;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: #f1f5f9; }
.picker-name { display: block; font-weight: 600; font-size: 13.5px; }
.picker-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- Login ---- */

.login-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art {
    background: linear-gradient(150deg, var(--navy) 0%, #1c4a86 55%, #2563eb 100%);
    color: #fff; display: grid; place-items: center; padding: 40px;
}
.login-brand { max-width: 380px; }
.login-brand h1 { font-size: 34px; line-height: 1.15; margin: 20px 0 10px; }
.login-brand p { color: #c7d8f2; font-size: 15px; }

.login-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; gap: 18px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h2 { font-size: 22px; margin-bottom: 2px; }
.login-card > .muted { margin-top: 0; margin-bottom: 20px; }
.login-foot { font-size: 12.5px; text-align: center; margin-top: 18px; }
.login-copy { font-size: 12px; }

@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .split { grid-template-columns: 1fr; }
    .sidebar { width: 64px; flex-basis: 64px; }
    .brand-text, .nav-link span:not(.nav-icon), .soon, .sidebar-foot { display: none; }
}

/* ---- Flow management ---- */

.btn-sm { padding: 4px 10px; font-size: 12.5px; }

.interval-row { display: flex; align-items: center; gap: 8px; }
.interval-input { max-width: 140px; }
.preset-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 14px; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 0; font-size: 13.5px; }

/* ---- Queue monitor & error center ---- */

.head-actions { display: flex; align-items: center; gap: 8px; }
.live-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

.badge-running { background: #dbeafe; color: var(--blue); }

.err-msg { max-width: 380px; font-size: 12.5px; }
.wrap { white-space: pre-wrap; word-break: break-word; }

.detail-panel { background: #fafbfd; border-radius: 8px; padding: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-grid h3 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.payload {
    background: #0f2544; color: #cbd5e1; border-radius: 8px; padding: 12px;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px;
    max-height: 260px; overflow: auto; margin: 0;
}

@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* ---- Field mapping ---- */

/* The rule table is dense by nature — seven controls per row — so inputs shed their default
   padding here and the table is allowed to scroll sideways rather than squeezing columns. */
.map-grid { table-layout: auto; }
.map-grid td { padding: 6px 8px; vertical-align: middle; }
.map-grid .input { padding: 6px 8px; font-size: 13px; min-width: 8rem; }
.map-grid select.input { min-width: 9.5rem; }
.map-grid .col-on { width: 44px; text-align: center; }
.map-grid .col-on input { margin: 0; }

/* The explanation line sits under its rule, so it must not read as a separate record. */
.rule-note td { border-top: none; padding-top: 0; font-size: 12.5px; }
.rule-note .cell-sub { display: block; }

.lookup { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.lookup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.lookup-head h3 { margin: 0 0 4px; font-size: 14px; }
.lookup .grid { margin-bottom: 0; }

.pill-error { background: var(--danger-bg); color: #7f1d1d; }
.pill-warning { background: var(--warn-bg); color: #78350f; }
.pill-info { background: #e0e7ff; color: #3730a3; }

/* The preview's provenance strip: neutral, because "sample data" is not a failure. */
.map-source { background: var(--canvas); display: flex; align-items: center; gap: 10px; }

details > summary { cursor: pointer; margin: 12px 0; font-size: 13px; }

@media (max-width: 1100px) {
    .map-grid { display: block; overflow-x: auto; }
}

/* ---- Scheduler ---- */

/* The two schedule modes are a real choice with real consequences, so they are presented as
   cards with their trade-off written out rather than two words in a dropdown. */
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-option {
    display: block; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
    cursor: pointer; transition: border-color .12s, background .12s;
}
.mode-option:hover { border-color: #cbd5e1; }
.mode-option.selected { border-color: var(--blue); background: #f5f9ff; }
.mode-option input { margin-right: 8px; }
.mode-title { font-weight: 600; font-size: 13.5px; }
.mode-help { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }

.summary { font-size: 15px; font-weight: 600; margin: 2px 0 6px; }

.tile-bad .tile-value { color: var(--danger); }

.pill-schedule { background: #dbeafe; color: var(--blue); }
.pill-manual { background: #ede9fe; color: #5b21b6; }

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

/* ---- Reports ---- */

.range-select { max-width: 12rem; padding: 7px 10px; }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.report-head h2 { margin-bottom: 4px; }
.report-head p { margin: 0; }

.report-grid td, .report-grid th { font-size: 13px; }
/* Figures line up on the right so columns of numbers can be scanned down. */
.report-grid .num { text-align: right; font-variant-numeric: tabular-nums; }

.caveat { display: block; margin: -6px 0 14px; }

.tile-good .tile-value { color: var(--ok); }
.tile-warning .tile-value { color: var(--warn); }
.tile-bad .tile-value { color: var(--danger); }

/* Print / save-as-PDF: drop the chrome and let the table use the page. The browser produces a
   perfectly good PDF from this, which is why no PDF engine is bundled. */
@media print {
    .no-print, .sidebar, .topbar { display: none !important; }
    body { background: #fff; }
    .shell, .main, .content { display: block; padding: 0; margin: 0; }
    .card, .grid, .tile { border-color: #ccc; box-shadow: none; }
    .tiles { grid-template-columns: repeat(4, 1fr); }
    .grid { page-break-inside: auto; }
    .grid tr { page-break-inside: avoid; page-break-after: auto; }
    .grid thead { display: table-header-group; }
    a[href]::after { content: ""; }
}

/* Reports carry up to eight columns; let the table scroll in its own box rather than pushing the
   page sideways, which would make the whole console scroll horizontally on a laptop. */
.report-scroll { overflow-x: auto; }
@media print { .report-scroll { overflow-x: visible; } }
