/* ==========================================================================
   BotShield Dashboard — Stylesheet
   Aligned with the Metalytiq marketing-site design system so the
   product feels like a continuation of the brand. Uses the same
   color tokens, font pairing, radius scale, and dark/light toggle
   mechanism (data-theme attribute on <html>, localStorage key
   "metalytiq-theme").
   ========================================================================== */

/* ---------- Tokens (mirrored from metalytiq/assets/css/style.css) ---------- */
:root {
    /* Brand */
    --brand-blue: #044181;
    --brand-blue-2: #0a5fbd;
    --brand-green: #089b54;
    --brand-green-2: #16c47f;
    --brand-accent: #ffc847;

    /* Light theme (default) */
    --bg: #f6f8fb;
    --bg-elev: #ffffff;
    --bg-soft: #eef2f7;
    --bg-input: #ffffff;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-border: rgba(8, 30, 70, 0.08);
    --border: rgba(8, 30, 70, 0.08);
    --border-strong: rgba(8, 30, 70, 0.16);
    --text: #0e1a2b;
    --text-soft: #475467;
    --text-muted: #6b7785;
    --heading: #042144;
    --shadow-sm: 0 1px 2px rgba(8, 30, 70, 0.06), 0 2px 8px rgba(8, 30, 70, 0.04);
    --shadow-md: 0 8px 28px rgba(8, 30, 70, 0.08), 0 2px 6px rgba(8, 30, 70, 0.04);
    --shadow-lg: 0 24px 60px rgba(8, 30, 70, 0.16);

    /* Semantic state colors */
    --color-success: var(--brand-green);
    --color-success-2: var(--brand-green-2);
    --color-success-soft: rgba(8, 155, 84, 0.10);
    --color-warning: #e08b00;
    --color-warning-soft: rgba(224, 139, 0, 0.12);
    --color-danger: #c0392b;
    --color-danger-soft: rgba(192, 57, 43, 0.10);
    --color-info: var(--brand-blue-2);
    --color-info-soft: rgba(10, 95, 189, 0.10);
    --color-purple: #6f47b8;
    --color-purple-soft: rgba(111, 71, 184, 0.10);

    /* Aliases used heavily in the legacy CSS — keep them so the
       existing class names still work without a wholesale rename. */
    --bg-primary: var(--bg);
    --bg-secondary: var(--bg-elev);
    --bg-card: var(--bg-elev);
    --bg-card-hover: var(--bg-soft);
    --accent: var(--brand-blue-2);
    --accent-hover: var(--brand-blue);
    --accent-soft: var(--color-info-soft);
    --green: var(--color-success);
    --green-soft: var(--color-success-soft);
    --red: var(--color-danger);
    --red-soft: var(--color-danger-soft);
    --amber: var(--color-warning);
    --amber-soft: var(--color-warning-soft);
    --purple: var(--color-purple);
    --purple-soft: var(--color-purple-soft);
    --text-primary: var(--text);
    --text-secondary: var(--text-soft);
    --border-light: var(--border-strong);

    /* Type */
    --font-display: "Sora", "Plus Jakarta Sans", system-ui, sans-serif;
    --font-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "DM Mono", ui-monospace, monospace;

    /* Layout */
    --radius-sm: 8px;
    --radius: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    --bg: #07101f;
    --bg-elev: #0e1a2e;
    --bg-soft: #122339;
    --bg-input: #0a1626;
    --surface: rgba(20, 36, 60, 0.6);
    --surface-border: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e9eef5;
    --text-soft: #b9c4d4;
    --text-muted: #8492a6;
    --heading: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 12px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 32px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.6);

    /* Soft tints need slightly more punch in dark mode */
    --color-success-soft: rgba(22, 196, 127, 0.16);
    --color-warning-soft: rgba(255, 200, 71, 0.16);
    --color-danger-soft: rgba(239, 68, 68, 0.16);
    --color-info-soft: rgba(10, 95, 189, 0.22);
    --color-purple-soft: rgba(139, 92, 246, 0.16);
    --color-warning: #ffc847;
    --color-danger: #ef4444;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { background: var(--bg); -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    transition: background-color 0.4s ease, color 0.3s ease;
}
a { color: var(--brand-blue-2); text-decoration: none; cursor: pointer; }
[data-theme="dark"] a { color: var(--brand-green-2); }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--heading);
    letter-spacing: -0.02em;
    font-weight: 700;
    line-height: 1.2;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::selection { background: var(--brand-green); color: #fff; }

/* ---------- Layout ---------- */
#app { display: flex; height: 100vh; }
.sidebar {
    width: 260px;
    background: var(--bg-elev);
    border-right: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 6px 14px rgba(8, 65, 129, 0.25);
}
.logo-icon svg { width: 18px; height: 18px; }
.logo-text {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--heading);
}

.nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 18px 14px 6px;
    font-weight: 700;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
    width: 100%;
    text-align: left;
    transition: background 0.18s ease, color 0.18s ease;
    font-family: var(--font-body);
}
.nav-item:hover { background: var(--bg-soft); color: var(--heading); }
.nav-item.active {
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--brand-blue) 14%, transparent),
        color-mix(in srgb, var(--brand-green) 10%, transparent));
    color: var(--brand-blue-2);
    font-weight: 600;
}
[data-theme="dark"] .nav-item.active { color: var(--brand-green-2); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.nav-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--surface-border);
}

.main {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px 60px;
    max-width: 1240px;
}
@media (max-width: 720px) {
    #app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--surface-border); }
    .nav { flex-direction: row; overflow-x: auto; padding: 8px; }
    .nav-section { display: none; }
    .nav-item { flex-shrink: 0; width: auto; }
    .main { padding: 20px; }
}

/* ---------- Theme toggle (matches metalytiq) ---------- */
.theme-toggle {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg-soft);
    border: 1px solid var(--surface-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s var(--ease-out), background 0.2s ease;
    color: var(--text);
}
.theme-toggle:hover { transform: rotate(20deg); background: var(--bg-elev); box-shadow: var(--shadow-sm); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---------- Auth screen ---------- */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}
.auth-screen::before, .auth-screen::after {
    content: "";
    position: absolute;
    width: 480px; height: 480px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.32;
    pointer-events: none;
}
.auth-screen::before { top: -160px; left: -120px; background: var(--brand-blue); }
.auth-screen::after  { bottom: -200px; right: -120px; background: var(--brand-green); }
[data-theme="dark"] .auth-screen::before,
[data-theme="dark"] .auth-screen::after { opacity: 0.28; }

.auth-box {
    width: 440px;
    max-width: calc(100% - 40px);
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
}
.auth-top {
    position: absolute;
    top: 20px;
    right: 20px;
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    justify-content: center;
}
.auth-logo .logo-icon { width: 44px; height: 44px; border-radius: 12px; }
.auth-logo .logo-icon svg { width: 22px; height: 22px; }
.auth-logo .logo-text { font-size: 22px; }
.auth-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
    color: var(--heading);
}
.auth-sub { font-size: 14px; color: var(--text-soft); margin-bottom: 26px; text-align: center; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.form-input, .form-select, .survey-select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:hover, .form-select:hover { border-color: var(--border-strong); }
.form-input:focus, .form-select:focus, .survey-select:focus {
    border-color: var(--brand-blue-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue-2) 18%, transparent);
}
.form-input::placeholder { color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}
.btn-primary {
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
    color: #fff;
    box-shadow: 0 6px 16px rgba(8, 65, 129, 0.22);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(8, 65, 129, 0.32); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    background: var(--bg-soft);
    color: var(--heading);
    border: 1px solid var(--surface-border);
}
.btn-secondary:hover { background: var(--bg-elev); border-color: var(--border-strong); }

.btn-danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
}
.btn-danger:hover { background: var(--color-danger); color: #fff; }

.btn-success {
    background: var(--color-success-soft);
    color: var(--color-success);
    border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
}
.btn-success:hover { background: var(--color-success); color: #fff; }

.btn-purple {
    background: var(--color-purple-soft);
    color: var(--color-purple);
    border: 1px solid color-mix(in srgb, var(--color-purple) 30%, transparent);
}
.btn-purple:hover { background: var(--color-purple); color: #fff; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-wide { width: 100%; padding: 12px; }
.btn svg { transition: transform 0.2s var(--ease-out); }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-error {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border: 1px solid color-mix(in srgb, var(--color-danger) 22%, transparent);
}
.alert-success {
    background: var(--color-success-soft);
    color: var(--color-success);
    border: 1px solid color-mix(in srgb, var(--color-success) 22%, transparent);
}
.alert-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
    padding: 2px 6px;
    border-radius: 6px;
}
.alert-close:hover { opacity: 1; background: rgba(0,0,0,0.06); }

.auth-toggle { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--text-soft); }
.auth-toggle a { color: var(--brand-blue-2); font-weight: 600; }
[data-theme="dark"] .auth-toggle a { color: var(--brand-green-2); }

/* ---------- Page header ---------- */
.page-header { margin-bottom: 28px; }
.page-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--heading);
}
.page-sub { font-size: 14px; color: var(--text-soft); margin-top: 6px; }
.page-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; flex-wrap: wrap; }

/* ---------- Cards & KPI ---------- */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--heading);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
@media (max-width: 1000px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi {
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.kpi-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: -0.03em;
    color: var(--heading);
}
.kpi-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 4px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--surface-border);
}
td {
    padding: 14px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--surface-border);
    vertical-align: middle;
}
tr.clickable { cursor: pointer; transition: background 0.12s; }
tr.clickable:hover { background: var(--bg-soft); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-human       { background: var(--color-success-soft); color: var(--color-success); }
.badge-suspicious  { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-bot         { background: var(--color-danger-soft);  color: var(--color-danger); }
.badge-unknown     { background: var(--color-info-soft);    color: var(--brand-blue-2); }
.badge-active      { background: var(--color-success-soft); color: var(--color-success); }
.badge-owner       { background: var(--color-purple-soft);  color: var(--color-purple); }
.badge-admin       { background: var(--color-info-soft);    color: var(--brand-blue-2); }
.badge-viewer      { background: var(--color-success-soft); color: var(--color-success); }
.badge-free        { background: var(--color-success-soft); color: var(--color-success); }
.badge-pro         { background: var(--color-info-soft);    color: var(--brand-blue-2); }
.badge-enterprise  { background: var(--color-purple-soft);  color: var(--color-purple); }

/* ---------- Score bar & signal grid ---------- */
.score-bar { display: flex; align-items: center; gap: 10px; }
.score-track { width: 64px; height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 3px; }
.score-text { font-size: 12px; font-weight: 700; font-family: var(--font-mono); min-width: 38px; }

.signal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { .signal-grid { grid-template-columns: 1fr; } }
.signal-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}
.signal-icon { font-size: 18px; flex-shrink: 0; }
.signal-name { flex: 1; font-size: 13.5px; color: var(--text-soft); }
.signal-bar { width: 100px; height: 6px; background: var(--bg-elev); border-radius: 3px; overflow: hidden; }
.signal-val { width: 42px; text-align: right; font-weight: 700; font-size: 13px; font-family: var(--font-mono); }

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--surface-border);
    background: var(--bg-elev);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.filter-btn:hover { border-color: var(--border-strong); color: var(--heading); }
.filter-btn.active {
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(8, 65, 129, 0.22);
}
.filter-count {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 6px;
    background: rgba(0,0,0,0.08);
    font-family: var(--font-mono);
}
.filter-btn.active .filter-count { background: rgba(255,255,255,0.22); }

/* ---------- Snippet ---------- */
.snippet-box { position: relative; }
.snippet-code {
    padding: 16px 18px;
    background: var(--bg-soft);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-soft);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
}
.snippet-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    background: var(--brand-blue-2);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 16, 32, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}
.modal {
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 520px;
    max-width: calc(100% - 40px);
    box-shadow: var(--shadow-lg);
}
.modal-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--heading);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ---------- Chart (overview) ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 8px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-stack { display: flex; flex-direction: column-reverse; height: 130px; width: 100%; gap: 1px; }
.chart-seg { border-radius: 2px; min-height: 0; transition: height 0.4s ease; }
.chart-label { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }
.chart-legend { display: flex; gap: 18px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-soft); }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Flags ---------- */
.flag-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.flag-name { width: 200px; font-size: 13px; color: var(--text-soft); flex-shrink: 0; }
.flag-bar-track { flex: 1; height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.flag-bar-fill { height: 100%; border-radius: 3px; }
.flag-count { width: 40px; text-align: right; font-size: 12.5px; color: var(--text-muted); font-family: var(--font-mono); }

/* ---------- Usage bar ---------- */
.usage-bar { height: 8px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.usage-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }

/* ---------- Pricing cards ---------- */
.pricing-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 20px;
}
.cycle-toggle {
    display: inline-flex;
    background: var(--bg-soft);
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
}
.cycle-toggle button {
    padding: 8px 18px;
    border: none;
    background: transparent;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s var(--ease-out);
}
.cycle-toggle button.active {
    background: var(--bg-elev);
    color: var(--heading);
    box-shadow: var(--shadow-sm);
}
.cycle-save-pill {
    margin-left: 8px;
    font-size: 10.5px;
    background: var(--color-success-soft);
    color: var(--color-success);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 28px; }
@media (max-width: 1000px) { .pricing-grid { grid-template-columns: 1fr; } }
.price-card {
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    position: relative;
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease, border-color 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.price-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.price-card.featured {
    border-color: transparent;
    background:
        linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box,
        linear-gradient(135deg, var(--brand-blue), var(--brand-green)) border-box;
    border: 1.5px solid transparent;
}
.price-badge {
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
    color: #fff;
    padding: 4px 16px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 6px 14px rgba(8, 65, 129, 0.32);
}
.price-name {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--heading);
}
.price-amount {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin: 14px 0 4px;
    color: var(--heading);
}
.price-amount .currency {
    font-size: 0.55em;
    font-weight: 700;
    color: var(--text-soft);
    vertical-align: super;
    margin-right: 2px;
}
.price-period { font-size: 13px; color: var(--text-muted); }
.price-features { list-style: none; margin-top: 18px; }
.price-features li {
    padding: 7px 0;
    font-size: 13.5px;
    color: var(--text-soft);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.price-features li::before {
    content: '';
    flex-shrink: 0;
    width: 18px; height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--color-success-soft);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='%23089b54' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3 3 7-7'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px;
}

/* ---------- User info (sidebar footer) ---------- */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-soft);
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-display);
}
.user-name { font-size: 13.5px; font-weight: 700; color: var(--heading); }
.user-email { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.plan-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 8px;
}
.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 14px;
    width: 100%;
    text-align: left;
    border-radius: var(--radius-sm);
    font-family: inherit;
    transition: all 0.15s;
}
.logout-btn:hover { background: var(--color-danger-soft); color: var(--color-danger); }

/* ---------- Survey card ---------- */
.survey-card {
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 22px;
    cursor: pointer;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease, border-color 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.survey-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.tag-display {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-soft);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    margin: 12px 0 0;
    color: var(--text-soft);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tag-display .copy-tag {
    margin-left: auto;
    font-family: var(--font-body);
    font-size: 11px;
    padding: 3px 10px;
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-soft);
    cursor: pointer;
    font-weight: 600;
}
.tag-display .copy-tag:hover { color: var(--brand-blue-2); border-color: var(--brand-blue-2); }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 52px 20px;
    color: var(--text-muted);
    background: var(--bg-elev);
    border: 1px dashed var(--surface-border);
    border-radius: var(--radius-lg);
}
.empty-icon { font-size: 42px; margin-bottom: 12px; }
.empty-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 6px;
}
.empty-sub { font-size: 13.5px; margin-bottom: 20px; }

/* ---------- Utilities ---------- */
.mono { font-family: var(--font-mono); }
.text-green   { color: var(--color-success); }
.text-red     { color: var(--color-danger); }
.text-amber   { color: var(--color-warning); }
.text-purple  { color: var(--color-purple); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-soft); }

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 200px;
    color: var(--text-muted);
    font-size: 14px;
}
.loading::before {
    content: '';
    width: 16px; height: 16px;
    border: 2px solid var(--surface-border);
    border-top-color: var(--brand-blue-2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease; }

/* ---------- Info bubble & popover ---------- */
.info-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-body);
    margin-left: 6px;
    cursor: help;
    border: 1px solid var(--surface-border);
    transition: all 0.15s;
    user-select: none;
    vertical-align: middle;
}
.info-bubble:hover { background: var(--color-info-soft); color: var(--brand-blue-2); border-color: var(--brand-blue-2); }
.info-bubble.active { background: var(--brand-blue-2); color: #fff; border-color: var(--brand-blue-2); }
.info-popover {
    position: absolute;
    z-index: 200;
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 12.5px;
    color: var(--text-soft);
    line-height: 1.55;
    max-width: 280px;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}
.info-popover-title { font-size: 12px; font-weight: 700; color: var(--heading); margin-bottom: 4px; }

/* ---------- Survey filter chip ---------- */
.survey-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 12px;
    background: var(--color-info-soft);
    color: var(--brand-blue-2);
    border: 1px solid color-mix(in srgb, var(--brand-blue-2) 22%, transparent);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}
.survey-chip-x {
    background: none;
    border: none;
    color: var(--brand-blue-2);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    font-family: inherit;
}
.survey-chip-x:hover { color: var(--color-danger); }

.survey-select-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.survey-select-label { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.survey-select { min-width: 240px; cursor: pointer; padding: 8px 12px; font-size: 13.5px; }

/* ---------- Export button ---------- */
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    color: var(--heading);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.18s;
}
.export-btn:hover { border-color: var(--brand-blue-2); color: var(--brand-blue-2); }
.export-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.export-btn.locked { opacity: 0.85; border-color: var(--surface-border); color: var(--text-muted); }
.export-btn.locked:hover { border-color: var(--color-warning); color: var(--color-warning); background: var(--color-warning-soft); }

/* ---------- Plan gate / Upgrade card ---------- */
.plan-gate {
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    text-align: center;
    background-image:
        radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--brand-blue) 8%, transparent) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--brand-green) 8%, transparent) 0%, transparent 50%);
    box-shadow: var(--shadow-sm);
}
.plan-gate-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 28px;
    box-shadow: 0 10px 24px rgba(8, 65, 129, 0.28);
}
.plan-gate-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--heading);
}
.plan-gate-sub { font-size: 14.5px; color: var(--text-soft); max-width: 520px; margin: 0 auto 22px; line-height: 1.65; }
.plan-gate-features { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 16px 0 28px; }
.plan-gate-feat { font-size: 13px; color: var(--text-soft); display: flex; align-items: center; gap: 6px; }
.plan-gate-feat::before { content: '✓'; color: var(--color-success); font-weight: 700; }
.plan-badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    margin-left: 6px;
    vertical-align: middle;
}
.plan-badge-inline.pro        { background: var(--brand-blue-2); }
.plan-badge-inline.enterprise { background: var(--color-purple); }
.lock-icon { font-size: 14px; opacity: 0.7; }

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: 24px;
}
.tab {
    padding: 11px 18px;
    background: none;
    border: none;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tab:hover { color: var(--heading); }
.tab.active { color: var(--brand-blue-2); border-bottom-color: var(--brand-blue-2); }
[data-theme="dark"] .tab.active { color: var(--brand-green-2); border-bottom-color: var(--brand-green-2); }

/* ---------- API Docs ---------- */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
@media (max-width: 900px) {
    .docs-layout { grid-template-columns: 1fr; }
    .docs-nav { position: static; border-right: none; border-bottom: 1px solid var(--surface-border); padding-bottom: 12px; padding-right: 0; flex-direction: row; flex-wrap: wrap; }
}
.docs-nav {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 10px;
    border-right: 1px solid var(--surface-border);
}
.docs-nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 12px 10px 4px;
}
.docs-nav-item {
    display: block;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--text-soft);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s;
}
.docs-nav-item:hover { color: var(--heading); background: var(--bg-soft); }
.docs-content { min-width: 0; }
.docs-content h3 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin-top: 32px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--surface-border);
    scroll-margin-top: 12px;
}
.docs-content h3:first-child { margin-top: 0; }
.docs-content h4 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin-top: 22px;
    margin-bottom: 8px;
    color: var(--heading);
    scroll-margin-top: 12px;
}
.docs-content p { font-size: 14px; color: var(--text-soft); line-height: 1.7; margin-bottom: 12px; }
.docs-content ul { margin: 8px 0 12px 20px; }
.docs-content li { font-size: 14px; color: var(--text-soft); line-height: 1.7; margin-bottom: 4px; }
.endpoint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 13px;
    margin: 12px 0;
    word-break: break-all;
}
.http-method {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    flex-shrink: 0;
}
.http-get    { background: var(--color-success-soft); color: var(--color-success); }
.http-post   { background: var(--color-info-soft);    color: var(--brand-blue-2); }
.http-delete { background: var(--color-danger-soft);  color: var(--color-danger); }
.docs-table {
    width: 100%;
    margin: 8px 0 16px;
    border-collapse: collapse;
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.docs-table th, .docs-table td { padding: 11px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--surface-border); }
.docs-table th { background: var(--bg-soft); color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.docs-table tr:last-child td { border-bottom: none; }
.docs-table td:first-child { font-family: var(--font-mono); color: var(--brand-blue-2); font-size: 12.5px; white-space: nowrap; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}
.pagination button {
    padding: 7px 12px;
    border: 1px solid var(--surface-border);
    background: var(--bg-elev);
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.pagination button:hover:not(:disabled) { border-color: var(--brand-blue-2); color: var(--brand-blue-2); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .pg-info { font-size: 13px; color: var(--text-muted); padding: 0 8px; }

/* ---------- Bot rate visual (sessions overview) ---------- */
.botrate-card {
    background: var(--bg-elev);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.botrate-track {
    flex: 1;
    height: 12px;
    background: var(--bg-soft);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
}
.botrate-seg { height: 100%; transition: width 0.4s var(--ease-out); }
.botrate-seg.human       { background: var(--color-success); }
.botrate-seg.suspicious  { background: var(--color-warning); }
.botrate-seg.bot         { background: var(--color-danger); }
.botrate-label {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--heading);
    white-space: nowrap;
}
.botrate-pct { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); }
