/* XFiles Panel UI v3 - design system (dark default, light via [data-theme="light"]) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #05070f;
    --bg-2: #0b101e;
    --bg-3: #141b30;
    --bg-hover: #1b2440;
    --border: #283457;
    --border-soft: #192340;
    --text: #f0f3fa;
    --text-2: #9aa8c6;
    --text-3: #5e6c8a;
    --primary: #8b5cf6;
    --primary-2: #a78bfa;
    --primary-glow: rgba(139, 92, 246, .4);
    --accent: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;
    --ring: rgba(139, 92, 246, .35);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 2px 10px rgba(0,0,0,.22);
    --shadow: 0 6px 16px rgba(0,0,0,.3), 0 18px 50px rgba(0,0,0,.38);
    --shadow-lg: 0 12px 36px rgba(0,0,0,.45), 0 36px 90px rgba(0,0,0,.55);
    --sidebar-w: 240px;
    --grad: linear-gradient(120deg, #8b5cf6, #6366f1 45%, #22d3ee);
    --glass: color-mix(in srgb, var(--bg-2) 72%, transparent);
    --card-edge: inset 0 1px 0 rgba(255,255,255,.045);
    --glow-a: rgba(139,92,246,.16);
    --glow-b: rgba(34,211,238,.09);
    --dots: rgba(255,255,255,.035);
}
[data-theme="light"] {
    --bg: #f4f6fd;
    --bg-2: #ffffff;
    --bg-3: #f4f6fc;
    --bg-hover: #ebeef9;
    --border: #dde3f2;
    --border-soft: #e8ecf7;
    --text: #101729;
    --text-2: #505e7d;
    --text-3: #93a0ba;
    --primary-2: #7c4dff;
    --primary-glow: rgba(139, 92, 246, .22);
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --ring: rgba(139, 92, 246, .22);
    --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 2px 8px rgba(15,23,42,.05);
    --shadow: 0 6px 14px rgba(15,23,42,.07), 0 18px 46px rgba(15,23,42,.09);
    --shadow-lg: 0 12px 32px rgba(15,23,42,.11), 0 36px 80px rgba(15,23,42,.15);
    --glass: color-mix(in srgb, #ffffff 78%, transparent);
    --card-edge: inset 0 1px 0 rgba(255,255,255,.7);
    --glow-a: rgba(139,92,246,.1);
    --glow-b: rgba(34,211,238,.07);
    --dots: rgba(16,23,41,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(1100px 600px at 85% -15%, var(--glow-a), transparent 58%),
        radial-gradient(900px 560px at -15% 45%, var(--glow-b), transparent 55%),
        radial-gradient(var(--dots) 1px, transparent 1.4px),
        var(--bg);
    background-size: auto, auto, 26px 26px, auto;
    background-attachment: fixed;
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-2); text-decoration: none; }
code, .mono { font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace; font-size: .9em; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(139,92,246,.4); }

/* thin, theme-aware scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

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

/* ---------- layout: floating sidebar (desktop) / floating dock (mobile) ---------- */
.layout { display: flex; min-height: 100dvh; }
.sidebar {
    width: var(--sidebar-w);
    background: var(--glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 20px 14px;
    position: fixed; inset: 12px auto 12px 12px;
    display: flex; flex-direction: column; gap: 3px;
    z-index: 40;
    box-shadow: var(--shadow-sm), var(--card-edge);
}
.sidebar .brand {
    display: flex; align-items: center; gap: 11px;
    font-weight: 800; font-size: 16px; padding: 4px 10px 20px; letter-spacing: -.2px;
}
.brand-dot {
    width: 36px; height: 36px; border-radius: 12px; flex: none;
    background: var(--grad);
    display: grid; place-items: center; font-size: 17px;
    box-shadow: 0 4px 18px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.3);
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 13px; border-radius: var(--radius-sm);
    color: var(--text-2); cursor: pointer; border: 0; background: none;
    font: inherit; font-weight: 600; font-size: 13.5px; width: 100%; text-align: left;
    position: relative; transition: background .16s, color .16s;
    -webkit-tap-highlight-color: transparent;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .9; transition: transform .16s; }
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item:hover svg { transform: translateY(-1px); }
.nav-item.active {
    background: var(--grad);
    color: #fff; font-weight: 700;
    box-shadow: 0 4px 16px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.22);
}
.nav-item.active svg { color: #fff; opacity: 1; }
.sidebar .spacer { flex: 1; }

.content {
    flex: 1; margin-left: calc(var(--sidebar-w) + 12px);
    padding: 28px clamp(16px, 3vw, 38px) 100px;
    max-width: 1280px; width: 100%;
    animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.topbar h1 {
    font-size: 24px; font-weight: 800; letter-spacing: -.6px;
    background: linear-gradient(100deg, var(--text) 40%, var(--primary-2));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.topbar .sub { color: var(--text-2); font-size: 13px; margin-top: 1px; }

@media (max-width: 860px) {
    .sidebar {
        inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px;
        width: auto; height: auto;
        flex-direction: row; padding: 5px 6px;
        border: 1px solid var(--border-soft); border-radius: 20px;
        overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 0;
        /* Compact, centered when they fit; left-aligned + scroll when there are many.
           "safe" prevents the first items from being clipped past the scroll start. */
        justify-content: safe center;
        box-shadow: 0 10px 34px rgba(0,0,0,.4), var(--card-edge);
    }
    .sidebar::-webkit-scrollbar { display: none; }
    .sidebar .brand, .sidebar .spacer, .sidebar .side-only { display: none; }
    .nav-item {
        flex: 0 0 auto; flex-direction: column; gap: 2px;
        font-size: 9px; font-weight: 600; letter-spacing: -.1px;
        padding: 7px 8px; text-align: center; align-items: center;
        min-width: 48px; max-width: 78px; border-radius: 14px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .nav-item svg { width: 18px; height: 18px; }
    .nav-item:hover { background: transparent; }
    .nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 4px 14px var(--primary-glow); }
    .content { margin-left: 0; padding-top: 18px; padding-bottom: 110px; }
}

/* ---------- cards / grids ---------- */
.card {
    position: relative;
    background: var(--bg-2); border: 1px solid var(--border-soft);
    border-radius: var(--radius); margin-bottom: 18px; overflow: hidden;
    box-shadow: var(--shadow-sm), var(--card-edge);
}
.card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; pointer-events: none;
    background: linear-gradient(90deg, transparent 5%, rgba(139,92,246,.45), rgba(34,211,238,.3), transparent 95%);
    opacity: .6;
}
[data-theme="light"] .card::before { opacity: .35; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 15px 20px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; font-weight: 750; letter-spacing: -.2px; }
/* Buttons in card headers use natural width (not the 130px form-row min-width),
   so header actions never overflow / get clipped by the card on small screens. */
.card-head .row { flex: 0 1 auto; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.card-head .row > * { flex: 0 0 auto; min-width: 0; }
.card-body { padding: 20px; }
.grid { display: grid; gap: 12px; }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); margin-bottom: 18px; }
.stat {
    position: relative; overflow: hidden;
    background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 17px 18px; box-shadow: var(--shadow-sm), var(--card-edge);
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.stat::after {
    content: ''; position: absolute; width: 130px; height: 130px; right: -50px; top: -50px;
    border-radius: 50%; background: radial-gradient(circle, var(--glow-a), transparent 70%);
    pointer-events: none;
}
.stat:hover { transform: translateY(-3px); border-color: var(--border); box-shadow: var(--shadow), var(--card-edge); }
.stat .ico {
    position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
    border-radius: 11px; display: grid; place-items: center; font-size: 16px;
    background: var(--bg-3); z-index: 1;
}
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--text-2); font-size: 12px; margin-top: 3px; font-weight: 500; }
.stat.accent { background: linear-gradient(150deg, rgba(139,92,246,.18), var(--bg-2) 62%); }
.stat.accent .v {
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.stat.accent .ico { background: rgba(139,92,246,.2); }
.stat.good .v { color: var(--success); }
.stat.good .ico { background: rgba(52,211,153,.16); }
.stat.warn .v { color: var(--warning); }
.stat.warn .ico { background: rgba(251,191,36,.16); }

/* ---------- forms ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 11.5px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .6px; }
.input, select.input, textarea.input {
    width: 100%; padding: 11px 14px;
    background: var(--bg-3); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--text-3); }
.input:hover:not(:focus) { border-color: var(--bg-hover); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); background: var(--bg-2); }
select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 120px; font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace; line-height: 1.6; }
textarea.input.code { font-size: 13px; tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 130px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 18px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    font: inherit; font-weight: 700; font-size: 13.5px;
    background: var(--grad); background-size: 150% 100%; background-position: 0 0;
    color: #fff;
    transition: background-position .25s, transform .12s, box-shadow .15s, filter .15s;
    box-shadow: 0 3px 14px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.22);
    -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:hover { background-position: 60% 0; transform: translateY(-1px); box-shadow: 0 6px 20px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.22); }
.btn:active { transform: translateY(1px); filter: brightness(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; filter: none; transform: none; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 13px; font-size: 12.5px; gap: 5px; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--text-2); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { color: var(--text); background: var(--bg-3); transform: none; box-shadow: none; }
.btn.good { background: linear-gradient(120deg, #10b981, #0ea5a4); box-shadow: 0 3px 14px rgba(16,185,129,.32), inset 0 1px 0 rgba(255,255,255,.22); }
.btn.good:hover { box-shadow: 0 6px 20px rgba(16,185,129,.36), inset 0 1px 0 rgba(255,255,255,.22); }
.btn.bad { background: linear-gradient(120deg, #ef4444, #e11d67); box-shadow: 0 3px 14px rgba(239,68,68,.32), inset 0 1px 0 rgba(255,255,255,.22); }
.btn.bad:hover { box-shadow: 0 6px 20px rgba(239,68,68,.36), inset 0 1px 0 rgba(255,255,255,.22); }
.btn.warn { background: linear-gradient(120deg, #f59e0b, #ea700c); color: #1c1206; box-shadow: 0 3px 14px rgba(245,158,11,.32), inset 0 1px 0 rgba(255,255,255,.3); }
.icon-btn {
    width: 33px; height: 33px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-3); color: var(--text-2); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
    transition: color .15s, border-color .15s, background .15s, transform .12s;
    -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { color: var(--text); border-color: var(--primary); background: var(--bg-hover); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.bad:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 25%, transparent);
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 7px currentColor; }
.b-green { background: rgba(52,211,153,.12); color: var(--success); }
.b-yellow { background: rgba(251,191,36,.12); color: var(--warning); }
.b-red { background: rgba(248,113,113,.12); color: var(--danger); }
.b-blue { background: rgba(56,189,248,.12); color: var(--info); }
.b-purple { background: rgba(167,139,250,.14); color: #c4b5fd; }
.b-gray { background: rgba(148,163,184,.12); color: var(--text-2); }
[data-theme="light"] .b-purple { color: #7c3aed; }
[data-theme="light"] .b-blue { color: #0284c7; }

/* ---------- tables (desktop) / cards (mobile) ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
    text-align: left; padding: 10px 12px; color: var(--text-3);
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--bg-3) 60%, transparent); }
.actions { display: flex; gap: 6px; }

@media (max-width: 700px) {
    table.cardify thead { display: none; }
    table.cardify, table.cardify tbody, table.cardify tr, table.cardify td { display: block; width: 100%; }
    table.cardify tr {
        border: 1px solid var(--border-soft); border-radius: 14px;
        margin-bottom: 10px; padding: 6px 2px; background: var(--bg-2);
        box-shadow: var(--shadow-sm), var(--card-edge);
    }
    table.cardify td {
        border: 0; padding: 7px 14px;
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
    }
    table.cardify td::before {
        content: attr(data-th);
        font-size: 11px; color: var(--text-3); text-transform: uppercase;
        letter-spacing: .5px; font-weight: 700; flex: none;
    }
    table.cardify td:not([data-th]) { justify-content: flex-end; }
    tbody tr:hover td { background: transparent; }
}

/* ---------- login screen ---------- */
.login-wrap {
    min-height: 100dvh; display: grid; place-items: center; padding: 20px;
    background:
        radial-gradient(860px 480px at 12% -8%, rgba(139,92,246,.26), transparent 55%),
        radial-gradient(860px 480px at 92% 108%, rgba(34,211,238,.16), transparent 55%),
        radial-gradient(520px 340px at 82% 10%, rgba(99,102,241,.12), transparent 60%),
        radial-gradient(var(--dots) 1px, transparent 1.4px),
        var(--bg);
    background-size: auto, auto, auto, 26px 26px, auto;
}
.login-card {
    position: relative; width: 100%; max-width: 400px;
    background: color-mix(in srgb, var(--bg-2) 90%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px; padding: 36px 30px;
    box-shadow: var(--shadow-lg), var(--card-edge);
    animation: pop .3s cubic-bezier(.2,.9,.3,1.2);
}
.login-card::before {
    content: ''; position: absolute; inset: -1px; border-radius: 25px; pointer-events: none;
    background: linear-gradient(160deg, rgba(139,92,246,.6), transparent 32%, transparent 68%, rgba(34,211,238,.45));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    padding: 1px; opacity: .8;
}
.login-card .brand { justify-content: center; display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 800; margin-bottom: 6px; letter-spacing: -.3px; }
.login-card .sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- modal ---------- */
.modal-back {
    position: fixed; inset: 0; background: rgba(2,4,12,.68);
    display: grid; place-items: center; padding: 16px; z-index: 100;
    -webkit-backdrop-filter: blur(9px);
    backdrop-filter: blur(9px); animation: fade .18s;
}
[data-theme="light"] .modal-back { background: rgba(15,23,42,.35); }
@keyframes fade { from { opacity: 0; } }
.modal {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: 20px; width: 100%; max-width: 470px;
    max-height: 90dvh; overflow-y: auto;
    box-shadow: var(--shadow-lg), var(--card-edge);
    animation: pop .24s cubic-bezier(.2,.9,.3,1.15);
}
.modal.wide { max-width: 760px; }
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
    position: sticky; top: 0; background: var(--bg-2); z-index: 1;
}
.modal-head h3 { font-size: 15.5px; font-weight: 750; }
.modal-body { padding: 20px; }
@media (max-width: 560px) {
    /* bottom-sheet feel on phones */
    .modal-back { place-items: end center; padding: 0; }
    .modal { max-width: 100%; border-radius: 22px 22px 0 0; border-bottom: 0; max-height: 92dvh; animation: sheet-up .26s cubic-bezier(.2,.9,.3,1.1); }
    .modal-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
@keyframes sheet-up { from { opacity: 0; transform: translateY(40px); } }

/* ---------- toast ---------- */
#toasts {
    position: fixed; top: 16px; right: 16px; left: 16px; z-index: 200;
    display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
    pointer-events: none;
}
.toast {
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid var(--border); border-radius: 14px;
    padding: 12px 16px; font-size: 13.5px; font-weight: 600;
    box-shadow: var(--shadow-lg); max-width: 430px;
    border-left: 3px solid var(--info);
    animation: toast-in .24s cubic-bezier(.2,.9,.3,1.2);
    display: flex; align-items: center; gap: 9px;
}
.toast::before { content: 'ℹ'; font-size: 15px; }
.toast.success { border-left-color: var(--success); }
.toast.success::before { content: '✓'; color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.danger::before { content: '✕'; color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning::before { content: '⚠'; color: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }

/* ---------- offset editor ---------- */
.editor-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.editor-toolbar .grow { flex: 1; }
.editor-status { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.editor-status.ok { color: var(--success); }
.editor-status.err { color: var(--danger); }
.validation-panel {
    margin-top: 10px; border-radius: var(--radius-sm); padding: 11px 14px;
    font-size: 12.5px; line-height: 1.5; display: none;
}
.validation-panel.show { display: block; }
.validation-panel.ok { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); color: var(--success); }
.validation-panel.err { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: #fca5a5; }
[data-theme="light"] .validation-panel.err { color: #b91c1c; }
.validation-panel code { background: rgba(0,0,0,.25); padding: 1px 5px; border-radius: 4px; }
[data-theme="light"] .validation-panel code { background: rgba(15,23,42,.08); }

/* ---------- inline icons ---------- */
.ic { width: 1.1em; height: 1.1em; display: inline-block; vertical-align: -.2em; flex: none; }
.brand-dot svg { width: 18px; height: 18px; color: #fff; }
.stat .ico svg { width: 17px; height: 17px; }
.stat.accent .ico svg { color: var(--primary-2); }
.stat.good .ico svg { color: var(--success); }
.stat.warn .ico svg { color: var(--warning); }
.empty .big svg { width: 38px; height: 38px; }

/* ---------- misc ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.mt { margin-top: 15px; }
.mb0 { margin-bottom: 0; }
.key-box {
    background: var(--bg-3); border: 1px dashed var(--primary);
    border-radius: var(--radius-sm); padding: 15px;
    font-family: ui-monospace, Consolas, monospace; font-size: 13px;
    white-space: pre-wrap; word-break: break-all; line-height: 1.5;
    box-shadow: inset 0 0 28px rgba(139,92,246,.06);
}
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.tabs-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
    padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-2); color: var(--text-2); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 650;
    transition: color .14s, border-color .14s, background .14s, box-shadow .14s, transform .12s;
    -webkit-tap-highlight-color: transparent;
}
.chip:hover { color: var(--text); border-color: var(--primary); transform: translateY(-1px); }
.chip.active {
    background: var(--grad); border-color: transparent; color: #fff;
    box-shadow: 0 3px 14px var(--primary-glow);
}
.spin {
    width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
    display: inline-block; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 34px 16px; color: var(--text-3); }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .5; }
.skeleton {
    border-radius: var(--radius-xs); background: var(--bg-3); position: relative; overflow: hidden;
    color: transparent !important; pointer-events: none; user-select: none;
}
.skeleton::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
    animation: shimmer 1.4s infinite;
}
[data-theme="light"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(15,23,42,.05), transparent); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
