/* ============================================================
   Panel zarzadzania klientami IPTV
   ------------------------------------------------------------
   Motyw ciemny (petrolowy) z jasnym wariantem. Nie jest to
   przyciemniona czern — baza jest wyraznie niebiesko-zielona,
   zeby akcent fioletowy mial na czym stac.

   Zasada porzadkujaca: stan jest wazniejszy niz ozdoba. Kolor
   niesie informacje (przechodzi / wolno / blokada / tunel),
   glebia bierze sie ze stopni powierzchni, a nie z cieni pod
   wszystkim po kolei.
   ============================================================ */

:root {
    color-scheme: dark;

    --bg:        #0c1a21;
    --bg-2:      #0f2029;
    --card:      #122530;
    --card-2:    #17303c;
    --line:      #22414f;
    --line-soft: #1a3341;

    --ink:   #e7f1f4;
    --ink-2: #c2d6de;
    --muted: #8aa6b2;
    --faint: #63808d;

    --accent:      #8e7cf8;
    --accent-2:    #a794ff;
    --accent-soft: #221f45;
    --accent-ink:  #b9adff;

    /* Skala sygnalu: przechodzi, wolno, blokada, tunel. */
    --ok:      #3ed598;
    --ok-bg:   #0f3a30;
    --warn:    #f3b03c;
    --warn-bg: #3a2f14;
    --bad:     #f5647e;
    --bad-bg:  #3c1a26;
    --info:    #4eb8e8;
    --info-bg: #10303f;

    --r-lg: 14px;
    --r-md: 10px;
    --r-sm: 7px;

    --sh-1: 0 1px 0 rgba(255,255,255,.03) inset;
    --sh-2: 0 18px 40px -28px rgba(0,0,0,.9);
    --sh-3: 0 30px 70px -30px rgba(0,0,0,.85);

    --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

    --nav-h: 64px;
}

/* Jasny wariant to wylacznie inne wartosci tych samych zmiennych —
   zaden komponent nizej nie wie, w ktorym motywie dziala.
   Wlacza sie na dwa sposoby: gdy system o niego prosi
   albo gdy uzytkownik wybierze go przyciskiem (data-motyw na <html>).
   Wybor uzytkownika jest wazniejszy, wiec ciemny cofa ustawienie systemu. */
@media (prefers-color-scheme: light) {
    :root:not([data-motyw="ciemny"]) {
        color-scheme: light;
        --bg:        #f2f5f7;
        --bg-2:      #e9eef1;
        --card:      #ffffff;
        --card-2:    #f6f8fa;
        --line:      #dde5ea;
        --line-soft: #eaeff2;
        --ink:   #0e1f27;
        --ink-2: #33505d;
        --muted: #63808d;
        --faint: #91a8b3;
        --accent:      #6d3fe8;
        --accent-2:    #8b6cf5;
        --accent-soft: #f0ecfe;
        --accent-ink:  #5b2fd0;
        --ok:      #067a52;
        --ok-bg:   #dff5ec;
        --warn:    #97621b;
        --warn-bg: #fbf0da;
        --bad:     #c32544;
        --bad-bg:  #fde5ea;
        --info:    #0a6f9c;
        --info-bg: #e0f2fb;
        --sh-1: 0 1px 2px rgba(14,31,39,.05);
        --sh-2: 0 14px 34px -24px rgba(14,31,39,.5);
        --sh-3: 0 26px 60px -28px rgba(14,31,39,.45);
    }
}

:root[data-motyw="jasny"] {
    color-scheme: light;
    --bg:        #f2f5f7;
    --bg-2:      #e9eef1;
    --card:      #ffffff;
    --card-2:    #f6f8fa;
    --line:      #dde5ea;
    --line-soft: #eaeff2;
    --ink:   #0e1f27;
    --ink-2: #33505d;
    --muted: #63808d;
    --faint: #91a8b3;
    --accent:      #6d3fe8;
    --accent-2:    #8b6cf5;
    --accent-soft: #f0ecfe;
    --accent-ink:  #5b2fd0;
    --ok:      #067a52;
    --ok-bg:   #dff5ec;
    --warn:    #97621b;
    --warn-bg: #fbf0da;
    --bad:     #c32544;
    --bad-bg:  #fde5ea;
    --info:    #0a6f9c;
    --info-bg: #e0f2fb;
    --sh-1: 0 1px 2px rgba(14,31,39,.05);
    --sh-2: 0 14px 34px -24px rgba(14,31,39,.5);
    --sh-3: 0 26px 60px -28px rgba(14,31,39,.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

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

/* Liczby sa trescia tego panelu, wiec dostaja wlasne ustawienie:
   staly odstep cyfr, ciasniejszy trakt, mocniejsza waga. */
.tabnum, td.num, .num, time, .mono { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- szkielet */

.shell { display: flex; min-height: 100vh; }

.side {
    width: 236px; flex: 0 0 236px;
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    padding: 18px 12px 24px;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto; overscroll-behavior: contain;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 22px; }
.logo {
    width: 36px; height: 36px; flex: 0 0 36px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.02em;
    display: flex; align-items: center; justify-content: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--faint); font-size: 11.5px; }

/* Naglowek grupy w menu: bez wersalikow — wystarcza kolor i waga. */
.nav-group {
    color: var(--faint); font-size: 12px; font-weight: 600;
    padding: 20px 10px 7px;
}

.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; margin-bottom: 2px;
    border-radius: var(--r-md); color: var(--ink-2);
    font-weight: 500; font-size: 14.5px;
    position: relative; overflow: hidden;
    transition: background .12s ease, color .12s ease;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .7; }
.nav-item:hover { background: var(--line-soft); text-decoration: none; }
.nav-item.active {
    background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
/* Aktywna pozycja dostaje krawedz sygnalu, nie wypelnienie gradientem. */
.nav-item.active::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}

.side-veil {
    display: none; position: fixed; inset: 0; z-index: 30;
    background: rgba(6, 16, 21, .66);
}
.side-veil.on { display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 24px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.grow { flex: 1; }
.burger {
    display: none; width: 42px; height: 42px; padding: 10px;
    border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--card); color: var(--ink); cursor: pointer;
}
.who { display: flex; align-items: center; gap: 9px; }
.avatar {
    width: 31px; height: 31px; border-radius: 9px;
    background: var(--accent-soft); color: var(--accent-ink);
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.uname { font-weight: 550; font-size: 14px; }

.pill {
    padding: 4px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: var(--accent-soft); color: var(--accent-ink);
}
.pill.warn { background: var(--warn-bg); color: var(--warn); }

.content {
    padding: 26px 28px 60px;
    width: 100%; max-width: 1500px;
    margin-inline: auto;
}

.cols-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1180px) {
    .cols-2 { grid-template-columns: 1fr 1fr; }
    .cols-2 > .card { margin-bottom: 0; }
}
.cols-2\-wide { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1180px) {
    .cols-2\-wide { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
    .cols-2\-wide > div > .card:last-child { margin-bottom: 0; }
}

/* -------------------------------------------------------- typografia */

h1 { font-size: 25px; font-weight: 680; letter-spacing: -.024em; margin: 0 0 20px; text-wrap: balance; }
h2 { font-size: 16px; font-weight: 640; letter-spacing: -.01em; margin: 0 0 13px; }
/* Bez wersalikow i bez rozstrzelenia — to naglowek, nie ozdoba. */
h3 { font-size: 13.5px; font-weight: 650; color: var(--muted); margin: 24px 0 9px; }

p { margin: 0 0 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono  { font-family: var(--mono); font-size: 12.5px; font-variant-ligatures: none; }
.bad   { color: var(--bad); }
.dim   { opacity: .5; }
code { font-family: var(--mono); font-size: .92em; background: var(--card-2);
       padding: 1px 5px; border-radius: 5px; }

/* ------------------------------------------------------------- karty */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 14px;
}
.card.danger { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

.card.login {
    max-width: 392px; margin: 10vh auto; padding: 32px 30px;
    box-shadow: var(--sh-3);
}
.card.login h1 { font-size: 23px; margin-bottom: 4px; }
body.plain { display: block; background: var(--bg); }

/* ------------------------------------------------------------ kafle */

.tiles { display: grid; gap: 12px; margin-bottom: 18px;
         grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Kafel to odczyt stanu, nie baner. Kolor wchodzi waska krawedzia
   po lewej — tyle, zeby rozpoznac go katem oka, i nie wiecej. */
.tile {
    position: relative; overflow: hidden;
    border-radius: var(--r-lg); padding: 17px 18px 17px 21px;
    background: var(--card); border: 1px solid var(--line);
    color: var(--muted); font-size: 13px; font-weight: 500;
}
.tile::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--accent);
}
.tile:nth-child(2)::before { background: var(--ok); }
.tile:nth-child(3)::before { background: var(--bad); }
.tile:nth-child(4)::before { background: var(--info); }
.tile .num {
    display: block; font-size: 34px; font-weight: 700; line-height: 1.02;
    letter-spacing: -.035em; color: var(--ink);
    font-variant-numeric: tabular-nums; margin-bottom: 2px;
}

/* ----------------------------------------------------------- tabele */

.tablewrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left; padding: 11px 12px 11px 0;
    border-bottom: 1px solid var(--line-soft); vertical-align: middle;
}
th { font-size: 12.5px; font-weight: 600; color: var(--muted);
     padding-top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--line-soft); }

/* ------------------------------------------------------- formularze */

label { display: block; margin-bottom: 15px;
        font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
    display: block; width: 100%; margin-top: 6px;
    padding: 10px 12px;
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--ink); font-size: 14px; font-family: inherit; font-weight: 400;
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus {
    outline: 0; border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
input::placeholder { color: var(--faint); }
input[readonly] { background: var(--card-2); color: var(--ink-2); }
input[disabled], select[disabled] { opacity: .5; cursor: not-allowed; }
input[type="file"] { padding: 9px; cursor: pointer; font-size: 13px; }
input[type="checkbox"] { accent-color: var(--accent); }
label > .muted, label > span.small, label > small { font-weight: 400; display: block; margin-top: 5px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 7px; padding: 10px 16px;
    border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--card-2); color: var(--ink);
    font-size: 14px; font-weight: 600; font-family: inherit;
    cursor: pointer; white-space: nowrap;
    position: relative; overflow: hidden; isolation: isolate;
    transition: background .14s ease, border-color .14s ease, transform .08s ease;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.vpn { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 45%, transparent); color: var(--info); }
.btn.bad { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }

.hotplayer-box {
    background: var(--card-2); border: 1px solid var(--line);
    border-radius: var(--r-md); padding: 14px 16px; margin-top: 4px;
}
.przelacznik { display: flex; gap: 11px; align-items: flex-start; margin: 0; cursor: pointer; }
.przelacznik input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; cursor: pointer; }
.przelacznik > span { display: block; }
.przelacznik b { display: block; margin-bottom: 3px; }
.hotplayer-box > label:not(.przelacznik) { margin: 14px 0 0; }

.pasek-ruchu { height: 8px; border-radius: 5px; background: var(--line-soft);
               overflow: hidden; margin: 4px 0 13px; }
.pasek-wypelnienie { height: 100%; border-radius: 5px; background: var(--accent);
                     transition: width .5s cubic-bezier(.4,0,.2,1); }
.pasek-wypelnienie.warn { background: var(--warn); }
.pasek-wypelnienie.bad  { background: var(--bad); }

.xtream { margin-bottom: 15px; }
.xtream label { margin-bottom: 12px; }
.kopiowalne { display: flex; gap: 8px; align-items: stretch; }
.kopiowalne input, .kopiowalne textarea { flex: 1 1 auto; min-width: 0; resize: vertical; }
.kopiowalne .btn { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 520px) {
    .kopiowalne { flex-direction: column; }
    .kopiowalne .btn { width: 100%; }
}

/* -------------------------------------------------------- plakietki */

.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 650; vertical-align: middle; white-space: nowrap;
    background: var(--line-soft); color: var(--muted);
}
.badge.ok   { background: var(--ok-bg);   color: var(--ok); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.vpn  { background: var(--info-bg); color: var(--info); }

/* Komunikat niesie stan lewa krawedzia — ta sama zasada co w kaflach. */
.flash {
    padding: 12px 15px; border-radius: var(--r-md);
    margin-bottom: 16px; font-size: 14px; font-weight: 500;
    display: flex; gap: 10px; align-items: flex-start;
    border: 1px solid var(--line); border-left-width: 4px;
    background: var(--card);
}
.flash.ok  { border-left-color: var(--ok);  color: var(--ok); }
.flash.err { border-left-color: var(--bad); color: var(--bad); }
.flash.floating { max-width: 392px; margin: 20px auto -8px; }

/* ------------------------------------------------------------ reszta */

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .inline { flex: 1; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.inline input, .inline select { margin-top: 0; }
.inline.wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }

.sendbar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    padding: 14px; border: 1px solid var(--line);
    border-radius: var(--r-md); background: var(--card-2); margin-bottom: 13px;
}
.loc-select { width: auto; min-width: 210px; margin-top: 0; }

.routes { display: flex; gap: 12px; flex-wrap: wrap; }
.route {
    flex: 1; min-width: 232px; padding: 15px;
    border-radius: var(--r-md); border: 1px solid var(--line);
    background: var(--card-2); position: relative; overflow: hidden;
}
.route.active { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.route.active::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ok);
}
.route.vpn.active { border-color: color-mix(in srgb, var(--info) 50%, var(--line)); }
.route.vpn.active::before { background: var(--info); }
.route-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }

details.card > summary {
    cursor: pointer; list-style: none; color: var(--ink);
    font-size: 14.5px; padding: 2px 0 2px 23px; position: relative; font-weight: 500;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before {
    content: ""; position: absolute; left: 4px; top: 8px;
    width: 6px; height: 6px; border-right: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint); transform: rotate(-45deg);
    transition: transform .15s ease;
}
details.card[open] > summary::before { transform: rotate(45deg); top: 6px; }
details.card[open] > summary { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.details-body { padding-top: 16px; }
details summary { cursor: pointer; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 10px 0 10px 27px; position: relative;
                border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { position: absolute; left: 2px; font-weight: 800; font-size: 13px; }
.checklist li.yes::before  { content: "\2713"; color: var(--ok); }
.checklist li.no::before   { content: "\2715"; color: var(--bad); }
.checklist li.warn::before { content: "!";     color: var(--warn); }
.checklist li.off::before  { content: "\2013"; color: var(--faint); }
.checklist li.off { color: var(--muted); }

.steps { margin: 0 0 15px; padding-left: 20px; line-height: 1.8; }
.steps li { margin-bottom: 4px; }
.steps li::marker { color: var(--faint); font-weight: 600; }

.inline-check { display: flex; align-items: center; gap: 10px; color: var(--ink);
                margin-bottom: 8px; font-weight: 500; }
.inline-check input { width: auto; margin: 0; }

pre {
    background: var(--bg-2); border: 1px solid var(--line);
    padding: 12px; border-radius: var(--r-sm); overflow-x: auto;
    font-size: 11.5px; margin: 8px 0 0;
    white-space: pre-wrap; word-break: break-all; color: var(--ink-2);
}
textarea.msgbox { line-height: 1.6; resize: vertical; font-size: 13px; }

.unsaved {
    display: block; margin-top: 8px; padding: 9px 12px;
    background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
    border-radius: var(--r-sm); color: var(--warn); font-size: 13px; font-weight: 500;
}

/* Jedyna animacja bez udzialu uzytkownika: przycisk zapisu, gdy zmiana
   czeka niezapisana. Sluzy zwroceniu uwagi, nie ozdobie. */
@keyframes pulse-save {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
    50%      { box-shadow: 0 0 0 6px transparent; }
}
.btn.pulse { animation: pulse-save 1.6s ease-in-out infinite; }

.demo-bar {
    background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
    color: var(--warn); border-radius: var(--r-md); padding: 12px 15px;
    margin-bottom: 16px; font-size: 13.5px; line-height: 1.5;
}
.demo-bar b { font-weight: 700; }
.demo-kup { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
            margin-top: 10px; padding-top: 10px;
            border-top: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }

.wygaslo { max-width: 620px; margin: 0 auto; padding: 44px 20px 70px; }
.wygaslo h1 { text-align: center; }
.wygaslo .lead { text-align: center; font-size: 15.5px; color: var(--ink-2);
                 margin: 0 0 24px; line-height: 1.6; }
.wygaslo .cena { font-size: 30px; font-weight: 700; color: var(--accent-ink);
                 margin: 0 0 6px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kontakt-lista { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 520px) { .kontakt-lista .btn { width: 100%; } }

.setup-bar {
    display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
    background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    color: var(--accent-ink); border-radius: var(--r-md); padding: 11px 15px;
    margin-bottom: 16px; font-size: 13.5px; line-height: 1.5;
}
.setup-bar span { flex: 1 1 260px; }
.setup-bar b { font-weight: 700; }

.hint, .note {
    background: var(--card-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
    border-radius: var(--r-md); padding: 12px 15px; margin: 0 0 15px;
    font-size: 13.5px; color: var(--ink-2);
}

/* ------------------------------------------- kreator konfiguracji */

.setup { max-width: 680px; margin: 0 auto; padding: 44px 20px 80px; }
.setup-head { margin-bottom: 26px; }
.setup-head h1 { margin-bottom: 8px; }

.progress { height: 6px; border-radius: 6px; background: var(--line);
            overflow: hidden; margin: 20px 0 8px; }
.progress-bar { height: 100%; border-radius: 6px; background: var(--accent);
                transition: width .4s cubic-bezier(.4,0,.2,1); }

.stepcard {
    display: grid; grid-template-columns: 38px 1fr; gap: 0 16px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 20px; margin-bottom: 12px;
    transition: border-color .2s ease;
}
.stepcard.todo { opacity: .55; }
.stepcard.active { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.stepnum {
    width: 32px; height: 32px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
    background: var(--line-soft); color: var(--faint);
}
.stepcard.active .stepnum { background: var(--accent); color: #fff; }
.stepcard.done .stepnum { background: var(--ok-bg); color: var(--ok); }
.stepbody h2 { margin-bottom: 9px; font-size: 16px; }
.stepbody > :last-child { margin-bottom: 0; }

.tag {
    display: inline-block; vertical-align: middle; margin-left: 8px;
    padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
    background: var(--accent-soft); color: var(--accent-ink);
}
.tag.soft { background: var(--line-soft); color: var(--muted); }

.setup-foot { display: flex; justify-content: space-between; align-items: center;
              gap: 15px; flex-wrap: wrap; margin-top: 22px; }
.setup-foot p { margin: 0; }
.setup-foot form { flex: 0 0 100%; }

/* -------------------------------------------- filtry i paginacja */

.filtry { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
.filtry .chip {
    display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px;
    border: 1px solid var(--line); border-radius: 999px; font-size: 13px;
    text-decoration: none; color: var(--ink-2); background: var(--card);
}
.filtry .chip:hover { border-color: var(--accent); text-decoration: none; }
.filtry .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.filtry .chip.on b { color: #fff; }
.filtry .chip b { font-weight: 650; opacity: .6; font-variant-numeric: tabular-nums; }
.filtry .chip.pusty { opacity: .45; }
.filtry .sortuj { margin-left: auto; font-size: 13px; color: var(--muted); }
.filtry .sortuj a { margin-left: 8px; color: var(--muted); text-decoration: none;
                    border-bottom: 1px dotted; }
.filtry .sortuj a.on { color: var(--ink); font-weight: 600; border-bottom-style: solid; }

.strony { display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
          justify-content: space-between; margin-top: 14px; }
.strony .nawigacja { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* ------------------------------------------- ustawienia i dostawca */

.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin: 12px 0; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 14px;
               width: 100%; max-width: 420px; }
.stack label.check { flex-direction: row; align-items: center; gap: 9px; max-width: none; }
.stack label.check input { width: auto; margin: 0; }

label.waski { display: flex; flex-direction: column; gap: 4px; font-size: 13px; max-width: 190px; }
label.waski select { min-width: 150px; }

.trasy-test {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin: 0 0 14px; padding: 11px 13px; border: 1px solid var(--line);
    border-left: 3px solid var(--info);
    border-radius: var(--r-md); background: var(--card-2);
}
.trasy-test .muted { flex: 1; min-width: 220px; }

.stopka { padding: 26px 28px 20px; color: var(--faint); }

/* ================================================================
   RUCH
   ================================================================ */

.btn:active { transform: translateY(1px) scale(.99); }
.ripple {
    position: absolute; border-radius: 50%; pointer-events: none;
    background: color-mix(in srgb, var(--ink) 25%, transparent);
    transform: scale(0); opacity: .7;
    animation: ripple .6s cubic-bezier(.2,.7,.3,1) forwards;
}
.btn.primary .ripple { background: rgba(255,255,255,.4); }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
.nav-item:active { transform: scale(.99); }

@media (prefers-reduced-motion: reduce) {
    .btn.pulse { animation: none; }
    .ripple { display: none; }
    * { transition-duration: .01ms !important; }
}

/* ================================================================
   TELEFON I TABLET  — projektowane od tego konca
   ================================================================ */

.tabbar { display: none; }

@media (max-width: 900px) {

    body { font-size: 15.5px; padding-bottom: var(--nav-h); }

    .side {
        position: fixed; z-index: 40; left: 0; top: 0; bottom: 0;
        width: 274px; flex-basis: 274px;
        transform: translateX(-100%);
        transition: transform .26s cubic-bezier(.4,0,.2,1);
        box-shadow: 0 0 60px rgba(0,0,0,.5);
    }
    .side.open { transform: translateX(0); }
    .burger { display: flex; align-items: center; justify-content: center; }

    .topbar { padding: 9px 13px; }
    .uname, .pill { display: none; }
    .pill.warn { display: inline-block; }

    .content { padding: 16px 13px 28px; }
    h1 { font-size: 21px; margin-bottom: 14px; }
    .card { padding: 16px; border-radius: 13px; margin-bottom: 12px; }
    .grid2 { grid-template-columns: 1fr; gap: 0; }

    .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
    .tile { padding: 14px 14px 14px 17px; font-size: 12px; }
    .tile .num { font-size: 27px; }

    /* Palec potrzebuje wiekszych celow niz kursor. */
    .btn { padding: 12px 17px; font-size: 15px; min-height: 46px; }
    .btn.small { padding: 9px 13px; font-size: 13.5px; min-height: 40px; }
    /* 16px zapobiega samoczynnemu przyblizaniu strony przez iOS. */
    input, select, textarea { padding: 12px 13px; font-size: 16px; }

    .toolbar, .sendbar, .routes { flex-direction: column; align-items: stretch; }
    .toolbar .inline, .sendbar .inline { width: 100%; }
    .toolbar .btn, .sendbar .btn, .sendbar form { width: 100%; }
    .loc-select { width: 100%; min-width: 0; }
    .inline.wrap { flex-direction: column; align-items: stretch; }
    label.waski, .stack label { max-width: none; }

    .setup { padding: 22px 13px 40px; }
    .stepcard { grid-template-columns: 30px 1fr; gap: 0 12px; padding: 16px; }
    .stepnum { width: 29px; height: 29px; font-size: 13px; }
    .card.login { margin: 5vh 13px; padding: 24px 20px; }
    .setup-foot { flex-direction: column; align-items: stretch; }

    .filtry { gap: 5px; overflow-x: auto; flex-wrap: nowrap;
              padding-bottom: 4px; margin-inline: -13px; padding-inline: 13px; }
    .filtry .chip { flex: 0 0 auto; }
    .filtry .sortuj { display: none; }
    .strony { justify-content: center; }

    /* --- tabele zamieniaja sie w kafelki, bez przewijania w bok --- */
    .cards-mobile thead { display: none; }
    .cards-mobile, .cards-mobile tbody, .cards-mobile tr, .cards-mobile td {
        display: block; width: 100%;
    }
    .cards-mobile tr {
        border: 1px solid var(--line); border-radius: 12px;
        padding: 13px 14px; margin-bottom: 10px; background: var(--card);
    }
    .cards-mobile tr:hover td { background: transparent; }
    .cards-mobile td {
        border: 0; padding: 4px 0;
        display: flex; align-items: center; justify-content: space-between;
        gap: 14px; font-size: 14px;
    }
    /* Etykieta wiersza bez wersalikow — czyta sie szybciej. */
    .cards-mobile td::before {
        content: attr(data-label);
        color: var(--faint); font-size: 12.5px; font-weight: 500; flex: 0 0 auto;
    }
    .cards-mobile td[data-label=""]::before { content: none; }
    .cards-mobile td.head {
        display: block; padding: 0 0 8px;
        border-bottom: 1px solid var(--line-soft); margin-bottom: 6px;
    }
    .cards-mobile td.head::before { content: none; }
    .cards-mobile td.head a { font-size: 16px; font-weight: 650; color: var(--ink); }
    .cards-mobile td.act { padding-top: 10px; }
    .cards-mobile td.act::before { content: none; }
    .cards-mobile td.act .btn { width: 100%; }

    /* --- stale zakladki na dole --- */
    .tabbar {
        display: flex; position: fixed; z-index: 25;
        left: 0; right: 0; bottom: 0; height: var(--nav-h);
        background: color-mix(in srgb, var(--bg-2) 94%, transparent);
        backdrop-filter: saturate(160%) blur(14px);
        border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .tabbar a, .tabbar button {
        flex: 1; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 3px;
        border: 0; background: none; cursor: pointer;
        color: var(--muted); font-size: 11px; font-weight: 600;
        font-family: inherit; text-decoration: none; padding: 0;
        position: relative;
    }
    .tabbar svg { width: 21px; height: 21px; transition: transform .12s ease; }
    .tabbar .on { color: var(--accent-ink); }
    /* Ten sam znacznik co w menu bocznym, obrocony do gory. */
    .tabbar .on::before {
        content: ""; position: absolute; top: 0; left: 26%; right: 26%;
        height: 2px; border-radius: 0 0 2px 2px; background: var(--accent);
    }
    .tabbar a:hover { text-decoration: none; }
    .tabbar a:active svg, .tabbar button:active svg { transform: scale(.88); }

    .stopka { padding: 18px 13px 8px; text-align: center; }
}

@media (max-width: 420px) {
    .tiles { grid-template-columns: 1fr; }
    .content { padding: 14px 12px 24px; }
}

/* ---------------------------------------------------- drobne klasy */

.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.mode-select { max-width: 260px; }
.host-field { margin-top: 10px; }
.card.switcher { background: var(--card-2); }
.card.kontakt { border-left: 3px solid var(--accent); }

/* ---------------------------------------------- naglowek strony */

/* Tytul i jedno zdanie o tym, po co ta strona jest, a po prawej
   jedna liczba, ktora najczesciej sie sprawdza. Wiecej tu nie wchodzi. */
.naglowek {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.naglowek h1 { margin: 0 0 4px; }
.naglowek p { margin: 0; max-width: 62ch; font-size: 14px; }

.licznik {
    display: inline-flex; align-items: baseline; gap: 6px;
    padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--card); color: var(--muted); font-size: 13px;
    white-space: nowrap;
}
.licznik b {
    font-size: 17px; font-weight: 700; color: var(--ink);
    font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}

/* ------------------------------------------- czyszczenie dziennika */

/* Operacja nieodwracalna, wiec domyslnie zwinieta — trzeba po nia
   siegnac swiadomie, a nie trafic przypadkiem obok innego przycisku. */
.czyszczenie > summary { color: var(--muted); font-size: 13.5px; }
.czyszczenie[open] > summary { color: var(--ink); }
.czyszczenie .details-body { padding-top: 14px; }
.czyszczenie .inline-check { margin: 0 4px 0 0; font-size: 13.5px; font-weight: 500; }
.czyszczenie form { align-items: flex-end; }

@media (max-width: 900px) {
    .naglowek { margin-bottom: 14px; gap: 10px; }
    .naglowek p { font-size: 13.5px; }
    .licznik { padding: 6px 11px; }
    .czyszczenie form { flex-direction: column; align-items: stretch; }
    .czyszczenie form .btn { width: 100%; }
}

/* ---------------------------------------------- karty dostawcow */

/* Kazdy dostawca to osobna karta — przy dwoch panelach naraz wazne
   jest, ktory jest ktory, wiec rodzaj widac przy nazwie. */
.dostawca-karta h2 { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }


/* Numer porzadkowy przy dostawcy — przy kilku panelach naraz latwiej
   o nich rozmawiac ("ten drugi") niz po samej nazwie. */
.dostawca-karta h2 .numer {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 7px;
    background: var(--accent-soft); color: var(--accent-ink);
    font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.dodaj-dostawce { border-style: dashed; }
.dodaj-dostawce > h2 { margin-bottom: 4px; }

/* Znak marki moze byc litera albo obrazkiem — oba w tym samym kwadracie. */
img.logo { object-fit: cover; background: var(--card-2); padding: 0; }
