/* fidbek: formularz uwag na sypian.ski. Plan: dev/DESIGN.md (decyzja z 21 X 2026).
   Jeden DOM, dwa układy: wąski ekran = wariant A (kafelki), od 860 px = wariant C
   (dwie kolumny: lista aplikacji z lewej, formularz z prawej), kolory A w obu.
   Bez kartki, pieczątki, cieni i ozdób. */
:root {
  --paper: #f7f5f0;
  --field: #ffffff;
  --ink: #1a1a1a;
  --soft: #4a4740;
  --mute: #5f5a50;
  --rule: #cbc4b6;
  --edge: #857e70;        /* obramowania pól i kafelków (3,7:1 na papierze) */
  --gold: #c9a227;
  --gold-ink: #735600;
  /* nazwy czytane przez app-shell/shell.css */
  --accent: var(--gold);
  --accent-ink: var(--gold-ink);
  --font-display: 'Alegreya', Georgia, 'Times New Roman', serif;
  --font-body: 'Alegreya Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-pixel: 'Jacquard 12', 'Alegreya', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16140f; --field: #1f1c16; --ink: #ece6d8; --soft: #bfb7a6; --mute: #a39b8a;
    --rule: #4a453b; --edge: #8a8374; --gold: #d9b43a; --gold-ink: #e2c15a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16140f; --field: #1f1c16; --ink: #ece6d8; --soft: #bfb7a6; --mute: #a39b8a;
  --rule: #4a453b; --edge: #8a8374; --gold: #d9b43a; --gold-ink: #e2c15a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wrap { max-width: calc(640px + 40px); margin: 0 auto; padding-inline: 20px; }
a { color: var(--gold-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
[hidden] { display: none !important; }

/* fokus: brązowe złoto (kontrast ≥ 3:1), także bez :focus-visible w starych przeglądarkach */
a:focus, button:focus, select:focus, textarea:focus, input:focus { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; }
.vh:focus + label, .vh:focus-visible + label { outline: 3px solid var(--gold-ink); outline-offset: 2px; }

.ico { width: 1.25em; height: 1.25em; flex: none; }
.gi { fill: none; stroke: currentColor; stroke-width: 1.6px; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- nagłówek ---------- */
.head { padding-block: 2.5rem 0; }
.head h1 {
  font: 400 2.75rem/1 var(--font-pixel); margin: 0; text-wrap: balance; overflow-wrap: anywhere;
}
.lede { font: 400 1.25rem/1.5 var(--font-display); color: var(--soft); margin: .9rem 0 0; max-width: 54ch; text-wrap: pretty; }

/* ---------- aplikacje i wtyczki: jedna linijka opisu i link ---------- */
.about { margin-top: 1.75rem; }
.about h2 { font: 400 1.5rem/1.2 var(--font-pixel); margin: 0 0 .5rem; }
.about-list { list-style: none; margin: 0; padding: 0; font: 400 1.0625rem/1.45 var(--font-body); color: var(--soft); }
.about-list li { padding-block: .1875rem; }
.about-list a { color: var(--ink); font-weight: 700; text-underline-offset: .15em; margin-right: .5rem; }
.about-fam { margin: .75rem 0 .25rem; font: italic 400 1rem/1.3 var(--font-body); color: var(--soft); }

/* ---------- formularz (wąski ekran: jedna kolumna) ---------- */
.sheet { margin: 2.5rem 0 0; display: flex; flex-direction: column; gap: 2.5rem; }
.col { display: flex; flex-direction: column; gap: 2.5rem; min-width: 0; }
.cur { display: none; }

.row { border: 0; margin: 0; padding: 0; min-width: 0; }
.row > label, .row legend, .lbl {
  display: block; padding: 0; margin: 0 0 .5rem;
  font: 700 1.375rem/1.3 var(--font-display); color: var(--ink);
}
.opt-note { font: 400 1rem/1.3 var(--font-body); color: var(--soft); }
.hint { margin: 0 0 .75rem; color: var(--soft); font-size: .95rem; line-height: 1.5; max-width: 62ch; }

/* legenda w środku wiersza, nie w linii obramowania fieldsetu */
.row legend { float: left; width: 100%; }
.row legend + * { clear: both; }
.row legend { margin-bottom: .875rem; }

/* W sprawie: legenda nad kafelkami (prawdziwe radio w fieldset), nie lista rozwijana */
.re { display: block; }
.re-field { min-width: 0; }
.re > .hint, .re > .err { margin: .6rem 0 0; }
.fixed { margin: 0; min-height: 44px; display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; font-size: 1.125rem; }
.fixed span { color: var(--soft); }
.fixed b { font-weight: 700; overflow-wrap: anywhere; }
.re:focus { outline: none; }
.re:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 2px; }

.apps { display: block; min-width: 0; }
.tiles { display: flex; flex-wrap: wrap; gap: .625rem; }
.fam-h { margin: 1.5rem 0 .625rem; font: 400 1rem/1.3 var(--font-body); color: var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.gen { margin-top: .875rem; }

/* kafelek = radio (visually hidden) + etykieta; zaznaczony: 2 px atramentu, pogrubienie i ✓ (nie sam kolor) */
.tile {
  position: relative; display: inline-flex; align-items: center; gap: .625rem; max-width: 100%; min-width: 0;
  box-sizing: border-box; min-height: 44px; padding: 0 .875rem;
  background: var(--field); border: 2px solid var(--edge); border-radius: 6px; cursor: pointer;
  font: 500 1.0625rem/1.2 var(--font-body); color: var(--ink);
}
.tile-app { min-height: 64px; padding: .5rem 1rem .5rem .75rem; gap: .75rem; font-size: 1.125rem; }
.tile:hover { background: color-mix(in srgb, var(--ink) 6%, var(--field)); }
.tile:has(input:checked) { border-color: var(--ink); font-weight: 700; }
.tile:has(input:focus-visible) { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
.tile-img { width: 40px; height: 40px; flex: none; border-radius: 4px; object-fit: contain; }
.tile-name { min-width: 0; overflow-wrap: anywhere; flex: 1 1 auto; }
.gi.tick { width: .95rem; height: .95rem; flex: none; margin-left: auto; visibility: hidden; stroke-width: 2.2px; }
.tile input:checked ~ .tick, .opt input:checked ~ .tick { visibility: visible; }

/* rodzaj: chipy (tak samo jak kafelki); natywne radio zostaje, tylko niewidoczne */
.opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.opt {
  position: relative; display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; box-sizing: border-box;
  padding: 0 1.125rem; background: var(--field); border: 2px solid var(--edge); border-radius: 6px; cursor: pointer;
  font: 500 1.0625rem/1.2 var(--font-body);
}
.opt:hover { background: color-mix(in srgb, var(--ink) 6%, var(--field)); }
.opt .dot { display: none; }
.opt:has(input:checked) { border-color: var(--ink); font-weight: 700; }
.opt:has(input:focus-visible) { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
.check input { width: 1.5rem; height: 1.5rem; margin: 0; accent-color: var(--ink); flex: none; }

textarea, input[type="text"] {
  display: block; width: 100%; padding: .75rem .875rem;
  font: 400 1.125rem/1.55 var(--font-body); color: var(--ink); background: var(--field);
  border: 2px solid var(--edge); border-radius: 6px;
}
input[type="text"] { min-height: 48px; padding-block: .5rem; }
textarea { min-height: 11.25rem; resize: vertical; }
[aria-invalid="true"] { border-color: var(--ink); border-style: solid; }
.count { margin: .35rem 0 0; text-align: right; font-size: .9rem; color: var(--soft); font-variant-numeric: tabular-nums; }
.count.near { color: var(--ink); font-weight: 700; }

/* wersja i system: legenda jak pozostałe sekcje, pod nią dwa pola z własnymi etykietami (bez pikselowego kroju) */
::placeholder { color: var(--mute); opacity: 1; }
.ctx > .hint { margin-bottom: 1rem; }
.ctx-f + .ctx-f { margin-top: 1rem; }
.ctx-f > label { display: block; margin: 0 0 .35rem; font: 700 1.0625rem/1.3 var(--font-body); color: var(--ink); }
.ctx-ver input { max-width: 16rem; }
.ctx-os-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.ctx-os-row input[type="text"] { flex: 1 1 13rem; width: auto; min-width: 0; }
.ctx-os-row .btn { flex: none; min-height: 48px; }
.ctx-os .note { margin-top: .5rem; min-height: 0; }
.ctx-os .note:empty { display: none; }

/* przyciski: pole z obramowaniem; główny = atrament na papierze (złoto zostaje dla fokusa) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .5rem 1rem; box-sizing: border-box;
  font: 500 1.0625rem/1.2 var(--font-body); color: var(--ink); background: var(--field);
  border: 2px solid var(--edge); border-radius: 6px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 6%, var(--field)); }
.btn.primary { min-height: 52px; padding-inline: 2rem; background: var(--ink); color: var(--paper); border-color: var(--ink); font: 700 1.25rem/1 var(--font-body); }
.btn.primary:hover { background: var(--soft); border-color: var(--soft); }
.btn[disabled] { cursor: progress; opacity: .6; }

.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.att-info { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.att-file { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.att-size { color: var(--soft); font-weight: 400; white-space: nowrap; }

/* prywatność: natywny checkbox, notatki jako zwykły tekst */
.priv { display: flex; flex-direction: column; gap: .5rem; }
.row > .check { display: flex; align-items: center; gap: .75rem; min-height: 44px; margin: 0; cursor: pointer; font: 500 1.125rem/1.3 var(--font-body); }
.check input:disabled + span { cursor: not-allowed; }
.note { margin: 0; color: var(--soft); font-size: 1rem; line-height: 1.5; max-width: 62ch; }
.contact { margin-top: .875rem; }
.contact > label { display: block; margin: 0 0 .5rem; font: 700 1.375rem/1.3 var(--font-display); }

.err { display: flex; gap: .5rem; align-items: flex-start; margin: .5rem 0 0; font-weight: 700; color: var(--ink); max-width: 62ch; }
.err::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 1.3em; height: 1.3em; margin-top: .1em; border: 2px solid currentColor; border-radius: 50%; font: 700 .8em/1 var(--font-body); }

/* pole-pułapka: poza ekranem, nie dla ludzi */
.trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* wysyłka: przycisk, obok jedna linia stanu prywatności */
.send { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; }
.send-btns { display: flex; flex-wrap: wrap; gap: .6rem; }
.send-info { flex: 1 1 14rem; min-width: 0; }
.privline, .status { margin: 0; font: 400 1rem/1.4 var(--font-body); color: var(--soft); }
.status { margin-top: .25rem; font-style: italic; }
.status:empty, .privline:empty { display: none; }

.alert { display: flex; gap: .7rem; align-items: flex-start; margin: 0; padding: .8rem 1rem; border: 2px solid var(--ink); border-radius: 6px; }
.alert .ico { margin-top: .15em; }
.alert p { margin: 0; font-weight: 500; }
.alert details { margin-top: .5rem; font-size: .9rem; color: var(--soft); }
.alert summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.alert code { font: .9rem/1.4 ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }

/* potwierdzenie: tekst + ikona + złota krawędź */
.done { margin: 2rem 0 0; padding: .4rem 0 .4rem 1.1rem; border-left: 4px solid var(--gold); }
.done:focus { outline: none; }
.done:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 4px; }
.done h2 { display: flex; align-items: center; gap: .5rem; margin: 0; font: 500 1.5rem/1.25 var(--font-display); }
.done p { margin: .4rem 0 0; color: var(--soft); max-width: 62ch; }
.done a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }

.foot { margin-top: 3rem; padding: 1.25rem 0 2.5rem; border-top: 1px solid var(--rule); color: var(--soft); font-size: .95rem; }
.foot p { margin: 0 0 .5rem; max-width: 62ch; }
.foot a { color: var(--soft); }

@media (max-width: 560px) {
  .wrap { padding-inline: 16px; }
  body { font-size: 1rem; }
  .head { padding-block: 1.75rem 0; }
  .lede { font-size: 1.125rem; }
  .sheet { margin-top: 2rem; gap: 2rem; }
  .col { gap: 2rem; }
}

/* ---------- szeroki ekran: wariant C (dwie kolumny), kolory bez zmian ---------- */
@media (min-width: 860px) {
  .wrap { max-width: calc(980px + 40px); }
  .head { padding-block: 2.5rem 0; }
  .head h1 { font-size: 3.5rem; }
  .lede { font-size: 1.25rem; }

  .sheet {
    display: grid; grid-template-columns: minmax(15rem, 17.5rem) minmax(0, 1fr);
    column-gap: clamp(2rem, 5vw, 3.5rem); align-items: start; margin-top: 2.5rem;
  }
  .sheet.is-fixed { grid-template-columns: minmax(0, 1fr); }
  .sheet.is-fixed #appGroup { display: none; }
  .col { gap: 2.25rem; }

  /* tytuły sekcji w kroju pikselowym */
  .row legend, .row > label, .lbl, .contact > label {
    font: 400 1.875rem/1 var(--font-pixel); margin-bottom: .75rem;
  }
  .row legend { margin-bottom: .5rem; }
  .opt-note { font-size: 1rem; line-height: 1.3; }

  /* wiersz „Zgłoszenie dotyczy” */
  .cur { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; margin: 0; font: 400 1.375rem/1.25 var(--font-display); min-height: 48px; align-content: center; }
  .cur-l { color: var(--soft); }
  .cur b { font-weight: 700; overflow-wrap: anywhere; }
  .cur[data-empty="true"] b { font-weight: 400; font-style: italic; color: var(--soft); }
  .cur[hidden] { display: none; }

  /* LEWA kolumna: lista jak menu boczne */
  .tiles, .chips, .gen { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0; }
  .gen { margin-top: 0; padding-top: .875rem; margin-top: .875rem; border-top: 1px solid var(--rule); }
  .fam-h { margin: 1.125rem 0 .25rem; padding-inline: .75rem; font-style: italic; font-size: 1.0625rem; }
  .tile {
    display: flex; width: 100%; min-height: 44px; padding: .25rem .75rem; gap: .75rem;
    background: transparent; border: 0; border-radius: 4px; font: 400 1.125rem/1.25 var(--font-body);
  }
  .tile-app, .gen .tile { min-height: 48px; padding: .375rem .75rem; font-size: 1.125rem; }
  .tile-img { width: 28px; height: 28px; }
  .tile:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
  .tile:has(input:checked) { background: color-mix(in srgb, var(--ink) 8%, transparent); border: 0; font-weight: 700; }
  .gi.tick { width: 1.1rem; height: 1.1rem; }

  /* rodzaj zgłoszenia: kółko z kropką, bez ramek */
  .opts { gap: .25rem 1.5rem; }
  .opt { min-height: 48px; padding: 0; gap: .625rem; background: transparent; border: 0; border-radius: 0; font: 400 1.125rem/1.2 var(--font-body); }
  .opt:hover { background: transparent; }
  .opt:has(input:checked) { border: 0; font-weight: 700; }
  .opt .dot { display: inline-block; width: 1.5rem; height: 1.5rem; flex: none; box-sizing: border-box; border: 2px solid var(--ink); border-radius: 50%; position: relative; }
  .opt input:checked ~ .dot::after { content: ""; position: absolute; inset: .25rem; border-radius: 50%; background: var(--ink); }
  .opt .tick { display: none; }
  .opt:has(input:focus-visible) .dot { outline: 3px solid var(--gold-ink); outline-offset: 2px; }
  .opt:has(input:focus-visible) { outline: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
