/* AWBGuru Admin console — deliberately independent of the customer app's CSS.
   Dark, dense, desktop-only. No external fonts (CSP: self only). */

:root {
    --bg: #0e1116;
    --bg2: #151a21;
    --line: #262d38;
    --text: #d7dde6;
    --muted: #8b95a3;
    --accent: #4da3ff;
    --ok: #3ecf8e;
    --err: #ff6b6b;
    --warn: #f5b74a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: Consolas, monospace; }

/* ── Shell ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.side {
    width: 210px;
    flex: none;
    background: var(--bg2);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 16px 0;
}

.brand { font-weight: 600; font-size: 15px; padding: 0 16px 4px; letter-spacing: .3px; }
.brand-center { text-align: center; padding-bottom: 16px; }
.brand-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 2px; }
.brand-admin { font-size: 10px; color: var(--muted); letter-spacing: 2px; vertical-align: 2px; }

.env { font-size: 10px; letter-spacing: 2px; padding: 2px 16px 14px; }
.env-test { color: var(--warn); }
.env-prod { color: var(--err); }

.nav { display: flex; flex-direction: column; }
.nav a { color: var(--text); padding: 9px 16px; border-left: 2px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.04); text-decoration: none; }
.nav a.active { border-left-color: var(--accent); background: rgba(77,163,255,.08); }

.side-foot { margin-top: auto; padding: 12px 16px 0; border-top: 1px solid var(--line); }
.whoami { font-size: 12px; color: var(--muted); margin-bottom: 8px; word-break: break-all; }

.main { flex: 1; padding: 28px 36px 60px; min-width: 0; }

h1 { font-size: 21px; margin: 0 0 6px; font-weight: 600; }
h2 { font-size: 15px; margin: 30px 0 10px; font-weight: 600; color: var(--text); }
.muted { color: var(--muted); }

/* ── Metric cards ──────────────────────────────────────── */
.cards { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }

.metric {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 18px;
    min-width: 150px;
}
.metric-num { font-size: 22px; font-weight: 600; }
.metric-num.na { color: var(--muted); font-size: 16px; }
.metric-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.metric.warn { border-color: var(--warn); }
.metric.warn .metric-num { color: var(--warn); }

/* ── Tables ────────────────────────────────────────────── */
.tbl { border-collapse: collapse; width: 100%; margin: 10px 0; }
.tbl th, .tbl td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl thead th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-narrow { width: auto; min-width: 280px; }
.tbl-kv th { color: var(--muted); font-weight: 500; width: 160px; }
.wrap { max-width: 420px; overflow-wrap: anywhere; }
.details { font-family: Consolas, monospace; font-size: 12px; color: var(--muted); }

.pill {
    display: inline-block;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
}
.pill-ok { color: var(--ok); border-color: var(--ok); }
.pill-err { color: var(--err); border-color: var(--err); }

/* ── Forms ─────────────────────────────────────────────── */
.filters { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 360px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }

.input {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 14px;
}
.input:focus { outline: none; border-color: var(--accent); }
select.input { min-width: 160px; }

.btn {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    display: inline-block;
    text-align: center;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0b1017; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.fld-err { color: var(--err); font-size: 12px; }

.banner { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin: 12px 0; }
.banner-err { border-color: var(--err); color: var(--err); }

/* ── Auth pages ────────────────────────────────────────── */
.auth-stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-box {
    width: 380px;
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 32px 34px 36px;
}
.auth-title { font-size: 18px; margin: 0 0 6px; }
.auth-note { color: var(--muted); font-size: 13px; margin-top: 0; }

/* ── 2FA setup ─────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px 24px;
    max-width: 520px;
    margin-top: 14px;
}
.qr { background: #fff; padding: 8px; border-radius: 6px; }
.totp-key { letter-spacing: 1px; }
.recovery { columns: 2; list-style: none; padding: 0; }
.recovery li { margin: 4px 0; }

/* ── Phase B1 inline forms ─────────────────────────────── */
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.input-sm { padding: 4px 8px; font-size: 12px; }
.input-num { width: 70px; }
.btn-danger { border-color: var(--err); color: var(--err); }
.btn-danger:hover { background: rgba(255,107,107,.08); }
.tbl tr.sel td { background: rgba(43,108,176,.08); font-weight: 600; }

/* ── Field probe (/costs/doc/{id}) ─────────────────────── */
.probe-grid { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; margin-top: 14px; }
.probe-left { flex: 1 1 440px; min-width: 320px; }
.probe-right { flex: 1 1 520px; min-width: 380px; }
.probe-doc { position: relative; display: inline-block; max-width: 100%; line-height: 0;
    border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg2); }
.probe-doc img { display: block; max-width: 100%; height: auto; }
.probe-doc img:not([src]) { width: 440px; height: 580px; max-width: 100%; }
.probe-overlay { position: absolute; inset: 0; line-height: 1.2; font-size: 12px; color: var(--muted); }
.probe-box { position: absolute; border: 2px solid var(--pc, var(--accent)); border-radius: 2px; }
.probe-tag { position: absolute; top: -16px; left: -2px; font-size: 10px; padding: 0 4px;
    border-radius: 2px; background: var(--pc, var(--accent)); color: #0b1017; white-space: nowrap; }
.probe-chip { display: inline-block; width: 10px; height: 10px; border-radius: 2px;
    margin-right: 5px; background: var(--pc, var(--accent)); }
/* Box palette — assigned by probe order, cycles at 8. */
.pc0 { --pc: #ff6b6b; } .pc1 { --pc: #4da3ff; } .pc2 { --pc: #3ecf8e; } .pc3 { --pc: #f5b74a; }
.pc4 { --pc: #c792ea; } .pc5 { --pc: #64d8cb; } .pc6 { --pc: #ff9e64; } .pc7 { --pc: #e6e97a; }
.probe-actions { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.probe-runs { margin-bottom: 10px; }
.probe-val { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.probe-note, .probe-note-cell { font-size: 12px; color: var(--muted); }
.probe-note { max-width: 560px; line-height: 1.45; }
.probe-prompt-box { margin: 12px 0; }
.probe-prompt-box summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.probe-prompt { width: 100%; min-height: 280px; margin-top: 8px; resize: vertical;
    font: 12px/1.5 Consolas, monospace; background: var(--bg); color: var(--text);
    border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.probe-prompt:focus { outline: none; border-color: var(--accent); }
.probe-raw { white-space: pre-wrap; word-break: break-word; font: 12px/1.5 Consolas, monospace;
    background: var(--bg2); border: 1px solid var(--line); border-radius: 6px;
    padding: 10px 12px; max-height: 420px; overflow: auto; }
/* Raw (uncalibrated) model boxes: dashed, no fill tag emphasis. */
.probe-box.probe-raw { border-style: dashed; opacity: .55; }
.probe-box.probe-raw .probe-tag { opacity: .8; }
.probe-raw-toggle { margin-left: 10px; display: inline-flex; gap: 5px; align-items: center;
    color: var(--muted); font-size: 12px; cursor: pointer; }
/* Calibration tuning strip under the doc preview. */
.cal-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 4px; }
.cal-form label { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cal-form .input-num { width: 78px; }
/* Grouped calibration knobs: Rotate | Zoom | Move. */
.cal-group { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px 4px 8px;
    border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); }
.cal-group-name { font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
    color: var(--muted); font-weight: 600; margin-right: 2px; }
.cal-lock { cursor: pointer; }
/* Red manipulation frame: center grip = move, corner handles = zoom. */
.cal-frame { position: absolute; border: 2px solid rgba(255,64,64,.9); pointer-events: none; z-index: 6; }
.cal-grip { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
    border: 2px solid rgba(255,64,64,.95); background: rgba(255,64,64,.28); border-radius: 50%;
    cursor: move; pointer-events: auto; touch-action: none; }
.cal-handle { position: absolute; width: 12px; height: 12px; background: rgba(255,64,64,.95);
    border: 1px solid #fff2; pointer-events: auto; touch-action: none; }
.cal-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.cal-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.cal-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.cal-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
