/*
  Quarkod QR – vzhled. Barvy a tvary převzaté z brány (src/Quarkod.Gateway/wwwroot/app.css):
  inkoust + světlý podklad, jediná signální barva (--qk-signal) = „zapnuto / zaplaceno“.
  Písma jsou přibalená ve fonts/ (CSP nepovoluje cizí zdroje), licence OFL – viz fonts/README.txt.
*/

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/Inter-Regular.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/Inter-Medium.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/Inter-SemiBold.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/Inter-Bold.woff') format('woff'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/SpaceGrotesk-SemiBold.woff') format('woff'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/SpaceGrotesk-Bold.woff') format('woff'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('../fonts/JetBrainsMono-Regular.woff') format('woff'); }

:root {
  --qk-ink: #14171A;
  --qk-ink-3: #3A4046;
  --qk-ground: #F3F4F1;
  --qk-surface: #FFFFFF;
  --qk-soft: #EDEFEA;
  --qk-line: #E2E4E0;
  --qk-line-strong: #C9CDD1;
  --qk-muted: #5B6268;
  --qk-grey: #8A9096;
  --qk-signal: #C6F432;
  --qk-ok: #3F5A00;
  --qk-danger: #B3261E;
  --qk-radius: 14px;
  --qk-radius-sm: 10px;
  --qk-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --qk-display: 'Space Grotesk', var(--qk-font);
  --qk-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --qk-focus: 0 0 0 3px rgba(20, 23, 26, .18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--qk-ground);
  color: var(--qk-ink);
  font: 400 15px/1.45 var(--qk-font);
}
a { color: var(--qk-ink); }
a:hover { color: var(--qk-ink-3); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--qk-ink); outline-offset: 2px; }
.mono { font-family: var(--qk-mono); font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--qk-surface); padding: 8px 12px; border-radius: 8px; z-index: 20; }
.skip:focus { left: 8px; }

/* ---------- kostra ---------- */

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--qk-ground);
}
@media (min-width: 680px) {
  body { background: #E6E8E3; }
  .app { box-shadow: 0 0 0 1px var(--qk-line); }
}

.bar {
  position: sticky; top: 0; z-index: 10;
  height: 56px; flex-shrink: 0;
  background: var(--qk-ink);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px 0 18px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 700 18px/1 var(--qk-display); letter-spacing: -0.02em; }
.brand:hover { color: #fff; }
.brand-qr { color: var(--qk-signal); }
.bar-right { display: flex; align-items: center; gap: 2px; }
.bar-lang { min-width: 44px; height: 44px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: #C9CDD1; font: 700 13px/1 var(--qk-font); letter-spacing: 0.06em; cursor: pointer; }
.bar-lang:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.bar-help { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: #C9CDD1; border-radius: 10px; }
.bar-help:hover, .bar-help[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .08); }

.view { flex: 1; padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 14px; outline: none; }

.tabs {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; background: var(--qk-surface); border-top: 1px solid var(--qk-line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 10px; text-decoration: none; color: var(--qk-muted); font: 600 11px/1 var(--qk-font); }
.tab-ico { width: 56px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }
.tab:hover { color: var(--qk-ink); }
.tab[aria-current="page"] { color: var(--qk-ink); background: var(--qk-signal); }
body.shared .tabs { display: none; }

/* ---------- typografie a drobnosti ---------- */

.title { margin: 0; font: 700 26px/1.1 var(--qk-display); letter-spacing: -0.02em; }
.title-row { display: flex; align-items: center; gap: 4px; }
.back { width: 44px; height: 44px; margin-left: -12px; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.back-link { align-self: flex-start; display: flex; align-items: center; gap: 4px; min-height: 36px; margin: -6px 0 -4px -6px; padding: 0 8px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 14px; }
.note { margin: 0 4px; font-size: 12px; line-height: 1.5; color: var(--qk-muted); }
.btn-reset { border: 0; background: transparent; cursor: pointer; color: var(--qk-ink); }
.view-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
fieldset.plain { margin: 0; padding: 0; border: 0; min-width: 0; }
[hidden] { display: none !important; }
.empty { margin: 8px 4px; font-size: 14px; color: var(--qk-muted); text-align: center; }

.card { background: var(--qk-surface); border: 1px solid var(--qk-line); border-radius: var(--qk-radius); }
.card-strong { border: 1.5px solid var(--qk-ink); }
.card-pad { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.soft { background: var(--qk-soft); border-radius: var(--qk-radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- tlačítka ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--qk-ink);
  background: var(--qk-ink); color: #fff; text-decoration: none; font-weight: 600; font-size: 16px; cursor: pointer;
}
.btn:hover { background: var(--qk-ink-3); border-color: var(--qk-ink-3); color: #fff; }
.btn-md { min-height: 48px; font-size: 15px; }
.btn-2 {
  flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px;
  border-radius: var(--qk-radius-sm); border: 1px solid var(--qk-line-strong); background: var(--qk-surface);
  color: var(--qk-ink); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn-2:hover { border-color: var(--qk-ink); background: var(--qk-soft); color: var(--qk-ink); }
.btn-sm { min-height: 36px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-sm.dark { background: var(--qk-ink); border: 1px solid var(--qk-ink); color: #fff; }
.btn-sm.dark:hover { background: var(--qk-ink-3); color: #fff; }
.btn-sm.light { background: var(--qk-surface); border: 1px solid var(--qk-line-strong); color: var(--qk-ink); }
.btn-sm.light:hover { border-color: var(--qk-ink); }
.btn-sm.danger { background: var(--qk-surface); border: 1px solid #E6B8B4; color: var(--qk-danger); }
.btn-sm.danger:hover { background: var(--qk-danger); border-color: var(--qk-danger); color: #fff; }
.btn-dashed {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 12px;
  border: 1.5px dashed var(--qk-grey); color: var(--qk-ink); text-decoration: none; font-weight: 600; font-size: 15px; background: transparent; cursor: pointer;
}
.btn-dashed:hover { border-style: solid; border-color: var(--qk-ink); }
.ico-btn { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; border: 0; background: transparent; color: var(--qk-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ico-btn:hover { background: var(--qk-soft); color: var(--qk-ink); }
.ico-btn.danger:hover { color: var(--qk-danger); }

/* ---------- formulářové prvky ---------- */

.lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.input {
  width: 100%; height: 44px; border: 1px solid var(--qk-line-strong); border-radius: var(--qk-radius-sm);
  padding: 0 12px; font-size: 15px; font-weight: 500; background: var(--qk-surface); outline: none;
}
.input:focus { border-color: var(--qk-ink); box-shadow: var(--qk-focus); }
.input.err { border-color: var(--qk-danger); }
.input.mono { font-family: var(--qk-mono); }
select.input { appearance: auto; }
.input-wrap { position: relative; }
.input-wrap .input.has-suffix { padding-right: 48px; }
.suffix { position: absolute; right: 12px; top: 0; height: 44px; display: flex; align-items: center; font-size: 14px; font-weight: 600; color: var(--qk-muted); pointer-events: none; }
.hint { margin-top: 4px; font-size: 12px; color: var(--qk-muted); }
.err-msg { margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--qk-danger); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; min-height: 32px; }
.check input, .radio { accent-color: var(--qk-ink); width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--qk-ink-3); margin-top: 4px; }
.status strong { font-weight: 600; color: var(--qk-ink); }
.status.err { color: var(--qk-danger); font-weight: 500; }

/* ---------- účet na formuláři ---------- */

.acc-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--qk-ink); }
.acc-card:hover { color: var(--qk-ink); border-color: var(--qk-line-strong); }
.acc-card.missing { border: 1.5px dashed var(--qk-grey); }
.acc-card.err { border-color: var(--qk-danger); }
.acc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.acc-cap { font-size: 12px; font-weight: 500; color: var(--qk-muted); }
.acc-name { font-size: 16px; font-weight: 600; }
.acc-line { font-size: 13px; color: var(--qk-ink-3); overflow-wrap: anywhere; }

/* ---------- formulář se zásobníkem parametrů ---------- */

.pay-form { display: flex; gap: 12px; padding: 14px 12px 14px 14px; margin: 0; }
.fields { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fields-empty { margin: 6px 0 12px; font-size: 13px; color: var(--qk-muted); line-height: 1.45; }

.field {
  display: grid; grid-template-rows: 1fr; opacity: 1; margin-bottom: 12px; transform: translateY(0);
  transition: grid-template-rows .28s ease, opacity .22s ease, margin-bottom .28s ease, transform .28s ease, visibility 0s;
}
.field.off { grid-template-rows: 0fr; opacity: 0; margin-bottom: 0; visibility: hidden; transform: translateY(-6px); transition-delay: 0s, 0s, 0s, 0s, .28s; }
.field-in { min-height: 0; overflow: hidden; padding: 3px; margin: -3px; } /* místo pro rámeček fokusu */

.stack { width: 44px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; border-left: 1px dashed var(--qk-line); padding-left: 10px; box-sizing: content-box; }
.chip {
  position: relative; width: 44px; height: 44px; border-radius: var(--qk-radius-sm);
  font: 700 12px/1 var(--qk-font); letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.chip[aria-pressed="true"] { background: var(--qk-ink); color: #fff; border: 1px solid var(--qk-ink); }
.chip[aria-pressed="false"] { background: var(--qk-surface); color: var(--qk-ink); border: 1px dashed var(--qk-line-strong); }
.chip[aria-pressed="false"]:hover { border-color: var(--qk-ink); border-style: solid; }
.chip-dot { position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 6px; background: var(--qk-signal); border: 2px solid var(--qk-ink); display: none; }
.chip.remembered .chip-dot { display: block; }

@media (prefers-reduced-motion: reduce) {
  .field, .field.off, .chip { transition: none; }
}

/* ---------- seznamy ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list.card { overflow: hidden; }
.list.card > li + li { border-top: 1px solid var(--qk-line); }
.list.gap { display: flex; flex-direction: column; gap: 8px; }

.pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-name { font-size: 15px; font-weight: 600; }
.pick-line { font-size: 13px; color: var(--qk-ink-3); overflow-wrap: anywhere; }

.acc-item { padding: 12px 8px 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.acc-item.editing { padding: 12px 14px; }
.acc-actions { display: flex; align-items: center; gap: 2px; }
.acc-actions .grow { flex: 1; }
.edit-actions { display: flex; gap: 8px; justify-content: flex-end; }

.seg { display: flex; gap: 4px; background: var(--qk-line); border-radius: var(--qk-radius-sm); padding: 3px; }
.seg button { flex: 1; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--qk-ink-3); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--qk-surface); color: var(--qk-ink); box-shadow: 0 1px 2px rgba(20, 23, 26, .12); }

.pay-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.pay-li.open { background: #FAFBF8; }
.pay-chevron { color: var(--qk-muted); display: flex; transition: transform .2s; }
.pay-li.open .pay-chevron { transform: rotate(180deg); }
.pay-detail { padding: 0 12px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.pay-detail .details { margin: 0; }
.pay-detail .details > div { font-size: 13px; padding: 6px 0; }
.pay-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pay-actions .btn-sm svg { flex-shrink: 0; }
.pay-actions .btn-sm { gap: 6px; min-width: 0; padding: 0 8px; white-space: nowrap; }
.rename-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.rename-form .lbl { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .pay-chevron { transition: none; } }
.pay-toggle { width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: background .2s, border-color .2s; }
.pay-toggle[aria-pressed="false"] { background: var(--qk-surface); border: 1.5px dashed var(--qk-grey); color: var(--qk-muted); }
.pay-toggle[aria-pressed="false"]:hover { border-style: solid; border-color: var(--qk-ink); color: var(--qk-ink); }
.pay-toggle[aria-pressed="true"] { background: var(--qk-signal); border: 1.5px solid var(--qk-signal); color: var(--qk-ink); }
.pay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--qk-ink); border: 0; background: transparent; padding: 4px 0; text-align: left; cursor: pointer; }
.pay-main:hover { color: var(--qk-ink); }
.pay-item:has(.pay-main:hover) .pay-chevron { color: var(--qk-ink); }
.pay-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pay-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-amount { font-size: 14px; font-weight: 700; white-space: nowrap; }
.pay-meta { font-size: 12px; color: var(--qk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.recent { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.recent-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px; }
.recent-head h2 { margin: 0; font: 600 15px/1.3 var(--qk-font); }
.recent-head a { font-size: 13px; font-weight: 600; }
.recent-item { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--qk-ink); }
.recent-item:hover { background: #FAFBF8; }

/* ---------- QR ---------- */

.qr-card { padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; border-radius: 16px; }
.qr-box { position: relative; width: min(264px, 72vw); }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-paid { position: absolute; inset: 0; background: rgba(255, 255, 255, .84); display: flex; align-items: center; justify-content: center; }
.qr-paid span { display: flex; align-items: center; gap: 6px; background: var(--qk-signal); color: var(--qk-ink); font-weight: 700; font-size: 15px; padding: 8px 14px; border-radius: 999px; }
.amount-big { font: 700 30px/1 var(--qk-display); letter-spacing: -0.02em; text-align: center; }
.amount-free { font-size: 15px; font-weight: 600; color: var(--qk-muted); }
.details { margin: 4px 0 0; width: 100%; }
.details > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--qk-line); font-size: 14px; }
.details dt { color: var(--qk-muted); flex-shrink: 0; }
.details dd { margin: 0; font-weight: 400; color: var(--qk-ink); text-align: right; overflow-wrap: anywhere; }
.details dd.dd-copy { display: flex; align-items: center; justify-content: flex-end; gap: 2px; margin: -8px -8px -8px 0; }
.copy-btn { width: 36px; height: 36px; }
.copy-spacer { width: 36px; height: 36px; flex-shrink: 0; }
.acc-num { cursor: pointer; }
.dt-toggle { display: inline-flex; align-items: center; gap: 4px; margin: -8px 0 -8px -6px; padding: 8px 6px; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--qk-muted); font: inherit; cursor: pointer; }
.dt-toggle:hover { color: var(--qk-ink); background: var(--qk-soft); }
.dt-toggle svg { transition: transform .2s; }
.dt-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.details > div.sub { padding: 4px 0 4px 16px; border-top: 1px dashed var(--qk-line); font-size: 13px; }
.details > div.sub dd.dd-copy { margin: -4px -8px -4px 0; }
@media (prefers-reduced-motion: reduce) { .dt-toggle svg { transition: none; } }
.row2 { display: flex; gap: 8px; }
.paid-btn[aria-pressed="true"] { background: var(--qk-surface); color: var(--qk-ink); border-color: var(--qk-line-strong); }
.paid-btn[aria-pressed="true"]:hover { background: var(--qk-soft); color: var(--qk-ink); border-color: var(--qk-ink); }
.promo { margin: 0 4px; font-size: 13px; font-weight: 600; }

/* ---------- nápověda ---------- */

.help h2 { margin: 6px 0 0; font: 600 17px/1.3 var(--qk-display); }
.help p, .help li { margin: 0; font-size: 14px; line-height: 1.55; color: var(--qk-ink-3); }
.help ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- oznámení ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px);
  background: var(--qk-ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
