/* Panel konta sklepu (src/konto.html, panel.js). Kroje, kolory i promienie ze styles.css; tu tylko to, czego
   potrzebuje panel: pasek sekcji, kafle, wykresy, lista przymierzeń. Najpierw telefon. */
:root {
  --ok: #1a7f37; --ok-bg: #eaf6ec; --warn: #8a4b00; --warn-bg: #fff4e5; --bad: #b42318; --bad-bg: #fdecea;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; scroll-padding: 84px 0 96px; }
/* Przyciski strony mają stan najechania bez warunku: na ekranie dotykowym zostawałby po dotknięciu. */
@media (hover: none) { .btn-dark:hover { opacity: 1; } .btn-line:hover { background: none; } }
/* Strona sięga pod wycięcie ekranu (viewport-fit=cover): treść trzyma się bezpiecznego obszaru także w poziomie. */
.wrap { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
button, .btn, .pnav a, summary { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Nagłówek: po zalogowaniu menu strony ustępuje menu sklepu. */
body.in header .nav ul, body.in header .cta-top, body.in header .acc-link, body.in header .site-menu { display: none; }
.menu.store-menu { display: block; }
.store-menu summary { gap: 8px; max-width: min(58vw, 340px); font-weight: 500; }
.store-menu summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-menu summary svg { flex: none; width: 14px; height: 14px; transition: transform 160ms var(--ease-out); }
.store-menu[open] summary svg { transform: rotate(180deg); }
.store-menu nav { width: max-content; min-width: 240px; max-width: min(400px, calc(100vw - 40px)); }
.store-menu .pick { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; align-items: center; padding: 8px 12px; border-radius: 8px; cursor: pointer; overflow-wrap: anywhere; font-weight: 500; }
.store-menu .pick[aria-current]::after { content: "✓"; flex: none; }
.store-menu #addShop, .store-menu #logout { font-weight: 400; }
.store-menu .pick:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.store-menu .who { margin-top: 6px; padding: 12px 12px 4px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.store-menu nav a { min-height: 44px; display: flex; align-items: center; }
@media (hover: hover) and (pointer: fine) { .store-menu .pick:hover { background: var(--sand); } }

/* Układ: na telefonie pasek sekcji u dołu ekranu, od 960 px kolumna po lewej. */
body.in { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
.panel { padding-top: 28px; padding-bottom: 48px; }
.pmain { min-width: 0; display: grid; gap: 16px; align-content: start; }
.view { padding: 0; display: grid; gap: 16px; min-width: 0; }
.view > *, [data-load="analytics"] > * { min-width: 0; }
[data-load="analytics"] { display: grid; gap: 16px; }
.vtitle { margin-bottom: 6px; font-size: clamp(34px, 5vw, 46px); outline: none; text-wrap: balance; }
.pnav { position: fixed; z-index: 9; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.pnav a { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; border-radius: 12px; font-size: 11.5px; font-weight: 500; line-height: 1.2; color: var(--muted); text-decoration: none; -webkit-touch-callout: none; transition: transform 120ms var(--ease-out); }
.pnav svg { width: 22px; height: 22px; }
.pnav a[aria-current] { color: var(--ink); font-weight: 600; }
.pnav a[aria-current] svg { stroke-width: 1.9; }
.pnav a:active { transform: scale(.96); }
.pnav a:focus-visible { outline-offset: -2px; }
@media (min-width: 960px) {
  body.in { padding-bottom: 0; }
  .panel { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 56px; padding-top: 48px; padding-bottom: 96px; }
  .pside { position: sticky; top: 96px; align-self: start; display: grid; gap: 28px; }
  .pnav { position: static; grid-template-columns: 1fr; gap: 2px; padding: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; }
  .pnav a { grid-template-columns: 22px 1fr; justify-items: start; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 15px; }
  .pnav a[aria-current] { background: var(--sand); }
  .pmain, .view, [data-load="analytics"] { gap: 20px; }
}
@media (hover: hover) and (pointer: fine) { .pnav a:hover { color: var(--ink); } }

/* Pomoc (WhatsApp i e-mail). Na komputerze pod sekcjami, w przyklejonej kolumnie; na telefonie okrągły przycisk
   nad paskiem sekcji, w stylu przycisku drugiego rzędu (białe tło, obrys, ikona w kolorze atramentu). */
.help { display: none; }
.help-fab { position: fixed; z-index: 9; right: max(16px, env(safe-area-inset-right)); bottom: calc(66px + env(safe-area-inset-bottom) + 14px);
  display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink);
  box-shadow: 0 10px 24px -12px rgba(22, 21, 20, .45); -webkit-touch-callout: none; touch-action: manipulation; transition: transform 120ms var(--ease-out); }
.help-fab svg { width: 24px; height: 24px; }
.help-fab:active { transform: scale(.94); }
.help-fab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* Ostatnia treść sekcji wysuwa się nad przycisk, zamiast zostać pod nim. */
body.in .panel { padding-bottom: 96px; }
@media (min-width: 960px) {
  .help-fab { display: none; }
  .help { display: grid; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
  .help p { padding: 0 12px; font-size: 13px; line-height: 1.45; color: var(--muted); }
  .help .btn { justify-content: flex-start; min-height: 40px; padding: 0 12px; font-size: 14px; white-space: nowrap; border-color: var(--line); background: #fff; }
  .help .btn svg { flex: none; width: 18px; height: 18px; }
  .help-mail a { color: var(--ink); text-underline-offset: 2px; overflow-wrap: anywhere; }
}
@media (hover: hover) and (pointer: fine) { .help .btn:hover { border-color: var(--ink); background: #fff; } }

/* Wybór planu przy rejestracji (test z kartą) */
.pick-plan { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.pick-plan legend { margin-bottom: 6px; padding: 0; font-size: 14px; font-weight: 500; }
.card-form .pick-plan .opt { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; font-weight: 400; cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; }
.pick-plan .opt input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); }
.pick-plan .opt b { margin-right: 8px; font-weight: 600; }
.pick-plan .opt small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.pick-plan .opt:has(input:checked) { border-color: var(--ink); background: var(--paper); }
.pick-plan .opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Kafle z liczbami */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles-3 .tile:first-child { grid-column: 1 / -1; }
@media (min-width: 700px) { .tiles-3, .tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tiles-3 .tile:first-child { grid-column: auto; } }
.tile { display: grid; gap: 4px; align-content: start; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.tile .k { font-size: 13px; line-height: 1.35; color: var(--muted); }
.tile .v { font: 400 30px/1.15 var(--serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile .v:empty::before { content: "\00a0"; }
.tile .v .of { font-size: .62em; letter-spacing: 0; color: var(--muted); white-space: nowrap; }
.tile small { font-size: 13px; line-height: 1.45; color: var(--muted); }
.tile small a { text-underline-offset: 2px; }
@media (max-width: 380px) { .tile { padding: 14px; } .tile .v { font-size: 26px; } }
@media (max-width: 349px) { .tiles-3 { grid-template-columns: minmax(0, 1fr); } }
.meter { height: 6px; margin: 6px 0 4px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.meter i { display: block; height: 100%; min-width: 0; border-radius: 999px; background: var(--ink); }
.meter.near i { background: var(--warn); }
.meter.full i { background: var(--bad); }

/* Karty sekcji */
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
@media (min-width: 700px) { .card { padding: 26px 28px; } }
.card-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 18px; }
.card h2 { font-size: 22px; line-height: 1.2; text-wrap: balance; }
.card-h a { font-size: 14px; text-underline-offset: 3px; }
.card .note { margin-top: 18px; }
.sub { margin-bottom: 14px; font: 500 13px/1.4 var(--sans); letter-spacing: 0; color: var(--muted); }
.week { display: grid; gap: 30px; }
@media (min-width: 860px) { .week { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 44px; } }
.lede { max-width: 44em; margin-bottom: 14px; font-size: 15px; color: var(--muted); }
.view .seg { justify-self: start; margin: 0; }
.view .seg button { padding: 0 16px; line-height: 40px; transition: transform 120ms var(--ease-out); }
.view .seg button:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .view .seg button:hover { color: var(--ink); } .view .seg button[aria-pressed="true"]:hover { color: #fff; } }
.view .acc-h { margin: 18px 0 0; }
.view .plans-3 { margin-top: 12px; }
.view .acc-foot { margin-top: 0; }
#limit-card small { display: block; margin-top: 10px; font-size: 13px; color: var(--muted); }

/* Komunikaty */
.banner { display: grid; gap: 12px; align-items: center; padding: 16px 18px; border-radius: var(--r); background: var(--warn-bg); color: #5c3200; }
.banner.bad { background: var(--bad-bg); color: #7a1a12; }
.banner p { font-size: 15px; }
.banner .btn { justify-self: start; min-height: 44px; padding: 0 20px; font-size: 14px; }
@media (min-width: 700px) { .banner { grid-template-columns: minmax(0, 1fr) auto; } }
.state { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 14.5px; background: var(--sand); color: #3d3a37; }
.state::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: currentColor; }
.state.ok { background: var(--ok-bg); color: #14602a; }
.none { max-width: 46em; font-size: 15px; color: var(--muted); }
.empty, .failed { display: grid; gap: 14px; justify-items: start; }
.empty p, .failed p { max-width: 40em; color: var(--muted); }
.failed { margin-bottom: 16px; }
.empty .btn, .failed .btn { min-height: 44px; padding: 0 20px; font-size: 14px; }
/* Ponowne wczytanie: poprzedni obraz zostaje, przygaszony (bez migania i przeskoku). */
.loading > :not(.failed) { opacity: .45; transition: opacity 150ms ease; }
[data-f="weekChart"]:empty, [data-a="chart"]:empty { min-height: 194px; }
[data-f="weekFunnel"]:empty, [data-a="funnel"]:empty { min-height: 210px; }

/* Wykres kolumnowy: jedna seria w kolorze atramentu, siatka z cienkich linii */
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; padding-top: 8px; border-radius: 8px; }
.chart:focus-visible { outline-offset: 8px; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; height: 160px; font-size: 12px; line-height: 1; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.yaxis span:first-child { transform: translateY(-50%); }
.yaxis span:last-child { transform: translateY(50%); }
.plot { position: relative; height: 160px; }
.grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.grid i { display: block; height: 1px; background: var(--line); }
.cols { position: relative; height: 100%; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); align-items: end; touch-action: pan-y; cursor: default; }
.col { display: flex; align-items: flex-end; justify-content: center; height: 100%; padding: 0 max(1px, 14%); } /* słupek węższy od swojego pola: powietrze między słupkami */
.col i { display: block; width: 100%; max-width: 24px; min-height: 3px; border-radius: 4px 4px 0 0; background: var(--ink); }
.col i.zero { min-height: 0; }
.col.on i { background: #6d6a66; }
.tip { position: absolute; z-index: 2; display: grid; padding: 8px 11px; transform: translateX(-50%); border-radius: 10px; background: var(--ink); color: #fff; font-size: 12.5px; line-height: 1.4; white-space: nowrap; pointer-events: none; box-shadow: 0 10px 24px -10px rgba(22, 21, 20, .45); }
.tip b { font-size: 13.5px; font-weight: 600; }
.tip span { color: #cfcac2; }
.xaxis { grid-column: 2; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); height: 16px; font-size: 12px; line-height: 16px; color: var(--muted); }
.xaxis span { justify-self: center; white-space: nowrap; }
/* Przy wielu słupkach podpis jest szerszy niż słupek: ostatni kończy się równo z wykresem, zamiast wystawać poza niego. */
.xaxis.dense span:last-child { justify-self: end; }

/* Lista z paskami (lejek, produkty, powody błędów) */
.mlist { display: grid; gap: 16px; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 14px; align-items: baseline; }
/* Dopisek stoi obok nazwy, a gdy się nie mieści, przechodzi w całości pod nią (nazwa nie łamie się w połowie). */
.mrow .n { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.mrow .n small { font-size: 13px; color: var(--muted); }
.mrow .n a { text-underline-offset: 3px; }
.mrow b { font-weight: 600; font-variant-numeric: tabular-nums; }
.mrow .bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.mrow .bar i { display: block; height: 100%; min-width: 3px; border-radius: 999px; background: var(--ink); }
.mrow .bar i.zero { min-width: 0; }

/* Lista przymierzeń */
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { padding: 0 14px 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 500; text-align: left; color: var(--muted); }
.tbl td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r { padding-right: 0; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .when { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.tbl .why, .tbl .dur { color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 699px) {
  /* Na telefonie każdy wiersz to dwie linie: wynik i czas, pod nimi produkt, powód i czas generowania. */
  .res thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .res, .res tbody { display: block; }
  .res tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .res tbody tr:first-child { padding-top: 0; }
  .res tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .res td { padding: 0; border: 0; font-size: 13.5px; }
  .res td:empty { display: none; }
  .res .st { grid-area: 1 / 1; }
  .res .when { grid-area: 1 / 2; }
  .res .prod, .res .why { grid-column: 1; }
  .res .dur { grid-column: 2; grid-row: 2; }
}

/* Wygląd przycisku: pola, a od 900 px podgląd obok (przyklejony). */
.look-grid { display: grid; gap: 24px; margin-top: 18px; }
@media (min-width: 1100px) { .look-grid { grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); align-items: start; } }
.look-fields { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .look-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .look-fields .wide { grid-column: 1 / -1; } }
.look-fields label { display: grid; gap: 6px; align-content: end; font-size: 14px; font-weight: 500; min-width: 0; }
.look-fields input[type=text], .look-fields input[type=number], .look-fields select { font: 400 16px var(--sans); min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); width: 100%; min-width: 0; }
.look-fields input:focus-visible, .look-fields select:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.look-fields .crow { display: flex; gap: 8px; }
.look-fields input[type=color] { flex: none; width: 48px; height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.look-fields input[name^="--tryon-"][type=text] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; }
.look-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Na telefonie podgląd nad polami: widać efekt zmian bez przewijania na dół. */
.look-preview { display: grid; gap: 10px; order: -1; }
@media (min-width: 1100px) { .look-preview { order: 0; } }
@media (min-width: 1100px) { .look-preview { position: sticky; top: 96px; } }
.look-stage { display: grid; gap: 12px; padding: 24px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.look-cart { all: unset; box-sizing: border-box; display: grid; place-items: center; width: 100%; min-height: 48px; background: var(--ink); color: #fff; font: 500 15px var(--sans); border-radius: 0; }

/* Kraj firmy (waluta i VAT): pola w formularzu sklepu, a w sekcji Plan jedna linijka z polami po „zmień”. */
.firm-fields { display: grid; gap: 16px; }
.firm-fields > * { min-width: 0; }
.firm-fields select, .firm-fields input { width: 100%; min-width: 0; box-sizing: border-box; }
.firm-fields .note[hidden] { display: none; }
.firm { display: grid; gap: 10px; }
.firm[hidden], .firm-edit[hidden], .firm-line[hidden] { display: none; }
.firm-line { margin: 0; font-size: 13px; color: var(--muted); }
.firm-line b { font-weight: 600; color: var(--ink); }
.firm-line button { all: unset; cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.firm-line button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.firm-edit { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.firm label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.firm select, .firm input { font: inherit; font-weight: 400; font-size: 16px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); min-width: 0; }
.firm select:focus, .firm input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.firm-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: end; }
.firm-row .btn { min-height: 44px; padding: 0 16px; font-size: 14px; }
.firm small:empty { display: none; }
@media (min-width: 900px) { .firm-row { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; } .firm-row:has([data-firmextra][hidden]) { grid-template-columns: minmax(0, 320px) auto; justify-content: start; } }
/* Panel na telefonie: w nagłówku jest menu sklepu, więc przełącznik języka jest w tym menu (STORE_MENU w build.py). */
@media (max-width: 859px) { body.in header .lang-sw { display: none; } }

/* Rodzaje produktów: przełączniki „Do czego używasz przymierzalni” (buty i biżuteria, panel.js renderKinds). */
.kinds-form .kind-opts { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 14px 0 16px; }
.kinds-form .kind-opt { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.kinds-form .kind-opt input { width: 18px; height: 18px; accent-color: currentColor; }
