/* Tokeny z systemu Nekly. Motyw jasny domyślnie, ciemny po przełączeniu. */
:root {
  --bg: #F4F2EC; --panel: #FFFFFF; --card: #FFFFFF; --soft: #FAF8F3; --line: #EAE7DF; --line2: #DAD6CB; --canvas: #E9E5DA;
  --text: #1B1A17; --muted: #5E5B52; --faint: #76705F;
  --acc: #C8A964; --acc-hover: #BE9E57; --acc-soft: #F4E9D4; --acc-text: #7A5E23; --on-acc: #241B08;
  --in-bg: #FFFFFF; --in-line: #DAD6CB; --red: #B53C2E; --red-soft: #F7E5E1; --green: #2C7A4F;
  --shadow: 0 1px 2px rgba(30,28,22,.04), 0 6px 20px -14px rgba(30,28,22,.18);
  --shadow-lg: 0 24px 60px -28px rgba(30,28,22,.45);
  --r-sm: 8px; --r-md: 11px; --r-lg: 14px; --r-xl: 18px;
  --sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141310; --panel: #1D1B16; --card: #201E18; --soft: #1A1813; --line: #2D2A23; --line2: #39352B; --canvas: #100F0C;
  --text: #EBE7DD; --muted: #A29D90; --faint: #92897A;
  --acc: #CDAE6B; --acc-hover: #D9BC7C; --acc-soft: #2C2518; --acc-text: #E3CB94; --on-acc: #241B08;
  --in-bg: #16140F; --in-line: #322E26; --red: #E07468; --red-soft: #2C1A17; --green: #5DB587;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -16px rgba(0,0,0,.6);
  --shadow-lg: 0 28px 70px -30px rgba(0,0,0,.85);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #root { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 15px; line-height: 1.5; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* kontrolki */
.lbl { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; margin: 0 0 6px; }
.fld { width: 100%; min-height: 46px; padding: 0 13px; background: var(--in-bg); border: 1px solid var(--in-line); border-radius: var(--r-md); color: var(--text); font-size: 16px; }
textarea.fld { padding: 11px 13px; resize: vertical; line-height: 1.6; }
.fld:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.fld.warn { border-color: var(--acc); background: var(--acc-soft); }
.row { display: grid; gap: 14px; margin-bottom: 16px; }
.row.two { grid-template-columns: 1fr 1fr; }
.row > * { min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r-md); color: var(--text); font-weight: 700; font-size: 15px; text-decoration: none; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.btn.primary:hover { background: var(--acc-hover); }
.btn.quiet { background: none; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--text); }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.hint { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--acc-soft); color: var(--acc-text); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.h3 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.sub { color: var(--muted); margin: 4px 0 20px; font-size: 14.5px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--in-bg); border: 1px solid var(--in-line); border-radius: var(--r-md); }
.seg button { min-height: 42px; padding: 0 6px; background: none; border: 0; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--acc-soft); color: var(--acc-text); box-shadow: inset 0 0 0 1px var(--acc); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; cursor: pointer; }
.switch span { font-weight: 600; }
.switch small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: var(--line2); cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked { background: var(--acc); }
.switch input:checked::after { transform: translateX(18px); }
.range { display: grid; gap: 0; margin-bottom: 10px; }
.range > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.range span { font-weight: 600; }
.range small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.range em { font-style: normal; font-size: 13px; color: var(--muted); margin-top: -4px; }
input[type=range] { width: 100%; height: 44px; margin: 0; accent-color: var(--acc); }
.sep { height: 1px; background: var(--line); margin: 20px 0; }
.card { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); }
.err { padding: 12px 14px; border-radius: var(--r-md); background: var(--red-soft); color: var(--red); font-size: 14.5px; margin-bottom: 16px; }
.note { padding: 11px 14px; border-radius: var(--r-md); background: var(--acc-soft); color: var(--acc-text); font-size: 14.5px; }
.note b { font-weight: 800; }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; top: calc(72px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 100; max-width: calc(100% - 32px); padding: 11px 16px; background: #1B1A17; border: 1px solid #CDAE6B; color: #F4F2EC; border-radius: var(--r-md); font-size: 14.5px; opacity: 0; transition: opacity .2s; pointer-events: none; text-align: center; }
.toast.on { opacity: 1; }
.word { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; color: var(--acc-text); white-space: nowrap; }

/* logowanie */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.login form { width: 100%; max-width: 400px; }
.login .word { display: block; margin-bottom: 22px; }
.login .btn { width: 100%; margin-top: 6px; }

/* aplikacja */
.app { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.top { display: flex; align-items: center; gap: 28px; min-height: 60px; padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); background: var(--panel); border-bottom: 1px solid var(--line); }
.nav { display: flex; gap: 4px; }
.nav button { height: 44px; padding: 0 14px; background: none; border: 0; border-radius: 999px; color: var(--muted); font-weight: 700; }
.nav button:hover { color: var(--text); }
.nav button[aria-pressed="true"] { background: var(--acc-soft); color: var(--acc-text); }
.nav .short { display: none; }
@media (max-width: 860px) { .nav .short { display: inline; } }
@media (max-width: 380px) { .top .word { display: none; } }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.firm { font-weight: 600; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.iconbtn { display: grid; place-items: center; width: 44px; height: 44px; flex: none; background: none; border: 1px solid var(--line2); border-radius: 999px; color: var(--text); }
.iconbtn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; padding: 8px 16px; background: var(--acc-soft); color: var(--acc-text); font-size: 14px; font-weight: 600; text-align: center; }
.banner a { color: inherit; }
.main { min-height: 0; position: relative; overflow: hidden; }

/* pasek kroków */
.steps { display: flex; gap: 4px; padding: 12px max(16px, env(safe-area-inset-left, 0px)); background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps button { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; min-height: 52px; padding: 4px 6px; background: none; border: 0; border-radius: var(--r-md); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.steps button b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line2); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.steps button.done b { background: var(--acc-soft); border-color: var(--acc); color: var(--acc-text); }
.steps button[aria-current="step"] { color: var(--text); }
.steps button[aria-current="step"] b { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.steps button:disabled { opacity: .45; cursor: default; }

/* widoki */
.view { height: 100%; overflow: auto; }
.col { max-width: 760px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-left, 0px)) 120px; }
.col.wide { max-width: 1080px; }
.foot { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.foot .btn.primary { flex: 1; }
.drop { display: grid; place-items: center; min-height: 240px; padding: 24px; border: 1.5px dashed var(--faint); border-radius: var(--r-xl); text-align: center; color: var(--muted); cursor: pointer; background: var(--soft); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--acc); background: var(--acc-soft); }
.drop strong { display: block; color: var(--text); font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.drop img { max-width: 100%; max-height: 360px; border-radius: var(--r-md); box-shadow: var(--shadow); }
.dane { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }
.dane .ob { position: sticky; top: 0; }
.dane .ob img { width: 100%; border-radius: var(--r-lg); border: 1px solid var(--line); cursor: zoom-in; display: block; }
.postbox { font-size: 15.5px; line-height: 1.7; min-height: 380px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 22px; }

/* studio grafiki */
.studio { display: grid; grid-template-columns: 420px minmax(0, 1fr); min-height: 0; }
.gview { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.pane { overflow: auto; padding: 22px 20px 32px; }
.pfoot { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--panel); }
.pfoot .btn.primary { flex: 1; }
.stage { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; padding: 24px; background: var(--canvas); min-height: 0; min-width: 0; }
.fit { display: grid; place-items: center; min-height: 0; min-width: 0; container-type: size; }
.fit canvas { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); box-shadow: var(--shadow-lg); touch-action: none; display: block; background: #070707; }
.stage p { text-align: center; font-size: 13.5px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { padding: 12px 6px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text); text-align: center; font-size: 13px; font-weight: 600; line-height: 1.3; transition: border-color .15s; }
.tile:hover { border-color: var(--faint); }
.tile[aria-pressed="true"] { border-color: var(--acc); background: var(--acc-soft); box-shadow: inset 0 0 0 1px var(--acc); }
.tile .ico { position: relative; width: 56px; height: 56px; margin: 0 auto 8px; background: var(--in-bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tile .ico i { position: absolute; background: #8a8274; border-radius: 2px; }
.tile .ico i.c { border-radius: 50%; background: var(--acc); }
.slot { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 10px; }
.slot .th { width: 72px; height: 72px; border-radius: var(--r-sm); object-fit: cover; display: block; }
.slot .add { display: grid; place-items: center; width: 72px; height: 72px; border: 1.5px dashed var(--faint); border-radius: var(--r-sm); color: var(--muted); font-size: 28px; cursor: pointer; }
.slot .add:hover { border-color: var(--acc); color: var(--acc); }
.slot strong { display: block; font-weight: 700; margin-bottom: 6px; }
.slot .acts { margin: 0; gap: 6px; align-items: center; }
.slot .zoom { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.slot .switch { grid-column: 1 / -1; min-height: 40px; }
.adv { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
.adv summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 0 14px; cursor: pointer; font-weight: 700; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); }
.adv[open] summary::after { transform: rotate(225deg) translateY(-3px); }
.adv .inner { padding: 4px 14px 14px; }
.done ol { margin: 0 0 20px; padding: 0; list-style: none; counter-reset: d; display: grid; gap: 10px; }
.done li { counter-increment: d; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.done li::before { content: counter(d); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--acc-soft); color: var(--acc-text); font-weight: 800; font-size: 14px; }
.done li strong { display: block; font-weight: 700; }
.done li span { color: var(--muted); font-size: 14px; }
.done li .btn { margin-top: 10px; }

/* zapisane */
.list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.item .th { width: 64px; height: 64px; border-radius: var(--r-sm); object-fit: cover; background: #070707; display: block; }
.item .th.empty { display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--faint); font-size: 12px; font-weight: 600; }
.item strong { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 700; font-size: 16px; }
.item small { font-size: 13.5px; color: var(--muted); }
.item .acts { margin: 0; }
.empty { padding: 32px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line2); border-radius: var(--r-xl); }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.8); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--r-md); }

/* telefon */
@media (max-width: 860px) {
  .top { gap: 10px; min-height: 56px; }
  .top .word { font-size: 12px; letter-spacing: .1em; }
  .firm { display: none; }
  .nav .long { display: none; }
  .nav button { padding: 0 10px; font-size: 14px; }
  .steps { padding-top: 8px; padding-bottom: 8px; }
  .steps button { min-width: 54px; font-size: 11.5px; }
  .steps button span { display: none; }
  .steps button[aria-current="step"] span { display: inline; }
  .dane { grid-template-columns: 1fr; }
  .dane .ob { position: static; }
  .dane .ob img { max-height: 220px; object-fit: contain; background: var(--soft); }
  .studio { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .stage { order: -1; padding: 10px 16px; gap: 6px; grid-template-rows: auto; }
  .fit { container-type: normal; }
  .fit canvas { width: min(100%, 300px); height: auto; aspect-ratio: 1; transition: width .2s; }
  .studio.typing .fit canvas { width: 150px; }
  .stage p { display: none; }
  .panel { border-right: 0; border-top: 1px solid var(--line); }
  .pane { padding: 16px; }
  .tiles { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .tile { padding: 8px 2px 6px; font-size: 11px; border-radius: var(--r-md); }
  .tile .ico { width: 40px; height: 40px; margin-bottom: 5px; }
  .item { grid-template-columns: 56px minmax(0, 1fr); }
  .item .th { width: 56px; height: 56px; }
  .item .acts { grid-column: 1 / -1; }
  .item .acts .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
