/*
 * Wygląd panelu klienta — jedyny arkusz stylów stron (bez Bootstrapa). Projekt: Claude Design,
 * „Panel klienta — nowy wygląd" (2026-10-07). Opis elementów: docs/01-mapa-projektu.md, „Wygląd".
 *
 * Kolejność: czcionka → zmienne → podstawy → szkielet strony → elementy wspólne (karta, przycisk, komunikat,
 * pole) → formularz dokumentów (kroki, listy plików, postęp, wysyłka) → strony stanu → narzędzia.
 */

/* --- Czcionka: Figtree, hostowana lokalnie (template/assets/figtree, zakresy znaków z pakietu) --- */
@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-display: swap;
    font-weight: 300 900;
    src: url(assets/figtree/figtree-latin-ext-wght-normal.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-display: swap;
    font-weight: 300 900;
    src: url(assets/figtree/figtree-latin-wght-normal.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Zmienne --- */
:root {
    --accent: #0E6E83;          /* morski z projektu; kontrast z białym tekstem 5,9:1 */
    --accent-dark: #0A5567;
    --accent-soft: #E8F2F5;
    --accent-line: #C5DDE4;
    --ground: #F2F5F7;
    --surface: #FFFFFF;
    --line: #DCE3E9;
    --line-strong: #8A96A3;
    --ink: #17212B;
    --ink-soft: #3A4652;
    --muted: #55616E;
    --done: #1D7A4C;
    --done-soft: #DDF3E6;
    --done-ink: #17603C;
    --todo-soft: #FFF1D6;
    --todo-ink: #7A4A00;
    --optional-soft: #E9EEF2;
    --optional-ink: #44515E;
    --danger: #A12B2B;
    --danger-soft: #FBE4E1;
    --radius: 16px;
    --radius-small: 12px;
}

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

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

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

h1, h2, h3, p, ul, ol {
    margin: 0;
}

h1 {
    font-size: 26px;
    line-height: 32px;
    font-weight: 700;
}

h2 {
    font-size: 19px;
    line-height: 24px;
    font-weight: 700;
}

a {
    color: var(--accent);
}

a:hover {
    color: var(--accent-dark);
}

button, input, textarea {
    font: inherit;
    color: inherit;
}

img, svg {
    vertical-align: middle;
}

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

.icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-bold {
    stroke-width: 3;
}

/* --- Szkielet strony --- */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.page-header-inner {
    max-width: 1120px;
    min-height: 56px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 24px;
}

.page-brand {
    font-size: 17px;
    font-weight: 700;
}

.page-header-note {
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}

.page-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px 16px 40px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page-narrow {
    max-width: 520px;
}

.page-intro {
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lead {
    color: var(--ink-soft);
}

.hint {
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
}

/* --- Karta --- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* --- Przyciski (także odnośniki wyglądające jak przyciski) --- */
.btn {
    min-height: 48px;
    padding: 10px 16px;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--accent);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
    font-weight: 700;
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #FFFFFF;
}

.btn-large {
    min-height: 56px;
    border-radius: 14px;
    font-size: 17px;
}

.btn:disabled {
    cursor: default;
    opacity: 0.75;
}

/* Wysyłka, dopóki brakuje wymaganych kroków: przycisk wygląda na nieaktywny, ale da się go kliknąć —
   kliknięcie pokazuje, czego brakuje (form.js). */
.btn-waiting, .btn-waiting:hover {
    background: var(--line);
    border-color: var(--line);
    color: var(--optional-ink);
}

/* --- Komunikaty --- */
.notice {
    padding: 12px;
    border-radius: var(--radius-small);
    background: var(--accent-soft);
    color: var(--ink);
    font-size: 15px;
    line-height: 22px;
    display: flex;
    gap: 10px;
}

.notice > .icon {
    margin-top: 1px;
    color: var(--accent-dark);
}

.notice-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Komunikat złożony z kilku wierszy dopisywanych przez skrypt (lista braków, uwagi do plików). */
.notice-stack {
    flex-direction: column;
    gap: 4px;
}

.notice-warning {
    background: var(--todo-soft);
    color: #5E3900;
}

.notice-warning > .icon {
    color: #5E3900;
}

.notice-danger {
    background: var(--danger-soft);
    color: #6E1B1B;
}

.notice-danger > .icon {
    color: #6E1B1B;
}

.notice-success {
    background: var(--done-soft);
    color: var(--done-ink);
}

.notice-success > .icon {
    color: var(--done-ink);
}

/* --- Pola --- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field > label {
    font-weight: 700;
}

.input {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    font-size: 18px;
}

textarea.input {
    height: auto;
    min-height: 96px;
    padding: 12px;
    font-size: 16px;
    resize: vertical;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.divider::before, .divider::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: var(--line);
}

/* Pole wyboru z opisem: cały wiersz jest klikalny. */
.check-row {
    padding: 12px;
    border-radius: var(--radius-small);
    background: var(--ground);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.check-row > input {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: var(--accent);
}

.check-row-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-row-title {
    font-weight: 600;
}

.check-row-details {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 21px;
}

.check-row-details ul {
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 15px;
    line-height: 22px;
}

.check-row-details li::before {
    content: '• ';
}

/* Potwierdzenie, na które formularz czeka. */
.check-row-required {
    background: var(--surface);
    border: 1.5px solid var(--accent);
}

/* Zaznaczenie potwierdzenia RODO podświetla zgodę z punktu trzeciego (form.js). */
.bg-attention {
    background: var(--done-soft);
}

/* --- Formularz dokumentów: układ --- */
/* Telefon: postęp, wiadomość od agenta, kroki, wysyłka, kontakt — jedno pod drugim. Komputer: kroki po lewej,
   reszta w kolumnie po prawej. Kolumna boczna na telefonie „znika" (display: contents), a kolejność ustawia order. */
.form-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-aside {
    display: contents;
}

.form-steps {
    order: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-card {
    order: 1;
}

.agent-message {
    order: 2;
}

.submit-card {
    order: 4;
}

.contact-card {
    order: 5;
}

@media (min-width: 900px) {
    h1 {
        font-size: 34px;
        line-height: 40px;
    }

    .page-main {
        padding: 32px 24px 48px 24px;
        gap: 24px;
    }

    .page-header-inner {
        padding: 8px 24px;
    }

    .lead-large {
        font-size: 18px;
        line-height: 28px;
    }

    .form-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        align-items: start;
        gap: 24px;
    }

    .form-aside {
        position: sticky;
        top: 16px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    /* Na komputerze kolejność jak w kodzie strony: kroki, potem kolumna boczna. */
    .form-steps {
        order: 0;
        gap: 16px;
    }

    .form-steps .card {
        padding: 24px;
    }

    /* .form-steps w selektorze: reguła bazowa .step-pair stoi niżej w pliku i inaczej by wygrała. */
    .form-steps .step-pair {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 16px;
    }
}

.step-pair {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Krok formularza --- */
.step-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-head > h2 {
    flex: 1 1 auto;
    min-width: 0;
}

.step-badge {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-badge > .icon {
    display: none;
    width: 18px;
    height: 18px;
}

.chip {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--todo-soft);
    color: var(--todo-ink);
    font-size: 13px;
    line-height: 16px;
    font-weight: 700;
}

/* Stan kroku ustawia form.js w atrybucie data-status: todo (domyślnie) | done | optional | blocked. */
.step[data-status="done"] .step-badge {
    border-color: var(--done);
    background: var(--done);
    color: #FFFFFF;
}

.step[data-status="done"] .step-badge > .icon {
    display: block;
}

.step[data-status="done"] .step-number {
    display: none;
}

.step[data-status="done"] .chip {
    background: var(--done-soft);
    color: var(--done-ink);
}

.step[data-status="optional"] .step-badge {
    border-color: var(--line-strong);
    color: var(--optional-ink);
}

.step[data-status="optional"] .chip {
    background: var(--optional-soft);
    color: var(--optional-ink);
}

.step[data-status="blocked"] .chip {
    background: var(--danger-soft);
    color: #6E1B1B;
}

.step-list {
    padding-left: 22px;
    color: var(--ink-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* --- Lista plików sekcji (template/file_group.tpl, template/form.js) --- */
.file-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-group > label {
    font-weight: 600;
}

.file-group-input {
    width: 100%;
    padding: 10px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
}

.file-group-add {
    min-height: 88px;
    padding: 12px 16px;
    border: 2px dashed #9FB3BF;
    border-radius: var(--radius-small);
    background: #F7FAFB;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.file-group-add:hover {
    background: var(--accent-soft);
}

.file-group-add > .icon {
    width: 24px;
    height: 24px;
}

.file-group-add:disabled {
    cursor: default;
    border-color: var(--line);
    background: var(--ground);
    color: var(--optional-ink);
}

/* Gdy na liście są już pliki, przycisk dokładania jest zwykłym, niskim przyciskiem. */
.file-group[data-has-files] .file-group-add {
    min-height: 48px;
    border: 0;
    background: var(--accent);
    color: #FFFFFF;
    flex-direction: row;
    gap: 8px;
}

.file-group[data-has-files] .file-group-add:hover {
    background: var(--accent-dark);
}

.file-group[data-has-files] .file-group-add:disabled {
    background: var(--line);
    color: var(--optional-ink);
}

.file-group-list {
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-group-item {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-group-thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--accent-soft);
}

.file-group-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
}

.file-group-name {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.file-group-name > small {
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
}

.file-group-remove {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: var(--surface);
    color: var(--danger);
    font-weight: 600;
    cursor: pointer;
}

.file-group-remove:hover {
    background: var(--danger-soft);
}


/* --- Dokumenty od agenta --- */
.file-link {
    min-height: 56px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    color: var(--ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-link:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.file-link-badge {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-link-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.file-link-text > small {
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
}

.file-link > .icon {
    color: var(--accent);
}

/* --- Postęp --- */
.progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-weight: 700;
}

.progress-head > small {
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}

.progress-track {
    height: 8px;
    border-radius: 4px;
    background: #E3E9EE;
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 8px;
    border-radius: 4px;
    background: var(--done);
    transition: width 0.2s;
}

.progress-list {
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 15px;
    line-height: 22px;
}

.progress-list a {
    min-height: 36px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-mark {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-mark > .icon {
    display: none;
    width: 12px;
    height: 12px;
    stroke-width: 4;
}

.progress-list li[data-status="done"] a {
    color: var(--done-ink);
    font-weight: 400;
}

.progress-list li[data-status="done"] .progress-mark {
    border-color: var(--done);
    background: var(--done);
    color: #FFFFFF;
}

.progress-list li[data-status="done"] .progress-mark > .icon {
    display: block;
}

.progress-list li[data-status="optional"] a {
    color: var(--optional-ink);
    font-weight: 400;
}

.progress-list li[data-status="optional"] .progress-mark {
    border-color: var(--line-strong);
}

/* --- Wiadomość od agenta i kontakt --- */
.agent-message {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    gap: 6px;
}

.agent-message-label {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

/* Jasna karta: dane agencji to HTML z panelu i mogą mieć własne kolory tekstu. */
.contact-card {
    border-color: var(--accent-line);
    border-top: 4px solid var(--accent);
    gap: 6px;
}

.contact-card-label {
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
}

.contact-card-name {
    font-size: 19px;
    line-height: 24px;
    font-weight: 700;
}

.contact-card-details {
    color: var(--ink-soft);
    overflow-wrap: anywhere;
}

.contact-card-details p {
    margin: 0;
}

.contact-card-details img {
    max-width: 100%;
    height: auto;
}

/* --- Wysyłka --- */
.submit-summary {
    color: var(--muted);
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}

#sending_info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.sending-bar {
    height: 8px;
    border-radius: 4px;
    background: repeating-linear-gradient(-45deg, var(--accent) 0 12px, #5AA3B3 12px 24px);
    background-size: 34px 8px;
    animation: sending 0.8s linear infinite;
}

@keyframes sending {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 34px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sending-bar {
        animation: none;
    }

    .progress-fill {
        transition: none;
    }
}

/* --- Strony stanu (weryfikacja, wysłano, błędy) --- */
.status-mark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-mark > .icon {
    width: 28px;
    height: 28px;
}

.status-mark-success {
    background: var(--done);
    color: #FFFFFF;
}

.status-mark-warning {
    background: var(--todo-soft);
    color: var(--todo-ink);
}

.status-mark-muted {
    background: var(--optional-soft);
    color: var(--optional-ink);
}

.sent-list {
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sent-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.sent-list .icon {
    margin-top: 2px;
    color: var(--done);
}

/* --- Narzędzia (nazwy jak w Bootstrapie — używa ich form.js i testy) --- */
.d-none {
    display: none !important;
}

.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;
}
