/* ==========================================================================
   Baza Spawania - warstwa wizualna

   Bez frameworka CSS i bez DevExpressa. Kolor wiodacy #305088 pochodzi z logo
   Verlogic. Wszystkie pary tekst/tlo sprawdzone pod katem WCAG AA:
   bialy na #305088 daje 7,99:1, tekst podstawowy na bieli 15,52:1,
   tekst drugorzedny 6,20:1, tekst pomocniczy 4,83:1.
   ========================================================================== */

:root {
    /* marka */
    --brand:        #305088;
    --brand-dark:   #243E68;
    --brand-light:  #E8EEF7;
    --brand-tint:   #F2F6FC;

    /* tekst */
    --ink:          #1F2430;
    --ink-soft:     #5B6170;
    /* 4,83:1 na bieli i 4,50:1 na tle strony - tekst pomocniczy tez musi spelniac AA */
    --ink-faint:    #6B7280;
    --on-brand:     #FFFFFF;

    /* powierzchnie */
    --bg:           #F7F9FC;
    --surface:      #FFFFFF;
    --line:         #D8DEE8;
    --line-soft:    #E8ECF2;

    /* listy: jasne karty, cienkie linie wierszy, delikatne podswietlenie */
    --card-line:    #E3E8EF;
    --row-line:     #EDF0F5;
    --row-hover:    #F5F8FD;
    --card-shadow:  0 1px 2px rgba(31, 36, 48, .04), 0 4px 16px rgba(31, 36, 48, .04);

    /* stany */
    --ok:           #1F7A4D;
    --ok-bg:        #E8F5EE;
    --warn:         #8A5A00;
    --warn-bg:      #FDF4E3;
    --danger:       #B42318;
    --danger-bg:    #FDECEA;

    /* ksztalt i rytm */
    --r-sm: 4px;
    --r:    8px;
    --r-lg: 12px;
    --shadow:    0 1px 2px rgba(31, 36, 48, .06), 0 2px 8px rgba(31, 36, 48, .06);
    --shadow-lg: 0 8px 28px rgba(31, 36, 48, .14);

    --header-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }

/* atrybut hidden wygrywa z klasami ustawiajacymi display (.toolbar, .grid-form...) -
   inaczej przelaczane grupy pol (np. miejsce wykonania spoiny) bylyby widoczne mimo hidden */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font: 15px/1.55 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 600; color: var(--ink); }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- widoczny focus klawiatury: jedna regula dla calej aplikacji --- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}
.topbar a:focus-visible, .topbar button:focus-visible { outline-color: #FFFFFF; }

/* --- pasek gorny --- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    height: var(--header-h);
    background: var(--brand);
    color: var(--on-brand);
    display: flex; align-items: center; gap: 20px;
    padding: 0 20px;
    box-shadow: var(--shadow);
}
/* brand jest odnosnikiem, wiec regula "a { color: var(--brand) }" wygrywa
   z kolorem dziedziczonym z paska - nazwa systemu znikala wtedy w tle */
.topbar .brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; color: var(--on-brand); }
.topbar .brand:hover { color: var(--on-brand); text-decoration: none; }
.topbar .brand img { height: 30px; width: auto; display: block; }
.topbar .brand .sep { width: 1px; height: 26px; background: rgba(255,255,255,.35); }
.topbar .brand .title { font-weight: 600; letter-spacing: .02em; white-space: nowrap; }

.topbar nav { display: flex; gap: 2px; flex: 1 1 auto; }
.topbar nav a {
    color: rgba(255,255,255,.86);
    padding: 8px 13px; border-radius: var(--r-sm);
    font-weight: 500; white-space: nowrap;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.18); color: #fff; }

.topbar .user { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; font-size: 14px; }
.topbar .user .who { color: rgba(255,255,255,.9); }
.topbar .user form { margin: 0; }
.topbar .user button {
    background: transparent; border: 1px solid rgba(255,255,255,.45);
    color: #fff; padding: 6px 12px; border-radius: var(--r-sm);
    font: inherit; cursor: pointer;
}
.topbar .user button:hover { background: rgba(255,255,255,.14); }
/* przejscie do drugiej aplikacji (Baza Spawania / Projekty Inwestycyjne) - ten sam login */
.topbar .user .app-switch {
    color: #fff; padding: 6px 12px; border-radius: var(--r-sm); white-space: nowrap;
    background: rgba(255,255,255,.12); text-decoration: none;
}
.topbar .user .app-switch:hover { background: rgba(255,255,255,.22); color: #fff; text-decoration: none; }

.hamburger { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 6px 8px; }

/* --- układ strony --- */
.page { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .grow { flex: 1 1 260px; min-width: 0; }
.page-head .lead { color: var(--ink-soft); margin: 0; }

.crumbs { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.crumbs a { color: var(--ink-soft); }
.crumbs span { padding: 0 6px; color: var(--ink-faint); }

/* --- karty --- */
.card { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--r-lg); box-shadow: var(--card-shadow); }
.card + .card { margin-top: 18px; }
.card > header {
    padding: 14px 18px; border-bottom: 1px solid var(--row-line);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card > header h2, .card > header h3 { margin: 0; }
.card > header .grow { flex: 1 1 auto; }
.card > .body { padding: 18px; }
.card > .body.tight { padding: 0; }

/* --- kafelki podsumowania --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--r-lg); padding: 15px 17px; box-shadow: var(--card-shadow); }
.tile .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; }
.tile .value { font-size: 27px; font-weight: 600; color: var(--brand); line-height: 1.2; margin-top: 4px; }
.tile .hint { font-size: 12px; color: var(--ink-faint); }

/* --- przyciski --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 38px; padding: 0 16px;
    border: 1px solid transparent; border-radius: var(--r-sm);
    font: inherit; font-weight: 500; cursor: pointer;
    background: var(--brand); color: #fff;
    transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn.secondary:hover { background: var(--brand-tint); color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn.ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8F1B12; }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }

/* --- formularze --- */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.grid-form .span-2 { grid-column: span 2; }
.grid-form .span-all { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid-form .span-2 { grid-column: span 1; } }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field > label .req { color: var(--danger); }
.field .help { font-size: 12px; color: var(--ink-faint); }

/* pola tekstowe wszystkich rodzajow - takze tel/url i pola bez atrybutu type (domyslnie tekst);
   bez nich telefon i pola pisane recznie dostawaly waska szerokosc przegladarki */
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=url], input[type=date], input[type=time], input[type=datetime-local],
input[type=month], input[type=week], input[type=search], select, textarea {
    width: 100%; min-height: 38px; padding: 7px 10px;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    font: inherit; color: var(--ink); background: var(--surface);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
input[readonly], input[disabled], select[disabled], textarea[disabled] { background: var(--bg); color: var(--ink-soft); }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox input { width: 17px; height: 17px; min-height: 0; accent-color: var(--brand); }

.field-error { color: var(--danger); font-size: 13px; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }

/* --- komunikaty --- */
.alert { border-radius: var(--r); padding: 11px 14px; margin-bottom: 16px; border: 1px solid transparent; font-size: 14px; }
.alert.ok     { background: var(--ok-bg);     border-color: #BFE3CF; color: var(--ok); }
.alert.error  { background: var(--danger-bg); border-color: #F3C7C2; color: var(--danger); }
.alert.warn   { background: var(--warn-bg);   border-color: #EBD4A3; color: var(--warn); }
.alert.info   { background: var(--brand-light); border-color: #C6D5EC; color: var(--brand-dark); }

/* --- tabele ---
   Jasny uklad: bialy naglowek z cienka linia, wiersze rozdzielone delikatna kreska,
   podswietlenie wiersza ledwie widoczne. Skrajne komorki maja odstep jak naglowek karty,
   wiec tekst tabeli zaczyna sie w jednej linii z paskiem narzedzi nad nia. */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 18px; }
table.data th:last-child, table.data td:last-child { padding-right: 18px; }
table.data thead th {
    background: var(--surface); color: var(--ink-faint);
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
    padding-top: 10px; padding-bottom: 10px;
    white-space: nowrap; position: sticky; top: 0; z-index: 1;
    /* linia pod naglowkiem jako cien - przy przyklejonym naglowku obramowanie by znikalo */
    border-bottom: 0; box-shadow: inset 0 -1px 0 var(--card-line);
}
table.data tbody tr { transition: background-color .12s ease; }
table.data tbody tr:hover { background: var(--row-hover); }
/* ostatni wiersz bez kreski - pod tabela jest juz linia stronicowania albo brzeg karty */
table.data tbody tr:last-child > td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data tbody tr.selected { background: var(--brand-light); }
table.data td > a:not(.btn):not(.badge) { font-weight: 500; }
table.data input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: middle; }
table.data .btn.sm.secondary { border-color: var(--card-line); }
/* opis materialow i spoiwa w liscie spoin - bez tej szerokosci para materialow lamala sie na ukosniku */
table.data td.materials { min-width: 190px; }
/* lista w dwoch liniach na pozycje: pod danymi glownymi komorki - uzupelniajace (.term),
   w naglowku - ich nazwy (.sub). Dzieki temu szeroka lista miesci sie bez przewijania w bok */
table.data thead th .sub { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 500; letter-spacing: .02em; text-transform: none; color: var(--ink-faint); }
table.data.two-line td { vertical-align: top; }
table.data.two-line td.materials { min-width: 170px; }
table.data .actions-stack { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-soft); }
.empty .big { font-size: 17px; color: var(--ink); margin-bottom: 6px; }

/* --- etykiety statusu - jasne tlo z obrysem w tym samym odcieniu --- */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5;
    background: #F3F5F8; color: var(--ink-soft); border: 1px solid var(--line-soft);
}
.badge.ok     { background: var(--ok-bg);     color: var(--ok);     border-color: #CBE8D8; }
.badge.warn   { background: var(--warn-bg);   color: var(--warn);   border-color: #F0DDB4; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: #F4CBC6; }
.badge.brand  { background: var(--brand-light); color: var(--brand-dark); border-color: #CFDBEE; }

/* --- pasek narzedzi nad lista --- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.toolbar input[type=search] { min-width: 260px; width: auto; }
.toolbar select { min-width: 170px; width: auto; }
.toolbar .grow { flex: 1 1 auto; }
.toolbar input:not([type=checkbox]):not([type=radio]), .toolbar select { border-color: var(--card-line); }
.toolbar input:not([type=checkbox]):not([type=radio]):hover, .toolbar select:hover { border-color: var(--line); }
/* lupa w polu wyszukiwania - rysunek w tle, bez dodatkowego znacznika w widokach */
.toolbar input[type=search] {
    padding-left: 34px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center / 16px 16px;
}

/* --- stronicowanie - lekkie przyciski, biezaca strona w jasnym odcieniu marki --- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--row-line); flex-wrap: wrap; }
.pager .info { color: var(--ink-soft); font-size: 13px; }
.pager .links { display: flex; gap: 2px; flex-wrap: wrap; }
.pager a, .pager span.current {
    min-width: 34px; height: 34px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: var(--r); font-size: 14px; color: var(--ink-soft);
}
.pager a:hover { background: var(--brand-tint); color: var(--brand); text-decoration: none; }
.pager span.current { background: var(--brand-light); color: var(--brand-dark); border-color: #CFDBEE; font-weight: 600; }

/* --- zakladki --- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
    padding: 10px 16px; color: var(--ink-soft); font-weight: 500;
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--brand); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* --- strona logowania i rejestracji --- */
.auth { display: flex; align-items: flex-start; justify-content: center; padding: 48px 20px; }
.auth .box { width: 100%; max-width: 440px; }
.auth .box.wide { max-width: 760px; }
.auth .logo { text-align: center; margin-bottom: 24px; }
.auth .logo img { width: 100%; max-width: 240px; height: auto; }
/* „Nie pamietam hasla” pod polem hasla - sam link, nie na cala szerokosc pola */
.auth .forgot { align-self: flex-end; }

/* --- strona glowna --- */
.hero { background: var(--brand); color: #fff; }
.hero .inner { max-width: 1320px; margin: 0 auto; padding: 64px 20px 72px; }
.hero h1 { color: #fff; font-size: clamp(27px, 4vw, 42px); max-width: 20ch; margin-bottom: 14px; }
.hero p.lead { color: rgba(255,255,255,.88); font-size: clamp(16px, 1.6vw, 19px); max-width: 60ch; margin-bottom: 28px; }
.hero .btn.secondary { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.5); }
.hero .btn.secondary:hover { background: rgba(255,255,255,.2); }
.hero .btn:not(.secondary) { background: #fff; color: var(--brand-dark); }
.hero .btn:not(.secondary):hover { background: var(--brand-light); }

.features { max-width: 1320px; margin: 0 auto; padding: 56px 20px; }
.features h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft); margin-bottom: 26px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.feature .n { width: 34px; height: 34px; border-radius: var(--r); background: var(--brand); color: #fff;
              display: grid; place-items: center; font-weight: 700; margin-bottom: 13px; }
.feature h3 { color: var(--brand-dark); }
.feature p { color: var(--ink-soft); margin: 0; font-size: 14px; }

/* strona startowa: nazwa aplikacji nad tytulem, kroki pracy i pasek drugiej aplikacji */
.hero .also { margin: 22px 0 0; font-size: 14px; color: rgba(255,255,255,.82); }
.hero .also a { color: #fff; text-decoration: underline; }
.features + .features { padding-top: 0; }
.steps { list-style: none; counter-reset: krok; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin: 0; padding: 0; }
.steps li { counter-increment: krok; border-top: 3px solid var(--brand); padding-top: 14px; }
.steps li::before { content: counter(krok, decimal-leading-zero); display: block; margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--brand); }
.steps h3 { margin: 0 0 6px; }
.steps p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.apps-band {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
    background: var(--brand-tint); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px;
}
.apps-band h3 { margin: 0 0 4px; font-size: 18px; color: var(--brand-dark); }
.apps-band p { margin: 0; max-width: 70ch; color: var(--ink-soft); }

/* strona startowa ze zdjeciami: tytul obok zdjecia, opis aplikacji i pasy zdjec z opisem.
   Zdjecia przykladowe (CC0) w img/home - zrodla w img/home/ZRODLA.txt */
.hero .inner.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.hero .inner.split h1 { max-width: 24ch; }
.hero .photo { margin: 0; }
.hero .photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 35% center;
                   border-radius: var(--r-lg); box-shadow: 0 18px 44px rgba(0, 0, 0, .3); }
.hero .facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 26px 0 0; padding: 0; font-size: 14px; color: rgba(255,255,255,.88); }
.hero .facts li::before { content: "✓"; margin-right: 7px; font-weight: 700; color: #fff; }
.hero .trial-note { margin: 14px 0 0; font-size: 15px; color: rgba(255,255,255,.88); }
.hero .trial-note strong { color: #fff; }
.hero .trial-note::before { content: "★"; margin-right: 8px; color: #FFD27A; }
@media (max-width: 960px) {
    .hero .inner.split { grid-template-columns: 1fr; gap: 32px; padding-bottom: 56px; }
    .hero .photo img { aspect-ratio: 16 / 9; }
}

.about { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.about .title { font-size: clamp(21px, 2.4vw, 28px); font-weight: 600; line-height: 1.3; color: var(--brand-dark); margin-bottom: 16px; max-width: 34ch; }
.about p:not(.title) { color: var(--ink-soft); font-size: 16px; max-width: 70ch; }
.about .who { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--r-lg); padding: 22px 24px; }
.about .who h3 { color: var(--brand-dark); margin-bottom: 10px; }
.about .who ul { margin: 0; padding-left: 18px; color: var(--ink-soft); }
.about .who li + li { margin-top: 7px; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; gap: 24px; } }

.showcase { display: grid; gap: 44px; }
.show { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 44px; align-items: center; }
.show:nth-child(even) .pic { order: 2; }
.show .pic { margin: 0; }
.show .pic img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r-lg); box-shadow: var(--shadow); }
.show h3 { font-size: clamp(19px, 2vw, 23px); color: var(--brand-dark); margin-bottom: 10px; }
.show p { color: var(--ink-soft); font-size: 16px; margin-bottom: 14px; }
.ticks { list-style: none; margin: 0; padding: 0; }
.ticks li { position: relative; padding-left: 26px; }
.ticks li + li { margin-top: 8px; }
.ticks li::before { content: ""; position: absolute; left: 3px; top: .45em; width: 11px; height: 6px;
                    border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(-45deg); }
@media (max-width: 860px) {
    .showcase { gap: 36px; }
    .show { grid-template-columns: 1fr; gap: 18px; }
    .show:nth-child(even) .pic { order: 0; }
}

/* --- drzewo dokumentacji --- */
.docs { display: grid; grid-template-columns: minmax(240px, 330px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .docs { grid-template-columns: 1fr; } }

.tree { list-style: none; margin: 0; padding: 6px; font-size: 14px; }
.tree ul { list-style: none; margin: 0; padding-left: 17px; border-left: 1px solid var(--line-soft); }
.tree li { margin: 1px 0; }
.tree .node {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 8px; border-radius: var(--r-sm); color: var(--ink);
    width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer;
}
.tree .node:hover { background: var(--brand-tint); text-decoration: none; }
.tree .node.current { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.tree .node .ico { flex: 0 0 auto; width: 18px; text-align: center; color: var(--ink-faint); }
.tree .node.folder .ico { color: var(--brand); }
.tree .node .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .node .ver { flex: 0 0 auto; margin-left: auto; padding: 0 6px; font-size: 11px; }
.tree .line { display: flex; align-items: center; gap: 2px; }
.tree .line .node { flex: 1 1 auto; min-width: 0; }
.tree .tw {
    flex: 0 0 18px; width: 18px; height: 22px; padding: 0; border: 0; background: none;
    color: var(--ink-faint); font-size: 11px; line-height: 22px; text-align: center; border-radius: var(--r-sm);
}
button.tw { cursor: pointer; }
button.tw:hover { background: var(--brand-tint); color: var(--brand); }
button.tw::before { content: "▸"; }
button.tw[aria-expanded="true"]::before { content: "▾"; }

/* drzewo przewija sie we wlasnym oknie - dlugie drzewo nie spycha podgladu w dol strony,
   a kliknieta pozycja jest dociagana do widoku skryptem (app.js) */
.docs .tree-box { max-height: 60vh; overflow: auto; overscroll-behavior: contain; }
@media (max-width: 860px) { .docs .tree-box { max-height: 40vh; } }

/* wysokosc rezerwujemy tylko w panelu dokumentow - ta sama siatka opisu
   sluzy tez kartom WPQR i WPS, gdzie pusty pas pod trescia wyglada na blad */
.docs .preview { min-height: 340px; }
.preview .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.preview .meta .k { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; }
.preview .meta .v { font-size: 14px; }
.preview .frame { width: 100%; height: 540px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.preview img.shot { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r); }

/* --- drobiazgi --- */
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: 14px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- telefon --- */
@media (max-width: 860px) {
    .topbar { gap: 10px; padding: 0 12px; }
    .topbar .brand .title { display: none; }
    .topbar nav {
        display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
        flex-direction: column; background: var(--brand-dark); padding: 8px; gap: 2px;
        box-shadow: var(--shadow-lg);
    }
    .topbar nav.open { display: flex; }
    .hamburger { display: block; }
    .topbar .user .who { display: none; }
    .topbar .user .app-switch { padding: 6px 8px; font-size: 13px; }
    .page { padding: 16px 12px 48px; }
    .card > .body { padding: 14px; }
    .card > form > .body:not(.tight) { padding: 14px; }
    .bulk { padding: 12px; }
    .btn-row .btn { flex: 1 1 auto; }

    /* pola formularzy co najmniej 16 px - mniejsze iPhone powieksza przy wpisywaniu
       i strona "odjezdza" w bok; przelacznik jezyka w pasku ma wlasny, mniejszy rozmiar */
    input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number],
    input[type=tel], input[type=url], input[type=date], input[type=time], input[type=datetime-local],
    input[type=month], input[type=week], input[type=search], select, textarea { font-size: 16px; }

    /* filtry list na cala szerokosc zamiast stalych minimow z komputera */
    .toolbar, .toolbar form { width: 100%; }
    .toolbar input[type=search], .toolbar select { min-width: 0; flex: 1 1 100%; max-width: 100%; }

    /* male przyciski wygodne dla palca */
    .btn.sm { min-height: 36px; }

    /* przed zalogowaniem w pasku zostaje "Zaloguj sie" - rejestracja jest na stronie */
    .topbar .user .hide-sm { display: none; }

    /* okruszki i odnosniki stopki - wyzszy obszar dotyku przy tym samym wygladzie */
    .crumbs a, .site-footer nav a { display: inline-block; padding: 8px 0; }
    .crumbs { margin-bottom: 0; }

    /* zakladki przewijane w bok - bez paska przewijania, ale z miejscem na palec */
    .tabs { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .tabs a { white-space: nowrap; }

    /* rozwijanie katalogow dokumentacji - strzalka 18 px byla za mala pod palec */
    .tree .tw { flex-basis: 32px; width: 32px; height: 32px; line-height: 32px; font-size: 13px; }
}

/* lista postepu na pulpicie: dlugie nazwy projektow skracane wielokropkiem, nie rozpychaja wiersza */
.progress-list > li { min-width: 0; }
.progress-list .row b, .progress-list .row .badge { white-space: nowrap; flex: 0 0 auto; }

/* elementy siatki nie moga byc szersze niz kolumna (dlugie podpisy legendy wykresu) */
.dash-split > * { min-width: 0; }
.legend.vertical span { min-width: 0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ==========================================================================
   Panel ustawień, awatary i oś czasu historii
   ========================================================================== */

/* --- awatary --- */
.avatar {
    width: 36px; height: 36px; flex: 0 0 auto;
    border-radius: 50%; object-fit: cover;
    border: 1px solid var(--line);
    background: var(--bg);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; letter-spacing: .02em;
    overflow: hidden; vertical-align: middle;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }

/* Zastępczy awatar: barwa z nazwy. Jasność i nasycenie są stałe, więc tekst
   w kolorze z tego samego odcienia, ale znacznie ciemniejszy, trzyma kontrast
   powyżej 4,5:1 niezależnie od wylosowanego odcienia. */
.avatar.fallback {
    background: hsl(var(--av, 210) 42% 90%);
    color: hsl(var(--av, 210) 65% 26%);
    border-color: hsl(var(--av, 210) 35% 80%);
}

.topbar .user .me { display: flex; align-items: center; gap: 9px; color: inherit; }
.topbar .user .me:hover { text-decoration: none; }
.topbar .user .me:hover .who { text-decoration: underline; }
.topbar .user .avatar { border-color: rgba(255,255,255,.4); }

/* --- układ panelu ustawień --- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.settings-grid > .card { margin-top: 0; }
.settings-grid + .card { margin-top: 18px; }

.logo-box {
    display: flex; align-items: center; justify-content: center;
    min-height: 110px; padding: 14px;
    border: 1px dashed var(--line); border-radius: var(--r); background: var(--bg);
}
.logo-box img { max-width: 100%; max-height: 90px; height: auto; display: block; }
.logo-box .empty-logo { color: var(--ink-faint); font-size: 13px; }

.avatar-box { display: flex; align-items: center; gap: 14px; }

/* formularz w wierszu tabeli - role i status zmienia się bez osobnego ekranu */
.row-form { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin: 0; max-width: 380px; margin-left: auto; }
/* obie listy musza pomiescic najdluzsza nazwe roli bez przycinania */
.row-form select { min-width: 150px; width: auto; flex: 1 1 150px; }
.row-form .reason { flex: 1 1 120px; width: auto; min-width: 0; }
.toolbar .reason { min-width: 170px; width: auto; }
/* pola dat w pasku filtrow nie moga rozpychac sie na cala szerokosc wiersza */
.toolbar input[type=date] { width: auto; min-width: 150px; }

/* --- oś czasu historii --- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 0; border-top: 1px solid var(--line-soft);
}
.timeline > li:first-child { border-top: 0; padding-top: 0; }
.timeline > li:last-child { padding-bottom: 0; }

.timeline .body { min-width: 0; flex: 1 1 auto; }
.timeline .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.timeline .head .kind { color: var(--ink-soft); font-size: 13px; }
.timeline .changes { font-size: 13px; color: var(--ink); margin-top: 4px; overflow-wrap: anywhere; }
.timeline .comment {
    font-size: 13px; color: var(--ink-soft); margin-top: 4px;
    border-left: 2px solid var(--line); padding-left: 10px; font-style: italic;
    overflow-wrap: anywhere;
}
.timeline .meta { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }

@media (max-width: 980px) {
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .topbar .user .who { display: none; }
    .row-form { justify-content: flex-start; }
    .row-form .reason { width: 100%; }
}

/* ==========================================================================
   Uprawnienia
   ========================================================================== */

.perm-set { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px; margin: 0; }
.perm-set legend { font-size: 13px; font-weight: 600; color: var(--ink-soft); padding: 0 6px; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 18px; }
.perm-group .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; margin-bottom: 5px; }
.perm-group .checkbox { margin-top: 3px; }
.perm-set .help { display: block; margin-top: 12px; font-size: 12px; color: var(--ink-faint); }

/* pole wyboru wylaczone to podglad, nie blokada - ma byc czytelne, nie wyblakle */
.perm-set input[disabled] + span { color: var(--ink); }
.perm-set input[disabled] { opacity: .9; }

/* zwiezle zestawienie uprawnien w tabeli kont */
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-chips .chip {
    font-size: 12px; line-height: 1.5; padding: 1px 7px;
    border-radius: 999px; border: 1px solid var(--line); white-space: nowrap;
}
.perm-chips .chip.ro { background: var(--bg); color: var(--ink-soft); }
.perm-chips .chip.rw { background: var(--brand-light); color: var(--brand-dark); border-color: #C6D5EC; }

/* wiersz z rozwijanym edytorem konta */
table.data tr.editor-row td { padding-top: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
table.data tr.editor-row summary { font-size: 13px; cursor: pointer; }
table.data tbody tr.editor-row:hover { background: transparent; }
table.data.users tbody tr:not(.editor-row) td { border-bottom: 0; }

/* ==========================================================================
   Spawacze, certyfikaty i załączniki PDF
   ========================================================================== */

/* Wyróżnienie terminu ważności. Pasek z lewej niesie informację niezależnie od
   koloru tła (czytelny także w druku i dla daltonistów), plakietka w wierszu
   mówi to samo słowem. */
table.data tbody tr.row-warn   { background: #FFFBF2; }
table.data tbody tr.row-danger { background: #FFF7F6; }
table.data tbody tr.row-warn   > td:first-child { box-shadow: inset 3px 0 0 #D9A23A; }
table.data tbody tr.row-danger > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
table.data tbody tr.row-muted  { color: var(--ink-faint); }
table.data tbody tr.row-warn:hover   { background: #FFF5E1; }
table.data tbody tr.row-danger:hover { background: #FFEEEC; }

.term { display: block; font-size: 12px; color: var(--ink-soft); }

/* plakietka na tle w tym samym odcieniu zlewa się z nim - na wyróżnionych
   wierszach i kafelkach dostaje białe tło i obrys */
tr.row-warn .badge.warn, tr.row-danger .badge.danger,
.welder-pick li.bad .badge.danger, .alert .badge {
    background: var(--surface); box-shadow: inset 0 0 0 1px currentColor;
}
.row-danger .term { color: var(--danger); font-weight: 600; }
.row-warn .term   { color: var(--warn); font-weight: 600; }

/* pasek ostrzeżeń nad listą - liczniki prowadzą do przefiltrowanej listy */
.alert .alert-links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.alert .alert-links a { color: inherit; font-weight: 600; text-decoration: underline; }

/* --- pliki PDF: lista po lewej, podgląd po prawej --- */
.attachments { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .attachments { grid-template-columns: 1fr; } }

.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li {
    border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px;
    background: var(--surface);
}
.file-list li.active { border-color: var(--brand); background: var(--brand-tint); }
.file-list .name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.file-list .info { display: block; font-size: 12px; color: var(--ink-faint); }
.file-list .desc { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 2px; overflow-wrap: anywhere; }
.file-list .btn-row { margin-top: 7px; gap: 6px; }
.file-list form { margin: 0; }

.attachments .preview .frame { height: 640px; }
@media (max-width: 860px) { .attachments .preview .frame { height: 460px; } }

.upload-row { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(180px, 1fr) auto; gap: 10px; align-items: end; }
.upload-row input[type=file] { padding: 6px 0; font: inherit; font-size: 14px; }
@media (max-width: 760px) { .upload-row { grid-template-columns: 1fr; } }

/* --- wybór spawaczy przy spoinie --- */
.welder-pick { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.welder-pick li {
    border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px;
    display: flex; flex-direction: column; gap: 4px; background: var(--surface);
}
.welder-pick li.chosen { border-color: var(--brand); background: var(--brand-tint); }
.welder-pick li.chosen.bad { border-color: var(--danger); background: var(--danger-bg); }
.welder-pick .checkbox { font-weight: 600; }
.welder-pick .verdict { font-size: 12px; color: var(--ink-soft); padding-left: 25px; }
.welder-pick .verdict .badge { margin-right: 4px; }
.welder-pick-filter { max-width: 320px; margin-bottom: 10px; }
.weld-date { grid-template-columns: minmax(200px, 300px); }

.qual-problems { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.qual-problems li + li { margin-top: 2px; }

/* spawacze w wierszu listy spoin */
.welder-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.welder-chips .badge { font-weight: 600; }


/* --- dokumentacja powykonawcza --- */
.upload-row.four { grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.2fr) minmax(200px, 1.2fr) auto; }
@media (max-width: 960px) { .upload-row.four { grid-template-columns: 1fr; } }

/* lista pol do zaznaczenia: kategorie, odcinki, personel w eksporcie */
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check-list li {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px;
    border: 1px solid var(--line-soft); border-radius: var(--r); padding: 8px 11px; background: var(--surface);
}
.check-list li .badge { margin-right: 6px; }

/* edycja pliku rozwijana w wierszu tabeli */
.inline-edit { display: inline-block; }
.inline-edit > summary { list-style: none; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit[open] { display: block; }

/* --- konfiguracja projektu: badania NDT w kilku kolumnach --- */
.check-list.ndt-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* --- badania NDT przy spoinie --- */
.exam-table td { vertical-align: top; }
.exam-table input, .exam-table select { min-width: 110px; }
.exam-table .verdict { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.exam-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.exam-table .exam-comment { min-width: 180px; resize: vertical; }
/* wybor kilku badan na pasku listy spoin - lista rozwijana */
.exam-dropdown { position: relative; display: inline-block; }
.exam-dropdown > summary { list-style: none; cursor: pointer; }
.exam-dropdown > summary::-webkit-details-marker { display: none; }
.exam-dropdown-panel {
    position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 300px; max-height: 360px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 8px 12px; display: grid; gap: 6px;
}

/* operacje na zaznaczonych spoinach (dziennik, dobor WPS, badania) - sekcje leza
   w formularzu listy, wiec .card > .body ich nie obejmuje i odstepy maja wlasne */
.card > form > .body { padding: 18px; }
.card > form > .body.tight { padding: 0; }
.bulk-actions {
    display: grid; gap: 14px;
    background: var(--bg); border-top: 1px solid var(--line);
}
.bulk {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 14px 16px;
}
.bulk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bulk-head h3 { font-size: 16px; margin: 0; }
.bulk .help {
    margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line-soft);
    font-size: 13px; line-height: 1.55; color: var(--ink-soft); max-width: 90ch;
}

/* --- obiekty: podglad mapy i model 3D --- */
.map-preview { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.map-preview iframe { display: block; width: 100%; height: 340px; border: 0; }
.model-3d { display: block; width: 100%; height: 480px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r); }
.model-progress { display: none; }
@media (max-width: 760px) { .map-preview iframe { height: 260px; } .model-3d { height: 340px; } }

/* legenda modelu 3D: obok przegladarki, na telefonie pod nia */
.model-wrap { display: flex; gap: 12px; align-items: stretch; }
.model-wrap .model-3d { flex: 1 1 auto; min-width: 0; }
.model-legend {
    flex: 0 0 250px; display: flex; flex-direction: column; gap: 8px; max-height: 480px;
    padding: 12px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r);
}
.model-legend[hidden] { display: none; }
.model-legend-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.model-legend-head h3 { margin: 0; font-size: 15px; }
.model-legend-selection { margin: 0; font-size: 14px; color: var(--ink); min-height: 1.4em; }
.model-legend-selection:empty { display: none; }
.model-legend-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.model-legend-list button {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; text-align: left;
    font: inherit; font-size: 14px; color: var(--ink); background: none; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
}
.model-legend-list button:hover { background: var(--row-hover); }
.model-legend-list button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.model-legend-list button[aria-pressed="true"] { background: var(--brand-light); border-color: var(--brand); }
.model-legend-list .swatch { flex: 0 0 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(31, 36, 48, .25); }
.model-legend-list .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-legend-list .count { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.model-legend-list .model-legend-group {
    margin: 8px 0 2px; padding: 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-faint);
}
.model-legend-list .model-legend-group:first-child { margin-top: 0; }
.model-legend-list li.sub button { padding-left: 24px; }
.model-legend-option { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }
.model-legend-option[hidden] { display: none; }

/* numery spoin przypiete do modelu (hotspoty model-viewer); zasloniete przez model - przygaszone */
.weld-tag {
    display: block; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; cursor: pointer;
    font: 600 11px/18px system-ui, sans-serif; text-align: center; font-variant-numeric: tabular-nums;
    color: #fff; background: #c0392b; border: 1px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    transform: translate(-50%, -130%); transition: opacity .15s;
}
.weld-tag.field { background: #7d3c98; }
.weld-tag:not([data-visible]) { opacity: .3; }
.weld-tag.dim { opacity: .2; }
.weld-tag.active { outline: 2px solid #1a8cff; outline-offset: 1px; opacity: 1; }
.weld-tag:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.weld-tags-off .weld-tag { display: none; }

/* pelny ekran: przegladarka z legenda na calym ekranie (Fullscreen API albo okno na cala strone) */
.model-3d { position: relative; }
.model-fullscreen { position: absolute; top: 10px; right: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.model-fullscreen[hidden] { display: none; }
.model-fullscreen .ico-close, .model-full .model-fullscreen .ico-open { display: none; }
.model-full .model-fullscreen .ico-close { display: inline; }
.model-wrap.model-full { box-sizing: border-box; width: 100%; height: 100%; padding: 12px; background: var(--bg); }
.model-wrap.is-fullscreen { position: fixed; inset: 0; z-index: 1000; }
.model-full .model-3d { height: auto; }
.model-full .model-legend { flex-basis: 300px; max-height: none; }
html.model-fullscreen-open, html.model-fullscreen-open body { overflow: hidden; }

@media (max-width: 760px) {
    .model-wrap { flex-direction: column; }
    .model-legend { flex-basis: auto; max-height: 260px; }
    .model-full .model-3d { flex: 1 1 auto; min-height: 0; }
    .model-full .model-legend { flex: 0 0 auto; max-height: 40vh; }
}

/* --- reklamacje: zakladki statusow, galeria zdjec, pola opisowe --- */
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.status-chips a {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: 14px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); text-decoration: none;
}
.status-chips a b { font-weight: 600; color: var(--ink); }
.status-chips a:hover { border-color: var(--brand); color: var(--brand); }
.status-chips a.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.status-chips a.active b { color: var(--on-brand); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.photo-grid li { position: relative; border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid .cap { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px; font-size: 12px; color: var(--ink-soft); }
.photo-grid .cap form { margin: 0; }

/* izometria: miejsce wykonania - warsztat i montaz obok siebie, kazde ze swoimi polami */
.place-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.place-box { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--surface); }

.capture-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
@media (max-width: 760px) { .capture-row { grid-template-columns: 1fr; } }

.note-field { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin: 0 0 14px; }
.note-field.req-now { border-left-color: var(--warn); }
.note-field .who { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.note-text { white-space: pre-wrap; margin: 0; }

/* --- awatar projektu: zaokraglony kwadrat, zeby nie mylil sie z osoba --- */
.avatar.project { border-radius: var(--r); }
th.avatar-col, td.avatar-col { width: 48px; padding-right: 0; }
td.avatar-col a { display: inline-flex; }
.page-head .project-avatar { margin-right: 4px; }
.page-head:has(> .project-avatar) { align-items: center; }

/* --- przelacznik jezyka w pasku gornym --- */
.topbar .lang-switch select {
    width: auto; min-width: 0; height: 30px; padding: 2px 6px; font-size: 13px;
    color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.4); border-radius: var(--r-sm);
}
.topbar .lang-switch select:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.topbar .lang-switch option { color: var(--ink); background: var(--surface); }


/* --- pole pliku z przyciskiem w jezyku interfejsu (app.js); natywne pole ukryte wizualnie, ale dostepne --- */
.file-picker { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 0; }
.file-picker input[type=file] {
    position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; margin: 0;
    opacity: 0; overflow: hidden; border: 0;
}
.file-picker:focus-within .btn { outline: 2px solid var(--brand); outline-offset: 2px; }
.file-picker-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--ink-soft); }

/* --- pulpit uzytkownika --- */
/* Paleta wykresow: kazdy kolor ma co najmniej 3:1 do bieli (WCAG 1.4.11 dla grafiki).
   Kolor nie jest jedynym nosnikiem informacji - obok kazdego wykresu stoi tabela z liczbami. */
.c0 { --c: #305088; } .c1 { --c: #1F7A4D; } .c2 { --c: #B7791F; } .c3 { --c: #7B4FA0; }
.c4 { --c: #0E7C86; } .c5 { --c: #A23B72; } .c6 { --c: #6B7A2A; } .c7 { --c: #7A8496; }
.chart .ok { --c: #1F7A4D; } .chart .warn { --c: #B7791F; } .chart .danger { --c: #B42318; }
.chart .brand { --c: #305088; } .chart .muted { --c: #8B95A5; }

.dashboard .tiles a.tile { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.dashboard .tiles a.tile:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.tile .value.danger { color: var(--danger); }
.dashboard section.card { scroll-margin-top: calc(var(--header-h) + 12px); }
.dashboard .card > header form { margin: 0; }

.dash-split { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .dash-split { grid-template-columns: 1fr; } }
.dash-sub { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 0 0 10px; }
.dash-note { font-size: 13px; color: var(--ink-soft); padding: 10px 18px 14px; margin: 0; }
.body .dash-note { padding: 8px 0 0; }
.warn-text { color: var(--warn); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }

.chart { margin: 0; }
.chart-scroll { overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; font-family: inherit; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick, .chart .cat { font-size: 11px; fill: var(--ink-soft); }
.chart .cat.sub { font-size: 10px; fill: var(--ink-faint); }
.chart .line-tick { fill: var(--brand-dark); }
.chart rect.bar { fill: var(--c); }
.chart rect.bar:hover { opacity: .8; }
.chart .cumulative { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 3; }
.chart .cumulative-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.chart-empty { color: var(--ink-soft); margin: 0; padding: 24px 0; text-align: center; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; }
.legend .sw.line { height: 0; border-top: 2px dashed var(--ink); border-radius: 0; background: none; width: 16px; }
.legend.vertical { flex-direction: column; gap: 6px; }
.legend.vertical b { margin-left: auto; padding-left: 12px; color: var(--ink); }

.donut svg { max-width: 200px; margin: 0 auto; }
.donut .donut-track { fill: none; stroke: var(--line-soft); }
.donut .slice { fill: none; stroke: var(--c); }
.donut .donut-total { font-size: 28px; font-weight: 600; fill: var(--ink); }
.donut .donut-caption { font-size: 12px; fill: var(--ink-soft); }

.progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.progress-list .row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.progress-list .row a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-list .bar { height: 10px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.progress-list .bar span { display: block; height: 100%; background: var(--ok); border-radius: 5px; }

.status-sum { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.status-sum > div { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--r); padding: 8px 14px; font-size: 13px; color: var(--ink-soft); }
.status-sum > div b { font-size: 20px; color: var(--ink); margin-right: 6px; }
.status-sum .ok { --c: #1F7A4D; } .status-sum .warn { --c: #B7791F; } .status-sum .danger { --c: #B42318; } .status-sum .muted { --c: #8B95A5; }

table.data.compact th, table.data.compact td { padding: 7px 8px; }
table.data th small { font-weight: 400; color: var(--ink-faint); }
table.data td.zero { color: var(--ink-faint); }
table.data tfoot th, table.data tfoot td { border-top: 2px solid var(--line); background: var(--brand-tint); font-weight: 600; }

/* poziome slupki pietrowane (projekty x statusy) - zwarte niezaleznie od liczby wierszy */
.chart.rows { display: grid; gap: 8px; }
.hrow { display: grid; grid-template-columns: minmax(120px, 240px) 1fr 44px; gap: 12px; align-items: center; font-size: 13px; }
.hlabel { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.hlabel b { color: var(--ink); font-weight: 600; }
.hlabel small { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.htrack { display: flex; height: 22px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.htrack .seg { background: var(--c); color: #FFFFFF; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center;
               overflow: hidden; white-space: nowrap; min-width: 3px; box-shadow: inset -1px 0 0 rgba(255,255,255,.6); }
.htotal { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.chart.rows .legend { margin-top: 6px; }
.chart svg { margin: 0 auto; }
@media (max-width: 560px) { .hrow { grid-template-columns: 80px 1fr 36px; } .hlabel small { display: none; } }

/* --- transport: kontrola zaladunku (masa, powierzchnia, podpowiedz pojazdu) --- */
.load-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.load-stat { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.load-stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 600; }
.load-stat b { font-size: 18px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.load-stat small { font-size: 12px; color: var(--ink-soft); }
.load-bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; margin-top: 2px; }
.load-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.load-bar i.over { background: var(--danger); }
.load-bar i.warn { background: var(--warn); }

/* --- stopka i strony informacyjne (FAQ, regulamin, polityki, kontakt) ---
   body jako kolumna: na krotkiej stronie stopka i tak lezy na dole okna */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > main { flex: 1 0 auto; min-width: 0; }

/* bialy na #243E68 - 11,0:1; tekst stopki (.82 bieli) - 7,6:1 */
.site-footer { background: var(--brand-dark); color: rgba(255,255,255,.82); font-size: 14px; }
.site-footer .inner { max-width: 1320px; margin: 0 auto; padding: 22px 20px; display: flex; align-items: center; gap: 16px 32px; flex-wrap: wrap; }
.site-footer .inner.bottom { padding-top: 12px; padding-bottom: 14px; border-top: 1px solid rgba(255,255,255,.16); font-size: 13px; gap: 8px 24px; }
.site-footer .who { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 600; }
.site-footer .who img { height: 26px; width: auto; display: block; }
.site-footer nav { margin-left: auto; }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.site-footer a { color: #fff; }
.site-footer a:focus-visible { outline-color: #fff; }
@media (max-width: 860px) { .site-footer nav { margin-left: 0; width: 100%; } }

/* kolumna wezsza niz zwykla strona (1320 px) i wysrodkowana: menu 220 px + karta, tekst wypelnia
   cala karte - ok. 85-90 znakow w wierszu, wygodnie do czytania bez pustego pasa po prawej */
.page.legal { max-width: 1120px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.legal-nav { position: sticky; top: calc(var(--header-h) + 16px); }
.legal-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.legal-nav a { display: block; padding: 7px 12px; border-radius: var(--r); color: var(--ink-soft); }
.legal-nav a:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.legal-nav a[aria-current=page] { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.legal-doc > .body { padding: 32px 40px 36px; font-size: 15.5px; line-height: 1.65; }
.legal-doc h2 { margin-top: 1.6em; }
.legal-doc h3 { margin-top: 1.2em; }
.legal-doc ol, .legal-doc ul { padding-left: 22px; margin: 0 0 1em; }
.legal-doc li + li { margin-top: 4px; }
.legal-doc table.data { margin-bottom: 1em; }
.legal-doc details { border: 1px solid var(--card-line); border-radius: var(--r); padding: 0 16px; background: var(--surface); }
.legal-doc details + details { margin-top: 8px; }
.legal-doc summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--ink); }
.legal-doc details[open] summary { color: var(--brand-dark); }
.legal-doc details > :not(summary) { color: var(--ink-soft); }
.legal-doc .faq-group { margin-top: 1.8em; }
.legal-doc dl.contact { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0 0 1.4em; }
.legal-doc dl.contact dt { color: var(--ink-soft); }
.legal-doc dl.contact dd { margin: 0; font-weight: 600; }
/* cennik - karta oferty na gorze strony Cennik */
.legal-doc .offer { display: grid; grid-template-columns: 240px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin: 4px 0 1.6em; }
.legal-doc .offer-price { background: var(--brand); color: #fff; padding: 22px 24px; display: flex; flex-direction: column; justify-content: center; gap: 4px; line-height: 1.3; }
.legal-doc .offer-price .offer-name { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.legal-doc .offer-price strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.legal-doc .offer-price span:last-child { font-size: 14px; opacity: .9; }
.legal-doc .offer-body { padding: 18px 24px; background: var(--brand-tint); }
.legal-doc .offer-body ul { margin-bottom: 14px; }
.legal-doc .offer-trial { margin: 0 0 8px; color: var(--brand-dark); }
.legal-doc .offer-table td.num, .legal-doc .offer-table th.num { white-space: nowrap; }
@media (max-width: 560px) { .legal-doc .offer { grid-template-columns: 1fr; } .legal-doc .offer-price strong { font-size: 26px; } }
@media (max-width: 860px) {
    .page.legal { grid-template-columns: 1fr; gap: 16px; }
    .legal-nav { position: static; }
    .legal-nav ul { display: flex; flex-wrap: wrap; gap: 4px; }
    .legal-doc > .body { padding: 20px 18px; }
}

@media print {
    .topbar, .site-footer, .legal-nav { display: none; }
    body { display: block; background: #fff; }
    .page.legal { display: block; max-width: none; }
    .legal-doc { border: 0; box-shadow: none; }
}

/* --- oplaty: pasek stanu, strona platnosci --- */
.billing-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 10px 20px;
               background: var(--brand-light); color: var(--brand-dark); border-bottom: 1px solid #C6D5EC; font-size: 14px; }
.billing-bar.expired { background: var(--warn-bg); color: var(--warn); border-bottom-color: #EBD4A3; }
.billing-bar .btn { margin-left: auto; }
.billing-bar .msg { flex: 1 1 260px; min-width: 0; }
.billing-bar .msg strong { font-weight: 600; }
@media (max-width: 860px) {
    /* na telefonie jedna linijka z przyciskiem obok - szczegoly sa na stronie Platnosci */
    .billing-bar { flex-wrap: nowrap; padding: 8px 12px; font-size: 13px; gap: 10px; }
    .billing-bar .msg { flex: 1 1 auto; }
    .billing-bar .more { display: none; }
    .billing-bar .btn { white-space: nowrap; }
}
.billing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-top: 18px; }
.billing-grid .card + .card { margin-top: 0; }
.billing-grid + .card, .alert + .billing-grid, .card + .alert { margin-top: 18px; }
dl.billing-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0 0 12px; }
dl.billing-facts dt { color: var(--ink-soft); }
dl.billing-facts dd { margin: 0; font-weight: 600; }
.billing-total { font-size: 16px; margin: 4px 0 0; }
.billing-total strong { font-size: 20px; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
ul.billing-rules { margin: 0 0 12px; padding-left: 20px; line-height: 1.5; }
ul.billing-rules li + li { margin-top: 6px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain:disabled { opacity: .6; }
.page.narrow { max-width: 760px; }
@media (max-width: 560px) { .billing-grid { grid-template-columns: 1fr; } dl.billing-facts { grid-template-columns: 1fr; gap: 2px; } dl.billing-facts dd { margin-bottom: 8px; } }
.trial-box strong { display: block; margin-bottom: 2px; }

/* --- tabele jako karty na telefonie (podpisy komorek ustawia app.js) --- */
@media (max-width: 760px) {
    table.data.as-cards, table.data.as-cards tbody, table.data.as-cards tfoot,
    table.data.as-cards tr, table.data.as-cards td, table.data.as-cards th { display: block; }

    table.data.as-cards thead { display: none; }
    table.data.as-cards.has-check-all thead, table.data.as-cards.has-check-all thead tr { display: block; }
    table.data.as-cards thead th { display: none; }
    table.data.as-cards thead th.cell-check-all {
        display: flex; align-items: center; gap: 10px; padding: 12px 14px 0 !important; border: 0; width: auto !important; white-space: nowrap;
        font-size: 14px; font-weight: 600; color: var(--ink-soft); text-transform: none; letter-spacing: 0; background: none;
    }
    table.data.as-cards thead th.cell-check-all::after { content: attr(data-label); }

    table.data.as-cards tr {
        position: relative; margin: 12px; padding: 10px 14px;
        border: 1px solid var(--card-line); border-radius: var(--r); background: var(--surface);
    }
    table.data.as-cards tbody tr:hover { background: var(--surface); }
    table.data.as-cards tr.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
    table.data.as-cards tfoot tr { background: var(--brand-tint); }

    table.data.as-cards td, table.data.as-cards th {
        /* podpis po lewej w stalym pasie, tresc - dowolna, takze kilka elementow - plynie po prawej */
        display: block; position: relative; padding-left: calc(38% + 12px) !important; min-height: 28px;
        padding: 5px 0; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere;
        width: auto !important; min-width: 0 !important; max-width: none !important; /* szerokosci kolumn z widokow nie dotycza kart */
    }
    table.data.as-cards td:first-child, table.data.as-cards td:last-child,
    table.data.as-cards th:first-child, table.data.as-cards th:last-child { padding-left: 0; padding-right: 0; }
    table.data.as-cards td::before, table.data.as-cards tbody th::before, table.data.as-cards tfoot th::before {
        content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--ink-soft);
        position: absolute; left: 0; top: 7px; width: 38%; line-height: 1.3;
    }
    table.data.as-cards td.num, table.data.as-cards th.num { text-align: left; }
    table.data.as-cards td > *, table.data.as-cards th > * { min-width: 0; max-width: 100%; }

    /* tytul karty: numer spoiny, nazwa projektu itp. */
    table.data.as-cards .cell-title { display: block; font-size: 16px; font-weight: 600; padding: 2px 0 8px; padding-left: 0 !important; }
    table.data.as-cards .cell-title::before { content: none; }
    table.data.as-cards tr:has(.cell-check) .cell-title { padding-right: 40px; }

    table.data.as-cards .cell-nolabel, table.data.as-cards .cell-full { display: block; padding-left: 0 !important; }
    table.data.as-cards .cell-nolabel::before, table.data.as-cards .cell-full::before { content: none; }
    table.data.as-cards .cell-empty { display: none; }

    /* pole wyboru wiersza w prawym gornym rogu karty */
    table.data.as-cards .cell-check { position: absolute; top: 8px; right: 8px; display: block; padding: 6px !important; min-height: 0; }
    table.data.as-cards .cell-check::before { content: none; }
    table.data.as-cards input[type=checkbox] { width: 22px; height: 22px; }

    /* przyciski wiersza na dole karty */
    table.data.as-cards .cell-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-left: 0 !important; }
    table.data.as-cards .cell-actions::before { content: none; }
    table.data.as-cards .cell-actions form { margin: 0; }

    /* wiersz edycji pod wierszem (np. uzytkownicy) dolacza do karty nad nim */
    table.data.as-cards tr:has(+ tr.editor-row) { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    table.data.as-cards tr.editor-row { margin-top: 0; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; padding-top: 0; }

    /* karty nie potrzebuja przewijania w bok */
    .table-wrap:has(> table.as-cards) { overflow-x: visible; }
}

/* ==========================================================================
   Pasek postępu dłuższych operacji (app.js, data-progress): wysyłka pliku, praca serwera
   ========================================================================== */
.busy-overlay {
    position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(31, 36, 48, .35);
}
.busy-overlay[hidden] { display: none; }
.busy-box {
    width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--card-line);
    border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 20px 22px;
}
.busy-title { margin: 0 0 12px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.busy-detail { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.busy-bar { position: relative; height: 10px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.busy-bar span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 5px; transition: width .2s ease; }
.busy-bar.indeterminate span { position: absolute; left: 0; width: 35%; animation: busy-slide 1.3s ease-in-out infinite; }
.busy-actions { margin-top: 14px; justify-content: flex-end; }
.busy-actions:not(:has(> :not([hidden]))) { display: none; }
.busy-overlay.is-error .busy-title { color: var(--danger); }
.busy-overlay.is-error .busy-bar span { background: var(--danger); }

@keyframes busy-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(290%); }
}

/* bez animacji - pasek "trwa" jako pelny, przygaszony; czas plynie w opisie */
@media (prefers-reduced-motion: reduce) {
    .busy-bar.indeterminate span { animation: none; width: 100%; opacity: .45; }
}
