@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap");

:root {
    --navy: #134462;
    --navy-600: #0f3750;
    --navy-400: #2a6280;
    --navy-soft: #e7eef3;
    --navy-softer: #f4f7f9;
    --white: #ffffff;
    --bg: #f6f8fa;
    --text: #134462;
    --muted: #5d7380;
    --line: #d7e1e7;
    --good: #1b7a4a;
    --good-bg: #e8f6ee;
    --warn: #9a6b12;
    --warn-bg: #fff6e5;
    --investigate: #c05621;
    --investigate-bg: #fff4ed;
    --bad: #b42318;
    --bad-bg: #fdecea;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(19, 68, 98, 0.08);
    --font: "Manrope", "Segoe UI", system-ui, sans-serif;
    --sidebar: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 10%, rgba(19, 68, 98, 0.12), transparent 36%),
        radial-gradient(circle at 90% 0%, rgba(19, 68, 98, 0.08), transparent 28%),
        var(--white);
}
.login-card {
    width: min(440px, 100%);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: var(--shadow);
}
.eyebrow {
    color: var(--navy-400);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.login-card h1 { font-size: 32px; letter-spacing: -0.03em; }
.lede { margin: 10px 0 24px; color: var(--muted); line-height: 1.5; }
.login-form label { display: block; margin-bottom: 16px; }
.login-form span, .field span, .check span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.login-form .btn { width: 100%; }
input.search,
.login-form input, .field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: 10px;
    padding: 11px 12px;
    outline: none;
}
.login-form input:focus, .field input:focus, .field select:focus, .field textarea:focus, input.search:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(19, 68, 98, 0.12);
}

.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar);
    background: var(--navy);
    color: #d7e4ec;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 22px 18px 18px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--white); color: var(--navy);
    display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.brand strong { display: block; color: #fff; font-size: 15px; }
.brand small { color: #9cb4c3; }
.nav { padding: 8px 12px; display: grid; gap: 4px; flex: 1; }
.nav-link {
    text-align: left; border: 0; background: transparent; color: #d7e4ec;
    border-radius: 10px; padding: 10px 12px; font-weight: 600;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar-foot {
    padding: 16px 18px 20px; display: flex; justify-content: space-between;
    color: #9cb4c3; font-size: 13px;
}
.sidebar-foot a { color: #fff; }
.shell { margin-left: var(--sidebar); flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 20px 28px 8px; }
.topbar h2 { font-size: 26px; letter-spacing: -0.03em; }
.topbar p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.topbar-meta { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#clock { font-weight: 700; }
#tz-pill, .chip, .badge {
    background: var(--navy-soft); color: var(--navy);
    border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700;
}
.menu-btn {
    display: none; width: 40px; height: 40px; border: 1px solid var(--line);
    background: var(--white); border-radius: 10px; padding: 10px 9px;
}
.menu-btn span { display: block; height: 2px; background: var(--navy); margin: 4px 0; }
.content { padding: 16px 28px 40px; }
.page { display: none; }
.page.active { display: block; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: 1.3fr 0.7fr; }
.three { grid-template-columns: 1fr 1fr 1fr; }
.card {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px;
}
.card h3 { font-size: 16px; margin-bottom: 12px; }
.stat {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px;
}
.stat b { display: block; font-size: 28px; letter-spacing: -0.04em; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat.healthy b { color: var(--good); }
.stat.watch b { color: var(--warn); }
.stat.investigate b { color: var(--investigate); }
.stat.quarantine b { color: var(--bad); }

.btn {
    border: 1px solid transparent; border-radius: 10px; padding: 10px 14px;
    font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-600); }
.btn-ghost { background: var(--white); border-color: var(--line); color: var(--navy); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-good { background: var(--good); color: #fff; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-tiny { padding: 6px 10px; font-size: 12px; }

.banner, .flash { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-weight: 600; }
.banner { background: var(--warn-bg); color: var(--warn); }
.flash-bad { background: var(--bad-bg); color: var(--bad); }
.flash-good { background: var(--good-bg); color: var(--good); }
.muted { color: var(--muted); }
.help { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 8px; }
.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--navy-softer); border-radius: 8px; padding: 10px 12px; font-size: 12px; overflow: auto;
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: var(--navy-softer); }
tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.st {
    display: inline-flex; align-items: center; border-radius: 999px;
    padding: 4px 9px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.st-healthy { background: var(--good-bg); color: var(--good); }
.st-watch { background: var(--warn-bg); color: var(--warn); }
.st-investigate { background: var(--investigate-bg); color: var(--investigate); }
.st-quarantine { background: var(--bad-bg); color: var(--bad); }
.st-unscored { background: var(--navy-soft); color: var(--muted); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.search { min-width: 220px; flex: 1; }
.filters input[type="date"] { width: auto; min-width: 148px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; cursor: pointer; }
.chip.on { background: var(--navy); color: #fff; }

.reasons { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 36px; }
.spark i { display: block; width: 4px; background: var(--navy-400); border-radius: 2px 2px 0 0; min-height: 2px; }
.delta-bad { color: var(--bad); font-weight: 700; }
.delta-good { color: var(--good); font-weight: 700; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.check span { margin: 0; }

.log { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: var(--white); }
.log-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 13px; margin: 8px 0; }
.empty { color: var(--muted); padding: 18px 0; }

.toast {
    position: fixed; right: 20px; bottom: 20px; background: var(--navy); color: #fff;
    padding: 12px 16px; border-radius: 10px; z-index: 50; max-width: 360px;
}
.toast.bad { background: var(--bad); }
.modal {
    position: fixed; inset: 0; background: rgba(19, 68, 98, 0.35);
    display: grid; place-items: center; z-index: 60; padding: 20px;
}
.modal-card {
    width: min(860px, 100%); background: #fff; border-radius: 16px;
    padding: 22px; max-height: 86vh; overflow: auto;
}
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(19, 68, 98, 0.35); z-index: 20; }

@media (max-width: 1100px) {
    .stats, .two, .three, .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
    .sidebar.open { transform: none; }
    .sidebar-overlay.show { display: block; }
    .shell { margin-left: 0; }
    .menu-btn { display: block; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
    .stats, .two, .three, .form-grid { grid-template-columns: 1fr; }
    .topbar-meta { flex-wrap: wrap; }
}
