:root {
    --bg: #0c1117;
    --shell: #111923;
    --shell-2: #151f2b;
    --panel: #ffffff;
    --panel-soft: #f7f9fb;
    --text: #17202b;
    --muted: #647184;
    --border: #dbe2ea;
    --border-strong: #c5ced8;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --steel: #334155;
    --steel-light: #e9eef4;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --warning: #b54708;
    --warning-bg: #fff7e6;
    --ok: #067647;
    --ok-bg: #ecfdf3;
    --private: #6d3ebf;
    --private-bg: #f4f0ff;
    --shadow-sm: 0 8px 24px rgba(15, 23, 42, .08);
    --shadow-md: 0 18px 55px rgba(15, 23, 42, .12);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: #eef2f6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; color: var(--primary-dark); }
button, input, select, textarea { font: inherit; }

/* Shell */
.app-body {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, .18), transparent 34rem),
        linear-gradient(135deg, #e9eef4 0%, #f7f9fb 58%, #edf2f7 100%);
}
.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    background:
        linear-gradient(180deg, rgba(29, 41, 57, .98), rgba(15, 23, 42, .98)),
        radial-gradient(circle at top right, rgba(96, 165, 250, .22), transparent 18rem);
    color: #e5edf6;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,.08);
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    padding: 8px 8px 20px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    margin-bottom: 18px;
}
.brand:hover { color: #fff; }
.brand strong { display: block; letter-spacing: .01em; font-size: 18px; }
.brand small { display: block; color: #9fb0c4; font-size: 12px; margin-top: 2px; }
.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    font-weight: 900;
    letter-spacing: -.05em;
    background: linear-gradient(135deg, #f8fafc, #93a4b8 38%, #334155 100%);
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 12px 30px rgba(0,0,0,.22);
}
.brand-mark.large {
    width: 66px;
    height: 66px;
    border-radius: 20px;
    font-size: 21px;
    margin-bottom: 18px;
}
.side-nav { display: grid; gap: 7px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ccd6e2;
    padding: 12px 13px;
    border-radius: 13px;
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.14);
    box-shadow: inset 3px 0 0 #60a5fa;
}
.nav-ico {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    background: rgba(255,255,255,.08);
    color: #dbeafe;
    font-size: 14px;
}
.side-foot {
    margin-top: auto;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(255,255,255,.05);
    color: #b7c3d2;
}
.side-foot small { display: block; margin-top: 8px; line-height: 1.45; }
.system-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: #e8f1fb; }
.system-status i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 28px;
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(197, 206, 216, .78);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-title { display: grid; gap: 3px; }
.topbar-title strong { font-size: 19px; letter-spacing: -.02em; }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #52606f;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.userbox { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    background: var(--steel);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}
.user-meta { display: grid; line-height: 1.1; }
.user-meta strong { font-size: 14px; }
.user-meta small { color: var(--muted); margin-top: 4px; }
.container { max-width: 1440px; width: 100%; margin: 0 auto; padding: 28px 28px 70px; }

/* Common */
h1, h2, h3 { margin: 0; letter-spacing: -.03em; color: #111827; }
h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1.06; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { line-height: 1.55; }
.muted, .empty { color: var(--muted); }
.small, button.small, .button.small { min-height: 32px; padding: 7px 10px; border-radius: 9px; font-size: 13px; }
.block { width: 100%; }

.page-head, .hero-panel, .panel, .login-card, .kpi-card, .dashboard-view {
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(197, 206, 216, .85);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
    margin-bottom: 22px;
}
.page-head p, .hero-panel p, .section-head p { color: var(--muted); margin: 8px 0 0; }
.elevated-head { background: linear-gradient(135deg, #fff, #f8fafc); }
.hero-panel {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 30px;
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
}
.hero-panel::after {
    content: "";
    position: absolute;
    right: -120px;
    top: -180px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,.18), transparent 68%);
    pointer-events: none;
}
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel h1 { max-width: 760px; margin-top: 8px; }
.hero-panel p { max-width: 780px; }
.hero-actions, .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel { padding: 22px; margin-bottom: 22px; }
.panel.narrow { max-width: 820px; }
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}
.compact-head { margin-bottom: 14px; }
.metric-pill {
    min-width: 44px;
    height: 36px;
    padding: 0 12px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-weight: 900;
}

/* KPI + dashboard views */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.report-grid { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
.kpi-card {
    position: relative;
    min-height: 126px;
    padding: 18px;
    overflow: hidden;
}
.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--steel);
}
.kpi-card.steel::before { background: linear-gradient(90deg, #0f172a, #94a3b8); }
.kpi-card.danger::before { background: var(--danger); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.private::before { background: var(--private); }
.kpi-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card strong { display: block; font-size: 34px; line-height: 1; margin: 12px 0 8px; color: #111827; }
.kpi-card small { color: var(--muted); }
.view-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.view-switch button {
    text-align: left;
    justify-content: flex-start;
    padding: 16px;
    min-height: 86px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(197,206,216,.86);
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
}
.view-switch button strong { color: #94a3b8; margin-right: 8px; }
.view-switch button span { display: block; font-size: 17px; font-weight: 900; color: #17202b; }
.view-switch button small { display: block; margin-top: 6px; color: var(--muted); }
.view-switch button.active {
    background: #111827;
    border-color: #111827;
    box-shadow: var(--shadow-md);
}
.view-switch button.active strong { color: #60a5fa; }
.view-switch button.active span { color: #fff; }
.view-switch button.active small { color: #b8c4d2; }
.dashboard-view { padding: 22px; }
.control-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
    gap: 18px;
    align-items: start;
}
.critical-panel, .notification-panel { margin-bottom: 18px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th, td { padding: 14px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th {
    font-size: 11px;
    text-transform: uppercase;
    color: #667085;
    letter-spacing: .08em;
    background: #f8fafc;
    font-weight: 900;
}
th:first-child { border-top-left-radius: 12px; }
th:last-child { border-top-right-radius: 12px; }
tbody tr { background: #fff; transition: background .15s ease; }
tbody tr:hover { background: #f8fbff; }
tr.row-danger { background: var(--danger-bg); }
tr.row-danger:hover { background: #ffe7e5; }
.item-title-cell { display: grid; gap: 7px; min-width: 240px; }
.item-title { color: #111827; font-weight: 900; }
.item-title:hover { color: var(--primary); }
.item-title-cell small, td small { color: var(--muted); }
.relation-cell { display: grid; gap: 5px; min-width: 170px; color: #344054; }
.row-action { text-align: right; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 11px; }
.form.compact { margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.form.compact.boxed { padding: 15px; border: 1px solid var(--border); border-radius: 14px; background: #fbfcfe; }
label, legend { font-weight: 800; font-size: 13px; color: #263445; }
input, select, textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96,165,250,.16);
}
textarea { resize: vertical; min-height: 110px; }
fieldset { border: 1px solid var(--border); border-radius: 15px; padding: 14px; margin: 0; }
.choice-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.choice-row label, .checkbox-line { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.choice-row input, .checkbox-line input { width: auto; }
.priority-row { display: grid; gap: 11px; }

/* Buttons + chips */
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: #fff;
    color: #17202b;
    padding: 10px 14px;
    cursor: pointer;
    min-height: 42px;
    font-weight: 850;
    line-height: 1;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
button:hover, .button:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(15,23,42,.08); color: #111827; }
button.primary, .button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.primary:hover, .button.primary:hover { color: #fff; background: var(--primary-dark); }
button.danger, .button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.button.ghost { background: transparent; color: #344054; }
.badge, .tag, .priority, .status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
    background: #eef2ff;
    color: #3730a3;
    white-space: nowrap;
    border: 1px solid rgba(99,102,241,.16);
}
.badge.danger, .tag-danger { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.tag-private { background: var(--private-bg); color: var(--private); border-color: #ded2ff; }
.priority.krytyczny { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.priority.wysoki { background: var(--warning-bg); color: var(--warning); border-color: #fedf89; }
.priority.normalny { background: #eef2ff; color: #3730a3; }
.priority.niski { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.status-chip { background: var(--steel-light); color: #344054; border-color: #d3dae2; }
.status-do_akceptacji, .status-do_poprawy { background: var(--warning-bg); color: var(--warning); border-color: #fedf89; }
.status-zatwierdzone, .status-prywatne_wykonane, .status-zamknieta { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.status-nowa_krytyczna { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.timer { font-weight: 950; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timer-ok { color: var(--ok); }
.timer-warn { color: var(--warning); }
.timer-hot { color: #c2410c; }
.timer-overdue { color: var(--danger); }

/* Details, history, notifications */
.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: 20px;
    align-items: start;
}
.details { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px 18px; }
.details dt { color: var(--muted); font-weight: 900; }
.details dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history { padding-left: 22px; }
.history li { margin-bottom: 13px; }
.notifications { display: grid; gap: 10px; }
.notification {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px;
    background: #fff;
}
.notification.unread { background: #f4f8ff; border-color: #b7cdfc; box-shadow: inset 3px 0 0 #2563eb; }
.notification p { margin: 5px 0; color: #475467; }
.notification small { color: var(--muted); }
.compact-list .notification { align-items: flex-start; }
.empty-state {
    padding: 28px;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    background: #fbfcfe;
    text-align: center;
    color: var(--muted);
}
.empty-state strong { display: block; color: #344054; font-size: 16px; }
.empty-state p { margin: 7px 0 0; }
.flash-area { margin-bottom: 18px; }
.flash {
    padding: 13px 15px;
    border-radius: 13px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.flash.success { background: var(--ok-bg); border-color: #abefc6; color: var(--ok); }
.flash.danger { background: var(--danger-bg); border-color: #fecdca; color: var(--danger); }
.flash.info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }
.hint {
    margin-top: 10px;
    padding: 13px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--muted);
    font-size: 14px;
}
.user-table-cell { display: flex; align-items: center; gap: 10px; }
.small-avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 11px; }

/* Login */
.login-body {
    background:
        radial-gradient(circle at top left, rgba(96,165,250,.28), transparent 30rem),
        linear-gradient(135deg, #0f172a 0%, #1f2937 48%, #e5e7eb 48%, #f8fafc 100%);
}
.login-body .container { max-width: 1180px; padding: 54px 24px; }
.login-shell {
    min-height: calc(100vh - 108px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    align-items: center;
    gap: 42px;
}
.login-hero { color: #e5edf6; max-width: 650px; }
.login-hero .eyebrow { color: #bfdbfe; }
.login-hero h1 { color: #fff; font-size: clamp(36px, 5vw, 62px); margin: 8px 0 16px; }
.login-hero p { color: #c6d3e1; font-size: 17px; max-width: 570px; }
.login-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.login-points span {
    display: inline-flex;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #eef6ff;
    font-weight: 800;
}
.login-card { padding: 28px; backdrop-filter: blur(14px); }
.login-card-head { margin-bottom: 18px; }
.login-card-head p { color: var(--muted); margin: 7px 0 0; }
.account-list { display: grid; gap: 5px; }
.account-list span { color: #475467; }

@media (max-width: 1180px) {
    .kpi-grid, .report-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
    .control-layout { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
        border-right: 0;
    }
    .brand { padding-bottom: 12px; }
    .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .side-foot { display: none; }
    .topbar, .page-head, .hero-panel, .section-head { flex-direction: column; align-items: stretch; }
    .container { padding: 20px 16px 44px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { color: #111827; }
    .login-hero h1 { color: #fff; }
    .grid-2 { grid-template-columns: 1fr; }
    .details { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .kpi-grid, .report-grid, .view-switch { grid-template-columns: 1fr; }
    .userbox { width: 100%; justify-content: space-between; }
    .user-meta { display: none; }
    .side-nav { grid-template-columns: 1fr; }
    th, td { padding: 12px 10px; }
}

/* Admin */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.admin-card {
    display: grid;
    gap: 10px;
    min-height: 170px;
    padding: 22px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(197, 206, 216, .9);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}
.admin-card:hover { color: var(--text); border-color: var(--primary); box-shadow: var(--shadow-md); }
.admin-ico {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: var(--steel-light);
    color: var(--steel);
    font-weight: 900;
}
.admin-card strong { font-size: 18px; }
.admin-card p { margin: 0; color: var(--muted); }
.settings-panel hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.check-row input { width: auto; }
@media (max-width: 980px) { .admin-grid { grid-template-columns: 1fr; } }

/* Analytics / reports */
.analytics-head { align-items: stretch; }
.score-legend-card {
    min-width: 220px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f8fafc;
    display: grid;
    gap: 6px;
    color: #475467;
    font-size: 13px;
}
.score-legend-card strong { color: #111827; font-size: 15px; }
.analytics-kpis { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.analytics-grid {
    display: grid;
    gap: 22px;
    align-items: start;
    margin-bottom: 0;
}
.analytics-grid.two-col { grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); }
.chart-panel { min-height: 360px; }
.chart-legend, .score-formula {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.chart-legend span, .score-formula span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
}
.chart-legend i {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}
.legend-created { background: #334155; }
.legend-completed { background: #067647; }
.legend-late { background: #b42318; }
.daily-chart {
    display: grid;
    gap: 7px;
    padding: 8px 0 0;
}
.daily-row {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}
.daily-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.daily-bars {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    min-width: 0;
}
.bar {
    min-width: 2px;
    height: 15px;
    border-radius: 999px;
    display: block;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.30);
}
.bar b {
    position: absolute;
    right: -2px;
    top: -17px;
    font-size: 10px;
    line-height: 1;
    color: #647184;
    opacity: 0;
    transition: opacity .15s ease;
}
.daily-row:hover .bar b { opacity: 1; }
.bar-created { background: linear-gradient(90deg, #64748b, #334155); }
.bar-completed { background: linear-gradient(90deg, #32d583, #067647); }
.bar-late { background: linear-gradient(90deg, #f97066, #b42318); }
.bar-list { display: grid; gap: 16px; }
.bar-list-row { display: grid; gap: 8px; }
.bar-list-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.bar-list-meta strong { color: #111827; }
.bar-list-meta span { color: var(--muted); font-size: 13px; text-align: right; }
.bar-track {
    height: 14px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
    border: 1px solid #d6dee8;
}
.bar-fill {
    height: 100%;
    min-width: 2px;
    display: block;
    border-radius: 999px;
}
.bar-fill.success { background: linear-gradient(90deg, #32d583, #067647); }
.bar-fill.danger { background: linear-gradient(90deg, #f97066, #b42318); }
.bar-fill.steel { background: linear-gradient(90deg, #94a3b8, #334155); }
.ranking-table td, .ranking-table th { white-space: nowrap; }
.score-cell {
    display: grid;
    grid-template-columns: 38px 100px 34px;
    gap: 8px;
    align-items: center;
}
.grade {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 28px;
    padding: 0 8px;
    border-radius: 10px;
    font-weight: 900;
    background: #eef2f6;
    color: #344054;
}
.grade-aplus, .grade-a { background: var(--ok-bg); color: var(--ok); }
.grade-b { background: #eff8ff; color: #175cd3; }
.grade-c { background: var(--warning-bg); color: var(--warning); }
.grade-d, .grade-e { background: var(--danger-bg); color: var(--danger); }
.score-track {
    height: 10px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
}
.score-track span {
    height: 100%;
    border-radius: 999px;
    display: block;
    background: linear-gradient(90deg, #64748b, #2563eb);
}
.score-cell small { color: var(--muted); font-weight: 800; }
.critical-list .bar-track { height: 16px; }
.workload-list .bar-track { height: 16px; }
@media (max-width: 1180px) {
    .analytics-kpis { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
    .analytics-grid.two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .analytics-kpis { grid-template-columns: 1fr; }
    .daily-row { grid-template-columns: 1fr; }
    .daily-bars { grid-template-columns: 1fr; }
    .chart-legend, .score-formula, .bar-list-meta { justify-content: flex-start; }
    .bar-list-meta { flex-direction: column; align-items: flex-start; gap: 4px; }
    .score-cell { grid-template-columns: 34px 1fr 30px; }
}

/* Analytics / reports */
.analytics-head h1 { margin-top: 8px; }
.filter-panel { padding: 18px; }
.report-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}
.report-filters label { display: grid; gap: 7px; }
.filter-actions { display: flex; align-items: end; }
.filter-actions button { width: 100%; }
.wide-report-grid { grid-template-columns: repeat(5, minmax(130px, 1fr)); }
.kpi-duration { font-size: 26px !important; line-height: 1.1 !important; }
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
    margin-bottom: 22px;
}
.analytics-grid-main { grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr); }
.span-2 { grid-column: span 1; }
.chart-card { min-height: 320px; }
.legend-row { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; font-weight: 800; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 10px; height: 10px; border-radius: 99px; display: inline-block; }
.legend-created { background: #334155; }
.legend-done { background: #067647; }
.legend-late { background: #b42318; }
.daily-chart {
    display: grid;
    grid-template-columns: repeat(30, minmax(20px, 1fr));
    gap: 8px;
    min-height: 260px;
    align-items: end;
    overflow-x: auto;
    padding: 6px 2px 0;
}
.day-col { display: grid; grid-template-rows: 1fr auto; gap: 8px; min-width: 22px; height: 240px; align-items: end; }
.day-col small { transform: rotate(-55deg); transform-origin: left top; white-space: nowrap; color: var(--muted); font-size: 10px; height: 34px; }
.bar-stack {
    height: 184px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 2px;
    padding: 0 2px;
    border-bottom: 1px solid var(--border-strong);
}
.bar-stack .bar { width: 6px; min-height: 0; border-radius: 999px 999px 2px 2px; display: inline-block; box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.bar-stack .created { background: #334155; }
.bar-stack .done { background: #067647; }
.bar-stack .late { background: #b42318; }
.bar-list { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 7px; }
.bar-row-head, .dept-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.bar-row-head strong, .dept-head strong { color: #1f2937; overflow-wrap: anywhere; }
.bar-row-head span { color: var(--muted); font-weight: 900; }
.progress {
    height: 10px;
    border-radius: 999px;
    background: #edf2f7;
    overflow: hidden;
    border: 1px solid #dde5ee;
}
.progress i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #1e3a8a, #60a5fa); }
.progress.warning i { background: linear-gradient(90deg, #b45309, #f97316); }
.progress.tall { height: 12px; }
.progress.tall i { background: linear-gradient(90deg, #065f46, #34d399); }
.dept-list { display: grid; gap: 16px; }
.dept-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: #fbfcfe; }
.mini-metrics { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 12px; font-weight: 800; }
.grade-chip {
    min-width: 42px;
    height: 30px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    padding: 0 10px;
    font-weight: 950;
    border: 1px solid var(--border);
    background: var(--steel-light);
    color: var(--steel);
}
.grade-aplus, .grade-a { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.grade-b { background: #eff8ff; color: #175cd3; border-color: #b2ddff; }
.grade-c { background: var(--warning-bg); color: var(--warning); border-color: #fedf89; }
.grade-d, .grade-e { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.ranking-panel { overflow: hidden; }
.ranking-table td { vertical-align: top; }
.score-cell { display: grid; grid-template-columns: auto auto; gap: 6px 10px; align-items: center; min-width: 150px; }
.score-cell strong { color: #111827; }
.scorebar { grid-column: 1 / -1; height: 7px; border-radius: 999px; overflow: hidden; background: #edf2f7; }
.scorebar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #334155, #60a5fa); }
.heatmap-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.heat-cell {
    min-height: 68px;
    border-radius: 13px;
    padding: 10px;
    display: grid;
    align-content: space-between;
    border: 1px solid rgba(180,35,24,.16);
    background: rgba(180, 35, 24, calc(.05 + (var(--level) * .0045)));
}
.heat-cell strong { font-size: 18px; color: #7a271a; }
.heat-cell small { color: #7a271a; font-weight: 800; }
.relations-list .bar-row-head strong { font-size: 13px; }
.critical-bars .bar-row-head strong { font-size: 13px; }
@media (max-width: 1180px) {
    .wide-report-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
    .report-filters { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    .analytics-grid, .analytics-grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .wide-report-grid, .report-filters { grid-template-columns: 1fr; }
    .heatmap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .daily-chart { grid-template-columns: repeat(30, 22px); }
}
.badge.warning { background: var(--warning-bg); color: var(--warning); border-color: #fedf89; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }

/* SteelMax 3 — raporty zadań v2 */
.task-report-head { align-items: stretch; }
.task-score-legend {
    min-width: 230px;
    padding: 16px;
    display: grid;
    gap: 6px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: #475467;
    font-size: 13px;
}
.task-score-legend strong { color: #111827; font-size: 15px; }
.task-report-kpis { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.task-kpi-small { font-size: 25px !important; line-height: 1.12 !important; }
.task-report-grid {
    display: grid;
    gap: 22px;
    align-items: start;
    margin-bottom: 0;
}
.task-report-grid.two { grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); }
.task-chart-panel { min-height: 360px; }
.task-chart-legend, .task-score-formula {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.task-chart-legend span, .task-score-formula span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
}
.task-chart-legend i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.task-chart-legend .created { background: #334155; }
.task-chart-legend .done { background: #067647; }
.task-chart-legend .late { background: #b42318; }
.task-daily-chart {
    display: grid;
    grid-template-columns: repeat(30, minmax(20px, 1fr));
    gap: 8px;
    min-height: 260px;
    align-items: end;
    overflow-x: auto;
    padding: 8px 2px 0;
}
.task-day {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 9px;
    min-width: 22px;
    height: 242px;
    align-items: end;
}
.task-day small {
    transform: rotate(-55deg);
    transform-origin: left top;
    white-space: nowrap;
    color: var(--muted);
    font-size: 10px;
    height: 34px;
}
.task-day-bars {
    height: 184px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 2px;
    padding: 0 2px;
    border-bottom: 1px solid var(--border-strong);
}
.task-day-bars span {
    width: 6px;
    min-height: 2px;
    display: inline-block;
    border-radius: 999px 999px 2px 2px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.task-day-bars .created { background: #334155; }
.task-day-bars .done { background: #067647; }
.task-day-bars .late { background: #b42318; }
.task-bars { display: grid; gap: 15px; }
.task-bar-row { display: grid; gap: 7px; }
.task-bar-row small { color: var(--muted); font-size: 12px; font-weight: 800; }
.task-bar-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-bar-meta strong { color: #111827; overflow-wrap: anywhere; }
.task-bar-meta span { color: var(--muted); font-weight: 900; white-space: nowrap; }
.task-progress {
    height: 12px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
    border: 1px solid #d6dee8;
}
.task-progress i { height: 100%; min-width: 2px; display: block; border-radius: inherit; }
.task-progress i.ok { background: linear-gradient(90deg, #32d583, #067647); }
.task-progress i.danger { background: linear-gradient(90deg, #f97066, #b42318); }
.task-progress i.steel { background: linear-gradient(90deg, #94a3b8, #334155); }
.task-ranking-table td, .task-ranking-table th { white-space: nowrap; }
.task-score-cell {
    display: grid;
    grid-template-columns: 40px 104px 34px;
    gap: 8px;
    align-items: center;
}
.task-grade {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 28px;
    padding: 0 8px;
    border-radius: 10px;
    font-weight: 950;
    background: var(--steel-light);
    color: var(--steel);
}
.task-grade.grade-aplus, .task-grade.grade-a { background: var(--ok-bg); color: var(--ok); }
.task-grade.grade-b { background: #eff8ff; color: #175cd3; }
.task-grade.grade-c { background: var(--warning-bg); color: var(--warning); }
.task-grade.grade-d, .task-grade.grade-e { background: var(--danger-bg); color: var(--danger); }
.task-score-track {
    height: 10px;
    border-radius: 999px;
    background: #e8eef5;
    overflow: hidden;
}
.task-score-track i {
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, #64748b, #2563eb);
}
.task-score-cell small { color: var(--muted); font-weight: 900; }
@media (max-width: 1180px) {
    .task-report-kpis { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
    .task-report-grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .task-report-kpis { grid-template-columns: 1fr; }
    .task-report-head, .task-chart-legend, .task-score-formula, .task-bar-meta { justify-content: flex-start; }
    .task-bar-meta { flex-direction: column; align-items: flex-start; gap: 4px; }
    .task-score-cell { grid-template-columns: 34px 1fr 30px; }
    .task-daily-chart { grid-template-columns: repeat(30, 22px); }
}
