/* La Pisa Skener — PWA. Tmavá neutrální šeď, korálově červený akcent,
   zelená jen pro finální „odesláno/doručeno", Archivo (nadpisy
   condensed přes font-stretch — písmo značky Spárováno), pill
   tlačítka, dotykové cíle >= 48 px. */

:root {
  --bg: #161616;
  --card: #1f1f1f;
  --card-2: #2a2a2a;
  --border: #2e2e2e;
  --text: #f5f5f5;
  --muted: #8e8e93;
  --accent: #f4503c;          /* brand — primární akce, aktivní stavy */
  --accent-soft: rgba(244, 80, 60, .15);
  --green: #35c759;           /* jen finální potvrzení (jako „Doručeno") */
  --yellow: #eab308;
  --red: #f4503c;
  --radius: 16px;
  --font: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Archivo', -apple-system, sans-serif; /* condensed přes font-stretch */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* overscroll i na html: gesto stažení dolů nesmí obnovit stránku
   uprostřed kontroly dokladu (reload = návrat do skeneru) */
html { -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
body.app {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
[data-screen] { flex: 1; display: flex; flex-direction: column; padding-top: var(--safe-top); }
[hidden] { display: none !important; }

h1 { font-family: var(--font-head); font-stretch: 84%; font-size: 1.75rem; font-weight: 760; margin-bottom: .5rem; }
h2 { font-family: var(--font-head); font-stretch: 84%; font-size: 1.2rem; font-weight: 760; margin-bottom: .6rem; }
/* Malé logo + margin-top:auto — spolu s margin-top:auto na .bottom-hint
   drží přihlašovací blok vertikálně na středu (PWA instalační lišta
   nahoře pak nic nepřekrývá) a nápovědu s podpisem u spodního okraje. */
.pair-logo { width: 190px; max-width: 100%; margin: auto 0 .8rem; display: block; }
/* název produktu pod logem; větší mezera odděluje značku od nadpisu */
.pair-sub {
  font-family: var(--font-head); font-stretch: 84%; font-weight: 760; font-size: 1.05rem;
  margin-bottom: 2.6rem;
}
.muted { color: var(--muted); }
.center { text-align: center; }
.screen-pad {
  padding: 2.2rem 1.4rem calc(1.4rem + var(--safe-bottom)); max-width: 480px; margin: 0 auto; width: 100%;
  transition: transform .25s ease; /* měkké zvednutí PIN polí nad klávesnici (app.js) */
  /* flex sloupec: .bottom-hint s margin-top:auto (a logo pod ním) sedí u spodního okraje */
  display: flex; flex-direction: column; flex: 1;
}
.field-label { display: block; margin: 1.6rem 0 .5rem; font-weight: 500; }

/* ---------- tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 1.5rem;
  border: none; border-radius: 999px;
  background: var(--card-2); color: var(--text);
  font-family: var(--font);
  font-size: 1.02rem; font-weight: 500; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--green); color: #06170c; }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-warn { background: var(--yellow); color: #241c02; }
.btn-block { width: 100%; margin-top: 1.4rem; }
.linklike { background: none; border: none; color: var(--text); font: inherit; cursor: pointer; padding: .4rem; }
.pill-link {
  display: inline-block; padding: .55rem 1.2rem; border-radius: 999px;
  background: var(--card-2); color: var(--text); text-decoration: none; font-weight: 500;
  border: none; cursor: pointer; font-family: var(--font); font-size: 1rem;
  -webkit-tap-highlight-color: transparent;
}

/* mini-dialog s odpovědí („Kde vezmu PIN?") */

/* ---------- prohlížeč naskenovaného dokladu (z potvrzení) ---------- */
.doc-viewer {
  position: fixed; inset: 0; z-index: 140; background: var(--bg);
  display: flex; flex-direction: column;
}
.dv-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(.9rem + var(--safe-top)) 1.2rem .9rem;
  border-bottom: 1px solid var(--border); flex: none;
}
.dv-title { font-family: var(--font-head); font-stretch: 84%; font-weight: 760; }
.dv-scroll {
  overflow-y: auto; flex: 1;
  padding: 1rem 1rem calc(1.6rem + var(--safe-bottom));
  display: grid; gap: 1rem; align-content: start;
}
.dv-hint { color: var(--muted); font-size: .85rem; text-align: center; }
.dv-page { position: relative; }
.dv-page img { width: 100%; display: block; border-radius: 10px; }
.dv-frame { width: 100%; height: 72vh; border: none; border-radius: 10px; background: var(--card); }
/* pás přes nejistý řádek — poloprůhledná červená, ať zůstane čitelný */
.dv-band {
  position: absolute; left: 0; right: 0;
  background: rgba(244, 80, 60, .28);
  border-top: 2px solid rgba(244, 80, 60, .85);
  border-bottom: 2px solid rgba(244, 80, 60, .85);
  border-radius: 3px;
}
.dv-empty { color: var(--muted); text-align: center; padding: 1.6rem 0; }

/* ---------- fullscreen dialog (náhrada alert/confirm) ---------- */
.app-dialog {
  position: fixed; inset: 0; z-index: 130; background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(2.2rem + var(--safe-top)) 1.4rem calc(1.4rem + var(--safe-bottom));
}
.app-dialog .ad-body { margin: auto 0; text-align: center; padding-bottom: 1rem; }
.ad-icon {
  width: 104px; height: 104px; border-radius: 50%; margin: 0 auto 1.6rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(234, 179, 8, .15); color: var(--yellow);
  animation: sent-pop .4s cubic-bezier(.2, 1.4, .4, 1);
}
.ad-icon svg { width: 46px; height: 46px; }
.ad-icon.danger { background: var(--accent-soft); color: #ff7a69; }
.app-dialog p { line-height: 1.5; max-width: 420px; margin: 0 auto; }
.ad-actions { display: grid; gap: .75rem; max-width: 480px; margin: 0 auto; width: 100%; }
.ad-actions .btn-block { margin-top: 0; }

.app-tip-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
  display: flex; align-items: center; justify-content: center; padding: 1.2rem;
}
.app-tip {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.5rem 1.6rem; width: min(400px, 100%);
}
.app-tip p { margin-bottom: .6rem; line-height: 1.5; }

/* naznačený terminál Reservo Eats — kde PIN hledat */
.tip-terminal {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: .75rem .9rem .6rem; margin: .9rem 0 1rem;
}
.tt-tabs { display: flex; gap: .4rem; margin-bottom: .8rem; }
.tt-tabs span {
  padding: .22rem .65rem; border-radius: 999px;
  background: var(--card-2); color: var(--muted);
  font-size: .72rem; font-weight: 500;
}
.tt-tabs span.active { background: var(--accent); color: #fff; }
.tt-label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; text-align: center; }
.tt-pin {
  font-family: var(--font-head); font-stretch: 84%; font-weight: 760; font-size: 1.7rem;
  letter-spacing: .3em; text-align: center; padding-left: .3em;
}
.bottom-hint { margin-top: auto; text-align: center; padding-top: 2rem; }

/* Inline SVG ikony — barvu dědí z textu. */
svg.icon { width: 1em; height: 1em; vertical-align: -0.12em; }

/* patička přihlášení: instalační pill, nápověda, podpis */
.pair-footer {
  margin-top: auto; padding-top: 2rem;
  display: grid; gap: .75rem; justify-items: center; text-align: center;
}
/* horní lišta s výzvou k instalaci — vlastní náhrada Chromí mini-infobar
   (vzor „app banner": dlaždice s ikonou, název, popisek, akce) */
.install-bar {
  display: flex; align-items: center; gap: .8rem;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: .65rem .9rem;
  padding-top: calc(.65rem + var(--safe-top));
}
.install-bar .ib-appicon {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.45rem;
}
.install-bar .ib-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.install-bar .ib-text strong { font-weight: 500; font-size: .95rem; }
.install-bar .ib-sub { color: var(--muted); font-size: .8rem; }
.install-bar .ib-action {
  flex: none; border: none; border-radius: 999px;
  background: var(--accent); color: #fff;
  font: inherit; font-weight: 500; padding: .45rem 1.1rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.install-bar .ib-close {
  flex: none; background: none; border: none; color: var(--muted);
  font-size: 1.35rem; line-height: 1; padding: .2rem .35rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- stavové lišty ---------- */
.flash {
  border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0;
  font-weight: 500; font-size: .95rem;
}
.flash-success { background: var(--green); color: #06170c; }
.flash-warning { background: var(--yellow); color: #241c02; }
.flash-error { background: var(--red); color: #fff; }

.offline-bar {
  background: var(--yellow); color: #241c02;
  text-align: center; padding: .55rem .8rem; font-weight: 500; font-size: .9rem;
  padding-top: calc(.55rem + var(--safe-top));
}

/* PIN zámek nemá logo ani patičku — na střed jde celý obsah. */
[data-screen="pin"] .screen-pad { justify-content: center; }

/* ---------- PIN — 6 samostatných políček (jako pokladní appka) ---------- */
.pin-boxes { display: flex; gap: .5rem; margin-top: 1.2rem; }
.pin-boxes input {
  flex: 1; min-width: 0; max-width: 60px; min-height: 58px; aspect-ratio: 4/5; padding: 0;
  background: var(--card-2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-family: var(--font);
  font-size: 1.5rem; font-weight: 500; text-align: center;
  caret-color: var(--accent);
}
.pin-boxes input:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* decentní podpis Reservo Eats dole na přihlášení */
.eats-brand { text-align: center; padding-top: 1.6rem; color: var(--muted); opacity: .55; }
.eats-brand svg { height: 13px; width: auto; display: inline-block; }

/* ---------- hlavička obrazovek ---------- */
.app-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 64px; flex-shrink: 0;
  padding: .9rem 1.2rem;
  font-family: var(--font-head); font-stretch: 84%; font-size: 1.1rem; font-weight: 760;
}
.scanner-store { width: 100%; min-width: 0; }
.scanner-store summary { display: block; min-height: 36px; padding: 5px 0; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; list-style: none; cursor: pointer; }
.scanner-store summary::-webkit-details-marker { display: none; }
.scanner-store[open] summary { white-space: normal; overflow-wrap: anywhere; }
.scanner-store summary:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }
.app-head--activity { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 8px; }
.app-head--activity .scanner-store summary { min-height: 0; padding-bottom: 0; }
.app-head .device-logout { display: inline-flex; align-items: flex-start; gap: 6px; align-self: flex-start; min-height: 44px; padding: 3px 0 12px; line-height: 20px; color: var(--muted); font-size: 13px; font-weight: 400; }
.app-head .device-logout svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.app-head .device-logout:hover { color: var(--text); }
#pin-store-name { overflow-wrap: anywhere; }

/* ---------- skener ---------- */
.camera-wrap {
  position: relative; flex: 1; margin: 0 1rem;
  border-radius: var(--radius); overflow: hidden; background: #000;
  display: flex; align-items: center; justify-content: center;
  min-height: 300px;
}
.camera-view { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; transform: translate(-50%, -50%); }
#camera-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.camera-fallback { position: relative; z-index: 2; color: var(--muted); text-align: center; padding: 1.5rem; }

/* navazování dlouhého dokladu — spodek minulé části nahoře v hledáčku */
.scan-prev {
  position: absolute; top: 0; left: 0; right: 0; height: 110px;
  overflow: hidden; z-index: 2; pointer-events: none;
  border-bottom: 2px dashed var(--accent);
  background: #000;
}
.scan-prev img {
  width: 100%; height: 100%; object-fit: cover; object-position: bottom;
  opacity: .8; display: block;
}
.scan-prev span {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .65); color: #fff;
  font-size: .72rem; font-weight: 500; white-space: nowrap;
  padding: .2rem .6rem; border-radius: 999px;
  animation: scan-hint-dismiss 0s 2.5s forwards;
}
/* Reappears for each new camera view; hide only the label, retain alignment. */
@keyframes scan-hint-dismiss { to { opacity: 0; visibility: hidden; } }

.scan-frame { position: absolute; inset: 12%; pointer-events: none; z-index: 1; }
.scan-frame i { position: absolute; width: 34px; height: 34px; border: 0 solid #fff; opacity: .95; }
.scan-frame i:nth-child(1) { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 10px; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 10px; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 10px; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 10px; }

.scan-controls {
  display: flex; justify-content: center; align-items: center;
  padding: 1.1rem 1.1rem calc(1.1rem + var(--safe-bottom));
  gap: .6rem;
}
/* jeden řádek — „Nahrát soubor" se nesmí zalomit */
.upload-btn {
  justify-self: start; font-size: .9rem; min-height: 46px;
  white-space: nowrap; padding: 0 1rem;
}
.upload-btn svg { flex: 0 0 18px; }
.scan-controls-spacer { }
.upload-choice {
  position: fixed; inset: 0; margin: auto; width: calc(100% - 2rem); max-width: 380px;
  max-height: calc(100% - 2rem); overflow: auto; padding: 1.4rem;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--card); color: var(--text); box-shadow: 0 18px 60px #0008;
}
.upload-choice::backdrop { background: rgb(0 0 0 / 65%); }
.upload-choice h2 { font-size: 1.4rem; margin-bottom: .35rem; }
.upload-choice > p { color: var(--muted); margin-bottom: 1.1rem; }
.upload-choice-option {
  display: block; width: 100%; text-align: left; padding: 1rem; margin: .6rem 0;
  background: var(--card-2); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
}
.upload-choice-option strong, .upload-choice-option span { display: block; }
.upload-choice-option span { margin-top: .3rem; font-size: .85rem; color: var(--muted); }
.upload-choice button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.upload-choice > .btn { width: 100%; margin-top: .65rem; }
.shutter {
  width: 74px; height: 74px; border-radius: 50%;
  border: 5px solid #fff; background: var(--card-2);
  box-shadow: 0 0 0 4px rgba(255,255,255,.12);
  cursor: pointer; justify-self: center;
  -webkit-tap-highlight-color: transparent;
}
.shutter:active { background: var(--accent); }

/* ---------- Aktivita (rozpracované + dnes odeslané) ---------- */
.today-list { flex: 1; overflow-y: auto; padding: 0 1rem calc(1rem + var(--safe-bottom)); }
.list-head {
  font-family: var(--font-head); font-stretch: 84%; font-weight: 760; font-size: 1rem;
  margin: 1.1rem 0 .6rem; color: var(--text);
}
.activity-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: .3rem 0 .6rem; min-height: 44px; }
.activity-heading .list-head { margin: 0; }
.activity-refresh { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; min-height: 44px; border-radius: 10px; color: var(--muted); }
.activity-refresh:hover { color: var(--text); background: var(--card-2); }
.activity-refresh svg { width: 18px; height: 18px; }
.doc-card {
  background: var(--card); border-radius: var(--radius);
  padding: .95rem .4rem .95rem 1.1rem; margin-bottom: .7rem;
  display: flex; align-items: center; gap: .6rem;
}
.doc-card.doc-tap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.doc-card.doc-tap:active { background: var(--card-2); }
.doc-main { flex: 1; min-width: 0; }
.doc-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-sub { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.doc-cta { color: var(--accent); }
.doc-amount { font-weight: 500; white-space: nowrap; }
/* zahození = samostatný křížek s velkou dotykovou zónou u kraje */
.doc-discard-x {
  flex: none; width: 46px; height: 46px;
  background: none; border: none; color: var(--muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.doc-discard-x:active { color: #ff6b70; }
.sent-row {
  background: var(--card); border-radius: var(--radius);
  padding: .8rem 1.1rem; margin-bottom: .55rem;
  display: flex; align-items: center; gap: .8rem;
}
.sr-amount { font-weight: 500; white-space: nowrap; }
.doc-badge {
  font-size: .72rem; font-weight: 500; padding: .2rem .55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em;
}
.doc-badge.draft { background: var(--yellow); color: #241c02; }
.doc-badge.ok { background: var(--green); color: #06170c; }
.doc-badge.superseded { background: var(--red); color: #fff; }
.doc-fix { font-size: .85rem; color: var(--accent); background: none; border: 1px solid var(--accent); border-radius: 999px; padding: .3rem .8rem; cursor: pointer; font-family: var(--font); }
.doc-discard { color: var(--muted); font-size: .8rem; }
.day-summary {
  background: var(--card-2); border-radius: var(--radius);
  padding: .9rem 1.1rem; margin-bottom: .9rem; font-size: .95rem;
}
.day-summary strong { font-size: 1.15rem; display: block; margin-bottom: .15rem; }

/* ---------- úspěšné odeslání ---------- */
.sent-check {
  width: 104px; height: 104px; border-radius: 50%;
  background: var(--green); color: #06170c;
  display: flex; align-items: center; justify-content: center;
  animation: sent-pop .4s cubic-bezier(.2, 1.4, .4, 1);
}
.sent-check svg { width: 50px; height: 50px; }
@keyframes sent-pop {
  0% { transform: scale(.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- zpracování ---------- */
.processing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; padding: 1.4rem; text-align: center; }
/* nadpis stavu velký, upřesnění času menší tlumené hned pod ním */
.processing h2 { font-size: 1.45rem; margin: 0; }
#processing-sub { margin-top: -0.8rem; font-size: .92rem; }
.retry-icon { font-size: 3rem; color: var(--yellow); }
.processing .btn-block { max-width: 320px; margin-top: 0; }
.add-page { width: 100%; margin: .2rem 0 1rem; font-size: .92rem; }
.spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid var(--card-2); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner.spinner-timed {
  position: relative; width: 72px; height: 72px; border: 0; animation: none;
  display: grid; place-items: center;
}
.spinner-timed::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--card-2); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
#processing-elapsed {
  color: var(--accent); font-size: .88rem; font-weight: 650;
  font-variant-numeric: tabular-nums; line-height: 1;
}
@media (prefers-reduced-motion: reduce) {
  .spinner-timed::before { animation: none; }
}

/* ---------- potvrzení ---------- */
#confirm-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.confirm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.2rem;
  font-family: var(--font-head); font-stretch: 84%; font-weight: 760; font-size: 1.05rem;
}
.confirm-scroll { flex: 1; overflow-y: auto; padding: 0 1.2rem 1rem; }
.confirm-scroll label { display: block; margin-bottom: .9rem; font-size: .9rem; color: var(--muted); }
.confirm-scroll input[type="text"], .confirm-scroll input[type="date"],
.confirm-scroll select {
  width: 100%; margin-top: .3rem;
  background: var(--card-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: var(--font); font-size: 1rem; padding: .7rem .8rem;
  -webkit-appearance: none; appearance: none;
}
.confirm-scroll input:focus, .confirm-scroll select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.confirm-scroll input.field-uncertain, .confirm-scroll select.field-uncertain {
  border-color: var(--yellow); background: rgba(234, 179, 8, .08);
}

/* hlavička: titulek na středu (grid 1fr auto 1fr) */
.confirm-head { display: grid; grid-template-columns: 1fr auto 1fr; }
.confirm-head > :first-child { justify-self: start; }
.confirm-head .ch-title { justify-self: center; }

/* stavový proužek: zelená = vše sedí, žlutá = závady k vyřízení */
.status-strip { border-radius: 12px; padding: .85rem 1rem; margin: .3rem 0 1rem; font-weight: 500; }
.status-strip.ok { background: rgba(53, 199, 89, .16); color: var(--green); }
.status-strip.warn { background: rgba(234, 179, 8, .14); color: var(--yellow); }
.status-strip.warn ul { margin: .45rem 0 0 1.1rem; font-weight: 400; }
.status-strip.warn li { margin: .2rem 0; }
.status-strip.warn details { margin-top: .2rem; }
.status-strip.warn summary { min-height: 44px; padding: .65rem 0; box-sizing: border-box; cursor: pointer; font-size: .9rem; font-weight: 400; }
.status-strip.warn summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
.quality-warning-title { display: block; font-size: 1rem; line-height: 1.4; }
.quality-warning-page { margin-top: .9rem; }
.quality-page-label { display: block; font-size: .78rem; font-weight: 650; opacity: .8; margin-bottom: .35rem; }
.status-strip.warn .quality-issues { list-style: none; margin: .55rem 0 0; padding: 0; }
.status-strip.warn .quality-issues li { display: flex; align-items: flex-start; gap: .75rem; margin: 0; padding: .75rem 0; }
.quality-issues li + li { border-top: 1px solid rgba(234, 179, 8, .2); }
.quality-issue-icon { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; background: rgba(234, 179, 8, .12); }
.quality-issue-icon svg { width: 20px; height: 20px; }
.quality-issues li > div { min-width: 0; }
.quality-issues strong { display: block; font-size: .95rem; line-height: 1.35; font-weight: 650; }
.quality-issues p { margin: .25rem 0 0; font-size: .88rem; line-height: 1.5; font-weight: 400; overflow-wrap: anywhere; }
.quality-duplicate { margin: 0 0 .75rem; }

/* read-only karty souhrnu */
.ro-card { background: var(--card); border-radius: 12px; padding: .35rem 1rem; margin-bottom: .8rem; }
.ro-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--border);
}
.ro-row:last-child { border-bottom: none; }
.ro-row span { color: var(--muted); font-size: .9rem; flex: none; }
.ro-row strong { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.ro-total strong { font-family: var(--font-head); font-stretch: 84%; font-size: 1.25rem; }

/* položka jen ke čtení: název přes šířku, pod ním částka a sazba */
.item-view {
  background: var(--card); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .5rem;
  display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem;
}
.item-view.uncertain { outline: 1px solid var(--yellow); }
.item-view .iv-name { grid-column: 1 / -1; font-weight: 500; overflow-wrap: anywhere; }
.item-view .iv-amount { color: var(--text); }
.item-view .iv-rate { color: var(--muted); justify-self: end; }
.item-view .iv-quantity { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .8rem; margin-top: .3rem; overflow-wrap: anywhere; }
.item-view .iv-quantity > span { color: var(--muted); font-size: .9rem; }
.item-view .iv-quantity > strong { font-weight: 500; }

/* nadpisy sekcí souhrnu */
.confirm-scroll .confirm-section {
  font-family: var(--font-head); font-stretch: 84%; font-weight: 760; font-size: 1.05rem;
  color: var(--text); margin: 1.4rem 0 .6rem;
}

/* obrysové tlačítko (bílý border + text) */
.btn-outline { background: none; border: 1px solid rgba(255, 255, 255, .55); color: var(--text); }
.btn-outline .icon { margin-right: .5rem; }
.confirm-footer .btn-block { margin-top: .6rem; }
.confirm-footer .btn-block:first-child { margin-top: 0; }
.add-page .icon { margin-right: .55rem; font-size: 1.1em; }
.add-note .icon { font-size: .95em; }

/* poznámka pro kancelář */
.note-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.note-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: .9rem 1.2rem; font-family: var(--font-head); font-stretch: 84%; font-weight: 760; font-size: 1.05rem; }
.note-head > :first-child { justify-self: start; }
.note-head .ch-title { justify-self: center; }
.note-guide { padding: 0 1.2rem .6rem; font-size: .9rem; }
.note-area {
  flex: 1; margin: 0 1.2rem 1rem; padding: .9rem 1rem; min-height: 0;
  background: var(--card-2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font: inherit; resize: none;
}
.note-area:focus { outline: 2px solid var(--accent); border-color: transparent; }
.note-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: .7rem .9rem; margin-bottom: .7rem;
}
.note-box .nb-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.note-box .nb-edit { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: .15rem; }
.note-box .nb-edit:hover { color: var(--text); }
.note-box p { margin-top: .35rem; overflow-wrap: anywhere; }

.confirm-footer {
  border-top: 1px solid var(--border); background: var(--card);
  padding: .9rem 1.2rem calc(.9rem + var(--safe-bottom));
}

/* swipe-to-confirm (jako Wolt) — přetažením palce doprava se odesílá */
.swipe-confirm {
  position: relative; height: 58px; border-radius: 999px;
  background: var(--card-2); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.sc-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(53, 199, 89, .22); z-index: 0;
}
.sc-label {
  position: relative; z-index: 1; pointer-events: none;
  font-family: var(--font-head); font-stretch: 84%; font-weight: 760; font-size: 1.02rem;
  padding: 0 2.2rem 0 3.4rem; text-align: center;
}
.sc-chevrons { position: absolute; right: 16px; z-index: 1; pointer-events: none; color: var(--green); font-size: 1.35rem; line-height: 1; }
.sc-chevrons i { font-style: normal; opacity: .25; animation: sc-chev 1.3s infinite; }
.sc-chevrons i:nth-child(2) { animation-delay: .18s; }
.sc-chevrons i:nth-child(3) { animation-delay: .36s; }
@keyframes sc-chev { 0%, 55%, 100% { opacity: .25; } 25% { opacity: 1; } }
.sc-thumb {
  position: absolute; left: 4px; top: 4px; width: 50px; height: 50px;
  border-radius: 50%; border: none; z-index: 2;
  background: var(--green); color: #06170c;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; cursor: grab;
  transition: transform .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.sc-thumb.dragging { transition: none; cursor: grabbing; }
.sc-thumb .icon { width: .95em; height: .95em; }

/* ---------- nafocené části (odložené čtení) ---------- */
.parts {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .9rem;
  padding: 1.4rem; text-align: center;
}
.parts img { max-height: 32vh; max-width: 72%; border-radius: 12px; border: 1px solid var(--border); }
.parts h2 { margin: 0; }
.parts .btn-block { max-width: 340px; margin-top: 0; }
.parts .btn .icon { margin-right: .55rem; }
.parts .parts-discard { color: var(--muted); font-size: .9rem; }
.confirm-sums { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .88rem; color: var(--muted); margin-bottom: .6rem; }
.confirm-sums strong { color: var(--text); }
.confirm-mismatch { color: var(--yellow); font-weight: 500; font-size: .88rem; margin-bottom: .6rem; }
.confirm-error { color: var(--red); font-weight: 500; font-size: .9rem; margin-bottom: .6rem; }
.confirm-footer .btn { width: 100%; }

/* ---------- tabbar ---------- */
.tabbar {
  display: flex; border-top: 1px solid var(--border); background: var(--bg);
  padding-bottom: var(--safe-bottom);
}
.tabbar button {
  flex: 1; min-height: 58px; background: none; border: none;
  color: var(--muted); font-family: var(--font);
  font-size: .72rem; font-weight: 500; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .2rem; padding-top: .5rem;
  -webkit-tap-highlight-color: transparent;
}
.tabbar button.active { color: var(--accent); }
.tabbar button:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; border-radius: 10px; }

/* ---------- návod ---------- */
.navod .card {
  background: var(--card); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin: 1rem 0;
}
.navod ol, .navod ul { padding-left: 1.3rem; }
.navod li { margin: .45rem 0; }
.ios-share { color: var(--accent); }

/* Shared product appearance, retaining scanner touch targets and capture geometry. */
body.app {
 --bg:#17191d;--card:#202328;--card-2:#292e36;--border:#343b45;
 --text:#f5f5f6;--muted:#acb4c0;--radius:12px;
 --font:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;--font-head:var(--font);
}
body.app :is(h1,h2,h3,button,input,textarea,select,.pair-sub,.list-head,.dv-title,.confirm-head,.note-head,.sc-label,.tt-pin,.ro-total strong) {font-family:var(--font);font-stretch:normal}
body.app h1 {font-size:26px;line-height:1.25;letter-spacing:-.5px;font-weight:650}
body.app h2 {font-size:19px;line-height:1.35;letter-spacing:-.2px;font-weight:600}
body.app :is(.pair-sub,.list-head,.dv-title,.confirm-head,.note-head,.sc-label,.ro-total strong) {font-weight:600}
body.app .pair-sub {color:var(--muted);font-size:15px;font-weight:400}
body.app .btn {border-radius:10px;font-size:15px;font-weight:600;line-height:1.35;gap:6px;transition:background-color .15s,transform .15s}
body.app .btn-primary {color:#fff}
body.app .btn-outline {border-color:#536070}
body.app :is(.app-head,.dv-head,.confirm-head,.note-head) {background:var(--bg);border-bottom:1px solid var(--border)}
body.app .confirm-head {grid-template-columns:auto minmax(0,1fr) auto;gap:12px}
body.app .ch-title {text-align:center;line-height:1.35;min-width:0}
body.app .confirm-scroll {padding-top:16px;scrollbar-gutter:stable}
body.app .ro-card {border:1px solid var(--border);padding:4px 16px}
body.app .ro-row {gap:16px}
body.app .ro-total strong {font-size:22px;font-variant-numeric:tabular-nums}
body.app .confirm-footer {background:#111418;padding-top:16px}
body.app :is(.app-tip,.upload-choice) {background:#111418;border-color:#303741;border-radius:16px;padding:24px;box-shadow:0 24px 80px #0007}
body.app .upload-choice-option {font:inherit}
body.app .app-tip-backdrop {background:#05080dc9}
body.app .app-dialog {background:#111418}
body.app .ad-icon {width:80px;height:80px;margin-bottom:24px}
body.app .ad-icon svg {width:36px;height:36px}
body.app .today-list {padding:16px 20px}
body.app :is(.doc-card,.sent-row) {border:1px solid var(--border)}
body.app .doc-title {font-size:15px;font-weight:600;white-space:normal;overflow-wrap:anywhere}
body.app .doc-sub {font-size:13px}
body.app .doc-badge {text-transform:none;letter-spacing:0;white-space:nowrap}
body.app .sent-row {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px}
body.app .sent-row .doc-badge {justify-self:start}
body.app .today-list>p.muted.center {padding:24px 20px;margin:12px 0;border:1px solid var(--border);border-radius:12px;background:var(--card);font-size:14px}
body.app .doc-discard-x {display:inline-flex;align-items:center;justify-content:center;border-radius:50%}
body.app :is(.btn,.linklike,.pill-link,.doc-discard-x):focus-visible {outline:2px solid var(--text);outline-offset:3px}
body.app,body.app * {scrollbar-width:thin;scrollbar-color:#505762 transparent}
body.app ::-webkit-scrollbar {width:8px;height:8px}
body.app ::-webkit-scrollbar-track {background:transparent}
body.app ::-webkit-scrollbar-thumb {background:#505762;border:2px solid transparent;background-clip:padding-box;border-radius:10px}
@media(hover:hover) {
 body.app .btn-primary:hover {filter:brightness(1.1)}
 body.app :is(.btn-ghost,.btn-outline,.doc-discard-x):hover {background:var(--card-2)}
 body.app .doc-discard-x:hover {color:#fff}
}
@media(prefers-reduced-motion:reduce) {body.app .btn {transition:none}}

body.app :is(.photo-quality,.scan-crop-dialog) {background:#111418;border-color:#303741;border-radius:16px;color:var(--text);padding:20px;box-shadow:0 24px 80px #0007}
body.app :is(.photo-quality,.scan-crop-dialog)::backdrop {background:#05080dcc;backdrop-filter:blur(5px)}
body.app .photo-quality h2 {font-size:19px}
body.app .pq-close {display:inline-flex;align-items:center;justify-content:center;line-height:1;background:#252b33;color:var(--text)}
body.app .pq-close:hover {background:#343d49}
body.app :is(.pq-intro,.pq-note) {color:var(--muted)}
body.app .doc-viewer>.scan-toolbar {background:var(--bg);border-color:var(--border)}
html:has(body.app) {scrollbar-width:thin;scrollbar-color:#505762 #17191d}

/* Quiet login footer; pairing is reached from the personal login alternative. */
.pair-footer .pin-help-link{color:var(--muted);font-size:14px;min-height:44px}.pair-footer .scanner-brand{padding-top:24px;text-align:center}.scanner-brand img{width:118px;height:auto;filter:brightness(0) invert(.55);opacity:.8}
