/* VPS Vulnerability Checker — UI redesigned to the FIM design system.
   Neutral zinc palette, Inter typography, sidebar + topbar shell.
   Everything is driven by CSS variables so the dark theme is a pure
   token override. Legacy tokens (--accent-blue, --bg-card, --border-color)
   are kept because the JS references them directly. */

/* ===== DESIGN TOKENS ===== */

:root,
[data-theme="light"] {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f4f4f5;   /* zinc-100 */
    --surface-3: #fafafa;
    --border: #e4e4e7;      /* zinc-200 */
    --border-strong: #d4d4d8;
    --text: #18181b;        /* zinc-900 */
    --text-muted: #71717a;  /* zinc-500 */
    --text-subtle: #a1a1aa; /* zinc-400 */
    --primary: #18181b;
    --primary-hover: #000000;
    --primary-fg: #fafafa;
    --ring: rgba(24, 24, 27, 0.10);
    --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04), 0 1px 3px rgba(24, 24, 27, 0.06);
    --shadow-md: 0 4px 12px rgba(24, 24, 27, 0.06), 0 2px 6px rgba(24, 24, 27, 0.04);
    --shadow-lg: 0 12px 32px rgba(24, 24, 27, 0.12), 0 4px 12px rgba(24, 24, 27, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 248px;

    /* Accents (severity / charts) */
    --accent-blue: #2563eb;
    --accent-red: #dc2626;
    --accent-green: #16a34a;
    --accent-warning: #a16207;
    --accent-orange: #c2410c;

    /* Severity surfaces */
    --sev-crit-bg: #fef2f2; --sev-crit-fg: #b91c1c; --sev-crit-bd: #fecaca;
    --sev-high-bg: #fff7ed; --sev-high-fg: #c2410c; --sev-high-bd: #fed7aa;
    --sev-med-bg:  #fefce8; --sev-med-fg:  #a16207; --sev-med-bd:  #fde68a;
    --sev-low-bg:  #f0fdf4; --sev-low-fg:  #15803d; --sev-low-bd:  #bbf7d0;
    --sev-info-bg: #eff6ff; --sev-info-fg: #1d4ed8; --sev-info-bd: #bfdbfe;

    /* Legacy aliases (referenced from JS + kept for safety) */
    --bg-primary: var(--bg);
    --bg-secondary: var(--surface);
    --bg-card: var(--surface);
    --bg-card-header: var(--surface-2);
    --bg-input: var(--surface);
    --text-primary: var(--text);
    --text-secondary: var(--text-muted);
    --border-color: var(--border);
    --btn-close-filter: none;
}

[data-theme="dark"] {
    --bg: #09090b;          /* zinc-950 */
    --surface: #18181b;     /* zinc-900 */
    --surface-2: #27272a;   /* zinc-800 */
    --surface-3: #1c1c1f;
    --border: #27272a;
    --border-strong: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-subtle: #71717a;
    --primary: #fafafa;
    --primary-hover: #e4e4e7;
    --primary-fg: #18181b;
    --ring: rgba(250, 250, 250, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

    --accent-blue: #3b82f6;
    --accent-red: #f87171;
    --accent-green: #4ade80;
    --accent-warning: #fbbf24;
    --accent-orange: #fb923c;

    --sev-crit-bg: rgba(248,113,113,.12); --sev-crit-fg: #f87171; --sev-crit-bd: rgba(248,113,113,.30);
    --sev-high-bg: rgba(251,146,60,.12);  --sev-high-fg: #fb923c; --sev-high-bd: rgba(251,146,60,.30);
    --sev-med-bg:  rgba(251,191,36,.12);  --sev-med-fg:  #fbbf24; --sev-med-bd:  rgba(251,191,36,.30);
    --sev-low-bg:  rgba(74,222,128,.12);  --sev-low-fg:  #4ade80; --sev-low-bd:  rgba(74,222,128,.30);
    --sev-info-bg: rgba(96,165,250,.12);  --sev-info-fg: #60a5fa; --sev-info-bd: rgba(96,165,250,.30);

    --btn-close-filter: invert(1) grayscale(100%) brightness(200%);
}

* { box-sizing: border-box; }

/* ===== BASE ===== */

html, body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    min-height: 100vh;
}

body { transition: background-color .25s ease, color .25s ease; }

/* Seamless geometric hex-pattern backdrop, tuned per theme (tile repeats).
   Base colour comes from --bg (themed above); only the tile swaps per theme.
   Light: the source lavender-grey pattern; Dark: same mesh in a faint cool tint. */
body {
    background-image: url("/static/img/hex-pattern-light.svg");
    background-repeat: repeat;
    background-position: top left;
}
[data-theme="dark"] body {
    background-image: url("/static/img/hex-pattern-dark.svg");
}

code, pre, kbd, samp, .mono,
.target-ip, .scan-id, .cve-cell a,
.count-pill, .date-cell, .summary-value-mono,
.dataTables_wrapper input, .dataTables_wrapper select {
    font-family: ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: .85em;
    color: var(--text);
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Slim scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); background-clip: content-box; }

.text-muted-soft { color: var(--text-subtle); }
.muted { color: var(--text-muted); }

/* ===== LAYOUT SHELL ===== */

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

/* Top app bar brand */
.topbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--primary); color: var(--primary-fg);
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px; letter-spacing: .02em;
    flex-shrink: 0; text-decoration: none;
}
.brand-mark:hover { text-decoration: none; }
.brand-name { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; color: var(--text); line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--text-subtle); }

/* Theme toggle button (top bar) */
.theme-toggle {
    display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-size: 13px; font-weight: 550; cursor: pointer; font-family: inherit;
    transition: background .12s ease, border-color .12s ease;
}
.theme-toggle:hover { background: var(--surface-2); border-color: var(--border-strong); }
.theme-toggle .theme-icon { font-size: 15px; line-height: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 60px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(180%) blur(8px);
    position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
/* ===== CUSTOM LANGUAGE PICKER ===== */
.lang-picker { position: relative; }

.lang-picker-btn {
    display: flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 12px 0 10px;
    font-size: 13px; font-weight: 550; font-family: inherit;
    border: 1.5px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text); cursor: pointer;
    transition: border-color .18s, box-shadow .18s, background .18s;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    white-space: nowrap; outline: none;
}
.lang-picker-btn:hover {
    border-color: var(--accent-blue);
    background: color-mix(in srgb, var(--accent-blue) 6%, var(--surface));
}
.lang-picker-btn.open {
    border-color: var(--accent-blue);
    background: color-mix(in srgb, var(--accent-blue) 6%, var(--surface));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 18%, transparent);
}
.lang-globe { opacity: .55; flex-shrink: 0; }
.lang-chevron { opacity: .5; flex-shrink: 0; transition: transform .2s; }
.lang-picker-btn.open .lang-chevron { transform: rotate(180deg); }

.lang-picker-menu {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.07);
    min-width: 152px; z-index: 2000;
    animation: lang-in .15s cubic-bezier(.22,1,.36,1);
}
@keyframes lang-in {
    from { opacity: 0; transform: translateY(-6px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.lang-picker-item {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 10px 16px;
    font-size: 13.5px; font-family: inherit; font-weight: 500;
    color: var(--text); background: none; border: none; cursor: pointer;
    text-align: left; transition: background .1s; gap: 8px;
}
.lang-picker-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.lang-picker-item:hover { background: var(--surface-2); }
.lang-picker-item.active { color: var(--accent-blue); font-weight: 650; }
.lang-picker-item.active::after {
    content: '';
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent-blue); flex-shrink: 0;
}

.content { padding: 28px 28px 112px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ===== BOTTOM NAVIGATION (mobile-style) ===== */
.bottom-nav {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 4px; padding: 6px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    border: 1px solid var(--border); border-radius: 999px;
    box-shadow: var(--shadow-lg); z-index: 50;
    backdrop-filter: saturate(180%) blur(10px);
    max-width: calc(100vw - 28px);
}
.bottom-nav-link {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 50%;
    color: var(--text-muted); text-decoration: none; cursor: pointer; user-select: none;
    transition: background .15s ease, color .15s ease;
}
.bottom-nav-link svg { width: 21px; height: 21px; stroke-width: 1.9; pointer-events: none; }
.bottom-nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.bottom-nav-link.active { background: var(--primary); color: var(--primary-fg); }
.bottom-nav-link.active:hover { background: var(--primary-hover); color: var(--primary-fg); }

/* ===== PAGE TRANSITION ===== */
/* Native cross-document transition where supported (Chromium). */
@view-transition { navigation: auto; }
/* Universal fallback: page content eases in on each navigation/load.
   No forwards-fill — so no lingering transform that could trap fixed-position
   modals inside .content; final state matches the untransformed base. */
@keyframes page-enter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.content { animation: page-enter .4s cubic-bezier(.22, 1, .36, 1); }

@media (prefers-reduced-motion: reduce) {
    .content { animation: none; }
}

/* Shared (read-only) topbar badge */
.shared-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 12.5px; font-weight: 550;
    padding: 5px 12px; border-radius: 999px;
}

/* ===== CARDS ===== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}
.card-body { padding: 18px 20px; }
.card-header {
    padding: 13px 20px;
    font-size: 13.5px; font-weight: 600; color: var(--text);
    background: transparent;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}
.shadow-sm { box-shadow: var(--shadow-sm) !important; }

/* ===== STAT CARDS (statistics) ===== */

.stats-card-lg { text-align: center; transition: box-shadow .15s ease, transform .15s ease; }
.stats-card-lg:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stats-lg-value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stats-lg-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; margin-top: 6px; }

/* Bootstrap text colors → theme accents */
.text-primary { color: var(--text) !important; }
.text-danger  { color: var(--accent-red) !important; }
.text-warning { color: var(--accent-warning) !important; }
.text-success { color: var(--accent-green) !important; }
.text-muted   { color: var(--text-muted) !important; }

/* ===== BUTTONS ===== */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 14px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-size: 13px; font-weight: 550; cursor: pointer; font-family: inherit;
    transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
    text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary, .btn-primary:focus {
    background: var(--primary); color: var(--primary-fg); border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-fg); }
.btn-primary:disabled, .btn-primary.disabled {
    background: var(--primary); border-color: var(--primary); color: var(--primary-fg);
}

.btn-secondary,
.btn-outline-secondary {
    background: var(--surface); color: var(--text);
    border-color: var(--border); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover,
.btn-outline-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }

.btn-outline-primary {
    background: var(--surface); color: var(--text);
    border-color: var(--border); box-shadow: var(--shadow-sm);
}
.btn-outline-primary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.w-100 { width: 100%; }

.btn-kbd {
    margin-left: 8px; font-family: ui-monospace, monospace; font-size: 11px;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25);
    border-radius: 5px; padding: 1px 6px; line-height: 1.4;
}

/* ===== SPINNERS ===== */

.spinner-border {
    display: inline-block; width: 1.1rem; height: 1.1rem;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -.15em;
}
.spinner-border-sm { width: .85rem; height: .85rem; border-width: 2px; }
.spinner-border.text-primary { color: var(--accent-blue); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== FORMS ===== */

.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.label-hint { display: block; font-weight: 400; font-size: 11.5px; color: var(--text-subtle); margin-top: 3px; }
.label-hint code { font-size: 11px; }

.form-control, .form-select {
    width: 100%; height: 36px; padding: 0 12px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit; outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control::placeholder { color: var(--text-subtle); }
.form-control:focus, .form-select:focus {
    border-color: var(--text-subtle); box-shadow: 0 0 0 3px var(--ring);
    background: var(--surface); color: var(--text);
}
.form-control-lg { height: 44px; font-size: 14.5px; }

.form-control.is-valid { border-color: var(--accent-green); }
.form-control.is-invalid { border-color: var(--accent-red); }
.validation-feedback { font-size: 12px; margin-top: 7px; min-height: 16px; }
.feedback-ok { color: var(--accent-green); }
.feedback-error { color: var(--accent-red); }

/* ===== SCAN HERO (index) ===== */

/* Center the form in the space between the top bar and the floating nav,
   so a tall form never lands under the bottom navigation. */
.scan-hero { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 200px); padding: 16px 0 40px; }
.scan-form-container { width: 100%; max-width: 760px; }
.scan-hero-icon { display: none; }
.scan-hero-title { font-size: 34px; font-weight: 720; letter-spacing: -.025em; margin: 0 0 8px; }
.scan-hero-subtitle { font-size: 15px; color: var(--text-muted); margin: 0; }
.scan-form-container .card-body { padding: 28px 30px; }

/* --- Hero badge --- */
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 14px; border-radius: 999px; margin-bottom: 20px;
    border: 1px solid color-mix(in srgb, var(--accent-blue) 28%, transparent);
    background: color-mix(in srgb, var(--accent-blue) 7%, transparent);
    color: var(--accent-blue); font-size: 11px; font-weight: 650;
    letter-spacing: .1em; text-transform: uppercase; user-select: none;
}
.hero-badge-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent-blue);
    animation: hero-dot-pulse 2.4s ease-in-out infinite;
}
@keyframes hero-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-blue) 40%, transparent); }
    50%       { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-blue) 0%, transparent); }
}

/* --- Hero wordmark --- */
.hero-wordmark {
    font-size: 40px; font-weight: 760; letter-spacing: -.04em;
    line-height: 1.1; margin: 0 0 12px; color: var(--text);
}
.hero-wordmark-accent {
    background: linear-gradient(130deg, var(--accent-blue) 0%, #7c3aed 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="dark"] .hero-wordmark-accent {
    background: linear-gradient(130deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text; background-clip: text;
}

/* --- Hero feature pills --- */
.hero-features {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; flex-wrap: wrap; margin-top: 16px;
}
.hero-feat {
    font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-muted); padding: 3px 10px; border-radius: 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    white-space: nowrap;
}

/* Target input with recent dropdown */
.target-field { position: relative; }
.target-input-wrapper { position: relative; }
.target-dropdown-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border: 0; background: transparent;
    border-radius: 6px; cursor: pointer; color: var(--text-muted); font-size: 14px;
    display: grid; place-items: center; transition: background .12s ease;
}
.target-dropdown-toggle:hover { background: var(--surface-2); color: var(--text); }
.target-dropdown {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-md); overflow: hidden; padding: 4px;
}
.dropdown-item-recent {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; border: 0; background: none; cursor: pointer;
    padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text);
    font-family: ui-monospace, monospace;
}
.dropdown-item-recent:hover { background: var(--surface-2); }
.dropdown-item-action { font-size: 11px; color: var(--text-subtle); font-family: 'Inter', sans-serif; }
.dropdown-empty { padding: 12px; font-size: 12.5px; color: var(--text-subtle); text-align: center; }

/* ===== SCAN PROFILES ===== */

.scan-profiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.profile-btn {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); cursor: pointer; text-align: left;
    transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
    position: relative;
}
.profile-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.profile-btn.active {
    border-color: var(--primary); background: var(--surface);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm);
}
.profile-icon { font-size: 17px; line-height: 1; }
.profile-name { font-size: 13px; font-weight: 650; color: var(--text); }
.profile-eta { font-size: 10.5px; color: var(--accent-blue); font-weight: 600; }
.profile-desc { font-size: 10.5px; color: var(--text-subtle); line-height: 1.3; }

/* ===== SCAN LOADING OVERLAY ===== */

.scan-loading-overlay {
    position: fixed; inset: 0; z-index: 1080;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(6px);
    align-items: center; justify-content: center;
}
.scan-overlay-close {
    position: absolute; top: 20px; right: 24px;
    width: 36px; height: 36px; border: 1px solid var(--border); background: var(--surface);
    border-radius: 50%; font-size: 20px; color: var(--text-muted); cursor: pointer;
    display: grid; place-items: center; transition: background .12s;
}
.scan-overlay-close:hover { background: var(--surface-2); color: var(--text); }
.scan-loading-content {
    text-align: center; max-width: 380px; width: 100%; padding: 24px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.scan-loading-spinner {
    width: 48px; height: 48px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite;
}
.scan-loading-text { font-size: 16px; font-weight: 650; color: var(--text); }
.scan-loading-time { font-size: 28px; font-weight: 720; letter-spacing: -.02em; font-family: ui-monospace, monospace; color: var(--text); }
.scan-progress-track { width: 100%; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.scan-progress-bar { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .5s ease; }
.scan-loading-steps { font-size: 13px; color: var(--text-muted); min-height: 18px; }
.scan-overlay-cancel {
    margin-top: 4px; height: 34px; padding: 0 16px; border: 1px solid var(--border);
    background: var(--surface); border-radius: var(--radius-sm); cursor: pointer;
    font-size: 13px; font-weight: 550; color: var(--text); transition: background .12s;
}
.scan-overlay-cancel:hover { background: var(--surface-2); }
.scan-overlay-hint { font-size: 11.5px; color: var(--text-subtle); }
.scan-overlay-hint a { color: var(--accent-blue); }

/* ===== TABLES ===== */

.table {
    width: 100%; border-collapse: collapse; font-size: 13px;
    color: var(--text); margin: 0;
}
.table thead th {
    text-align: left; padding: 11px 16px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-subtle); background: var(--surface-2);
    border-bottom: 1px solid var(--border); border-top: 0;
}
.table tbody td {
    padding: 11px 16px; border-top: 1px solid var(--border);
    color: var(--text); vertical-align: middle; background: transparent;
}
.table.table-sm thead th { padding: 8px 12px; }
.table.table-sm tbody td { padding: 8px 12px; }
.table tbody tr { transition: background .1s ease; }
.table-hover tbody tr:hover td { background: var(--surface-3); }
.table-striped tbody tr:nth-of-type(odd) td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.table > :not(caption) > * > * { box-shadow: none; }

/* Card with a table inside should clip rounded corners */
.card-body > .table:first-child:last-child { margin: -2px 0; }

/* ===== BADGES ===== */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 600; line-height: 1.6;
    border: 1px solid transparent; text-transform: capitalize;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }

.badge-critical { background: var(--sev-crit-bg); color: var(--sev-crit-fg); border-color: var(--sev-crit-bd); }
.badge-high     { background: var(--sev-high-bg); color: var(--sev-high-fg); border-color: var(--sev-high-bd); }
.badge-medium   { background: var(--sev-med-bg);  color: var(--sev-med-fg);  border-color: var(--sev-med-bd); }
.badge-low      { background: var(--sev-low-bg);  color: var(--sev-low-fg);  border-color: var(--sev-low-bd); }
.badge-info     { background: var(--sev-info-bg); color: var(--sev-info-fg); border-color: var(--sev-info-bd); }
.badge-unknown  { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* Tab count badge (no dot) */
.nav-tabs .badge { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.nav-tabs .badge::before { display: none; }
.ms-1 { margin-left: .25rem; }

/* ===== PILLS (history table) ===== */

.count-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px;
    font-size: 12px; font-weight: 650; border: 1px solid transparent;
}
.count-zero { background: var(--surface-2); color: var(--text-subtle); border-color: var(--border); }
.count-neutral { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.count-danger { background: var(--sev-crit-bg); color: var(--sev-crit-fg); border-color: var(--sev-crit-bd); }
.count-warning { background: var(--sev-med-bg); color: var(--sev-med-fg); border-color: var(--sev-med-bd); }

.scan-id { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.target-ip { font-weight: 600; color: var(--text); }

.tag-pill {
    display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
    font-size: 10.5px; font-weight: 600; background: var(--surface-2);
    color: var(--text-muted); border: 1px solid var(--border); margin-left: 4px;
}

.type-chip {
    display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 600; background: var(--surface-2);
    color: var(--text-muted); border: 1px solid var(--border);
}

.status-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; text-transform: capitalize;
    background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-completed { background: var(--sev-low-bg); color: var(--sev-low-fg); border-color: var(--sev-low-bd); }
.status-running { background: var(--sev-info-bg); color: var(--sev-info-fg); border-color: var(--sev-info-bd); }
.status-running .status-dot { animation: pulse 1.2s ease-in-out infinite; }
.status-error, .status-failed { background: var(--sev-crit-bg); color: var(--sev-crit-fg); border-color: var(--sev-crit-bd); }
@keyframes pulse { 50% { opacity: .35; } }

/* statistics recent table uses bare status-{x} span */
td > .status-completed, td > .status-running, td > .status-error { padding: 2px 8px; }

.date-cell { line-height: 1.25; }
.date-day { font-size: 12.5px; color: var(--text); font-weight: 550; }
.date-time { font-size: 11px; color: var(--text-subtle); }

.btn-view {
    display: inline-flex; align-items: center; gap: 5px;
    height: 28px; padding: 0 11px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-size: 12px; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s;
}
.btn-view:hover { background: var(--surface-2); border-color: var(--border-strong); }

.compare-checkbox { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ===== FILTERS (history) ===== */

.filters-dropdown-wrap { position: relative; }
.filters-toggle { position: relative; }
.filters-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 17px; height: 17px; padding: 0 5px; margin-left: 5px;
    border-radius: 999px; background: var(--primary); color: var(--primary-fg);
    font-size: 10px; font-weight: 700;
}
.filters-toggle.has-filters { border-color: var(--primary); }
.filters-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 260px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px;
}
.filters-dropdown-header {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12.5px; font-weight: 650; margin-bottom: 10px;
}
.filters-reset { border: 0; background: none; color: var(--accent-blue); font-size: 12px; font-weight: 550; cursor: pointer; }
.filter-group { margin-bottom: 12px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); font-weight: 600; margin-bottom: 7px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
    border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 550; cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.filter-chip:hover { background: var(--surface-2); color: var(--text); }
.filter-chip.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }

.auto-refresh-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent-green); font-weight: 550; }
.auto-refresh-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-green); animation: pulse 1.2s ease-in-out infinite; }

/* ===== MODALS ===== */

.modal-content {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.btn-close {
    width: 30px; height: 30px; border: 0; background: transparent; cursor: pointer;
    border-radius: 6px; font-size: 18px; line-height: 1; color: var(--text-muted);
    display: grid; place-items: center; opacity: 1;
    filter: var(--btn-close-filter);
}
.btn-close::before { content: '\00d7'; }
.btn-close:hover { background: var(--surface-2); color: var(--text); }

/* ===== EXPORT FOOTER ===== */

.export-footer { gap: 14px; }
.export-hint { font-size: 12px; color: var(--text-subtle); font-weight: 550; }
.export-buttons { display: flex; gap: 8px; }
.btn-export {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 12px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s;
}
.btn-export:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.export-icon { font-size: 13px; }

/* ===== SCAN DETAILS ===== */

.scan-summary-header {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px;
}
.summary-card, .summary-target {
    display: flex; flex-direction: column; gap: 4px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.summary-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); font-weight: 600; }
.summary-value { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-word; }
.summary-value-mono { font-size: 12.5px; font-weight: 500; }
.scan-summary-meta { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; }
.scan-summary-meta .summary-target { background: var(--surface-2); min-width: 150px; }

.severity-summary { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.sev-chip {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; text-transform: capitalize;
    border: 1px solid transparent;
}
.sev-critical { background: var(--sev-crit-bg); color: var(--sev-crit-fg); border-color: var(--sev-crit-bd); }
.sev-high     { background: var(--sev-high-bg); color: var(--sev-high-fg); border-color: var(--sev-high-bd); }
.sev-medium   { background: var(--sev-med-bg);  color: var(--sev-med-fg);  border-color: var(--sev-med-bd); }
.sev-low      { background: var(--sev-low-bg);  color: var(--sev-low-fg);  border-color: var(--sev-low-bd); }
.sev-info     { background: var(--sev-info-bg); color: var(--sev-info-fg); border-color: var(--sev-info-bd); }
.sev-clean    { background: var(--sev-low-bg);  color: var(--sev-low-fg);  border-color: var(--sev-low-bd); }

.result-section { margin-top: 24px; }
.result-section:first-of-type { margin-top: 0; }
.section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 650; color: var(--text); margin: 0 0 12px;
    text-transform: uppercase; letter-spacing: .03em;
}
.section-count {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 1px 9px; text-transform: none; letter-spacing: 0;
}

.cve-cell { display: inline-flex; align-items: center; gap: 6px; }
.cve-cell a { font-weight: 600; }
.copy-btn {
    border: 0; background: none; cursor: pointer; padding: 2px 4px; border-radius: 5px;
    font-size: 12px; color: var(--text-subtle); transition: background .12s, color .12s;
}
.copy-btn:hover { background: var(--surface-2); color: var(--text); }
.copy-btn.copied { color: var(--accent-green); font-size: 11px; }
.remediation-cell { display: flex; align-items: flex-start; gap: 6px; justify-content: space-between; }

/* vuln severity row accent */
.vuln-row-critical td:first-child { box-shadow: inset 3px 0 0 var(--accent-red); }
.vuln-row-high td:first-child { box-shadow: inset 3px 0 0 var(--accent-orange); }
.vuln-row-medium td:first-child { box-shadow: inset 3px 0 0 var(--accent-warning); }
.vuln-row-low td:first-child { box-shadow: inset 3px 0 0 var(--accent-green); }

/* ===== TABS (Bootstrap, in modal) ===== */

.nav-tabs {
    display: flex; flex-direction: row; flex-wrap: wrap; gap: 2px; list-style: none;
    padding: 0; margin: 0 0 4px; border-bottom: 1px solid var(--border);
}
.nav-tabs .nav-item { margin-bottom: -1px; }
.nav-tabs .nav-link {
    display: inline-flex; align-items: center; gap: 6px;
    border: 0; border-bottom: 2px solid transparent; background: none;
    padding: 9px 14px; font-size: 13px; font-weight: 550; color: var(--text-muted);
    cursor: pointer; border-radius: 0; transition: color .12s, border-color .12s;
}
.nav-tabs .nav-link:hover { color: var(--text); }
.nav-tabs .nav-link.active { color: var(--text); border-bottom-color: var(--primary); background: none; }
.tab-content { padding-top: 4px; }
.tab-pane { display: none; }
.tab-pane.show.active, .tab-pane.active { display: block; }
.fade { transition: opacity .15s linear; }
.fade:not(.show) { opacity: 0; }

/* ===== EMPTY STATE ===== */

.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 48px 24px; text-align: center;
}
.empty-icon { font-size: 36px; opacity: .8; }
.empty-title { font-size: 15px; font-weight: 650; color: var(--text); }
.empty-text { font-size: 13px; color: var(--text-muted); max-width: 340px; }
.empty-state .btn { margin-top: 8px; }

/* ===== COMPARE ===== */

.compare-header {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
    padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-2); margin-bottom: 16px;
}
.compare-scan-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-subtle); font-weight: 600; }
.compare-scan-target { font-size: 15px; font-weight: 650; color: var(--text); margin-top: 2px; }
.compare-scan-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.compare-arrow { font-size: 22px; color: var(--text-subtle); }
.compare-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.compare-stat {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.compare-num { font-size: 26px; font-weight: 720; letter-spacing: -.02em; }
.compare-label { font-size: 11.5px; color: var(--text-muted); font-weight: 550; }
.compare-new .compare-num { color: var(--accent-red); }
.compare-fixed .compare-num { color: var(--accent-green); }
.compare-persistent .compare-num { color: var(--accent-warning); }
.compare-section { margin-top: 20px; }
.section-title.cmp-new { color: var(--accent-red); }
.section-title.cmp-fixed { color: var(--accent-green); }
.section-title.cmp-persistent { color: var(--accent-warning); }

/* ===== PROGRESS BARS (statistics) ===== */

.progress { display: flex; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; }

/* ===== ALERTS / TOASTS ===== */

#alertContainer { position: fixed; bottom: 0; right: 0; padding: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.alert {
    position: relative; padding: 12px 38px 12px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-md); font-size: 13px; min-width: 260px; max-width: 380px;
}
.alert-toast { animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.alert.fade { transition: opacity .3s ease; }
.alert.fade:not(.show) { opacity: 0; }
.alert .btn-close { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; font-size: 15px; }
.alert-success { border-left: 3px solid var(--accent-green); }
.alert-danger  { border-left: 3px solid var(--accent-red); }
.alert-warning { border-left: 3px solid var(--accent-warning); }
.alert-info    { border-left: 3px solid var(--accent-blue); }
.alert-link { font-weight: 600; color: var(--accent-blue); }

/* ===== DATATABLES CHROME ===== */

.dataTables_wrapper { font-size: 13px; color: var(--text-muted); }
.dataTables_wrapper .dataTables_filter { margin-bottom: 14px; text-align: right; }
.dataTables_wrapper .dataTables_filter label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); font-weight: 550; }
.dataTables_wrapper .dataTables_filter input {
    height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); outline: none; min-width: 200px;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--text-subtle); box-shadow: 0 0 0 3px var(--ring); }
.dataTables_wrapper .dataTables_info { padding-top: 14px; font-size: 12.5px; color: var(--text-subtle); }
.dataTables_wrapper .dataTables_paginate { padding-top: 12px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex; align-items: center; height: 30px; padding: 0 11px; margin-left: 4px;
    border: 1px solid var(--border) !important; border-radius: 7px; background: var(--surface) !important;
    color: var(--text) !important; font-size: 12.5px; cursor: pointer;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--surface-2) !important; border-color: var(--border-strong) !important; color: var(--text) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary) !important; color: var(--primary-fg) !important; border-color: var(--primary) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: .4; cursor: not-allowed; }

/* DataTable table corners inside card */
#scansTable { border-collapse: collapse; min-width: 620px; }
#scansTable thead th { border-top: 0; }
/* Remove DataTables scrollX border that duplicates card border */
.dataTables_scrollHeadInner { width: 100% !important; }
.dataTables_scrollHead, .dataTables_scrollBody { border: none !important; }

/* DataTables processing overlay */
.dataTables_processing {
    position: absolute !important;
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-md) !important;
    padding: 14px 22px !important;
    width: auto !important; margin: 0 !important;
    z-index: 10 !important;
}
.dt-loading {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-muted); font-weight: 500;
}
.dt-loading-spinner {
    width: 18px; height: 18px; flex-shrink: 0;
    border: 2px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: dt-spin 0.7s linear infinite;
}
@keyframes dt-spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */

@media (max-width: 860px) {
    .topbar { padding: 0 16px; }
    .content { padding: 18px 16px 108px; }
    .scan-profiles { grid-template-columns: repeat(2, 1fr); }
    .scan-summary-header { grid-template-columns: repeat(2, 1fr); }
    .compare-summary { grid-template-columns: 1fr; }
    .bottom-nav { bottom: 12px; gap: 2px; padding: 5px; }
    .bottom-nav-link { width: 44px; height: 44px; }
    .brand-name, .brand-sub { display: none; }
}

/* ===== LARGER UI SCALE =====
   Global uplift of text, icons and buttons for better legibility.
   Equal specificity + later source order, so these win over the base rules. */
.btn { height: 40px; padding: 0 16px; font-size: 14px; gap: 8px; }
.btn svg { width: 17px; height: 17px; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 16px; }
.btn-view { height: 32px; font-size: 13px; }
.btn-export { height: 36px; font-size: 13.5px; }

.form-control, .form-select { height: 42px; font-size: 14.5px; }
.form-control-lg { height: 50px; font-size: 16px; }
.form-label { font-size: 13.5px; }
.label-hint { font-size: 12.5px; }

.page-title { font-size: 18px; }
.card-header { font-size: 15px; padding: 15px 22px; }
.card-title { font-size: 15px; }
.section-title { font-size: 14px; }
.section-count { font-size: 12px; }

.table { font-size: 14px; }
.table thead th { font-size: 12px; }

.badge { font-size: 12px; padding: 3px 11px; }
.count-pill { font-size: 13px; min-width: 28px; height: 24px; }
.type-chip, .status-pill, .sev-chip { font-size: 12px; }
.tag-pill { font-size: 11.5px; }
.scan-id { font-size: 13.5px; }

.brand-mark { width: 38px; height: 38px; font-size: 15.5px; }
.theme-toggle { height: 38px; font-size: 14px; }
.theme-toggle .theme-icon { font-size: 16.5px; }

.profile-icon { font-size: 20px; }
.profile-name { font-size: 14.5px; }
.profile-eta, .profile-desc { font-size: 11.5px; }

.stats-lg-value { font-size: 36px; }
.stats-lg-label { font-size: 13.5px; }

.bottom-nav-link { width: 52px; height: 52px; }
.bottom-nav-link svg { width: 24px; height: 24px; }

/* keep the bottom nav compact on small screens (re-assert after the uplift) */
@media (max-width: 860px) {
    .bottom-nav-link { width: 46px; height: 46px; }
}

/* ===== HELP / ONBOARDING FLOATING BUTTON ===== */
.help-btn {
    position: fixed; bottom: 24px; right: 24px; z-index: 900;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--accent-blue); color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--accent-blue) 40%, transparent);
    cursor: pointer; transition: transform .18s, box-shadow .18s;
    text-decoration: none;
}
.help-btn:hover {
    transform: translateY(-2px) scale(1.07);
    box-shadow: 0 6px 22px color-mix(in srgb, var(--accent-blue) 50%, transparent);
    color: #fff; text-decoration: none;
}
.help-btn svg { width: 20px; height: 20px; }

/* ===== ONBOARDING PAGE ===== */
.ob-shell {
    display: flex; flex-direction: column; min-height: 100vh;
    background: var(--bg);
}

/* Topbar */
.ob-topbar {
    display: flex; align-items: center; gap: 16px;
    height: 60px; padding: 0 24px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
}
.ob-progress {
    display: flex; align-items: center; gap: 8px; flex: 1;
    justify-content: center;
}
.ob-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border); transition: all .25s; cursor: pointer;
    border: 2px solid transparent;
}
.ob-dot.done { background: color-mix(in srgb, var(--accent-blue) 40%, var(--bg)); }
.ob-dot.active {
    width: 24px; border-radius: 4px;
    background: var(--accent-blue);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 20%, transparent);
}
.ob-skip {
    font-size: 17px; color: var(--text-muted); background: none; border: none;
    cursor: pointer; padding: 4px 8px; border-radius: 6px;
    transition: color .15s;
}
.ob-skip:hover { color: var(--text); }

/* Main scrollable area */
.ob-main {
    flex: 1; overflow: hidden; position: relative;
}

/* Steps */
.ob-step {
    display: none; flex-direction: column; align-items: center;
    padding: 40px 24px 24px; max-width: 700px; margin: 0 auto;
    animation: ob-in .3s cubic-bezier(.22,1,.36,1);
}
.ob-step.active { display: flex; }
@keyframes ob-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hero SVG */
.ob-icon-wrap { margin-bottom: 24px; }
.ob-hero-svg { width: 80px; height: 80px; }

/* Text */
.ob-title {
    font-size: 38px; font-weight: 740; letter-spacing: -.025em;
    text-align: center; margin: 0 0 12px; color: var(--text);
}
.ob-body {
    font-size: 20px; color: var(--text-muted); text-align: center;
    margin: 0 0 24px; max-width: 520px; line-height: 1.6;
}

/* Step 1 pills */
.ob-pills {
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.ob-pill {
    font-size: 15px; font-weight: 600; letter-spacing: .04em;
    padding: 6px 16px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Step 2 profiles grid */
.ob-profiles-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; width: 100%;
}
.ob-profile-card {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface);
    transition: border-color .15s;
}
.ob-profile-card:hover { border-color: var(--accent-blue); }
.ob-profile-icon { font-size: 22px; flex-shrink: 0; line-height: 1.2; }
.ob-profile-name { font-size: 19px; font-weight: 650; color: var(--text); }
.ob-profile-eta { font-size: 15px; color: var(--accent-blue); font-weight: 600; margin: 1px 0 3px; }
.ob-profile-desc { font-size: 16px; color: var(--text-muted); line-height: 1.45; }

/* Step 3 result cards */
.ob-result-cards {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; width: 100%;
}
.ob-result-card {
    padding: 14px 16px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface);
}
.ob-result-card--full { grid-column: 1 / -1; }
.ob-result-card-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 19px; font-weight: 650; color: var(--text);
    margin-bottom: 8px;
}
.ob-result-icon { font-size: 22px; }
.ob-result-card p { font-size: 17px; color: var(--text-muted); margin: 0; line-height: 1.5; }
.ob-sev-row {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}

/* Step 4 feature list */
.ob-feature-list { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.ob-feature {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 14px 16px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface);
}
.ob-feature-icon { font-size: 22px; flex-shrink: 0; }
.ob-feature-title { font-size: 19px; font-weight: 650; color: var(--text); margin-bottom: 3px; }
.ob-feature-desc { font-size: 17px; color: var(--text-muted); line-height: 1.5; }
.ob-feature-desc code { font-size: 15px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; color: var(--accent-blue); }

/* Step 5 */
.ob-notice {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: 10px; margin-bottom: 28px;
    background: color-mix(in srgb, #f59e0b 8%, transparent);
    border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
    color: var(--text-muted); font-size: 17px; line-height: 1.5;
    max-width: 520px; text-align: left;
}
.ob-notice-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.ob-cta { min-width: 220px; font-size: 16px; }

/* Footer nav */
.ob-footer {
    display: flex; align-items: center; justify-content: center;
    padding: 16px 24px; border-top: 1px solid var(--border);
    background: var(--surface);
}
.ob-footer-nav {
    display: flex; align-items: center; gap: 16px;
}
.ob-btn-prev, .ob-btn-next {
    display: flex; align-items: center; gap: 6px; font-size: 17px;
}
.ob-step-counter {
    font-size: 16px; color: var(--text-muted); font-weight: 550; min-width: 48px; text-align: center;
}
.ob-topbar-right {
    display: flex; align-items: center; gap: 10px;
}

/* ===== MOBILE RESPONSIVE ===== */

/* Prevent horizontal overflow on all screens */
html, body { overflow-x: hidden; }

/* Make onboarding steps scrollable on mobile */
@media (max-width: 860px) {
    .ob-main { overflow-y: auto; overflow-x: hidden; }
}

/* ── 640 px: phones in landscape / large portrait ── */
@media (max-width: 640px) {

    /* Topbar */
    .topbar { padding: 0 14px; height: 54px; }
    .page-title { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
    .topbar-actions { gap: 6px; }
    .theme-label { display: none; }
    .theme-toggle { padding: 0 10px; gap: 0; }

    /* Lang picker: show globe+chevron only, hide label */
    .lang-picker-label { display: none; }
    .lang-picker-btn { padding: 0 9px; gap: 4px; }

    /* Content */
    .content { padding: 14px 12px 100px; }

    /* Scan hero */
    .scan-hero { padding: 12px 0 80px; min-height: unset; }
    .hero-wordmark { font-size: 30px; }
    .scan-hero-subtitle { font-size: 14px; }
    .scan-form-container .card-body { padding: 18px 16px; }

    /* Modals — near full-width, bottom-sheet style */
    .modal-dialog { margin: 8px !important; max-width: calc(100vw - 16px) !important; }
    .modal-body { padding: 14px; overflow-x: hidden; }
    .modal-header { padding: 12px 14px; }
    .modal-footer { padding: 12px 14px; gap: 8px; }
    .modal-header-actions { gap: 6px; }
    .export-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
    .export-buttons { flex-wrap: wrap; gap: 6px; }

    /* Scan summary grid */
    .scan-summary-header { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }

    /* History card header: icon-only buttons, let buttons wrap */
    .card-header { padding: 12px 14px; }
    .card-header > .d-flex { flex-wrap: wrap; gap: 8px; }
    .card-header > .d-flex > .d-flex { flex-wrap: wrap; gap: 6px; }
    .card-header .btn-label { display: none; }

    /* DataTable: smooth horizontal scroll (scrollX:true creates .dataTables_scrollBody) */
    .dataTables_scrollBody { -webkit-overflow-scrolling: touch; }
    .dataTables_wrapper .dataTables_filter { text-align: left; }
    .dataTables_wrapper .dataTables_filter input { min-width: 120px; }

    /* Filters dropdown: clamp to screen */
    .filters-dropdown { width: min(260px, calc(100vw - 24px)); }

    /* Compare modal */
    .compare-header { grid-template-columns: 1fr; gap: 8px; text-align: center; }
    .compare-arrow { transform: rotate(90deg); display: block; }
    .compare-summary { grid-template-columns: repeat(3, 1fr); gap: 8px; }

    /* Scan loading overlay */
    .scan-loading-content { max-width: 100%; padding: 20px 16px; }

    /* Bottom nav: compact full-width bar pinned to bottom */
    .bottom-nav {
        bottom: 0; left: 0; right: 0;
        transform: none; border-radius: 14px 14px 0 0;
        max-width: 100%; padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
        justify-content: space-around; gap: 0;
        border-top: 1px solid var(--border);
        border-left: none; border-right: none; border-bottom: none;
    }
    .bottom-nav-link {
        flex: 1; flex-direction: column; gap: 2px;
        width: auto; height: auto; min-height: 44px; border-radius: 10px;
        padding: 4px 4px;
    }
    .bottom-nav-link svg { width: 19px; height: 19px; }
    .bottom-nav-link::after {
        content: attr(aria-label);
        font-size: 9px; font-weight: 550; line-height: 1;
        color: currentColor; white-space: nowrap;
    }

    /* Help button: above compact nav */
    .help-btn { bottom: 72px; right: 14px; width: 38px; height: 38px; }
    .help-btn svg { width: 17px; height: 17px; }

    /* Alert toasts: full width, above bottom nav */
    #alertContainer { padding: 8px; left: 0; right: 0; bottom: 62px; align-items: center; }
    .alert { min-width: unset; width: calc(100vw - 16px); max-width: 480px; }

    /* Onboarding */
    .ob-profiles-grid, .ob-result-cards { grid-template-columns: 1fr; }
    .ob-result-card--full { grid-column: auto; }
    .ob-title { font-size: 30px; }
    .ob-hero-svg { width: 64px; height: 64px; }
}

/* ── 480 px: compact phones (iPhone SE, Galaxy A series) ── */
@media (max-width: 480px) {

    /* Topbar */
    .topbar { padding: 0 12px; height: 52px; }
    .brand-mark { width: 32px; height: 32px; font-size: 13px; border-radius: 7px; }
    /* Hide page title text — brand mark "VP" is enough on tiny screens */
    .page-title { display: none; }
    .theme-toggle { padding: 0 8px; height: 32px; }

    /* Hero */
    .hero-wordmark { font-size: 26px; letter-spacing: -.03em; }
    .hero-features { gap: 4px; }
    .hero-feat { font-size: 10px; padding: 2px 7px; }
    .scan-hero-subtitle { font-size: 13px; }
    .scan-form-container .card-body { padding: 16px 14px; }
    /* Scan profiles: compact horizontal cards, 2 columns, no description */
    .scan-profiles { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .profile-btn { flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; }
    .profile-icon { font-size: 18px; flex-shrink: 0; }
    .profile-name { font-size: 13px; font-weight: 650; }
    .profile-eta { font-size: 10.5px; }
    .profile-desc { display: none; }

    /* Tabs in modals */
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 1px; scroll-snap-type: x mandatory; }
    .nav-tabs .nav-link { white-space: nowrap; font-size: 12px; padding: 8px 11px; }

    /* Compare summary: single column */
    .compare-summary { grid-template-columns: 1fr; }
    .compare-stat { padding: 10px 12px; flex-direction: row; justify-content: space-between; align-items: center; }
    .compare-num { font-size: 22px; }

    /* Export */
    .btn-export { height: 34px; font-size: 12px; padding: 0 10px; }

    /* Content */
    .content { padding: 12px 10px 100px; }

    /* Filters dropdown: full-width */
    .filters-dropdown { width: calc(100vw - 20px); right: -14px; max-height: 70vh; overflow-y: auto; }

    /* Statistics */
    .stats-lg-value { font-size: 28px; }
    .stats-lg-label { font-size: 12px; }

    /* DataTables pagination */
    .dataTables_wrapper .dataTables_paginate { text-align: center; }
    .dataTables_wrapper .dataTables_info { text-align: center; }
    .dataTables_wrapper .dataTables_paginate .paginate_button { padding: 0 9px; margin-left: 2px; font-size: 12px; }

    /* Onboarding */
    .ob-topbar { padding: 0 14px; height: 52px; }
    .ob-skip { font-size: 14px; }
    .ob-step { padding: 20px 14px 16px; }
    .ob-hero-svg { width: 56px; height: 56px; }
    .ob-icon-wrap { margin-bottom: 16px; }
    .ob-title { font-size: 26px; }
    .ob-body { font-size: 16px; margin-bottom: 18px; }
    .ob-pill { font-size: 13px; padding: 4px 12px; }
    .ob-profile-name { font-size: 15px; }
    .ob-profile-eta { font-size: 13px; }
    .ob-profile-desc { font-size: 13px; }
    .ob-feature-title { font-size: 16px; }
    .ob-feature-desc { font-size: 14px; }
    .ob-result-card-header { font-size: 15px; }
    .ob-result-card p { font-size: 14px; }
    .ob-notice { font-size: 13px; padding: 10px 12px; margin-bottom: 16px; gap: 8px; }
    /* Hide the in-step CTA on small screens — footer Next button already acts as CTA on last step */
    .ob-cta { display: none; }
    .ob-btn-prev, .ob-btn-next { font-size: 14px; padding: 8px 14px; gap: 5px; }
    .ob-btn-prev svg, .ob-btn-next svg { width: 14px; height: 14px; }
    .ob-step-counter { font-size: 13px; }
    .ob-footer { padding: 10px 14px; }
    .ob-footer-nav { gap: 10px; }
}
