/* ==========================================================================
   TSHOOT TOOL — Network forensics
   Design tokens
   ========================================================================== */
:root {
    color-scheme: dark;

    --bg: #07090d;
    --bg-2: #0a0d12;
    --surface: #0d1117;
    --surface-2: #121821;
    --surface-3: #18202b;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);

    --text: #e6edf3;
    --text-2: #a3afbd;
    --muted: #6b7785;

    --cyan: #22d3ee;
    --cyan-soft: rgba(34, 211, 238, 0.12);
    --green: #3dff8a;
    --green-soft: rgba(61, 255, 138, 0.12);

    --critical: #ef4b5b;
    --critical-soft: rgba(239, 75, 91, 0.12);
    --warning: #fab219;
    --warning-soft: rgba(250, 178, 25, 0.12);
    --ok: #3ddc84;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px -12px rgba(0, 0, 0, 0.6);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

    --topbar-h: 64px;
    --sidebar-w: 272px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
body.app-mode { overflow: hidden; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1f2833; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2a3644; }
* { scrollbar-color: #1f2833 transparent; scrollbar-width: thin; }

/* ==========================================================================
   Wordmark
   ========================================================================== */
.wordmark {
    margin: 0;
    font-weight: 850;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    line-height: 0.95;
    color: #fff;
    text-shadow: 0 0 18px rgba(34, 211, 238, 0.45), 0 0 42px rgba(34, 211, 238, 0.18);
    white-space: nowrap;
}
.wordmark span {
    color: var(--green);
    text-shadow: 0 0 18px rgba(61, 255, 138, 0.45), 0 0 42px rgba(61, 255, 138, 0.18);
}
.wordmark.sm { font-size: 1.3rem; }
.wordmark.xl { font-size: clamp(3rem, 7vw, 5.2rem); }
.wordmark.xl span { display: block; }

@keyframes flicker-in {
    0% { opacity: 0; }
    8% { opacity: 1; }
    12% { opacity: 0.35; }
    18% { opacity: 1; }
    22% { opacity: 0.6; }
    30%, 100% { opacity: 1; }
}
.flicker { animation: flicker-in 1.6s ease-out both; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 14px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
    background: var(--green); color: #04130a;
    box-shadow: 0 0 0 1px rgba(61, 255, 138, 0.4), 0 6px 20px -6px rgba(61, 255, 138, 0.55);
}
.btn-primary:hover { background: #6bffa7; }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); }
.btn-secondary:hover { border-color: rgba(34, 211, 238, 0.5); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    color: var(--text-2); border: 1px solid transparent;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-icon svg { width: 18px; height: 18px; }
.link-btn { color: var(--cyan); font-size: 12px; font-weight: 600; padding: 2px 4px; border-radius: 6px; }
.link-btn:hover { text-decoration: underline; }

/* ==========================================================================
   Landing
   ========================================================================== */
.landing {
    position: relative;
    min-height: 100vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.landing-bg {
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(900px 520px at 12% 8%, rgba(34, 211, 238, 0.10), transparent 60%),
        radial-gradient(800px 520px at 92% 92%, rgba(61, 255, 138, 0.08), transparent 60%);
}
.landing-bg::after {
    content: ""; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
            mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}
.landing > * { position: relative; z-index: 1; }

.landing-top, .landing-foot {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 28px;
}
.landing-foot { color: var(--muted); font-size: 12px; justify-content: center; gap: 10px; }
.landing-foot a { color: var(--text-2); text-decoration: none; }
.landing-foot a:hover { color: var(--cyan); }
.top-link {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 500;
    padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
    background: rgba(13, 17, 23, 0.6);
}
.top-link:hover { color: #fff; border-color: var(--border-strong); }
.top-link svg { width: 15px; height: 15px; }

.hero {
    flex: 1;
    display: grid; grid-template-columns: 1.05fr 1fr; gap: 64px; align-items: center;
    width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px 28px 48px;
}
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--cyan);
    padding: 6px 12px; border-radius: 999px;
    background: var(--cyan-soft); border: 1px solid rgba(34, 211, 238, 0.22);
    margin-bottom: 22px;
}
.pulse-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--green);
    box-shadow: 0 0 0 0 rgba(61, 255, 138, 0.6);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(61, 255, 138, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(61, 255, 138, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 255, 138, 0); }
}
.lead { margin: 26px 0 30px; max-width: 30em; font-size: 17px; line-height: 1.6; color: var(--text-2); }

.features { list-style: none; margin: 0 0 34px; padding: 0; display: grid; gap: 14px; }
.features li { display: flex; gap: 14px; align-items: flex-start; }
.feat-icon {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--cyan);
}
.feat-icon svg { width: 18px; height: 18px; }
.features strong { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.features div span { font-size: 13px; color: var(--muted); }

.credits { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; border-left: 2px solid var(--cyan); }
.credits span { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.credits strong { font-size: 16px; letter-spacing: 0.04em; color: #fff; }

/* Drop zone */
.drop-panel { display: flex; flex-direction: column; gap: 14px; }
.dropzone {
    position: relative;
    display: grid; place-items: center; text-align: center;
    min-height: 340px; padding: 36px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(18, 24, 33, 0.85), rgba(10, 13, 18, 0.85));
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.dropzone::before {
    content: ""; position: absolute; inset: 12px; border-radius: 14px;
    border: 1.5px dashed rgba(255, 255, 255, 0.12);
    transition: border-color .2s;
    pointer-events: none;
}
.dropzone:hover::before, .dropzone.drag::before { border-color: rgba(34, 211, 238, 0.55); }
.dropzone:hover { box-shadow: var(--shadow), 0 0 0 1px rgba(34, 211, 238, 0.15), 0 0 60px -20px rgba(34, 211, 238, 0.45); }
.dropzone.drag { transform: scale(1.01); box-shadow: var(--shadow), 0 0 0 1px rgba(34, 211, 238, 0.5), 0 0 80px -16px rgba(34, 211, 238, 0.6); }
.dropzone.busy { cursor: progress; }
.dz-state { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 400px; }
.dz-icon {
    display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; margin-bottom: 8px;
    color: var(--cyan); background: var(--cyan-soft); border: 1px solid rgba(34, 211, 238, 0.25);
    transition: transform .2s;
}
.dz-icon svg { width: 28px; height: 28px; }
.dropzone:hover .dz-icon, .dropzone.drag .dz-icon { transform: translateY(-3px); }
.dz-title { margin: 0; font-size: 17px; font-weight: 600; color: #fff; }
.dz-sub { margin: 0; color: var(--text-2); font-size: 14px; }
.dz-sub .link { color: var(--green); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dz-hint {
    margin-top: 14px; font-size: 12px; color: var(--muted);
    padding: 8px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
}
.dz-hint b { color: var(--text-2); font-weight: 500; }
.dz-file { margin: 0; font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-error-icon { color: var(--critical); background: var(--critical-soft); border-color: rgba(239, 75, 91, 0.3); }
.dz-error-msg { margin: 0; color: var(--text-2); font-size: 13px; }

.progress { width: 100%; height: 6px; border-radius: 99px; background: #0a0e14; border: 1px solid var(--border); overflow: hidden; margin-top: 6px; }
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--green));
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.6);
    transition: width .15s linear;
}
.spinner {
    width: 44px; height: 44px; border-radius: 50%; margin-bottom: 8px;
    border: 3px solid rgba(34, 211, 238, 0.15); border-top-color: var(--cyan);
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sample-btn {
    align-self: center;
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 500; color: var(--text-2);
    padding: 8px 14px; border-radius: 999px;
}
.sample-btn:hover { color: #fff; background: var(--surface); }
.sample-btn svg { width: 15px; height: 15px; color: var(--green); }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { height: 100vh; display: grid; grid-template-rows: var(--topbar-h) 1fr; }
.topbar {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 20px;
    background: rgba(7, 9, 13, 0.92);
    border-bottom: 1px solid var(--border);
    z-index: 20;
}
.topbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.7) 30%, rgba(61, 255, 138, 0.7) 70%, transparent);
    opacity: 0.55;
}
.topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.file-chip {
    display: inline-flex; align-items: center; gap: 8px; min-width: 0;
    padding: 6px 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 12.5px; color: var(--text-2);
}
.file-chip svg { width: 14px; height: 14px; color: var(--cyan); }
.file-chip .file-name { color: var(--text); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .sep { color: var(--muted); }

.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 0; }

/* Sidebar */
.sidebar {
    display: flex; flex-direction: column; gap: 18px;
    padding: 20px 18px;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}
.side-head { display: flex; align-items: center; justify-content: space-between; }
.side-head h2 {
    margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan);
    display: flex; align-items: center; gap: 8px;
}
.side-head h2 svg { width: 14px; height: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: 1fr 88px; gap: 10px; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.input-wrap input[type="text"] { padding-left: 32px; }
input[type="text"], select {
    width: 100%; height: 36px; padding: 0 11px;
    background: #090c11; border: 1px solid var(--border-strong); border-radius: 8px;
    color: var(--text); font-size: 13px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input[type="text"].mono { font-family: var(--mono); font-size: 12.5px; }
input::placeholder { color: #4b5562; }
input[type="text"]:focus, select:focus { border-color: rgba(34, 211, 238, 0.6); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12); }
select {
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7785' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}

.chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.chip {
    height: 28px; padding: 0 4px; border-radius: 999px;
    font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
    color: var(--text-2); background: var(--surface); border: 1px solid var(--border-strong);
    transition: all .15s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.25); }
.chip[aria-pressed="true"] { color: var(--cyan); background: var(--cyan-soft); border-color: rgba(34, 211, 238, 0.55); }
.chip[data-flag="RST"][aria-pressed="true"] { color: var(--critical); background: var(--critical-soft); border-color: rgba(239, 75, 91, 0.55); }

.segmented {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
    padding: 3px; border-radius: 10px; background: #090c11; border: 1px solid var(--border-strong);
}
.segmented button {
    height: 30px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.segmented .sev-dot { width: 7px; height: 7px; border-radius: 50%; }

.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.privacy { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.privacy svg { width: 13px; height: 13px; color: var(--green); }
.byline { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.byline strong { color: var(--cyan); font-weight: 700; text-shadow: 0 0 10px rgba(34, 211, 238, 0.45); }

/* Main column */
.main { overflow-y: auto; padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text); }
.card-sub { font-size: 12px; color: var(--muted); }
.chart-wrap { position: relative; height: 200px; padding: 4px 12px 12px; }
.chart-wrap.tall { height: 176px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi {
    position: relative; overflow: hidden;
    padding: 14px 16px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.kpi-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--cyan); background: var(--cyan-soft); }
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: #fff; line-height: 1.15; margin-top: 4px; }
.kpi-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: transparent; }
.kpi.is-critical .kpi-icon { color: var(--critical); background: var(--critical-soft); }
.kpi.is-warning .kpi-icon { color: var(--warning); background: var(--warning-soft); }
.kpi.is-green .kpi-icon { color: var(--green); background: var(--green-soft); }
.kpi.is-critical.has-value::after { background: var(--critical); box-shadow: 0 0 12px var(--critical); }
.kpi.is-warning.has-value::after { background: var(--warning); box-shadow: 0 0 12px var(--warning); }
.kpi.is-critical.has-value .kpi-value { color: #ff8a95; }
.kpi.is-warning.has-value .kpi-value { color: #ffd277; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-item b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* Table */
.table-card { display: flex; flex-direction: column; }
.table-head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.af-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 9px;
    border-radius: 999px; font-size: 11.5px; color: var(--text);
    background: var(--cyan-soft); border: 1px solid rgba(34, 211, 238, 0.35);
}
.af-chip b { font-weight: 500; color: var(--text-2); }
.af-chip button { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--text-2); }
.af-chip button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.af-chip svg { width: 10px; height: 10px; }

.table-scroll { overflow-x: auto; border-top: 1px solid var(--border); margin-top: 8px; }
table.ptable { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 1060px; }
.ptable th {
    position: sticky; top: 0;
    text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted); background: var(--surface-2);
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    white-space: nowrap; cursor: help;
}
.ptable th:first-child { padding-left: 16px; }
.ptable td {
    padding: 0 12px; height: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
    font-variant-numeric: tabular-nums;
}
.ptable td:first-child { padding-left: 16px; }
.ptable tbody tr { cursor: pointer; transition: background .1s; }
.ptable tbody tr:hover { background: rgba(34, 211, 238, 0.045); }
.ptable tbody tr:focus-visible { outline: none; background: rgba(34, 211, 238, 0.08); }
.ptable tbody tr.lvl-critical { background: rgba(239, 75, 91, 0.055); box-shadow: inset 3px 0 0 var(--critical); }
.ptable tbody tr.lvl-warning { background: rgba(250, 178, 25, 0.04); box-shadow: inset 3px 0 0 var(--warning); }
.ptable tbody tr.lvl-critical:hover { background: rgba(239, 75, 91, 0.1); }
.ptable tbody tr.lvl-warning:hover { background: rgba(250, 178, 25, 0.08); }
.ptable .c-no { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.ptable .c-num { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.ptable .c-ip { font-family: var(--mono); font-size: 12px; }
.ptable .c-host { color: var(--cyan); }
.ptable .c-host.inferred { color: var(--text-2); }
.ptable .c-dim { color: #4b5562; }
.proto-tag {
    display: inline-block; padding: 2px 7px; border-radius: 6px;
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    color: var(--text); background: var(--surface-3); border: 1px solid var(--border);
}
.flags { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.flags .f-rst { color: var(--critical); font-weight: 700; }
.flags .f-syn { color: var(--cyan); }
.flags .f-fin { color: var(--warning); }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 22px; padding: 0 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; }
.badge.ok { color: var(--muted); background: rgba(255, 255, 255, 0.03); border-color: var(--border); }
.badge.warning { color: var(--warning); background: var(--warning-soft); border-color: rgba(250, 178, 25, 0.3); }
.badge.critical { color: #ff7b88; background: var(--critical-soft); border-color: rgba(239, 75, 91, 0.35); }

.table-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted);
}
.pager { display: flex; align-items: center; gap: 6px; }
.pager .btn-icon { width: 30px; height: 30px; border: 1px solid var(--border); }
.pager .btn-icon:disabled { opacity: 0.35; cursor: default; background: none; }
.pager span { font-variant-numeric: tabular-nums; color: var(--text-2); }

.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }

/* ==========================================================================
   Packet drawer
   ========================================================================== */
.drawer-backdrop {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(3, 5, 8, 0.6);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; transition: opacity .2s;
}
.drawer-backdrop.open { opacity: 1; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
    width: min(620px, 100vw);
    display: flex; flex-direction: column;
    background: var(--bg-2);
    border-left: 1px solid var(--border-strong);
    box-shadow: -30px 0 60px -20px rgba(0, 0, 0, 0.7);
    transform: translateX(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
    visibility: hidden;
}
.drawer.open { transform: translateX(0); visibility: visible; }
.drawer-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 18px 20px 16px; border-bottom: 1px solid var(--border);
}
.drawer-kicker { margin: 0 0 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); }
.drawer-title { margin: 0; font-family: var(--mono); font-size: 15px; font-weight: 600; color: #fff; word-break: break-all; }
.drawer-title .arrow { color: var(--muted); margin: 0 6px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 18px; }
.drawer-body > * { flex-shrink: 0; }
.drawer h4 { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.kv { background: var(--surface); padding: 10px 12px; min-width: 0; }
.kv span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.kv b { display: block; font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.issues { display: flex; flex-direction: column; gap: 8px; }
.issue {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface);
}
.issue.critical { border-color: rgba(239, 75, 91, 0.35); background: linear-gradient(90deg, rgba(239, 75, 91, 0.08), var(--surface) 70%); }
.issue.warning { border-color: rgba(250, 178, 25, 0.3); background: linear-gradient(90deg, rgba(250, 178, 25, 0.07), var(--surface) 70%); }
.issue.ok { color: var(--text-2); }
.issue-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.issue.critical .issue-icon { color: var(--critical); background: var(--critical-soft); }
.issue.warning .issue-icon { color: var(--warning); background: var(--warning-soft); }
.issue.ok .issue-icon { color: var(--ok); background: rgba(61, 220, 132, 0.1); }
.issue-icon svg { width: 15px; height: 15px; }
.issue strong { display: block; font-size: 13.5px; color: #fff; margin-bottom: 2px; }
.issue p { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

.layers-head { display: flex; align-items: center; justify-content: space-between; }
.layers { display: flex; flex-direction: column; gap: 6px; }
.layer { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.layer summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; font-size: 12.5px; font-weight: 600; color: var(--text);
}
.layer summary::-webkit-details-marker { display: none; }
.layer summary .chev { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.layer[open] summary .chev { transform: rotate(90deg); }
.layer summary .proto-tag { font-size: 11px; }
.layer summary .layer-meta { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--muted); }
.layer summary:hover { background: rgba(255, 255, 255, 0.02); }
.json {
    margin: 0; padding: 12px 14px; border-top: 1px solid var(--border);
    background: #070a0e;
    font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text-2);
    white-space: pre-wrap; word-break: break-all;
    max-height: 420px; overflow: auto;
}
.j-key { color: #7dd3fc; }
.j-str { color: #86efac; }
.j-num { color: #fcd34d; }
.j-bool { color: #f0abfc; }
.j-punc { color: #4b5562; }

/* Tooltip + toast */
.tip {
    position: fixed; z-index: 100; pointer-events: none;
    max-width: 240px; padding: 7px 10px; border-radius: 8px;
    background: #0b0f15; border: 1px solid rgba(34, 211, 238, 0.35);
    color: var(--text); font-size: 12px; line-height: 1.4; font-weight: 400; letter-spacing: 0; text-transform: none;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
    opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tip.show { opacity: 1; transform: translateY(0); }
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 120;
    transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: 999px;
    background: var(--surface-3); border: 1px solid var(--border-strong);
    font-size: 13px; color: var(--text); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
}
.toast svg { width: 15px; height: 15px; color: var(--green); }

.only-mobile { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
    .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kpis .kpi:nth-child(4), .kpis .kpi:nth-child(5) { grid-column: span 1; }
}
@media (max-width: 1100px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-3 .card:last-child { grid-column: span 2; }
}
@media (max-width: 960px) {
    .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 8px; }
    .wordmark.xl span { display: inline; }
    .dropzone { min-height: 260px; }
}
@media (max-width: 860px) {
    body.app-mode { overflow: auto; }
    .app { height: auto; min-height: 100vh; }
    .topbar { position: sticky; top: 0; }
    .layout { grid-template-columns: 1fr; }
    .main { overflow: visible; padding: 16px 14px 32px; }
    .sidebar {
        position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 30;
        width: min(320px, 88vw);
        transform: translateX(-100%); transition: transform .25s;
        box-shadow: 20px 0 50px -10px rgba(0, 0, 0, 0.7);
    }
    .sidebar.open { transform: translateX(0); }
    .only-mobile { display: inline-grid; }
    .file-chip { display: none; }
    .kpis { grid-template-columns: 1fr 1fr; }
    .kpis .kpi:last-child { grid-column: span 2; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-3 .card:last-child { grid-column: auto; }
    .btn .btn-label { display: none; }
    .kv-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .landing-top, .landing-foot, .hero { padding-left: 18px; padding-right: 18px; }
    .lead { font-size: 15.5px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
