/* omnic2 — shared UI.
   Mobile first: the inspector works one-handed on a phone while walking.
   Big targets, one obvious action per screen, no build step. */

:root {
    --bg: #080b11;
    --bg-2: #0e141f;
    --surface: #121a27;
    --surface-2: #182233;
    --line: rgba(255, 255, 255, .10);
    --line-strong: rgba(255, 255, 255, .18);
    --fg: #e8eef6;
    --mut: #8b97a9;
    --dim: #64728a;

    --brand: #5b9dff;
    --brand-2: #3d7ee6;
    --accent: #ff8a3d;

    --ok: #4ade80;
    --warn: #eab308;
    --high: #f97316;
    --bad: #ef4444;

    --r: 14px;
    --r-lg: 20px;
    --pad: 1rem;
    --tap: 52px;
    --shadow: 0 8px 30px rgba(0, 0, 0, .40);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--fg);
    background:
        radial-gradient(1100px 600px at 50% -12%, rgba(91, 157, 255, .10) 0%, transparent 60%),
        linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 45%) fixed;
    font: 400 16px/1.6 system-ui, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }

.wrap { max-width: 560px; margin: 0 auto; padding: var(--pad); }
.wrap-wide { max-width: 1240px; margin: 0 auto; padding: var(--pad); }

.mut { color: var(--mut); }
.dim { color: var(--dim); }
.sm { font-size: .82rem; }
.xs { font-size: .74rem; }
.bold { font-weight: 600; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: .6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.wrapflex { display: flex; flex-wrap: wrap; gap: .5rem; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: .75rem; }
.stack-sm { display: grid; gap: .4rem; }
.hide { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* ── top bar ─────────────────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(8, 11, 17, .82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar-in {
    max-width: 1240px; margin: 0 auto;
    padding: .6rem var(--pad);
    display: flex; align-items: center; gap: .75rem;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; letter-spacing: -.02em; }
.brand-mark {
    width: 26px; height: 26px; border-radius: 8px; flex: none;
    background: linear-gradient(140deg, var(--brand), var(--brand-2));
    display: grid; place-items: center; font-size: .72rem; color: #04070d; font-weight: 700;
}

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 44px; padding: .55rem 1rem;
    border: 1px solid var(--line-strong); border-radius: 12px;
    background: var(--surface-2); color: var(--fg);
    font-weight: 500; cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(140deg, var(--brand), var(--brand-2));
    border-color: transparent; color: #04070d; font-weight: 650;
}
.btn-accent { background: var(--accent); border-color: transparent; color: #1a0d02; font-weight: 650; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--mut); }
.btn-danger { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .40); color: #fca5a5; }
.btn-block { width: 100%; }
.btn-lg { min-height: var(--tap); font-size: 1.02rem; border-radius: 14px; }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .82rem; border-radius: 10px; }

/* ── surfaces ────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--pad);
}
.card-tight { padding: .75rem; }
.card-flat { background: var(--surface-2); border-radius: var(--r); }

.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .22rem .6rem; border-radius: 99px;
    border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
    font-size: .74rem; color: var(--mut); white-space: nowrap;
}
.chip-ok { color: var(--ok); border-color: rgba(74, 222, 128, .35); background: rgba(74, 222, 128, .10); }
.chip-warn { color: var(--warn); border-color: rgba(234, 179, 8, .35); background: rgba(234, 179, 8, .10); }
.chip-bad { color: #fca5a5; border-color: rgba(239, 68, 68, .38); background: rgba(239, 68, 68, .12); }
.chip-brand { color: var(--brand); border-color: rgba(91, 157, 255, .38); background: rgba(91, 157, 255, .10); }
.chip-accent { color: var(--accent); border-color: rgba(255, 138, 61, .38); background: rgba(255, 138, 61, .10); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.dot-live { box-shadow: 0 0 0 0 rgba(74, 222, 128, .55); animation: pulse 2.2s infinite; }
@keyframes pulse {
    70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ── inputs ──────────────────────────────────────────────────────────── */
.field { display: grid; gap: .35rem; }
.input, .select, .textarea {
    width: 100%; min-height: 46px;
    padding: .6rem .8rem;
    background: var(--surface-2);
    border: 1px solid var(--line-strong); border-radius: 12px;
    outline: none;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); }
.input::placeholder, .textarea::placeholder { color: var(--dim); }
label.lbl { font-size: .82rem; color: var(--mut); }

/* ── score picker: the single most-tapped control in the system ──────── */
.scorebar { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.scorebtn {
    min-height: var(--tap);
    border: 1px solid var(--line-strong); border-radius: 12px;
    background: var(--surface-2); color: var(--mut);
    font-size: 1.15rem; font-weight: 600; cursor: pointer;
    transition: transform .08s ease, background .15s ease, color .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.scorebtn:active { transform: scale(.94); }
.scorebtn[aria-pressed="true"] { color: #04070d; border-color: transparent; }
.scorebtn[data-v="1"][aria-pressed="true"] { background: var(--bad); }
.scorebtn[data-v="2"][aria-pressed="true"] { background: var(--high); }
.scorebtn[data-v="3"][aria-pressed="true"] { background: var(--warn); }
.scorebtn[data-v="4"][aria-pressed="true"] { background: #a3e635; }
.scorebtn[data-v="5"][aria-pressed="true"] { background: var(--ok); }

/* toggle pills — checklists and tri-state */
.pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.pill {
    display: inline-flex; align-items: center; gap: .45rem;
    min-height: 46px; padding: .5rem .85rem;
    border: 1px solid var(--line-strong); border-radius: 12px;
    background: var(--surface-2); color: var(--mut);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: transform .08s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.pill:active { transform: scale(.97); }
.pill[aria-pressed="true"] {
    background: rgba(91, 157, 255, .16); border-color: var(--brand); color: var(--fg);
}
.pill[aria-pressed="true"] .pill-box { background: var(--brand); border-color: var(--brand); }
.pill-box {
    width: 18px; height: 18px; flex: none; border-radius: 6px;
    border: 1.5px solid var(--line-strong);
    display: grid; place-items: center; font-size: .7rem; color: #04070d;
}
.pill-good[aria-pressed="true"] { background: rgba(74, 222, 128, .16); border-color: var(--ok); }
.pill-partial[aria-pressed="true"] { background: rgba(234, 179, 8, .16); border-color: var(--warn); }
.pill-bad[aria-pressed="true"] { background: rgba(239, 68, 68, .16); border-color: var(--bad); }

/* ── progress ────────────────────────────────────────────────────────── */
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .35s ease; }
.bar-ok > i { background: var(--ok); }
.bar-warn > i { background: var(--warn); }
.bar-bad > i { background: var(--bad); }

/* ── layout helpers ──────────────────────────────────────────────────── */
.grid { display: grid; gap: .75rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) {
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; align-items: start; }
}

/* ── toast ───────────────────────────────────────────────────────────── */
#toast {
    position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(140%);
    z-index: 200; max-width: 92vw;
    padding: .7rem 1.1rem; border-radius: 12px;
    background: var(--surface-2); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow); font-size: .9rem;
    transition: transform .28s cubic-bezier(.22, .7, .3, 1);
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: rgba(74, 222, 128, .45); }
#toast.bad { border-color: rgba(239, 68, 68, .5); }

/* ── bottom sheet ────────────────────────────────────────────────────── */
.sheet-back {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(4, 7, 13, .68); backdrop-filter: blur(3px);
    display: grid; align-items: end; justify-items: center;
}
.sheet {
    width: min(560px, 100%);
    max-height: 88dvh; overflow: auto;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    animation: sheetin .28s cubic-bezier(.22, .7, .3, 1);
}
@media (min-width: 700px) {
    .sheet-back { align-items: center; }
    .sheet { border-radius: var(--r-lg); max-height: 82dvh; }
}
@keyframes sheetin { from { transform: translateY(26px); opacity: 0; } }
.sheet-grab {
    width: 38px; height: 4px; border-radius: 99px;
    background: var(--line-strong); margin: -.25rem auto .75rem;
}

/* ── misc ────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--line); margin: .25rem 0; }
.thumb {
    width: 100%; aspect-ratio: 4/3; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
}
.spin {
    width: 16px; height: 16px; border-radius: 50%; flex: none;
    border: 2px solid rgba(255, 255, 255, .22); border-top-color: var(--brand);
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, #1e2a3d 50%, var(--surface-2) 75%);
    background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 10px;
}
@keyframes sk { to { background-position: -200% 0; } }

.fade-in { animation: fin .4s cubic-bezier(.22, .7, .3, 1) both; }
@keyframes fin { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
