/**
 * Style RiftTodo Admin — w pełni samodzielny arkusz, bez zależności
 * od app.css głównej aplikacji. Ten sam język wizualny (fiolet, dark/light).
 */
:root {
    --bg: #0c0a16;
    --panel: #16132a;
    --panel-2: #1d1836;
    --border: #2c2650;
    --text: #f2eefc;
    --text-dim: #a79cd1;
    --text-faint: #776e9c;
    --accent: #8b5cf6;
    --accent-2: #d946ef;
    --success: #22c55e;
    --warning: #fbbf24;
    --danger: #f87171;
    --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-2));
    --gradient-hero: linear-gradient(135deg, #6d28d9 0%, #9333ea 45%, #db2777 100%);
    --radius-sm: 8px;
    --radius: 14px;
    --sidebar-w: 240px;
    /* Paleta wykresów — zwalidowana (dataviz skill): stały porządek kategorii,
       nigdy nie cyklujemy odcieni. Wartości "dark" to domyślny motyw panelu. */
    --series-1: #3987e5; /* niebieski */
    --series-2: #d95926; /* pomarańcz */
    --series-3: #199e70; /* turkus */
    --series-4: #c98500; /* żółty */
    --series-5: #d55181; /* magenta */
    --series-6: #22c55e; /* zielony (status: ok) */
    --series-7: #9085e9; /* fiolet */
    --series-8: #e66767; /* czerwony (status: krytyczny) */
    --chart-grid: rgba(255,255,255,.08);
    --chart-text: var(--text-faint);
}
:root[data-theme="light"] {
    --bg: #f6f4fd;
    --panel: #ffffff;
    --panel-2: #f1ecfb;
    --border: #e2d9f7;
    --text: #231b3d;
    --text-dim: #6c6191;
    --text-faint: #9187b3;
    --accent: #7c3aed;
    --accent-2: #c026d3;
    --danger: #dc2626;
    --gradient-hero: linear-gradient(135deg, #7c3aed 0%, #a855f7 45%, #ec4899 100%);
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;
    --series-6: #008300;
    --series-7: #4a3aa7;
    --series-8: #e34948;
    --chart-grid: rgba(35,27,61,.08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}
.accent-part { color: var(--accent); }

/* ---------------- IKONY (SVG, lucide) ---------------- */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
button .icon, a .icon { pointer-events: none; }

/* ---------------- LOGIN ---------------- */
.auth-wrap { margin: auto; width: 100%; max-width: 380px; padding: 24px; min-height: 100vh; display: flex; }
.auth-card {
    margin: auto; width: 100%;
    background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
    padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.auth-logo { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 9px; margin-bottom: 24px; }
.auth-logo-mark {
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; background: var(--gradient-accent);
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.auth-logo span { color: var(--text); }
h1 { font-size: 22px; margin: 0 0 6px; }
.auth-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 22px; }
.auth-error {
    background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35);
    color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 16px;
}
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 13px; color: var(--text-dim); margin-top: 10px; }
.auth-form input {
    background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px; color: var(--text); font-size: 14px; outline: none;
}
.auth-form input:focus { border-color: var(--accent); }
.btn-primary {
    margin-top: 20px; background: var(--gradient-accent); color: #fff; border: none;
    border-radius: 10px; padding: 11px 16px; font-size: 14px; font-weight: 700;
    cursor: pointer; text-align: center; text-decoration: none; display: block;
}
.btn-primary:hover { filter: brightness(1.08); }
.auth-otp-input {
    font-size: 26px !important; letter-spacing: 10px; text-align: center; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.auth-back-link {
    display: block; text-align: center; margin-top: 16px; font-size: 13px;
    color: var(--text-dim); text-decoration: none;
}
.auth-back-link:hover { color: var(--text); text-decoration: underline; }

/* ---------------- APP SHELL ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
    overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.brand, .sidebar-bottom { flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; margin-bottom: 24px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px; background: var(--gradient-accent); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px;
}
.brand-name { font-weight: 800; font-size: 15px; }
.brand-tag { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; }

.nav-main { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    color: var(--text-dim); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.nav-item .ic { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-item { transition: background .15s, color .15s; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--gradient-accent); color: #fff; box-shadow: 0 4px 14px rgba(139,92,246,.35); }
.nav-badge { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-faint); }
.nav-item.active .nav-badge { color: rgba(255,255,255,.85); }
.nav-section-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--text-faint); padding: 16px 12px 6px;
}
.nav-section-label:first-child { padding-top: 0; }

.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-status { font-size: 11px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }
.logout-link { display: block; margin-top: 8px; padding: 8px; font-size: 12.5px; color: var(--text-faint); text-decoration: none; text-align: center; border-radius: 8px; }
.logout-link:hover { background: var(--panel-2); color: var(--danger); }

/* ---------------- TOPBAR / CONTENT ---------------- */
.content { flex: 1; min-width: 0; }
.content-header {
    display: flex; align-items: center; gap: 16px; padding: 16px 28px; border-bottom: 1px solid var(--border);
    background: var(--panel); position: sticky; top: 0; z-index: 10;
}
.sidebar-toggle { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.topbar-search {
    flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.topbar-search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; }
.topbar-search .ic { opacity: .7; display: inline-flex; }
.header-utility { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 13px; color: var(--text-dim); margin-left: 2px; }
.icon-btn-round {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 15px; position: relative;
    display: inline-flex; align-items: center; justify-content: center; transition: background .15s, transform .15s;
}
.icon-btn-round:hover { background: var(--border); transform: translateY(-1px); }
.sidebar-toggle { display: none; align-items: center; justify-content: center; }
.bell-wrap { position: relative; }
.bell-badge {
    position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff; font-size: 9.5px;
    font-weight: 700; border-radius: 10px; min-width: 15px; height: 15px; display: none; align-items: center;
    justify-content: center; padding: 0 3px;
}
.bell-badge.show { display: flex; }
.notif-panel {
    display: none; position: absolute; top: 42px; right: 0; width: 300px; max-height: 380px; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,.35); z-index: 30;
}
.notif-panel.open { display: block; }
.notif-panel h4 { font-size: 10.5px; text-transform: uppercase; color: var(--text-faint); margin: 8px 8px 4px; }
.notif-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 8px; font-size: 12.5px; }
.notif-row:hover { background: var(--panel-2); }
.notif-empty { padding: 20px 10px; text-align: center; color: var(--text-faint); font-size: 12.5px; }
.notif-time { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }

.view-root { padding: 24px 28px 60px; max-width: 1300px; }

/* ---------------- EFEKTY: przejście widoku, skeleton ---------------- */
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
.view-fade-in { animation: viewFadeIn .28s cubic-bezier(.2,.8,.2,1); }

@keyframes skeletonPulse {
    0%, 100% { opacity: .55; }
    50% { opacity: 1; }
}
.skeleton-row { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.skeleton-bar {
    height: 14px; border-radius: 6px; background: var(--panel-2);
    animation: skeletonPulse 1.3s ease-in-out infinite;
}
.skeleton-bar.w-60 { width: 60%; } .skeleton-bar.w-40 { width: 40%; } .skeleton-bar.w-80 { width: 80%; }
.skeleton-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; }
.skeleton-card { height: 72px; border-radius: var(--radius); background: var(--panel-2); animation: skeletonPulse 1.3s ease-in-out infinite; }

/* Animowany licznik na kartach statystyk */
.stat-num { transition: color .2s; }

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ---------------- HERO ---------------- */
.hero {
    position: relative; overflow: hidden;
    background: var(--gradient-hero); border-radius: var(--radius); padding: 24px 28px; margin-bottom: 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: #fff;
}
.hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .9;
    background-image:
        radial-gradient(1.6px 1.6px at 8% 25%, rgba(255,255,255,.9), transparent),
        radial-gradient(1.2px 1.2px at 18% 65%, rgba(255,255,255,.7), transparent),
        radial-gradient(1.6px 1.6px at 27% 15%, rgba(255,255,255,.8), transparent),
        radial-gradient(1.2px 1.2px at 38% 80%, rgba(255,255,255,.6), transparent),
        radial-gradient(1.6px 1.6px at 47% 40%, rgba(255,255,255,.9), transparent),
        radial-gradient(1.2px 1.2px at 58% 20%, rgba(255,255,255,.7), transparent),
        radial-gradient(1.6px 1.6px at 68% 70%, rgba(255,255,255,.8), transparent),
        radial-gradient(1.2px 1.2px at 78% 30%, rgba(255,255,255,.6), transparent),
        radial-gradient(1.6px 1.6px at 88% 55%, rgba(255,255,255,.9), transparent),
        radial-gradient(1.2px 1.2px at 96% 10%, rgba(255,255,255,.7), transparent),
        radial-gradient(circle at 88% 15%, rgba(255,255,255,.14), transparent 45%),
        radial-gradient(circle at 10% 85%, rgba(255,255,255,.10), transparent 40%);
}
.hero > * { position: relative; z-index: 1; }
.hero-left { display: flex; align-items: center; gap: 16px; }
.hero-icon { width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.hero h2 { margin: 0 0 3px; font-size: 21px; }
.hero p { margin: 0; opacity: .85; font-size: 13.5px; }
.hero-status {
    background: rgba(0,0,0,.22); border-radius: 12px; padding: 12px 16px; font-size: 12.5px; min-width: 220px;
}
.hero-status-line { display: flex; align-items: center; gap: 7px; font-weight: 700; margin-bottom: 8px; }
.hero-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.hero-status-dot.off { background: var(--danger); }
.hero-status-row { display: flex; justify-content: space-between; gap: 10px; opacity: .85; padding: 2px 0; }
.hero-status-row b { opacity: 1; font-weight: 600; }
.hero-btn {
    margin-top: 10px; width: 100%; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
    color: #fff; border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.hero-btn:hover { background: rgba(255,255,255,.26); }

.section-label { font-size: 14px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 7px; }

/* ---------------- STAT CARDS ---------------- */
.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; display: flex; align-items: center; gap: 12px;
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.18); border-color: var(--accent); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-num { font-size: 19px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 11.5px; color: var(--text-faint); }

/* ---------------- LAYOUT: MAIN + SIDE ---------------- */
.layout-cols { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }

.widget {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 16px;
}
.warn-banner { border-color: var(--warning); }
.warn-banner .dim { color: var(--text-dim); margin-left: 6px; }
.widget-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.widget-title-sub { font-size: 11.5px; font-weight: 400; color: var(--text-faint); }
.pagination-info { font-weight: 400; font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.widget-search {
    display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 10px; margin-bottom: 12px; font-size: 12.5px;
}
.widget-search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 12.5px; }

.pill-select { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
    padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border);
    font-size: 12.5px; color: var(--text-dim); cursor: pointer; background: var(--panel-2);
}
.pill.active { background: var(--gradient-accent); border-color: transparent; color: #fff; }

.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
    text-align: left; color: var(--text-faint); font-size: 10.5px; text-transform: uppercase;
    padding: 7px 9px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
    padding: 7px 9px; border-bottom: 1px solid var(--border); white-space: nowrap;
    max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-family: monospace;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--panel-2); }
.data-table td.actions-cell { display: flex; gap: 4px; }

.empty-state { color: var(--text-faint); font-size: 13px; padding: 14px 2px; }
.row-count { font-size: 11.5px; color: var(--text-faint); margin-bottom: 8px; }
.error-text { color: var(--danger); }

#sql-input {
    width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); padding: 10px; font-family: monospace; font-size: 12.5px; resize: vertical;
}
#sql-input:focus { outline: none; border-color: var(--accent); }
.sql-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; }

/* ---------------- BUTTONS ---------------- */
.btn { border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
    padding: 8px 14px; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items:center; gap:6px; }
.btn:hover { border-color: var(--accent); }
.btn-accent { background: var(--gradient-accent); border-color: transparent; color: #fff; font-weight: 600; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-danger-outline { border-color: rgba(248,113,113,.4); color: var(--danger); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: flex-start; margin-bottom: 8px; }
.btn-block:last-child { margin-bottom: 0; }
.icon-btn {
    background: transparent; border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-dim); cursor: pointer; padding: 3px 8px; font-size: 13px;
}
.icon-btn:disabled, .btn-sm:disabled { opacity: .35; cursor: not-allowed; }

/* ---------------- QUICK ACTIONS / ACTIVITY / SAFE CARD ---------------- */
.quick-actions .btn-block { text-align: left; }
.activity-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.activity-row:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-icon-circle { width: 27px; height: 27px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity-main { flex: 1; min-width: 0; }
.activity-text { color: var(--text); }
.activity-text b { font-weight: 600; }
.activity-when { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.safe-card { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.3); font-size: 12.5px; display: flex; gap: 10px; align-items: flex-start; }
.safe-card .ic { font-size: 18px; }
.safe-card b { display: block; margin-bottom: 2px; }
.safe-card span { color: var(--text-dim); }

/* ---------------- BACKUPS ---------------- */
.backup-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.backup-row:last-child { border-bottom: none; }
.backup-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.backup-meta { flex: 1; min-width: 0; }
.backup-name { font-size: 13px; font-weight: 600; font-family: monospace; }
.backup-sub { font-size: 11.5px; color: var(--text-faint); }
.backup-actions { display: flex; gap: 6px; flex-shrink: 0; }
.backup-badge {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    background: rgba(139,92,246,.15); color: var(--accent); border-radius: 5px; padding: 2px 6px; margin-left: 8px;
}

/* ---------------- AUTOMATYCZNE KOPIE (harmonogram) ---------------- */
.schedule-box { margin-top: 4px; }
.schedule-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.schedule-row:last-of-type { border-bottom: none; }
.schedule-row .label { font-size: 13px; font-weight: 600; }
.schedule-row .desc { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.schedule-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.schedule-fields .form-row { margin-bottom: 0; min-width: 150px; }
.toggle-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; background: var(--border); border-radius: 20px; cursor: pointer; transition: background .18s;
}
.toggle-slider::before {
    content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff;
    border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-switch input:checked + .toggle-slider { background: var(--gradient-accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.schedule-status { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.schedule-status .ic { display: inline-flex; }

/* ---------------- STATYSTYKI / WYKRESY ---------------- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats-grid .widget-full { grid-column: 1 / -1; }
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart-svg .axis-label { fill: var(--chart-text); font-size: 9.5px; }
.chart-svg .bar-label { fill: var(--text); font-size: 10.5px; font-weight: 600; }
.chart-svg .cat-label { fill: var(--text-dim); font-size: 10px; }
.chart-point { cursor: pointer; }
.chart-hit { fill: transparent; }
.chart-bar { cursor: pointer; transition: opacity .12s; }
.chart-bar:hover { opacity: .82; }
.chart-tooltip {
    position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 10px; font-size: 11.5px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
    transform: translate(-50%, -115%); white-space: nowrap; z-index: 5; opacity: 0; transition: opacity .1s;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip b { display: block; font-size: 13px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--text-dim); }
.chart-legend-item { display: flex; align-items: center; gap: 6px; }
.chart-legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.chart-table-toggle { background: none; border: none; color: var(--accent); font-size: 11.5px; cursor: pointer; padding: 0; margin-top: 8px; }
.chart-table-toggle:hover { text-decoration: underline; }
.chart-fallback-table { display: none; margin-top: 10px; }
.chart-fallback-table.open { display: block; }
.priority-legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.priority-legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.priority-legend-item .dot { width: 10px; height: 10px; border-radius: 3px; }
.rank-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.rank-label { width: 130px; flex-shrink: 0; font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-track { flex: 1; background: var(--panel-2); border-radius: 6px; overflow: hidden; height: 16px; }
.rank-fill { height: 100%; border-radius: 6px; min-width: 3px; }
.rank-value { width: 68px; flex-shrink: 0; text-align: right; font-size: 11.5px; color: var(--text-faint); }

/* ---------------- BEZPIECZEŃSTWO ---------------- */
.security-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.security-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; display: flex; align-items: center; gap: 12px;
}
.security-card .stat-icon { flex-shrink: 0; }
.waf-row {
    display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.waf-row:last-child { border-bottom: none; }
.waf-reason {
    font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 7px; border-radius: 5px;
    background: rgba(248,113,113,.15); color: var(--danger); flex-shrink: 0;
}
.waf-detail { flex: 1; min-width: 0; color: var(--text-dim); font-family: monospace; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waf-time { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.locked-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.locked-row:last-child { border-bottom: none; }
.locked-meta { flex: 1; min-width: 0; font-size: 12.5px; }
.locked-meta b { display: block; font-size: 13px; }
.locked-meta span { color: var(--text-faint); font-size: 11.5px; }

/* ---------------- ODZNAKI (badge) ---------------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700;
    padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .02em;
}
.badge-success { background: rgba(34,197,94,.14); color: var(--success); }
.badge-danger { background: rgba(248,113,113,.14); color: var(--danger); }
.badge-muted { background: var(--panel-2); color: var(--text-faint); }
.badge-accent { background: rgba(139,92,246,.14); color: var(--accent); }

/* ---------------- UŻYTKOWNICY ---------------- */
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-cell .avatar { width: 26px; height: 26px; font-size: 11px; }

/* ---------------- EKSPORT ---------------- */
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.export-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .15s;
}
.export-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.export-card-icon {
    width: 38px; height: 38px; border-radius: 10px; background: var(--panel-2);
    display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.export-card h4 { margin: 0; font-size: 13.5px; }
.export-card p { margin: 0; font-size: 11.5px; color: var(--text-faint); flex: 1; }

/* ---------------- LOG AKTYWNOŚCI (pełny widok) ---------------- */
.activity-filter-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.activity-filter-row select {
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
    color: var(--text); font-size: 12.5px;
}
.pagination-bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; font-size: 12.5px; color: var(--text-dim); }

/* ---------------- LOGIN: ilustracja boczna ---------------- */
.auth-wrap { max-width: none; }
.auth-shell { margin: auto; width: 100%; max-width: 840px; display: flex; align-items: stretch; gap: 0; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.auth-shell .auth-card { box-shadow: none; border-radius: 0; flex: 1; max-width: 380px; }
.auth-illustration {
    flex: 1; display: none; position: relative; background: var(--gradient-hero); overflow: hidden;
    align-items: center; justify-content: center; padding: 30px;
}
.auth-illustration::before {
    content: ''; position: absolute; inset: 0; opacity: .9;
    background-image:
        radial-gradient(1.6px 1.6px at 10% 20%, rgba(255,255,255,.9), transparent),
        radial-gradient(1.2px 1.2px at 22% 60%, rgba(255,255,255,.7), transparent),
        radial-gradient(1.6px 1.6px at 33% 12%, rgba(255,255,255,.8), transparent),
        radial-gradient(1.2px 1.2px at 44% 78%, rgba(255,255,255,.6), transparent),
        radial-gradient(1.6px 1.6px at 60% 35%, rgba(255,255,255,.9), transparent),
        radial-gradient(1.2px 1.2px at 72% 65%, rgba(255,255,255,.7), transparent),
        radial-gradient(1.6px 1.6px at 85% 22%, rgba(255,255,255,.8), transparent),
        radial-gradient(1.2px 1.2px at 92% 80%, rgba(255,255,255,.6), transparent);
}
.auth-illustration-badge {
    position: relative; z-index: 1; width: 168px; height: 168px; border-radius: 32px;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
    display: flex; align-items: center; justify-content: center; color: #fff;
    animation: floatY 4.5s ease-in-out infinite; backdrop-filter: blur(6px);
}
.auth-illustration-caption { position: absolute; bottom: 26px; left: 26px; right: 26px; z-index: 1; color: #fff; text-align: center; }
.auth-illustration-caption b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.auth-illustration-caption span { font-size: 11.5px; opacity: .8; }
@media (min-width: 760px) {
    .auth-illustration { display: flex; }
}

/* ---------------- SETTINGS ---------------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kv-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--text-faint); }
.kv-row .v { font-family: monospace; }

/* ---------------- MODAL / FORM ---------------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center;
    justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.hidden { display: none; }
.modal {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
    box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.modal h2 { margin: 0 0 16px; font-size: 17px; }
.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-row label { font-size: 12.5px; color: var(--text-dim); }
.form-row input[type=text], .form-row input[type=number], .form-row input[type=password],
.form-row input[type=date], .form-row input[type=datetime-local], .form-row input[type=time],
.form-row textarea, .form-row select {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
    color: var(--text); font-size: 13px; font-family: inherit; outline: none;
}
.form-row textarea { resize: vertical; min-height: 60px; font-family: monospace; font-size: 12.5px; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--accent); }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin: 4px 0 12px; }
.form-hint { font-size: 11px; color: var(--text-faint); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------------- TOAST ---------------- */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--panel); border: 1px solid var(--border); color: var(--text);
    padding: 12px 18px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
    z-index: 100; transition: opacity .2s, transform .2s;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(8px); }

@media (max-width: 980px) {
    .layout-cols { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: 1fr; }
    .security-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .sidebar { position: fixed; z-index: 50; height: 100%; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: flex; }
    .content-header { padding: 14px 16px; }
    .view-root { padding: 16px 16px 60px; }
    .hero { flex-direction: column; align-items: stretch; }
    .hero-status { min-width: 0; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .schedule-fields { width: 100%; }
    .schedule-fields .form-row { flex: 1; min-width: 0; }
}
