/* MaiPed VFR – administration UI. Self-contained: no external fonts, scripts or CDNs. */

:root {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --ink: #17212f;
    --muted: #64748b;
    --line: #dde3ea;
    --brand: #0b3a66;
    --brand-2: #1565c0;
    --accent: #f59e0b;
    --ok: #1b7f4b;
    --ok-bg: #e3f5ea;
    --warn: #92600a;
    --warn-bg: #fdf1d6;
    --bad: #b3261e;
    --bad-bg: #fde7e5;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1 { font-size: 1.55rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; }
.card h2:first-child { margin-top: 0; }
h1:focus { outline: none; }
a { color: var(--brand-2); }
code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef2f6; padding: 1px 5px; border-radius: 4px; word-break: break-word; }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: linear-gradient(180deg, #0b2f54 0%, #0a2340 100%);
    color: #dbe7f5;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-block { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; color: #fff; }
.brand-sub { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: #8fb2d9; margin-top: 2px; }

.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar nav a {
    display: block;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #c9dbef;
    text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav a.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }

.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; }
.sidebar-foot .who { color: #9fbbdb; margin-bottom: 8px; word-break: break-all; }
.sidebar-foot form { margin: 0 0 8px; }
.muted-link { color: #8fb2d9; font-size: .8rem; }

.content { flex: 1; min-width: 0; padding: 28px 32px 48px; }

/* ---------- public pages ---------- */

.public-header {
    background: linear-gradient(90deg, #0b2f54, #134a80);
    color: #fff;
    padding: 16px 28px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.public-header .brand-sub { display: inline; margin: 0; }
.public-main { max-width: 1100px; margin: 28px auto; padding: 0 20px; }

/* ---------- building blocks ---------- */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 18px;
    overflow-x: auto;
}
.card.narrow { max-width: 420px; margin: 8vh auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; align-items: start; }
.grid .card { margin-bottom: 0; }

.lead { color: var(--muted); margin: 0 0 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.bad-text { color: var(--bad); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 0 0 14px; }
.toolbar label, .form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }

input, select {
    font: inherit;
    padding: 7px 10px;
    border: 1px solid #c4cdd8;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    min-width: 180px;
}
input:focus, select:focus { outline: 2px solid #9cc3f0; outline-offset: 1px; border-color: var(--brand-2); }

.form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.form input { width: 100%; }

.btn {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid #c4cdd8;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: #f2f5f9; border-color: #aab6c5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { background: #0f55a6; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.sidebar .btn.ghost { color: #dbe7f5; border-color: rgba(255, 255, 255, .25); width: 100%; }
.sidebar .btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.btn.small { padding: 3px 9px; font-size: .8rem; }

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    background: #e8edf3;
    color: #41526a;
    white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); border-color: #bfe5cd; color: #14613a; }
.alert.bad { background: var(--bad-bg); border-color: #f5c2bd; color: #8a1c16; }

/* ---------- tables ---------- */

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody tr:hover td { background: #f8fafc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { white-space: nowrap; text-align: right; }
.table.kv th { width: 190px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table.log td { font-size: .86rem; }

ul.plain { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Blazor ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: #fff4ce;
    border-top: 1px solid #e5cf8a;
    padding: 10px 20px;
}

.blazor-error-boundary { background: var(--bad); color: #fff; padding: 12px 16px; border-radius: 8px; }
.blazor-error-boundary::after { content: "An error has occurred."; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: auto; flex: none; height: auto; position: static; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .content { padding: 18px 14px 36px; }
    .grid { grid-template-columns: 1fr; }
}
