:root {
    --bg: #090c12;
    --bg-soft: #0f141d;
    --panel: rgba(18, 24, 34, .88);
    --panel-2: #121824;
    --line: rgba(255,255,255,.075);
    --text: #f4f7fb;
    --muted: #8893a6;
    --accent: #8c65ff;
    --accent-2: #5b7cff;
    --success: #44d19d;
    --danger: #ff6d7a;
    --shadow: 0 20px 60px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
      radial-gradient(circle at 78% -10%, rgba(100,80,255,.16), transparent 30%),
      radial-gradient(circle at -10% 30%, rgba(44,105,255,.09), transparent 26%),
      var(--bg);
    color: var(--text);
}
button, select, input { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
    position: sticky; top: 0; height: 100vh;
    padding: 26px 18px;
    border-right: 1px solid var(--line);
    background: rgba(9,12,18,.82);
    backdrop-filter: blur(18px);
    display: flex; flex-direction: column;
}
.brand { display:flex; align-items:center; gap:12px; padding:0 8px 25px; }
.brand-mark {
    width:42px; height:42px; border-radius:12px;
    display:grid; place-items:center; font-weight:900; letter-spacing:-1px;
    background: linear-gradient(135deg,var(--accent),var(--accent-2));
    box-shadow: 0 8px 30px rgba(108,83,255,.28);
}
.brand strong { display:block; font-size:15px; }
.brand span { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.14em; }
nav { display:grid; gap:5px; }
.nav-item { color:#aeb8c9; text-decoration:none; padding:11px 13px; border-radius:10px; font-size:14px; }
.nav-item:hover,.nav-item.active { color:#fff; background:rgba(255,255,255,.055); }
.sidebar-bottom { margin-top:auto; display:grid; grid-template-columns:auto 1fr; gap:7px 9px; align-items:center; color:var(--muted); font-size:12px; padding:12px 8px 0; }
.status-dot { width:7px; height:7px; border-radius:50%; background:var(--success); box-shadow:0 0 12px rgba(68,209,157,.8); }
.offline .status-dot { background:var(--danger); box-shadow:none; }
.logout { grid-column:2; color:#d6dbea; text-decoration:none; font-size:12px; }
.content { width:100%; max-width:1660px; margin:0 auto; padding:36px 42px 70px; }
.topbar { display:flex; justify-content:space-between; align-items:flex-end; gap:30px; margin-bottom:26px; }
.eyebrow { margin:0 0 5px; color:#8071d9; font-size:10px; font-weight:800; letter-spacing:.22em; }
h1 { margin:0; font-size:32px; letter-spacing:-.04em; }
.muted { color:var(--muted); margin:8px 0 0; font-size:14px; }
.filters { display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
select { background:#111722; color:#e9edf5; border:1px solid var(--line); border-radius:10px; padding:10px 34px 10px 12px; outline:none; }
.range-switch { display:flex; background:#111722; padding:4px; border:1px solid var(--line); border-radius:11px; }
.range-switch button { border:0; background:transparent; color:#8994a7; padding:7px 10px; border-radius:8px; cursor:pointer; font-size:12px; }
.range-switch button.active { background:#252b3a; color:#fff; box-shadow:0 5px 14px rgba(0,0,0,.18); }
.stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.stat-card { min-height:142px; background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:20px; box-shadow:var(--shadow); position:relative; overflow:hidden; }
.stat-card.accent:after { content:""; position:absolute; width:150px;height:150px;border-radius:50%;right:-65px;top:-65px;background:rgba(112,80,255,.2);filter:blur(4px); }
.stat-card span { display:block; color:#939daf; font-size:12px; margin-bottom:18px; }
.stat-card strong { display:block; font-size:27px; letter-spacing:-.045em; margin-bottom:8px; }
.stat-card small { color:#667084; font-size:11px; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); }
.chart-panel { margin-top:14px; padding:20px 20px 12px; }
.panel-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:18px; }
.panel-heading h2 { margin:0; font-size:16px; letter-spacing:-.02em; }
.panel-heading p { margin:5px 0 0; color:var(--muted); font-size:12px; }
.panel-heading.compact { margin-bottom:12px; }
.panel-heading.compact span,.updated { color:#677286; font-size:10px; text-transform:uppercase; letter-spacing:.08em; }
.chart-legend { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; max-width:58%; }
.chart-legend button { appearance:none; border:1px solid rgba(255,255,255,.08); background:rgba(255,255,255,.035); color:#aab3c2; border-radius:999px; min-height:30px; padding:5px 9px; display:flex; align-items:center; gap:6px; cursor:pointer; font:inherit; font-size:10px; transition:.15s ease; }
.chart-legend button:hover { background:rgba(255,255,255,.07); color:#eef1f7; }
.chart-legend button.is-hidden { opacity:.35; }
.chart-legend i { width:8px; height:8px; border-radius:50%; display:block; flex:0 0 auto; }
.chart { height:320px; width:100%; }
.chart svg { width:100%; height:100%; overflow:visible; }
.grid-line { stroke:rgba(255,255,255,.055); stroke-width:1; }
.axis-label { fill:#667084; font-size:10px; }
.chart-job-line { fill:none; stroke-width:2.5; vector-effect:non-scaling-stroke; stroke-linecap:round; stroke-linejoin:round; }
.chart-job-point { stroke:#17131f; stroke-width:1.8; vector-effect:non-scaling-stroke; }
.chart-empty,.empty-card { min-height:180px; display:grid; place-items:center; color:var(--muted); font-size:13px; }
.rank-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-top:14px; }
.rank-panel { padding:18px; }
.ranking-list { display:grid; gap:4px; }
.rank-row { display:grid; grid-template-columns:28px 1fr auto; gap:9px; align-items:center; padding:9px 4px; border-top:1px solid rgba(255,255,255,.05); }
.rank-row:first-child { border-top:0; }
.rank-position { width:23px;height:23px;border-radius:7px;background:rgba(255,255,255,.055);display:grid;place-items:center;color:#9ca7b8;font-size:10px;font-weight:700; }
.rank-row strong { display:block; font-size:12px; }
.rank-row small { display:block; color:#616c80; font-size:9px; margin-top:2px; }
.rank-row b { font-size:11px; font-weight:700; color:#dce1eb; }
.table-panel { margin-top:14px; padding:20px; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; min-width:760px; }
th { text-align:left; color:#667084; font-size:10px; text-transform:uppercase; letter-spacing:.07em; font-weight:700; padding:10px 11px; border-bottom:1px solid var(--line); }
td { padding:14px 11px; border-bottom:1px solid rgba(255,255,255,.045); color:#c7cfdd; font-size:12px; white-space:nowrap; }
tbody tr:hover { background:rgba(255,255,255,.018); }
td strong { color:#f0f3f8; }
.job-key { display:block; color:#566175; font-size:9px; margin-top:3px; }
.empty { text-align:center; padding:38px; color:var(--muted); }
.error-text { color:#ff8b96; }
.login-body { display:grid; place-items:center; }
.login-shell { min-height:100vh; width:100%; display:grid; place-items:center; padding:20px; }
.login-card { width:min(390px,100%); padding:30px; border:1px solid var(--line); border-radius:18px; background:rgba(16,21,31,.92); box-shadow:var(--shadow); }
.login-card .brand-mark { margin-bottom:20px; }
.login-card h1 { font-size:25px; }
.login-card > p { color:var(--muted); font-size:13px; margin:6px 0 24px; }
.login-card form { display:grid; gap:14px; }
.login-card label { display:grid; gap:7px; color:#aeb7c6; font-size:11px; }
.login-card input { width:100%; background:#0c111a; border:1px solid var(--line); color:#fff; border-radius:10px; padding:11px 12px; outline:none; }
.login-card input:focus { border-color:rgba(140,101,255,.7); box-shadow:0 0 0 3px rgba(140,101,255,.08); }
.primary-button { border:0; border-radius:10px; padding:11px 14px; background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:#fff; font-weight:700; cursor:pointer; }
.alert { padding:10px 12px; border-radius:9px; margin-bottom:14px; font-size:11px; }
.alert.error { color:#ffafb7; background:rgba(255,70,88,.08); border:1px solid rgba(255,90,106,.15); }
@media (max-width:1150px) {
    .stats-grid,.rank-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:800px) {
    .app-shell { display:block; }
    .sidebar { position:static; height:auto; padding:16px; border-right:0; border-bottom:1px solid var(--line); flex-direction:row; align-items:center; gap:15px; }
    .brand { padding:0; }
    .brand span, nav, .sidebar-bottom { display:none; }
    .content { padding:24px 15px 50px; }
    .topbar { align-items:flex-start; flex-direction:column; }
    .filters { justify-content:flex-start; width:100%; }
    .stats-grid,.rank-grid { grid-template-columns:1fr; }
    .range-switch { width:100%; overflow-x:auto; }
    .range-switch button { flex:1; white-space:nowrap; }
    select { width:100%; }
    .chart { height:240px; }
}

.page-view[hidden] { display: none !important; }
.page-intro { margin: 0 0 14px; padding: 2px 2px 4px; }
.page-intro h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.page-intro .eyebrow { margin-bottom: 7px; }
.page-view { animation: page-in .16s ease-out; }
@keyframes page-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width:800px) {
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 20;
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 10px;
        background: rgba(9,12,18,.96);
    }
    .brand { display: none; }
    .sidebar nav {
        display: flex;
        width: 100%;
        gap: 6px;
        overflow-x: auto;
    }
    .sidebar .nav-item {
        flex: 1 0 auto;
        text-align: center;
        padding: 9px 12px;
    }
    .sidebar-bottom { display: none; }
}


@media (max-width:800px) {
    .chart-panel .panel-heading { align-items:flex-start; flex-direction:column; }
    .chart-legend { max-width:none; justify-content:flex-start; width:100%; }
    .chart { height:300px; }
}


/* V4: porównanie prac zamiast wykresu liniowego */
.chart-scope {
    color:#8f99aa;
    font-size:11px;
    border:1px solid rgba(255,255,255,.07);
    background:rgba(255,255,255,.025);
    border-radius:999px;
    padding:6px 10px;
    white-space:nowrap;
}
.chart {
    height:auto;
    min-height:260px;
}
.jobs-bar-chart {
    display:flex;
    flex-direction:column;
    gap:13px;
    padding:12px 2px 4px;
}
.job-bar-row {
    display:grid;
    grid-template-columns:minmax(110px, 165px) minmax(0,1fr) minmax(88px,120px);
    gap:13px;
    align-items:center;
}
.job-bar-label {
    min-width:0;
}
.job-bar-label strong {
    display:block;
    color:#eef1f7;
    font-size:12px;
    line-height:1.2;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.job-bar-label small {
    display:block;
    color:#626d7f;
    font-size:9px;
    margin-top:3px;
}
.job-bar-track {
    position:relative;
    height:30px;
    border-radius:8px;
    overflow:hidden;
    background:rgba(255,255,255,.035);
    border:1px solid rgba(255,255,255,.04);
}
.job-bar-fill {
    height:100%;
    min-width:3px;
    border-radius:7px;
    background:linear-gradient(90deg, rgba(119,88,255,.72), rgba(147,117,255,.94));
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.04);
}
.job-bar-value {
    color:#f2f4f8;
    font-size:12px;
    font-weight:700;
    text-align:right;
    white-space:nowrap;
}
.job-bar-value small {
    display:block;
    color:#687386;
    font-size:9px;
    font-weight:500;
    margin-top:2px;
}
.chart-empty {
    min-height:240px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#6d7788;
    font-size:12px;
}
@media (max-width:800px) {
    .job-bar-row {
        grid-template-columns:minmax(88px,120px) minmax(0,1fr);
        gap:9px;
    }
    .job-bar-value {
        grid-column:2;
        margin-top:-5px;
        font-size:11px;
    }
    .job-bar-track {
        height:26px;
    }
}
