/* Kokonat System — wspólne komponenty panelu (etap 0, 10.2026).
 *
 * Ładowany w layout/admin.twig zaraz po tokens.css i app.css, PRZED arkuszami
 * stron. Arkusz strony ustawia układ (siatki, odstępy), a NIE wygląd
 * przycisków, plakietek i pól — te mieszkają tylko tutaj.
 *
 *   Przycisk   .btn + .btn--primary | --secondary | --danger   (+ .btn--lg)
 *   Plakietka  .chip + .chip--status | --pilne | --dzis | --czeka | --info | --meta | --kod
 *   Pole       input / select / textarea w panelu — jeden styl bez klasy (.field-control opcjonalnie)
 *   Etapy      _components/stepper.twig → .stepper
 *   Okruszki   _components/crumbs.twig  → .crumbs
 *   Kontener   .wrap--list (1200) | .wrap--card (960)
 *   Ikona      {{ icon('phone') }} → svg.icon
 */

/* ---------------------------------------------------------------- Typografia */

body.admin { font-family: var(--sans); color: var(--ink); background: var(--bg); }

/* H1 każdej strony panelu: szeryf, 32–40 px. H2 i niżej: Poppins. */
body.admin h1 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 36px;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
}
@media (max-width: 620px) {
    body.admin h1 { font-size: 30px; }
}

/* ---------------------------------------------------------------- Ikony */

.icon {
    display: inline-block;
    flex: none;
    vertical-align: -0.2em;
    width: 16px;
    height: 16px;
    color: currentColor;
}
.icon-20 { width: 20px; height: 20px; }
.icon-14 { width: 14px; height: 14px; }
.icon-12 { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- Przyciski */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn--lg { min-height: 44px; padding: 10px 18px; font-size: 14px; }
.btn--lg .icon { width: 20px; height: 20px; }
.btn--block { width: 100%; }

.btn--primary { background: var(--ink); color: var(--surface); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--action)); color: var(--surface); }

.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { border-color: color-mix(in srgb, var(--action) 35%, var(--line)); color: var(--ink); }

.btn--danger { background: transparent; color: var(--urgent); border-color: transparent; padding-left: 10px; padding-right: 10px; }
.btn--danger:hover { background: var(--urgent-soft); color: var(--urgent); }

.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* details > summary jako przycisk — bez trójkąta przeglądarki */
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

/* ---------------------------------------------------------------- Plakietki */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    vertical-align: middle;
    align-self: flex-start;
    text-decoration: none;
    background: var(--wait-soft);
    color: var(--wait);
}
.chip .icon { width: 14px; height: 14px; }

/* status — stan oferty/projektu */
.chip--status            { background: var(--action-soft); color: var(--action); }
.chip--status.is-done    { background: var(--done-soft);   color: var(--done); }
.chip--status.is-wait    { background: var(--wait-soft);   color: var(--wait); }
.chip--status.is-brand   { background: var(--brand-soft);  color: var(--brand-text); }

/* pilność — poziom niesie kolor, ikona niesie typ sprawy */
.chip--pilne { background: var(--urgent-soft); color: var(--urgent); }
.chip--dzis  { background: var(--today-soft);  color: var(--today); }
.chip--czeka { background: var(--wait-soft);   color: var(--wait); }
.chip--info  { background: var(--action-soft); color: var(--action); }
.chip--done  { background: var(--done-soft);   color: var(--done); }

/* meta — źródło, pakiet, „powracający”: neutralna */
.chip--meta { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }

/* kod — KO-xxx: cyfry tabelaryczne, bez podkreślenia */
.chip--kod {
    background: transparent;
    color: var(--muted);
    padding: 0;
    border-radius: 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    text-decoration: none;
}
a.chip--kod:hover { color: var(--action); }

/* ---------------------------------------------------------------- Pola */

/* Jeden styl pól w całym panelu: białe tło, ramka --line, fokus --action.
   :where() trzyma specyficzność na zerze — arkusz strony może zmienić
   szerokość czy wysokość, a wygląd zostaje wspólny. */
:where(body.admin) :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=range]):not([type=color]), select, textarea) {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink);
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 11px;
    min-height: 36px;
    line-height: 1.4;
}
:where(body.admin) :where(textarea) { min-height: 72px; }
:where(body.admin) :where(input, select, textarea):focus {
    outline: none;
    border-color: var(--action);
    box-shadow: 0 0 0 3px var(--action-soft);
}
:where(body.admin) :where(input, textarea)::placeholder { color: var(--muted); opacity: .8; }
:where(body.admin) :where(select) {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    /* strzałka: chevron-down z Lucide w kolorze --muted */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6280' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}
:where(body.admin) :where(input[type=checkbox], input[type=radio]) { accent-color: var(--action); }

/* Etykiety pól i nagłówki kolumn: zdania, nie wersaliki z rozstrzeleniem. */
.field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-2);
    margin-bottom: 4px;
    text-transform: none;
    letter-spacing: 0;
}

/* ---------------------------------------------------------------- Kontenery */

.wrap--list { max-width: var(--w-list); margin-left: auto; margin-right: auto; }
.wrap--card { max-width: var(--w-card); margin-left: auto; margin-right: auto; }

/* ---------------------------------------------------------------- Okruszki */

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 12px;
}
.crumbs a { color: var(--action); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .crumbs-sep { color: var(--line); }
.crumbs [aria-current] { color: var(--ink-2); }

/* ---------------------------------------------------------------- Pasek etapów */

/* Jeden komponent dla karty kontaktu i karty projektu.
   Stany: is-done (--done) · is-current (obwódka --action) ·
   is-skip (przerywana ramka — pominięty / poza systemem) · is-todo (szary) ·
   is-lost / is-postponed (znacznik końca sprawy). */
.stepper { margin: 0; }
.stepper ol {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}
.stepper li {
    flex: 1 0 104px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px 8px 34px;
    position: relative;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 13px;
    color: var(--muted);
    min-width: 0;
}
.stepper li::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--line);
    background: var(--surface);
    box-sizing: border-box;
}
.stepper .stepper-label { font-weight: 500; color: inherit; }
.stepper small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }

.stepper li.is-done { color: var(--ink); }
.stepper li.is-done::before {
    border-color: var(--done);
    background: var(--done) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat;
}
.stepper li.is-current {
    color: var(--ink);
    border-color: var(--action);
    box-shadow: 0 0 0 3px var(--action-soft);
}
.stepper li.is-current .stepper-label { color: var(--action); font-weight: 600; }
.stepper li.is-current::before {
    border-color: var(--action);
    background: radial-gradient(circle, var(--action) 0 3.5px, var(--surface) 4px);
}
.stepper li.is-skip { border-style: dashed; color: var(--muted); }
.stepper li.is-skip::before { border-style: dashed; border-color: var(--muted); }
.stepper li.is-todo { color: var(--muted); background: var(--bg); }
.stepper li.is-lost      { border-color: var(--urgent-soft); background: var(--urgent-soft); color: var(--urgent); }
.stepper li.is-lost::before { border-color: var(--urgent); }
.stepper li.is-postponed { border-color: var(--wait-soft); background: var(--wait-soft); color: var(--wait); }
.stepper li.is-postponed::before { border-style: dashed; border-color: var(--wait); }
.stepper-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* Telefon: dwie kolumny zamiast przewijania w bok — etykiety się nie urywają. */
@media (max-width: 620px) {
    .stepper ol { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
    .stepper li { min-width: 0; }
}


/* ---------------------------------------------------------------- Pasek pilności */

/* Boczny pasek przy sprawie (wiersz follow-upu, „Do zrobienia”) — ten sam
   poziom co plakietka: pilne · dziś · czeka · info. */
.lvl-pilne { border-left-color: var(--urgent) !important; }
.lvl-dzis  { border-left-color: var(--today) !important; }
.lvl-czeka { border-left-color: var(--wait) !important; }
.lvl-info  { border-left-color: var(--action) !important; }


/* ---------------------------------------------------------------- Menu „Więcej” */

/* Rozwijane menu dla rzadkich akcji, które niczego nie kończą (07.10.2026).
   Pozycje to zwykłe przyciski/linki z tymi samymi data-* co wcześniej — JS
   akcji nie wie, że siedzą w menu. Telefon: menu wysuwa się od dołu ekranu. */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
    min-width: 220px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 14%, transparent);
    display: flex; flex-direction: column; gap: 2px;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border: 0; border-radius: 8px; background: none;
    font: inherit; font-size: 14px; color: var(--ink); text-align: left;
    text-decoration: none; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--surface-2); outline: none; }
.dropdown-item .icon { color: var(--muted); flex: none; }
.dropdown-item--danger, .dropdown-item--danger .icon { color: var(--urgent); }
.dropdown-item--danger { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: 11px; }

@media (max-width: 620px) {
    .dropdown-menu {
        position: fixed; top: auto; left: 0; right: 0; bottom: 0;
        border-radius: 16px 16px 0 0; padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        /* Przyciemnienie reszty ekranu — widać, że to warstwa nad listą. */
        box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--ink) 45%, transparent);
    }
    .dropdown-item { padding: 14px 12px; font-size: 15px; }
}

/* Przycisk wyglądający jak link — akcja drugiego planu w zdaniu albo w stopce okna. */
.link-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-weight: 600; color: var(--action);
    text-decoration: underline; text-underline-offset: 3px;
}
.link-btn--danger { color: var(--urgent); }

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