/* =====================================================================
   KIPG Landingi — panel administracyjny
   Kierunek: spokojny „pulpit operatora”. Ciemnozielona listwa u góry,
   chłodny papier pod spodem, jedna zieleń = „aktywny/zdrowy”, bursztyn =
   „wymaga uwagi” (wewnętrzny, zaplanowana podmiana, wygasa), czerwień =
   nieodwracalne. Wartości maszynowe (slug, IP, klucz) zawsze w mono.
   ===================================================================== */

:root {
    --bg: #f3f5f2;
    --surface: #ffffff;
    --surface-2: #f8faf8;
    --ink: #14201a;
    --ink-soft: #5f6f68;
    --ink-faint: #8a978f;
    --line: #e3e8e4;
    --line-strong: #cbd6cf;

    --forest: #0f3d2a;
    --forest-2: #14532d;

    --accent: #16a34a;
    --accent-dark: #15803d;
    --accent-darker: #14532d;
    --accent-tint: #dcfce7;
    --accent-line: #b6e6c5;
    --accent-ink: #ffffff;

    --amber: #b45309;
    --amber-tint: #fef3c7;
    --amber-line: #fcd34d;

    --danger: #b42318;
    --danger-tint: #fee4e2;
    --danger-line: #f4b6b0;

    --warn: var(--amber);
    --ok: var(--accent-dark);

    /* Sekret pokazywany jednorazowo — jedyny element z terminem ważności. */
    --vault: #92400e;
    --vault-line: #fcd34d;
    --vault-tint: #fffbeb;

    /* Ograniczenia zasięgu: neutralnie-techniczne, nie „dobre” (zielone). */
    --limit: #475569;
    --limit-tint: #f1f5f9;
    --limit-line: #cbd5e1;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Cascadia Mono", SFMono-Regular, "SF Mono",
                 Menlo, Consolas, "Liberation Mono", monospace;

    --shadow-sm: 0 1px 2px rgba(20, 35, 25, 0.05);
    --shadow: 0 1px 2px rgba(20, 35, 25, 0.04), 0 6px 18px rgba(20, 35, 25, 0.05);
    --shadow-lg: 0 10px 30px rgba(20, 35, 25, 0.12);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    --topbar-h: 56px;
}

/* ---------- Reset / baza ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    font-feature-settings: "tnum" 1, "cv11" 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body > main { flex: 1; }

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, samp, .mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
}
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.mono { background: none; border: 0; padding: 0; }

strong { font-weight: 600; }
small { font-size: 12px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.nowrap { white-space: nowrap; }

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Ikony liniowe (sprite w base.html). Rozmiar dziedziczy po tekście. */
.ico {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    vertical-align: -0.2em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Topbar ---------- */
.topbar {
    height: var(--topbar-h);
    background: var(--forest);
    background-image: linear-gradient(90deg, var(--forest) 0%, var(--forest-2) 100%);
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 2px 10px rgba(10, 30, 20, 0.25);
}
.brand a {
    color: #fff;
    font-weight: 650;
    font-size: 15.5px;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}
.brand a:hover { text-decoration: none; }
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
}
.brand-mark .ico { width: 18px; height: 18px; stroke-width: 2.2; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 120ms ease, color 120ms ease;
}
.nav-link .ico { opacity: 0.85; }
.nav-link:hover { background: rgba(255, 255, 255, 0.09); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset; }
.nav-link.active .ico { opacity: 1; }

.user-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: rgba(255, 255, 255, 0.92);
    min-width: 0;
}
.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.role-pill {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.role-pill-admin { background: var(--accent); color: #fff; }
.btn-logout {
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 5px 11px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 12.5px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-logout:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: none; }

/* ---------- Kontener, nagłówek strony ---------- */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 24px auto 0;
    padding: 0 24px;
    display: grid;
    gap: 18px;
    align-content: start;
}
/* Element grida ma domyślnie min-width:auto — szeroka tabela rozpychałaby stronę. */
.container > * { min-width: 0; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.page-head h1 {
    font-size: 22px;
    font-weight: 650;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.page-head h1 .count {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 1px 9px;
}
.page-head .lead {
    margin: 6px 0 0;
    color: var(--ink-soft);
    max-width: 68ch;
    font-size: 13.5px;
}
.page-head .lead a { white-space: nowrap; }
.page-head-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ink-soft);
    margin-bottom: 6px;
}
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--accent-dark); }
.crumbs .sep { color: var(--ink-faint); }
.crumbs code { font-size: 12px; }

/* Metryki kontekstu pod nagłówkiem podstrony (właściciel, formularze itd.) */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: center;
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: 8px;
}
.meta-row .meta { display: inline-flex; align-items: center; gap: 6px; }
.meta-row .meta strong { color: var(--ink); font-weight: 500; }

/* Pasek KPI */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: grid;
    gap: 2px;
    box-shadow: var(--shadow-sm);
}
.kpi-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--ink-soft);
}
.kpi-value {
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.kpi-sub { font-size: 12px; color: var(--ink-soft); }

/* ---------- Karty ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.card > h2,
.card-head h2 {
    font-size: 15.5px;
    font-weight: 650;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.card > h2 { margin: 0 0 14px; }
.card > h2 .count,
.card-head h2 .count {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 8px;
}
.card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 16px;
    margin-bottom: 14px;
}
.card-head > h2 { grid-column: 1; }
.card-head > .lead { grid-column: 1; }
.card-head > .actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
.card-head .lead, .card > .lead {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
    max-width: 78ch;
}
.card > .lead { margin: -8px 0 16px; }
.card h3 {
    font-size: 13.5px;
    font-weight: 650;
    margin: 18px 0 10px;
}
.card h3:first-child { margin-top: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .toolbar { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-flush > .table-scroll { border-radius: 0; }
.card-flush > .empty { padding: 28px 20px; }
.card-flush > .pager { padding: 12px 20px 16px; }

.table-scroll {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Pasek narzędzi nad tabelą: filtry + akcje */
.toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 18px;
    flex-wrap: wrap;
}
.toolbar-group {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: flex-end;
}
.filters label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    color: var(--ink-soft);
}
.filters input, .filters select { min-width: 150px; }
.filters .search { min-width: 220px; }

/* ---------- Pola formularzy (wspólne dla wszystkich formularzy w panelu) ---------- */
input[type=text], input[type=email], input[type=url], input[type=number], input[type=password],
input[type=search], input[type=datetime-local], input[type=date], select, textarea {
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 8px 11px;
    min-width: 0;
    width: 100%;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
input[type=file] { font: inherit; font-size: 13px; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}
input::placeholder { color: var(--ink-faint); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-dark); width: auto; margin: 0; }
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6f68' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.form-grid,
.upload-form,
.settings-form {
    display: grid;
    gap: 14px 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}
.form-grid label, .upload-form label, .settings-form label, .field {
    display: grid;
    gap: 5px;
    font-size: 12.5px;
    color: var(--ink-soft);
}
.form-grid label > span:first-child, .upload-form label > span:first-child,
.settings-form label > span:first-child, .field > span:first-child {
    font-weight: 500;
    color: var(--ink);
}
.form-grid label small, .upload-form label small, .settings-form label small, .field small, .hint {
    font-size: 12px;
    color: var(--ink-soft);
}
.form-grid .span-2, .upload-form .span-2, .settings-form .span-2, .field.span-2 { grid-column: 1 / -1; }
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.form-actions .hint { margin-left: 4px; }

.checks {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
}
.checks label, .check-row {
    display: inline-flex !important;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
}
.check-row { align-items: flex-start; }
.check-row input[type=checkbox] { margin-top: 3px; flex-shrink: 0; }

/* ---------- Przyciski ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    padding: 7px 13px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--surface-2); border-color: #b9c6bf; text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled=true] { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: var(--accent-dark);
    color: var(--accent-ink);
    border-color: var(--accent-dark);
}
.btn-primary:hover { background: var(--accent-darker); border-color: var(--accent-darker); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-small { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger-line); }
.btn-icon { padding: 5px; width: 30px; height: 30px; }
.btn-icon .ico { width: 16px; height: 16px; }
.btn .ico { width: 15px; height: 15px; }

/* ---------- Tabele ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.data-table th,
.data-table td {
    text-align: left;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.data-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
    font-weight: 600;
    background: var(--surface-2);
    white-space: nowrap;
    border-bottom-color: var(--line-strong);
}
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.card:not(.card-flush) .data-table th:first-child, .card:not(.card-flush) .data-table td:first-child { padding-left: 12px; }
.card:not(.card-flush) .data-table th:last-child, .card:not(.card-flush) .data-table td:last-child { padding-right: 12px; }
.data-table tbody tr:hover > td { background: #fafcfa; }
.data-table tbody tr:last-child > td { border-bottom: 0; }
.data-table tr.row-disabled > td:not(.cell-actions) { opacity: 0.55; }
.data-table .num, .data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .actions, .data-table .cell-actions { white-space: nowrap; text-align: right; }
.data-table .actions form, .data-table .cell-actions form { display: inline; }
.data-table .actions .btn + form, .data-table .actions form + form,
.data-table .cell-actions .btn + form, .data-table .cell-actions form + form,
.data-table .cell-actions form + .btn { margin-left: 4px; }
.data-table td small { color: var(--ink-soft); }
.cell-when {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--ink);
}
.cell-when .t { display: block; font-size: 12px; color: var(--ink-soft); }
.cell-email { font-size: 13px; }
.cell-email small { display: block; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
th.sortable a:hover { color: var(--accent-dark); }
th.sortable .arrow { font-size: 10px; opacity: 0.75; }
th.sortable.is-sorted { color: var(--ink); }

.empty {
    color: var(--ink-soft);
    padding: 24px 0;
    text-align: center;
    display: grid;
    gap: 4px;
    justify-items: center;
}
.empty .ico { width: 26px; height: 26px; color: var(--ink-faint); stroke-width: 1.5; margin-bottom: 4px; }
.empty strong { color: var(--ink); font-weight: 600; }

/* ---------- Odznaki i statusy ---------- */
.badge, .pill, .tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.badge-public { background: var(--surface-2); border-color: var(--line); color: var(--ink-soft); }
.badge-internal { background: var(--amber-tint); border-color: #fde68a; color: var(--amber); }
.badge-on, .pill-ok, .tag-ok { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent-darker); }
.badge-off, .pill-muted, .tag-skip { background: var(--surface-2); border-color: var(--line); color: var(--ink-soft); }
.tag-fail, .pill-danger { background: var(--danger-tint); border-color: var(--danger-line); color: var(--danger); }
.pill-warn, .tag-warn { background: var(--amber-tint); border-color: #fde68a; color: var(--amber); }
.pill::before, .tag::before, .badge-dot::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
    flex-shrink: 0;
}

.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; white-space: nowrap; }
.status::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}
.status-ok { color: var(--accent-dark); }
.status-off { color: var(--ink-faint); }
.status-warn { color: var(--amber); }

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }

.eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--ink-soft);
}

/* ---------- Komunikaty ---------- */
.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 13px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.flash .ico { width: 17px; height: 17px; margin-top: 1px; }
.flash-ok { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent-darker); }
.flash-error { background: var(--danger-tint); border-color: var(--danger-line); color: var(--danger); }
.flash-warn { background: var(--amber-tint); border-color: var(--amber-line); color: var(--amber); }
.flash code { background: rgba(255,255,255,0.6); border-color: transparent; }

.footer {
    text-align: center;
    color: var(--ink-faint);
    padding: 32px 16px 28px;
    font-size: 12px;
}

.error-card { text-align: center; padding: 48px 24px; }
.error-card h1 { font-size: 64px; margin: 0; color: var(--accent-dark); letter-spacing: -0.04em; }
.error-card .lead { font-size: 16px; margin: 8px 0 4px; }
.error-card .hint { color: var(--ink-soft); margin: 0 0 18px; }

/* ---------- Zakładki (status filters) ---------- */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    margin: 0 0 14px;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tab .count {
    font-size: 11px;
    color: var(--ink-soft);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 7px;
}
.tab.active .count { color: var(--accent-dark); background: var(--accent-tint); border-color: var(--accent-line); }

/* ---------- Paginacja ---------- */
.pager {
    display: flex; gap: 4px; align-items: center;
    margin-top: 14px; justify-content: center;
    color: var(--ink-soft); font-size: 13px;
}
.pager a, .pager span.page-cur {
    min-width: 30px;
    padding: 4px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    text-decoration: none;
    color: var(--ink);
    font-size: 12.5px;
    text-align: center;
    background: var(--surface);
}
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager span.page-cur { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }

/* =====================================================================
   Pulpit — lista landingów
   ===================================================================== */

/* Formularz wgrywania jest schowany za przyciskiem; bez JS <details> działa natywnie. */
.upload-panel { display: contents; }
.upload-panel > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.upload-panel > summary::-webkit-details-marker { display: none; }
.upload-panel[open] > summary .btn-primary { background: var(--accent-darker); }
.upload-panel[open] > summary .ico-plus { transform: rotate(45deg); }
.upload-panel .ico-plus { transition: transform 160ms ease; }
.upload-card {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.07), var(--shadow);
    animation: card-in 200ms ease both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.tag-filter-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-filter-pills a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 11px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--ink);
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease;
}
.tag-filter-pills a .swatch { width: 8px; height: 8px; border-radius: 50%; }
.tag-filter-pills a:hover { background: var(--surface-2); text-decoration: none; }
.tag-filter-pills a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag-filter-pills a.active .swatch { box-shadow: 0 0 0 2px rgba(255,255,255,0.35); }

/* Komórka „Landing”: tytuł + slug + wersja + zaplanowana podmiana */
.landing-cell { display: grid; gap: 4px; min-width: 200px; max-width: 320px; justify-items: start; }
.landing-title { font-weight: 600; color: var(--ink); line-height: 1.3; }
.landing-slug {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-dark);
}
.landing-slug .ver { color: var(--ink-faint); font-family: var(--font); font-size: 11.5px; }
.landing-slug .ico { width: 12px; height: 12px; opacity: 0.6; }
.scheduled-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--amber);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--amber-tint);
    border-radius: 999px;
    padding: 1px 8px 1px 6px;
    width: max-content;
}
.scheduled-link .ico { width: 12px; height: 12px; }

/* Lewa szyna statusu — koduje stan wiersza, nie dekoruje. */
.landings-table tbody tr.lrow > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.landings-table tbody tr.lrow.row-disabled > td:first-child { box-shadow: inset 3px 0 0 var(--line-strong); }
.landings-table tbody tr.lrow.row-internal > td:first-child { box-shadow: inset 3px 0 0 var(--amber-line); }
.landings-table tbody tr.lrow.is-open > td { background: var(--surface-2); border-bottom-color: transparent; }
.landings-table tbody tr.lrow > td { border-bottom: 0; }
.landings-table tbody tr.row-panel-tr > td { padding: 0; border-bottom: 1px solid var(--line); }
.landings-table tbody tr.row-panel-tr:hover > td { background: transparent; }
.landings-table tbody tr.row-panel-tr:last-child > td { border-bottom: 0; }
.landings-table th, .landings-table td { padding-left: 10px; padding-right: 10px; }
.landings-table .cell-visits { min-width: 160px; }
.landings-table .cell-actions { width: 1%; }
.status-cell { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }

.sparkline-cell { display: flex; align-items: center; gap: 10px; }
.sparkline { display: block; flex-shrink: 0; }
.sparkline-cell .num { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.conv-rate { display: grid; line-height: 1.25; font-variant-numeric: tabular-nums; }
.conv-rate strong { color: var(--ink); font-weight: 600; }
.conv-rate small { color: var(--ink-soft); font-size: 11.5px; }
.forms-cell { display: inline-flex; align-items: center; gap: 6px; }
.forms-cell .count { font-size: 12px; color: var(--ink-soft); }
.owner-cell { display: grid; gap: 1px; font-size: 12.5px; overflow-wrap: anywhere; }
.owner-cell .editors { color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.expires-cell { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; }
.expires-cell.is-soon { color: var(--amber); font-weight: 600; }
.expires-cell.is-past { color: var(--ink-faint); text-decoration: line-through; }

.row-toggle {
    gap: 5px;
    color: var(--ink-soft);
}
.row-toggle .chev { transition: transform 160ms ease; }
.row-toggle[aria-expanded=true] { color: var(--accent-dark); border-color: var(--accent-line); background: var(--accent-tint); }
.row-toggle[aria-expanded=true] .chev { transform: rotate(180deg); }

/* Panel pod wierszem: zakładki Ustawienia / Akcje / Współpracownicy */
.row-panel {
    margin: 0 0 12px 20px;
    padding: 0 20px 18px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-line);
    border-radius: 0 0 var(--radius) var(--radius);
}
.row-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 0 16px;
    border-bottom: 1px solid var(--line);
}
.row-tab {
    border: 0;
    background: transparent;
    padding: 10px 12px 8px;
    font: inherit;
    font-size: 13px;
    color: var(--ink-soft);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.row-tab:hover { color: var(--ink); }
.row-tab.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.row-pane[hidden] { display: none; }
.settings-form { padding: 0; background: transparent; border: 0; }
.settings-form input[type=text], .settings-form input[type=email], .settings-form input[type=url], .settings-form select {
    background: var(--surface);
}

.action-group { display: grid; gap: 8px; margin-bottom: 16px; }
.action-group:last-child { margin-bottom: 0; }
.action-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.action-row form { margin: 0; }
.action-group-danger { border-top: 1px dashed var(--danger-line); padding-top: 14px; }
.action-group-danger > .eyebrow { color: var(--danger); }
.action-note { margin: 0; font-size: 12px; color: var(--ink-soft); max-width: 80ch; }

.replace-menu { position: relative; }
.replace-menu > summary { list-style: none; cursor: pointer; }
.replace-menu > summary::-webkit-details-marker { display: none; }
.replace-form {
    display: grid;
    gap: 10px;
    min-width: 340px;
    margin-top: 8px;
    padding: 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    position: absolute;
    z-index: 5;
}
.replace-form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-soft); }
.replace-form label > span { font-weight: 500; color: var(--ink); }
.replace-form small { color: var(--ink-soft); font-size: 11.5px; }

/* Dropzone */
.dropzone {
    grid-column: 1 / -1;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 26px 18px;
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: border-color 120ms ease, background 120ms ease;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.drag-over { border-color: var(--accent); background: var(--accent-tint); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); background: var(--surface); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-icon { color: var(--accent-dark); margin-bottom: 6px; }
.dropzone-icon .ico { width: 28px; height: 28px; stroke-width: 1.6; }
.dropzone-label { color: var(--ink-soft); font-size: 13.5px; }
.dropzone-label u { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.dropzone .preview-btn { margin-top: 12px; position: relative; z-index: 2; }

/* =====================================================================
   Leady / zgłoszenia
   ===================================================================== */
.kv {
    margin: 0;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 2px 10px;
    font-size: 12.5px;
    max-width: 440px;
}
.kv dt {
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.6;
    white-space: nowrap;
}
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.kv dd.is-email { font-family: var(--font-mono); font-size: 12px; }
.kv-empty { color: var(--ink-faint); font-size: 12.5px; }
.lead-error {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    background: var(--danger-tint);
    color: var(--danger);
    font-size: 12px;
}
.lead-error .ico { width: 13px; height: 13px; margin-top: 2px; }
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bulk-bar .hint { font-size: 12px; }
.subs-table td { vertical-align: top; }
.subs-table .cell-check { width: 32px; }
.subs-table .cell-check input { margin-top: 3px; }

/* ---------- Audit ---------- */
.audit-action {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--limit-tint);
    border: 1px solid var(--limit-line);
    padding: 1px 7px;
    border-radius: 5px;
    color: var(--limit);
    white-space: nowrap;
}
.audit-ctx { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; }
.audit-ctx b { color: var(--ink); font-weight: 500; }

/* ---------- Wersje ---------- */
.version-current > td { background: #f5fbf7; }
.version-current .ver-no { color: var(--accent-darker); }
.ver-no { font-weight: 650; font-variant-numeric: tabular-nums; }
.version-note { color: var(--ink-soft); font-size: 12.5px; }

/* ---------- Agenci ---------- */
.agent-link { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }

/* =====================================================================
   API keys
   ===================================================================== */
.rc-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 4px; font-size: 13px; }

.vault {
    border: 1px solid var(--vault-line);
    border-left: 4px solid var(--vault);
    background: var(--vault-tint);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: grid;
    gap: 12px;
    animation: vault-in 320ms cubic-bezier(0.16, 0.84, 0.44, 1) both;
}
@keyframes vault-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.vault-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.vault-head .eyebrow { color: var(--vault); }
.vault-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--vault); }
.vault-token {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: #fff;
    border: 1px dashed var(--vault-line);
    border-radius: 8px;
    padding: 12px 14px;
}
.vault-token code {
    flex: 1; min-width: 240px;
    font-size: 17px; letter-spacing: 0.04em; color: var(--ink);
    user-select: all; word-break: break-all;
    background: none; border: 0; padding: 0;
}
.vault-note { margin: 0; font-size: 12px; color: var(--vault); }

.keys-create[hidden] { display: none; }
.keys-create { display: grid; gap: 18px; }
.vault + .keys-create { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.field-groups {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
}
.field-group {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px 16px;
    margin: 0;
    display: grid;
    gap: 12px;
    align-content: start;
    background: var(--surface-2);
}
.field-group > legend { padding: 0 6px; margin-left: -6px; }
.field-group label { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-soft); }
.field-group label > span:first-child { color: var(--ink); font-weight: 500; }
.field-group .hint { font-size: 12px; color: var(--ink-soft); }
.field-group input[type=text], .field-group input[type=email], .field-group input[type=number], .field-group input[type=password] { background: var(--surface); }

.scope-ladder { display: grid; gap: 4px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px; background: var(--surface); }
.scope-opt {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
}
.scope-opt:hover { background: var(--surface-2); }
.scope-opt input { margin: 3px 0 0; width: auto; }
.scope-opt-name { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink); }
.scope-opt-desc { grid-column: 2; font-size: 12px; color: var(--ink-soft); }
.scope-opt.is-selected, .scope-opt:has(input:checked) { background: var(--accent-tint); border-color: var(--accent-line); }
.scope-opt.is-selected .scope-opt-name, .scope-opt:has(input:checked) .scope-opt-name { color: var(--accent-darker); }
.keys-create .form-actions { display: flex; align-items: center; gap: 8px; }

.reach { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.reach-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px;
    border-radius: 6px;
    border: 1px solid var(--limit-line);
    background: var(--limit-tint);
    color: var(--limit);
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.reach-chip-none { border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--ink-soft); font-weight: 500; }
.reach-chip-warn { border-color: var(--danger-line); background: var(--danger-tint); color: var(--danger); }

.keys-table td { vertical-align: top; }
.keys-table .cell-name { font-weight: 600; color: var(--ink); }
.keys-table .cell-sub { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 400; margin-top: 2px; }
.keys-table .cell-when { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; }
.keys-table .cell-when strong { display: block; color: var(--ink); font-weight: 500; }
.keys-table .scope-tag {
    font-family: var(--font-mono); font-size: 11px;
    background: var(--limit-tint); border: 1px solid var(--limit-line); color: var(--limit);
    padding: 2px 7px; border-radius: 5px; white-space: nowrap;
}
.keys-table tr.is-revoked td:not(.actions) { opacity: 0.6; }

.limits { display: inline-block; }
.limits-open { justify-content: space-between; gap: 8px; }
.limits-open::after { content: "▾"; font-size: 10px; opacity: 0.6; }
.limits-open.has-selection { border-color: var(--limit-line); background: var(--limit-tint); color: var(--limit); font-weight: 600; }
.limits-modal {
    position: fixed; inset: 0;
    background: rgba(15, 30, 22, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fade-in 140ms ease both;
}
.limits-modal[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.limits-dialog {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 500px;
    max-height: min(82vh, 720px);
    display: flex; flex-direction: column; overflow: hidden;
    text-align: left; font-size: 13px; color: var(--ink);
}
.limits-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.limits-head h3 { margin: 0 0 3px; font-size: 15px; font-weight: 600; }
.limits-head p { margin: 0; font-size: 12px; color: var(--ink-soft); }
.limits-close { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--ink-soft); cursor: pointer; padding: 0 2px; }
.limits-close:hover { color: var(--ink); }
.limits-body { overflow-y: auto; padding: 4px 0; display: grid; align-content: start; }
.limits-section { padding: 14px 18px; display: grid; gap: 8px; }
.limits-section + .limits-section { border-top: 1px solid var(--line); }
.limits-section > p { margin: 0; font-size: 12px; color: var(--ink-soft); }
.picker-list {
    max-height: 210px; overflow-y: auto;
    display: grid; gap: 2px; align-content: start;
    border: 1px solid var(--line); border-radius: 8px; padding: 4px;
}
.picker-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.picker-item:hover { background: var(--surface-2); }
.picker-item input[type=checkbox] { width: auto; flex-shrink: 0; margin: 0; }
.picker-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item-slug { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); flex-shrink: 0; background: none; border: 0; padding: 0; }
.picker-item-orphan .picker-item-title { color: var(--danger); font-style: italic; }
.picker-item.is-hidden { display: none; }
.picker-empty { font-size: 13px; color: var(--ink-soft); margin: 6px 9px; }
.picker-none { font-size: 12px; color: var(--ink-soft); margin: 0; }
.limits-foot {
    padding: 12px 18px; border-top: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--surface-2);
}
.limits-summary { font-size: 12px; color: var(--ink-soft); }
.limits-foot-actions { display: flex; align-items: center; gap: 8px; }

/* =====================================================================
   Assets
   ===================================================================== */
.asset-upload {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    margin: 0 0 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.asset-upload label { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-soft); flex: 1 1 320px; min-width: 0; }
.asset-upload label > span:first-child { color: var(--ink); font-weight: 500; }
.asset-upload input[type=file] {
    padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--surface); font: inherit; font-size: 13px; width: 100%;
}
.asset-upload .hint { font-size: 12px; }
.asset-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.asset-tile {
    margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    background: var(--surface); display: flex; flex-direction: column; min-width: 0;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.asset-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.asset-thumb {
    display: block; width: 100%; aspect-ratio: 4 / 3; border: 0; border-bottom: 1px solid var(--line);
    padding: 8px; cursor: zoom-in;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #eef2f0 25%, transparent 25%, transparent 75%, #eef2f0 75%),
        linear-gradient(45deg, #eef2f0 25%, transparent 25%, transparent 75%, #eef2f0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}
.asset-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.asset-thumb-file { display: grid; place-items: center; background: var(--surface-2); background-image: none; cursor: pointer; text-decoration: none; }
.asset-thumb-file:hover { text-decoration: none; }
.asset-ext {
    font-family: var(--font-mono); font-size: 15px; font-weight: 600; letter-spacing: 0.5px; color: var(--ink-soft);
    border: 1px dashed var(--line-strong); border-radius: 6px; padding: 8px 14px;
}
.asset-meta { padding: 10px 12px 0; display: grid; gap: 2px; min-width: 0; }
.asset-name { font-family: var(--font-mono); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-size { font-size: 11px; color: var(--ink-soft); }
.asset-actions { padding: 10px 12px 12px; display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.asset-actions form { margin: 0; }

body.no-scroll { overflow: hidden; }
.lightbox {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(12, 24, 18, 0.84);
    display: flex; align-items: center; justify-content: center;
    padding: 32px 20px;
    animation: fade-in 140ms ease both;
}
.lightbox[hidden] { display: none; }
.lightbox-figure { margin: 0; max-width: min(1100px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox-figure img {
    max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 8px;
    background:
        linear-gradient(45deg, #e6ebe8 25%, transparent 25%, transparent 75%, #e6ebe8 75%) 0 0/16px 16px,
        linear-gradient(45deg, #e6ebe8 25%, transparent 25%, transparent 75%, #e6ebe8 75%) 8px 8px/16px 16px,
        #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}
.lightbox-figure figcaption { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; color: rgba(255, 255, 255, 0.92); font-size: 13px; }
.lightbox-name { font-family: var(--font-mono); font-weight: 600; }
.lightbox-size { color: rgba(255, 255, 255, 0.65); font-size: 12px; }
.lightbox-open { color: #fff; text-decoration: underline; }
.lightbox-open:hover { color: #fff; }
.lightbox-close {
    position: absolute; top: 14px; right: 18px; width: 38px; height: 38px;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff;
    font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.26); }

/* ---------- Dokumentacja ---------- */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.doc-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 14px 0; border-bottom: 1px solid var(--line);
}
.doc-item:last-child { border-bottom: 0; }
.doc-item:first-child { padding-top: 4px; }
.doc-meta { display: grid; gap: 3px; min-width: 0; flex: 1 1 320px; }
.doc-title { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.doc-title .ico { color: var(--accent-dark); }
.doc-desc { color: var(--ink-soft); font-size: 13px; }
.doc-file { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }

/* ---------- Modal podglądu (dashboard.js) ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 30, 22, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 16px;
    animation: fade-in 140ms ease both;
}
.modal {
    background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 1100px; height: 85vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-foot { padding: 10px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-soft); background: var(--surface-2); }
.preview-iframe { flex: 1; border: 0; background: #fff; width: 100%; }

/* =====================================================================
   Logowanie
   ===================================================================== */
.login-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(90% 70% at 20% 0%, rgba(47, 191, 109, 0.35) 0%, transparent 60%),
        radial-gradient(70% 60% at 100% 100%, rgba(22, 163, 74, 0.28) 0%, transparent 60%),
        linear-gradient(160deg, #0b2f20 0%, #0f3d2a 55%, #14532d 100%);
    color: var(--ink);
    display: flex;
}
.login-shell { margin: auto; padding: 32px 16px; width: 100%; max-width: 440px; display: grid; gap: 16px; justify-items: center; align-content: center; flex: 0 0 auto; }
.login-card {
    width: 100%; background: #fff; border-radius: 18px; padding: 40px 40px 34px;
    box-shadow: 0 24px 60px rgba(5, 30, 18, 0.45), 0 2px 8px rgba(5, 30, 18, 0.2);
    text-align: center; display: grid; gap: 14px; justify-items: center; align-content: start;
}
.login-icon {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--accent-tint); color: var(--accent-dark);
    display: grid; place-items: center;
}
.login-icon .ico { width: 28px; height: 28px; stroke-width: 1.8; }
.login-title { font-size: 24px; line-height: 1.15; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.login-lead { margin: 0 0 6px; color: var(--ink-soft); font-size: 14px; max-width: 300px; }
.ms-button {
    display: inline-flex; align-items: center; gap: 12px;
    background: #1f1f23; color: #fff; text-decoration: none;
    padding: 11px 20px; border-radius: 9px; font-weight: 500; font-size: 14.5px;
    transition: background 120ms ease, transform 120ms ease;
}
.ms-button:hover { background: #2c2c33; text-decoration: none; transform: translateY(-1px); }
.ms-button:active { transform: translateY(0); }
.ms-logo { display: block; }
.login-error { color: var(--danger); font-size: 13px; margin: 0; background: var(--danger-tint); border-radius: 8px; padding: 8px 12px; }
.login-foot { color: rgba(255,255,255,0.6); font-size: 12px; margin: 0; letter-spacing: 0.04em; }

/* =====================================================================
   Responsywność
   ===================================================================== */
@media (max-width: 1000px) {
    .topbar {
        height: auto;
        flex-wrap: wrap;
        gap: 8px 14px;
        padding: 8px 16px;
        position: static;
    }
    .main-nav {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 -16px;
        padding: 2px 16px 4px;
    }
    .main-nav::-webkit-scrollbar { display: none; }
    .nav-link { flex-shrink: 0; }
    .user-nav { gap: 8px; margin-left: auto; }
    .user-name { display: none; }
}

@media (max-width: 760px) {
    .container { padding: 0 12px; margin-top: 14px; gap: 12px; }
    .card { padding: 16px 14px; border-radius: var(--radius); }
    .card-flush > .toolbar, .card-flush > .pager { padding-left: 14px; padding-right: 14px; }
    .data-table th:first-child, .data-table td:first-child { padding-left: 14px; }
    .data-table th:last-child, .data-table td:last-child { padding-right: 14px; }
    .page-head h1 { font-size: 19px; }
    .page-head-actions { width: 100%; }
    .page-head-actions .btn, .upload-panel > summary .btn { width: 100%; }
    .upload-panel > summary { width: 100%; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .kpi { padding: 10px 12px; }
    .kpi-value { font-size: 19px; }

    .upload-form, .form-grid, .settings-form { grid-template-columns: 1fr; }
    .filters { gap: 8px; }
    .filters label { flex: 1 1 100%; }
    .filters input, .filters select, .filters .search { min-width: 0; width: 100%; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-group { width: 100%; }

    .limits, .limits-open { width: 100%; }
    .limits-dialog { max-height: 88vh; }
    .limits-section { padding: 12px 14px; }
    .limits-head, .limits-foot { padding-left: 14px; padding-right: 14px; }
    .limits-foot { flex-wrap: wrap; }

    .data-table th, .data-table td { padding: 9px 9px; }
    .row-panel { margin-left: 0; padding: 0 12px 14px; }
    .replace-form { position: static; min-width: 0; box-shadow: none; }
    .vault-token code { font-size: 15px; min-width: 0; }
    .pager { flex-wrap: wrap; }
    .login-card { padding: 32px 22px 28px; }
}

/* Etykieta tylko dla czytników ekranu. */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}
