/* ============================================================
   Panel aukcji - system stylow
   Zaokraglenia: maks. 3px. Cienie warstwowe, wysoki kontrast.
   ============================================================ */

:root {
    --bg:            #eaeef5;
    --bg-grad:       radial-gradient(1200px 600px at 50% -200px, #f6f8fc 0%, #e7ecf4 55%, #dfe5ef 100%);
    --surface:       #ffffff;
    --surface-2:     #f6f8fc;
    --surface-3:     #eef2f8;

    --border:        #dde3ec;
    --border-strong: #c7d0de;

    --text:          #14202f;
    --text-2:        #46536a;
    --text-muted:    #7b8699;

    --brand:         #2b56cc;
    --brand-dark:    #1d3fa0;
    --brand-soft:    #e8eefc;

    --origin:        #1063c9;
    --origin-soft:   #e6f0fd;
    --dest:          #c1500b;
    --dest-soft:     #fdefe3;

    --ok:            #0f7a55;
    --ok-soft:       #e4f5ee;
    --warn:          #a35a06;
    --danger:        #bd2b3e;
    --danger-soft:   #fdeaec;

    --price:         #5638d6;
    --minprice:      #bd2b3e;

    --r:             3px;
    --r-sm:          2px;
    --topbar-h:      54px;

    --sh-1: 0 1px 1px rgba(17, 27, 44, .04), 0 1px 2px rgba(17, 27, 44, .06);
    --sh-2: 0 1px 2px rgba(17, 27, 44, .06), 0 6px 16px -6px rgba(17, 27, 44, .14);
    --sh-3: 0 2px 6px rgba(17, 27, 44, .10), 0 18px 40px -12px rgba(17, 27, 44, .30);
    --sh-pop: 0 4px 10px rgba(10, 18, 32, .18), 0 24px 48px -16px rgba(10, 18, 32, .45);

    /* tabela - wydzielone, bo motyw ciemny podmienia je w calosci */
    --row-bg:     #ffffff;
    --row-alt:    #fafbfe;
    --row-hover:  #eef4ff;
    --row-focus:  #e9f1ff;
    --row-line:   #eef1f6;
    --thead-from: #f9fbfd;
    --thead-to:   #eef2f8;
    --btn-from:   #ffffff;
    --btn-to:     #f4f6fa;
    --input-bg:   #ffffff;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "SF Mono", "Cascadia Mono", ui-monospace, Consolas, "Roboto Mono", monospace;
}

/* ============================================================
   Motyw ciemny - podmieniamy tylko zmienne i te miejsca,
   ktore z natury musza miec inny kolor tla.
   ============================================================ */

:root[data-theme="dark"] {
    --bg:            #0e131b;
    --bg-grad:       radial-gradient(1200px 600px at 50% -220px, #1b2430 0%, #121822 55%, #0e131b 100%);
    --surface:       #161d28;
    --surface-2:     #1a222e;
    --surface-3:     #212b3a;

    --border:        #263243;
    --border-strong: #35455b;

    --text:          #e8eef8;
    --text-2:        #aebbcd;
    --text-muted:    #7d8ca1;

    --brand:         #6c9bf5;
    --brand-dark:    #3a68e0;
    --brand-soft:    #1c2941;

    --origin:        #74aaff;
    --origin-soft:   #17253c;
    --dest:          #ffa06b;
    --dest-soft:     #33231a;

    --ok:            #4bc99a;
    --ok-soft:       #15302a;
    --warn:          #e0a44e;
    --danger:        #f2758a;
    --danger-soft:   #351d24;

    --price:         #a48bff;
    --minprice:      #f2758a;

    --row-bg:     #161d28;
    --row-alt:    #18202b;
    --row-hover:  #1f2b3c;
    --row-focus:  #223047;
    --row-line:   #222c3a;
    --thead-from: #1c2532;
    --thead-to:   #171f2a;
    --btn-from:   #212b3a;
    --btn-to:     #1a222e;
    --input-bg:   #121926;

    --sh-1: 0 1px 1px rgba(0, 0, 0, .25), 0 1px 2px rgba(0, 0, 0, .3);
    --sh-2: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 16px -6px rgba(0, 0, 0, .55);
    --sh-3: 0 2px 6px rgba(0, 0, 0, .4), 0 18px 40px -12px rgba(0, 0, 0, .7);
    --sh-pop: 0 4px 10px rgba(0, 0, 0, .5), 0 24px 48px -16px rgba(0, 0, 0, .8);
}

:root[data-theme="dark"] .tag--equip  { color: #6fd8ac; background: #14302a; border-color: #1f4b3d; }
:root[data-theme="dark"] .tag--driver { color: #c4a4ff; background: #251d3d; border-color: #3a2e5c; }
:root[data-theme="dark"] .tag--loads  { color: #8fb6ff; background: #1a2740; border-color: #2a3d5e; }

:root[data-theme="dark"] .src-chip--1 { color: #8fb6ff; background: #17233a; border-color: #27395a; }
:root[data-theme="dark"] .src-chip--2 { color: #c4a4ff; background: #241d3a; border-color: #392e59; }
:root[data-theme="dark"] .src-chip--3 { color: #6fd8ac; background: #14302a; border-color: #205044; }
:root[data-theme="dark"] .src-chip--4 { color: #f0b26a; background: #322613; border-color: #4d3a1d; }
:root[data-theme="dark"] .src-chip--5 { color: #ff9bb2; background: #331a23; border-color: #522936; }
:root[data-theme="dark"] .src-chip--6 { color: #6fcbdb; background: #122c33; border-color: #1e4952; }

:root[data-theme="dark"] .input-unit--km .input-unit__tag { color: var(--warn); background: #322613; border-color: #4d3a1d; }
:root[data-theme="dark"] .dist__band { color: var(--warn); }

:root[data-theme="dark"] .alert--ok    { background: #14302a; border-color: #205044; color: #8ce2bd; }
:root[data-theme="dark"] .alert--error { background: #331a23; border-color: #522936; color: #ffa8bb; }
:root[data-theme="dark"] .alert--info  { background: #17233a; border-color: #27395a; color: #a8c4f5; }

:root[data-theme="dark"] .choice:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }
:root[data-theme="dark"] .tile__icon { background: var(--brand-soft); }
:root[data-theme="dark"] .btn--primary { color: #fff; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

a { color: var(--brand); }

/* ---------------------------------------------------------- Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: linear-gradient(180deg, #1e2a3c 0%, #16202e 100%);
    border-bottom: 1px solid #0d1622;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 4px 16px -6px rgba(9, 15, 26, .55);
}

.topbar__inner {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 20px;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 9px;
    text-decoration: none;
    color: #fff;
    flex: none;
    padding-right: 18px;
    margin-right: 4px;
    border-right: 1px solid rgba(255, 255, 255, .12);
}

.brand__name { font-size: 14.5px; font-weight: 650; letter-spacing: -.1px; }
.brand__sub {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: #7e91ad;
}

/* Menu jako zakladki - sam tekst, aktywna pozycja podkreslona.
   Zadnych ramek ani wypelnien, zeby nie wygladalo jak rzad przyciskow. */
.nav {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 22px;
}

.nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 550;
    letter-spacing: .1px;
    color: #8fa2ba;
    text-decoration: none;
    white-space: nowrap;
    transition: color .16s ease;
}

/* pasek pod aktywna zakladka, przyklejony do dolu belki */
.nav__link::after {
    content: "";
    position: absolute;
    left: -2px;
    right: -2px;
    bottom: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: transparent;
    transition: background-color .16s ease;
}

.nav__link .ico { opacity: .7; transition: opacity .16s ease; }

.nav__link:hover { color: #dce6f4; }
.nav__link:hover .ico { opacity: 1; }
.nav__link:hover::after { background: rgba(255, 255, 255, .16); }

.nav__link.is-active { color: #ffffff; font-weight: 620; }
.nav__link.is-active .ico { opacity: 1; color: #7fadff; }
.nav__link.is-active::after { background: #5b8def; }

.topbar__end { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.topbar__user {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2px;
    color: #8fa2ba;
    padding-left: 10px;
    margin-left: 2px;
    border-left: 1px solid rgba(255, 255, 255, .12);
}

/* lekkie ikony bez ramek - spojne z borderless menu */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--r);
    border: 0;
    background: transparent;
    color: #8fa2ba;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* w jasnym motywie pokazujemy ksiezyc, w ciemnym slonce */
.icon-btn__dark { display: none; }
:root[data-theme="dark"] .icon-btn__light { display: none; }
:root[data-theme="dark"] .icon-btn__dark { display: inline-flex; }

.ico { width: 14px; height: 14px; flex: none; }

/* ---------------------------------------------------------- Page */

.page {
    flex: 1;
    width: 100%;
    max-width: 1760px;
    margin: 0 auto;
    padding: 22px 20px 40px;
}

.page__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.page__title {
    margin: 0;
    font-size: 21px;
    font-weight: 640;
    letter-spacing: -.2px;
    color: var(--text);
}

.page__sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }

.page__actions { display: flex; align-items: center; gap: 8px; }

.footer {
    padding: 14px 20px 22px;
    text-align: center;
    font-size: 11.5px;
    color: var(--text-muted);
}
.footer__dot { margin: 0 7px; opacity: .5; }

/* ---------------------------------------------------------- Karty */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-2);
}

.card__body { padding: 18px 20px; }
.card__title { margin: 0 0 4px; font-size: 14px; font-weight: 620; }
.card__sub { margin: 0; font-size: 12.5px; color: var(--text-muted); }

/* Pasek statystyk */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-1);
    padding: 11px 14px;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: var(--brand);
    opacity: .85;
}
.stat--ok::before     { background: var(--ok); }
.stat--warn::before   { background: var(--warn); }
.stat--danger::before { background: var(--danger); }

.stat__label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat__value {
    margin-top: 2px;
    font-size: 19px;
    font-weight: 640;
    letter-spacing: -.3px;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.stat__value small { font-size: 12px; font-weight: 550; color: var(--text-muted); margin-left: 3px; }

/* ---------------------------------------------------------- Formanty */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 32px;
    padding: 0 13px;
    border-radius: var(--r);
    border: 1px solid var(--border-strong);
    background: linear-gradient(180deg, var(--btn-from) 0%, var(--btn-to) 100%);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    font-weight: 560;
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--sh-1);
    transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease, transform .06s ease;
}

.btn:hover { border-color: var(--border-strong); background: linear-gradient(180deg, var(--btn-from) 0%, var(--surface-3) 100%); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(1px); box-shadow: var(--sh-1); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn--primary {
    border-color: var(--brand-dark);
    background: linear-gradient(180deg, #3a68e0 0%, #2b56cc 100%);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 2px 8px -2px rgba(43, 86, 204, .6);
}
.btn--primary:hover { background: linear-gradient(180deg, #4271ea 0%, #2f5ada 100%); }

.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: var(--border); }

.btn--sm { height: 26px; padding: 0 9px; font-size: 11.5px; }

.field { display: block; margin-bottom: 14px; }
.field__label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }

.input, input[type="text"], input[type="file"], select {
    height: 32px;
    padding: 0 9px;
    font: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    box-shadow: 0 1px 1px rgba(17, 27, 44, .04) inset;
    transition: border-color .14s ease, box-shadow .14s ease;
    max-width: 100%;
}

input[type="file"] { height: auto; padding: 7px 9px; }

.input:focus, input:focus, select:focus {
    outline: none;
    border-color: #5b8def;
    box-shadow: 0 0 0 3px rgba(91, 141, 239, .22);
}

.search {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 1 1 240px;
    max-width: 340px;
}
.search .ico { position: absolute; left: 9px; color: var(--text-muted); pointer-events: none; }
.search input { width: 100%; padding-left: 29px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

/* ---------------------------------------------------------- Toolbar */

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 11px 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--r) var(--r) 0 0;
    box-shadow: var(--sh-1);
}

.toolbar__spacer { flex: 1; }
.toolbar__meta { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- Tabela */

/* Bez wlasnego przewijania - strona ma miec jeden pasek, a naglowek
   tabeli przykleja sie do gornej belki (patrz thead th { top }). */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--r) var(--r);
    box-shadow: var(--sh-2);
}

table.grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
}

table.grid thead th {
    position: sticky;
    top: var(--topbar-h);   /* przykleja sie tuz pod granatowa belka */
    z-index: 20;
    background: linear-gradient(180deg, var(--thead-from) 0%, var(--thead-to) 100%);
    border-bottom: 1px solid var(--border-strong);
    padding: 9px 11px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 660;
    letter-spacing: .45px;
    text-transform: uppercase;
    color: var(--text-2);
    white-space: nowrap;
    /* delikatny cien, zeby przyklejony naglowek odcinal sie od przewijanych wierszy */
    box-shadow: 0 1px 0 rgba(17, 27, 44, .08), 0 6px 12px -8px rgba(17, 27, 44, .35);
}

table.grid thead th.is-sortable { cursor: pointer; user-select: none; }
table.grid thead th.is-sortable:hover { color: var(--brand); background: linear-gradient(180deg, var(--thead-to) 0%, var(--thead-from) 100%); }
table.grid thead th.is-sorted { color: var(--brand); }

.th-inner { display: inline-flex; align-items: center; gap: 5px; }
.sort-arrow { font-size: 9px; opacity: .9; }

table.grid tbody td {
    padding: 5px 11px;
    border-bottom: 1px solid var(--row-line);
    vertical-align: middle;
    background: inherit;
}

table.grid tbody tr { background: var(--row-bg); transition: background-color .12s ease, box-shadow .12s ease; }
table.grid tbody tr:nth-child(even) { background: var(--row-alt); }
table.grid tbody tr:last-child td { border-bottom: none; }

/* podswietlenie wiersza z delikatnym paskiem przy lewej krawedzi */
table.grid tbody tr:hover { background: var(--row-hover); }
table.grid tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
table.grid tbody tr:focus-within { background: var(--row-focus); }
table.grid tbody tr:focus-within td:first-child { box-shadow: inset 2px 0 0 var(--brand); }

.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.na { color: var(--text-muted); font-style: italic; }

.col-lp { width: 46px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* kolumna zaznaczen do zbiorczego otwierania */
/* user-select: none, zeby Shift+klik nie zaznaczal tekstu w tabeli */
.col-pick { width: 34px; text-align: center; padding-right: 0 !important; user-select: none; }
.col-pick input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; vertical-align: middle; }

/* aukcja juz otwierana w Relay - wygaszona, zeby odrozniala sie od reszty */
table.grid tbody tr.is-opened { background: var(--row-alt); }
table.grid tbody tr.is-opened td:not(.col-pick) { opacity: .55; }
table.grid tbody tr.is-opened:hover { background: var(--row-hover); }
table.grid tbody tr.is-opened:hover td:not(.col-pick) { opacity: .85; }

/* pasek akcji dla zaznaczonych wierszy */
.pickbar {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    padding: 9px 13px;
    background: var(--brand-soft);
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: var(--sh-1);
}
.pickbar__count { font-size: 12.5px; font-weight: 660; color: var(--brand); }
.pickbar__note { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }

/* ostrzezenie, gdy przegladarka zablokowala czesc kart */
.pickbar--warn {
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 12.5px;
}
.pickbar--warn .btn { margin-left: auto; }

/* Kolumna Code */

.code-cell { white-space: nowrap; }

.code-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 7px;
    border-radius: var(--r);
    border: 1px solid transparent;
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 640;
    letter-spacing: .2px;
    cursor: help;
    transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.code-chip:hover { background: var(--surface-3); border-color: var(--border-strong); box-shadow: var(--sh-1); }

/* dlugie kody skracamy - pelna nazwa jest w dymku i w title */
.code-chip__o,
.code-chip__d {
    display: inline-block;
    max-width: 14ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.code-chip__o { color: var(--origin); }
.code-chip__d { color: var(--dest); }
.code-chip__arrow { color: var(--text-muted); font-size: 11px; }

/* Miasta / kraje */

/* miasto i kod kraju w jednej linii - wiersze nie rosna na wysokosc */
.place { display: flex; align-items: center; gap: 7px; line-height: 1.3; }
.place__city { font-weight: 560; color: var(--text); }

.country {
    flex: none;
    padding: 0 5px;
    border-radius: var(--r-sm);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    line-height: 15px;
    color: #4a5468;
    background: var(--surface-3);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* Plakietka zrodla (konta) */

.src-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--r);
    font-size: 10.5px;
    font-weight: 660;
    letter-spacing: .3px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.src-chip--1 { color: #1f4e9c; background: #e8f0fd; border-color: #cadcf8; }
.src-chip--2 { color: #7a3ab5; background: #f3eafc; border-color: #e2cdf6; }
.src-chip--3 { color: #0d6b4c; background: #e2f5ed; border-color: #bce5d5; }
.src-chip--4 { color: #a3510b; background: #fdf1e2; border-color: #f2dcbc; }
.src-chip--5 { color: #a52a4a; background: #fdeaef; border-color: #f5c8d5; }
.src-chip--6 { color: #1d6a78; background: #e2f4f7; border-color: #bde0e7; }

.src-chip--btn { cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 660; margin: 0 4px 4px 0; }
.src-chip--btn:hover { filter: brightness(.96); }

/* Wiersz importu: plik + etykieta zrodla */

.file-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    flex-wrap: wrap;
    max-width: 780px;
}
.file-row:last-of-type { border-bottom: none; }
.file-row .field:first-child { flex: 1 1 260px; min-width: 240px; }
.file-row .field:nth-child(2) { flex: 0 1 230px; }
.file-row .js-source { width: 100%; }
.file-row .js-remove { flex: none; }

/* Wybor trybu importu */

.choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.choice:hover { border-color: var(--border-strong); background: var(--surface); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--sh-1); }
.choice input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
/* tylko tytul opcji jest blokiem - pogrubienia w opisie maja zostac w tekscie */
.choice > span > b { display: block; font-size: 13px; font-weight: 640; }
.choice small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-2); line-height: 1.45; }
.choice small b { font-weight: 640; color: var(--text); }

.choice-extra { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; padding-left: 25px; }
.choice-extra .checkbox { align-self: flex-start; }

/* Znaczniki */

.tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: var(--r);
    font-size: 10.5px;
    font-weight: 620;
    letter-spacing: .3px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.tag--equip  { color: #0d6b4c; background: var(--ok-soft);   border-color: #bfe5d6; }
.tag--driver { color: #7a3ab5; background: #f2eafc;          border-color: #e0cdf5; }
.tag--loads  { color: #2b4c8c; background: #eaf0fb;          border-color: #cfdcf5; font-variant-numeric: tabular-nums; }

/* Dystans */

.dist { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.dist__value { font-size: 13.5px; font-weight: 640; font-variant-numeric: tabular-nums; }
.dist__value small { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.dist__band { font-size: 10.5px; font-weight: 600; color: var(--warn); letter-spacing: .2px; }
.dist--est .dist__value { color: var(--warn); }

/* Ceny */

.money { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.18; }
.money__main { font-size: 15px; font-weight: 660; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.money__main small { font-size: 11px; font-weight: 550; margin-left: 2px; opacity: .75; }
/* stawki podane w zrodle za kilometr - jednostka w kolorze ostrzegawczym */
.money--bykm .money__main small { color: var(--warn); opacity: 1; font-weight: 650; }
.money__km { font-size: 11px; font-weight: 550; color: var(--text-2); font-variant-numeric: tabular-nums; margin-top: 1px; }
.money--reserve .money__main { color: var(--price); }
.money--min .money__main { color: var(--minprice); }

.cell-price { width: 118px; }

/* Edycja */

.edit-city { display: flex; align-items: center; gap: 6px; }
.edit-city input { width: 112px; height: 27px; font-size: 12.5px; }

.edit-min { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.edit-min input {
    width: 66px;
    height: 27px;
    text-align: right;
    font-size: 13px;
    font-weight: 660;
    font-variant-numeric: tabular-nums;
    color: var(--minprice);
}

/* jedna linijka pod polem: przeliczenie + stan zapisu */
.edit-min__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    min-height: 13px;
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}
.edit-min__hint { color: var(--text-2); white-space: nowrap; }
.edit-min__hint b { color: var(--minprice); font-weight: 700; }

/* pole z doklejonym znacznikiem jednostki */
.input-unit { display: inline-flex; align-items: stretch; border-radius: var(--r); }
.input-unit input { border-radius: var(--r) 0 0 var(--r); border-right: 0; box-shadow: none; }
.input-unit__tag {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-radius: 0 var(--r) var(--r) 0;
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space: nowrap;
}
.input-unit--km .input-unit__tag { color: var(--warn); background: #fdf3e4; border-color: #f0dcbb; }

.input-unit:focus-within { box-shadow: 0 0 0 3px rgba(91, 141, 239, .22); }
.input-unit:focus-within input,
.input-unit:focus-within .input-unit__tag { border-color: #5b8def; }
.input-unit:focus-within input { box-shadow: none; }

.cell-state { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; flex: none; }
.cell-state--saving { color: var(--text-muted); }
.cell-state--ok     { color: var(--ok); }
.cell-state--error  { color: var(--danger); }

.is-error input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(189, 43, 62, .16); }

/* Link */

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 9px;
    border-radius: var(--r);
    border: 1px solid var(--border-strong);
    background: linear-gradient(180deg, var(--btn-from) 0%, var(--btn-to) 100%);
    color: var(--brand);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--sh-1);
    transition: border-color .14s ease, box-shadow .14s ease, color .14s ease;
}
.link-btn:hover { border-color: var(--brand); color: var(--brand-dark); box-shadow: var(--sh-2); }
.link-btn.is-opened { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }

/* Akcje przy wierszu listy plikow - same ikony */
.file-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    text-decoration: none;
    transition: color .14s ease, border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.icon-action .ico { width: 15px; height: 15px; }
.icon-action:hover { color: var(--brand); border-color: var(--brand); box-shadow: var(--sh-1); }
.icon-action--danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* Przycisk niebezpieczny w pasku akcji */
.btn--danger { color: var(--danger); border-color: var(--border-strong); }
.btn--danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* ---------------------------------------------------------- Dymek z trasa */

.tip {
    position: fixed;
    z-index: 900;
    max-width: 340px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #202b3d 0%, #18212f 100%);
    color: #eaf0f9;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--r);
    box-shadow: var(--sh-pop);
    font-size: 12px;
    line-height: 1.45;
    pointer-events: none;
    opacity: 0;
    transform: translateY(3px);
    animation: tip-in .13s ease-out forwards;
}

@keyframes tip-in { to { opacity: 1; transform: translateY(0); } }

.tip__arrow {
    position: absolute;
    width: 9px;
    height: 9px;
    background: #1b2433;
    border-right: 1px solid rgba(255, 255, 255, .1);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    transform: rotate(45deg);
}
.tip--above .tip__arrow { bottom: -5.5px; }
.tip--below .tip__arrow { top: -5.5px; background: #212c3e; border: 1px solid rgba(255, 255, 255, .1); border-left: 0; border-bottom: 0; }

.tip__route { display: grid; grid-template-columns: 15px 1fr; gap: 0 10px; }

.tip__marker { position: relative; display: flex; justify-content: center; padding-top: 3px; }
.tip__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid currentColor;
    background: transparent;
    flex: none;
    z-index: 2;
}
.tip__line { position: absolute; top: 15px; bottom: -6px; width: 2px; border-radius: 1px; background: rgba(255, 255, 255, .3); }

.tip__stop { padding-bottom: 14px; }
.tip__stop:last-child { padding-bottom: 0; }

.tip__code {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    display: block;
    margin-bottom: 1px;
}
.tip__addr { color: #b9c6d8; font-size: 11.5px; }
.tip__place { color: #f2f6fb; font-size: 12px; font-weight: 550; }
.tip__country { color: #93a3ba; font-weight: 600; letter-spacing: .3px; }

.tip__o { color: #7fb4ff; }
.tip__d { color: #ffab73; }

.tip__foot {
    margin-top: 11px;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, .11);
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: #9dabc0;
}
.tip__foot b { color: #e6edf7; font-weight: 620; font-variant-numeric: tabular-nums; }

/* dymek nad polem ceny minimalnej */
.tip__head { font-size: 11.5px; color: #c3cede; line-height: 1.5; }
.tip__head b { color: #fff; font-weight: 640; }

.tip__label {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, .11);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #8d9cb2;
}

.tip__hist { margin-top: 6px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tip__hist td { padding: 2px 0; font-size: 11.5px; color: #c3cede; white-space: nowrap; }
.tip__hist td + td { padding-left: 12px; }
.tip__hist-val { color: #ffab73; font-weight: 700; }
.tip__hist-meta { color: #8d9cb2; font-size: 11px; }

/* pole, dla ktorego mamy zapisana historie cen */
.input-unit.has-history input { border-left: 2px solid #d9a441; padding-left: 8px; }

/* ---------------------------------------------------------- Stany */

.state {
    padding: 46px 20px;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-1);
}
.state__title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }

.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 13px;
    border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--sh-1);
    margin-bottom: 14px;
    font-size: 12.5px;
}
.alert--ok    { border-color: #bfe5d6; background: var(--ok-soft);     color: #0c5f42; }
.alert--error { border-color: #f0c2c8; background: var(--danger-soft); color: #8f1f2e; }
.alert--info  { border-color: #cfdcf5; background: #eef3fd;            color: #23407e; }
.alert b { font-weight: 640; }

.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(43, 86, 204, .25);
    border-top-color: var(--brand);
    border-radius: 50%;
    display: inline-block;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- Dashboard */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }

.tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 17px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-1);
    text-decoration: none;
    color: inherit;
    transition: box-shadow .16s ease, border-color .16s ease, transform .1s ease;
}
.tile:hover { box-shadow: var(--sh-3); border-color: var(--border-strong); transform: translateY(-1px); }
.tile__icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.tile__icon .ico { width: 15px; height: 15px; }
.tile__name { font-size: 13.5px; font-weight: 640; }
.tile__desc { font-size: 12px; color: var(--text-muted); }

/* ---------------------------------------------------------- Lista kopii */

.files { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.files th { text-align: left; font-size: 10.5px; letter-spacing: .45px; text-transform: uppercase; color: var(--text-2); padding: 8px 11px; border-bottom: 1px solid var(--border-strong); }
.files td { padding: 8px 11px; border-bottom: 1px solid var(--row-line); }
.files tr:last-child td { border-bottom: none; }
.files tbody tr:hover { background: var(--surface-2); }

/* ---------------------------------------------------------- Logowanie */

body.is-bare { background-attachment: fixed; }
.page--bare { display: flex; align-items: center; justify-content: center; padding: 60px 20px; }

.login { width: 100%; max-width: 360px; }

.login__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--sh-3);
    padding: 28px 26px 26px;
}

.login__brand { display: flex; flex-direction: column; gap: 2px; margin-bottom: 22px; }
.login__name { font-size: 19px; font-weight: 660; letter-spacing: -.2px; color: var(--text); }
.login__sub {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.login__card .field input { width: 100%; height: 36px; }
.login__submit { width: 100%; height: 36px; margin-top: 4px; }

/* ---------------------------------------------------------- Responsywnosc */

/* ============================================================
   Responsywnosc: zadnego przewijania w bok. Zamiast sciskac
   tabele, chowamy kolejne kolumny - ich tresc jest w dymku
   pod kodem trasy, wiec nic nie ginie.
   ============================================================ */

table.grid { table-layout: auto; }

.table-wrap { max-width: 100%; }

@media (max-width: 1560px) {
    .topbar__inner, .page { padding-left: 16px; padding-right: 16px; }
    table.grid tbody td, table.grid thead th { padding-left: 9px; padding-right: 9px; }
    .col-lp { width: 34px; }
}

@media (max-width: 1500px) {
    .col-driver { display: none; }
    .edit-city input { width: 100px; }
    .code-chip__o, .code-chip__d { max-width: 11ch; }
}

@media (max-width: 1390px) {
    .col-equip { display: none; }
    .nav { gap: 16px; }
}

@media (max-width: 1230px) {
    .col-loads { display: none; }
    .col-lp { width: 28px; }
    table.grid { font-size: 12px; }
    .money__main { font-size: 14px; }
    .dist__value { font-size: 12.5px; }
    .edit-city input { width: 88px; }
    .cell-price { width: 104px; }
}

@media (max-width: 1090px) {
    .col-source { display: none; }
    .toolbar { gap: 8px; }
    .search { flex: 1 1 160px; }
    .page__title { font-size: 18px; }
    table.grid tbody td, table.grid thead th { padding-left: 7px; padding-right: 7px; }
    .code-chip__o, .code-chip__d { max-width: 9ch; }
}

@media (max-width: 900px) {
    .col-pick { display: none; }
    /* sam znaczek zamiast napisu "Relay" */
    .link-btn__label { display: none; }
    .link-btn { padding: 0 7px; }
    .cell-price { width: 92px; }
    .money__main { font-size: 13px; }
}

@media (max-width: 880px) {
    .topbar__inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px 18px; }
    .topbar { position: static; }          /* zmienna wysokosc - naglowek tabeli nie ma sie do czego przykleic */
    table.grid thead th { position: static; }
    .brand { border-right: 0; padding-right: 0; }
    .nav { width: 100%; gap: 18px; flex-wrap: wrap; }
    .topbar__end { margin-left: auto; }
    .page { padding: 14px 12px 28px; }

    .code-chip__o, .code-chip__d { max-width: 9ch; }
    .edit-city input { width: 76px; }
    .edit-min input { width: 58px; }
    .pickbar__note { display: none; }
    .toolbar__meta { display: none; }
}

/* Bardzo waskie ekrany - zostaje sam rdzen: trasa, miasta, dystans, ceny */
@media (max-width: 780px) {
    table.grid { font-size: 11.5px; }
    table.grid tbody td, table.grid thead th { padding-left: 5px; padding-right: 5px; }
    .place { flex-direction: column; align-items: flex-start; gap: 1px; }
    .country { font-size: 9px; line-height: 13px; }
    .code-chip { padding: 2px 4px; font-size: 11px; }
    .code-chip__o, .code-chip__d { max-width: 8ch; }
    .cell-price { width: 84px; }
    .money__main { font-size: 12.5px; }
    .money__km, .edit-min__foot { font-size: 10px; }
    .dist__value { font-size: 12px; }
    .edit-city input { width: 68px; }
    .edit-min input { width: 54px; }
    .input-unit__tag { padding: 0 3px; font-size: 8.5px; }
    .btn--sm .ico { display: none; }
}

@media (max-width: 680px) {
    table.grid tbody td, table.grid thead th { padding-left: 4px; padding-right: 4px; }
    .code-chip__o, .code-chip__d { max-width: 7ch; }
    .code-chip { gap: 3px; }
    .edit-city input { width: 56px; }
    .edit-min input { width: 46px; }
    .cell-price { width: 72px; }
    .link-btn { padding: 0 5px; }
    .dist__band { display: none; }   /* zakres km zostaje w dymku */
    .page { padding: 12px 8px 24px; }
    .col-lp { width: 24px; font-size: 10.5px; }
}

@media (max-width: 620px) {
    table.grid tbody td, table.grid thead th { padding-left: 3px; padding-right: 3px; }
    table.grid thead th { font-size: 9.5px; letter-spacing: .2px; }
    .code-chip__o, .code-chip__d { max-width: 6ch; }
    .cell-price { width: 64px; }
    .edit-city input { width: 48px; }
    .edit-min input { width: 40px; }
    .page { padding: 10px 6px 20px; }
}
