/* ============================================================================
   PULT — components.css
   Knihovna komponent. Obrazovky skládají jen z těchto tříd, nikdy
   si nevymýšlejí vlastní vzhled — jinak by se systém rozešel.

   Vrstvy (z-index) viz tokens.css. Hloubka: karta nemá stín, plovoucí vrstva ano.
   ========================================================================= */

/* ============================================================================
   1. TLAČÍTKA
   ========================================================================= */

.btn {
  --btn-h: var(--tap);
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-line: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--btn-h);
  padding: 0 var(--s-5);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-line);
  border-radius: var(--r-md);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(var(--press-scale)); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
}
.btn > svg { flex: 0 0 auto; }

/* Primární — v celé aplikaci je jen jedna na obrazovku. */
.btn-primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--text-on-accent);
  --btn-line: transparent;
  font-weight: var(--fw-semi);
}
.btn-primary:hover:not(:disabled) { --btn-bg: var(--accent-hover); }
.btn-primary:active:not(:disabled) { --btn-bg: var(--accent-press); }

/* Sekundární — výchozí. Bílá plocha, tenká linka. */
.btn-secondary { --btn-bg: var(--surface); }
.btn-secondary:hover:not(:disabled) { --btn-bg: var(--surface-2); }
.btn-secondary:active:not(:disabled) { --btn-bg: var(--surface-3); }

/* Tichý — bez linky, splývá s plochou. */
.btn-ghost {
  --btn-bg: transparent;
  --btn-line: transparent;
  --btn-fg: var(--text-2);
}
.btn-ghost:hover:not(:disabled) { --btn-bg: var(--surface-2); --btn-fg: var(--text); }

/* Akcentní tichý — pro druhou akci, která patří k primární. */
.btn-accent-soft {
  --btn-bg: var(--accent-soft);
  --btn-fg: var(--accent-text);
  --btn-line: transparent;
  font-weight: var(--fw-semi);
}
.btn-accent-soft:hover:not(:disabled) { --btn-bg: var(--accent-soft-2); }

/* Nebezpečný — storno, smazání. */
.btn-danger {
  --btn-bg: transparent;
  --btn-fg: var(--s-danger);
  --btn-line: var(--s-danger-line);
}
.btn-danger:hover:not(:disabled) { --btn-bg: var(--s-danger-soft); }
.btn-danger-solid {
  --btn-bg: var(--s-danger);
  --btn-fg: #fff;
  --btn-line: transparent;
  font-weight: var(--fw-semi);
}

/* Hlavní akce — Zaplatit. Vysoká, aby se trefila i palcem za chůze. */
.btn-action {
  --btn-h: var(--action);
  font-size: var(--fs-lg);
  border-radius: var(--r-lg);
  padding: 0 var(--s-6);
}
.btn-lg { --btn-h: 64px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn-sm {
  --btn-h: 44px;
  padding: 0 var(--s-4);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
}
/* Na telefonu patří i malá tlačítka palci. */
@media (max-width: 599px) {
  .btn-sm { --btn-h: 48px; }
  .btn-icon.btn-sm { --btn-h: 44px; width: 44px; }
}
.btn-block { display: flex; width: 100%; }
.btn-pill { border-radius: var(--r-full); }

/* Ikona bez popisku — jen tam, kde je význam zřejmý a je popisek v ARIA. */
.btn-icon {
  --btn-h: var(--tap);
  width: var(--btn-h);
  padding: 0;
  --btn-bg: transparent;
  --btn-line: transparent;
  --btn-fg: var(--text-2);
  border-radius: var(--r-md);
}
.btn-icon:hover:not(:disabled) { --btn-bg: var(--surface-2); --btn-fg: var(--text); }
.btn-icon.btn-sm { --btn-h: 40px; }

.btn-group { display: flex; gap: var(--s-2); }
.btn-group > .btn { flex: 1 1 0; }

/* ============================================================================
   2. KARTY A PLOCHY
   ========================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--top-light);
}
.card-pad { padding: var(--s-5); }
.card-pad-sm { padding: var(--s-4); }
.card-flush { padding: 0; overflow: hidden; }

.card-hover { transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out); }
.card-hover:hover { border-color: var(--border-strong); }

/* Plovoucí vrstva — jediná, která má skutečný stín. */
.raised {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--elev-3);
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}
.section-head h2, .section-head h3 { font-size: var(--fs-md); font-weight: var(--fw-semi); }

/* Oddělovač sekcí s popiskem — místo nadpisu, když je obsah zřejmý. */
.rule-label {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.rule-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

/* ============================================================================
   3. ODZNAKY A STAVOVÉ PRVKY
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge > svg { width: 13px; height: 13px; }
.badge-ok      { background: var(--s-success-soft); color: var(--s-success); }
.badge-warn    { background: var(--s-warning-soft); color: var(--s-warning); }
.badge-danger  { background: var(--s-danger-soft);  color: var(--s-danger); }
.badge-info    { background: var(--s-info-soft);    color: var(--s-info); }
.badge-accent  { background: var(--accent-soft);    color: var(--accent-text); }
.badge-lg { height: 28px; padding: 0 12px; font-size: var(--fs-sm); }

/* Tečka stavu — vždy s textem nebo ikonou, nikdy sama. */
.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: currentColor;
  flex: 0 0 auto;
}
.dot-lg { width: 10px; height: 10px; }

/* Indikátor „stůl volá" — jediná povolená pulzující věc. */
.pulse-dot {
  position: relative;
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: currentColor;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid currentColor;
  opacity: 0;
  animation: pulse-ring 2s var(--ease-out) infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(.6); opacity: .55; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Řádek s popiskem a hodnotou — páteř všech souhrnů. */
.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 28px;
}
.kv-label { color: var(--text-2); font-size: var(--fs-sm); }
.kv-value { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.kv-lg .kv-label { font-size: var(--fs-md); }
.kv-lg .kv-value { font-size: var(--fs-lg); font-weight: var(--fw-semi); }
.kv-total .kv-label { font-size: var(--fs-lg); font-weight: var(--fw-semi); color: var(--text); }
.kv-total .kv-value { font-size: var(--fs-xl); font-weight: var(--fw-semi); letter-spacing: var(--tracking-tight); }
.kv-discount .kv-value { color: var(--s-success); }

/* ============================================================================
   4. FORMULÁŘOVÉ PRVKY
   ========================================================================= */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.field-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-2);
}
.field-hint { font-size: var(--fs-xs); color: var(--text-3); }
.field-error { font-size: var(--fs-xs); color: var(--s-danger); font-weight: var(--fw-medium); }

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-4);
  font-size: var(--fs-md);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
  appearance: none;
}
.textarea { min-height: 96px; padding: var(--s-3) var(--s-4); line-height: var(--lh-md); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { background: var(--surface-3); }
.input:focus, .select:focus, .textarea:focus {
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.input[aria-invalid="true"] { border-color: var(--s-danger); }
.select {
  padding-right: var(--s-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a6258' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-4) center;
}
:root[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23bdb3a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Vyhledávání — vždy po ruce, funguje i se čtečkou čárových kódů. */
.search {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--tap);
  padding: 0 var(--s-4);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.search:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.search > svg { color: var(--text-3); flex: 0 0 auto; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  font-size: var(--fs-md);
  outline: none;
}
.search-clear { color: var(--text-3); display: flex; }
.search-clear:hover { color: var(--text); }

/* Přepínač (segmented) — volba z mála možností, vždy vidět všechny. */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}
.segmented button {
  flex: 1;
  min-height: 42px;
  padding: 0 var(--s-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-2);
  border-radius: calc(var(--r-md) - 3px);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
  white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: var(--fw-semi);
  box-shadow: var(--elev-1);
}
.segmented-block { display: flex; width: 100%; }

/* Přepínač (switch) */
.switch {
  position: relative;
  width: 52px; height: 32px;
  flex: 0 0 auto;
  background: var(--border-strong);
  border-radius: var(--r-full);
  transition: background-color var(--dur-2) var(--ease-out);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  background: #fff;
  border-radius: var(--r-full);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform var(--dur-2) var(--ease-spring);
}
/* Stav nese řádek (role="switch"), kolečko ho jen zobrazuje. */
.setting-row[aria-checked="true"] .switch,
.switch[aria-checked="true"] { background: var(--accent); }
.setting-row[aria-checked="true"] .switch::after,
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* Přepínač zobrazení (label + popis + switch) */
.setting-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 60px;
  padding: var(--s-3) 0;
  cursor: pointer;
}
.setting-row + .setting-row { border-top: 1px solid var(--border-soft); }
.setting-text { flex: 1; min-width: 0; }
.setting-title { font-size: var(--fs-md); font-weight: var(--fw-medium); }
.setting-desc { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; text-wrap: pretty; }

/* ============================================================================
   5. VOLBY (chips)
   ========================================================================= */

.chip-row {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 44px;
  padding: 0 var(--s-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  white-space: nowrap;
  flex: 0 0 auto;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip:active { transform: scale(var(--press-scale)); }
.chip > svg { width: 18px; height: 18px; }
.chip[aria-pressed="true"], .chip[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  font-weight: var(--fw-semi);
}
.chip-lg { height: 52px; font-size: var(--fs-md); padding: 0 var(--s-5); }
.chip-count {
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  opacity: .7;
}

/* Volba modifikátoru — větší, protože se mačká v rychlosti. */
.option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: var(--tap);
  padding: var(--s-3) var(--s-4);
  text-align: left;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.option:hover { background: var(--surface-3); }
.option[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.option[aria-pressed="true"] .option-name { font-weight: var(--fw-semi); color: var(--accent-text); }
.option-name { font-size: var(--fs-md); }
.option-price { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
.option-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
@media (max-width: 599px) {
  .option-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================================
   6. DLAŽDICE PRODUKTU
   Obsah je hlavní: název a cena nesou dlaždici, nic jiného tam není.
   ========================================================================= */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-3);
  align-content: start;
}
@media (max-width: 1023px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
}
@media (max-width: 599px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 86px;
  padding: var(--s-4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--top-light);
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.tile:hover { border-color: var(--border-strong); }
.tile:active { transform: scale(var(--press-scale)); background: var(--surface-2); }
.tile-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-snug);
  line-height: 1.25;
  text-wrap: pretty;
}
.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.tile-price {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.tile-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--text-3);
}
/* Nejoblíbenější položka — tečka, ne barva celé dlaždice. */
.tile-fav { width: 6px; height: 6px; border-radius: var(--r-full); background: var(--accent); flex: 0 0 auto; }
/* Vyprodáno — šrafování nese informaci i bez barvy, ale nesmí křižovat text. */
.tile-out {
  background-image: repeating-linear-gradient(
    -45deg, transparent 0 8px,
    color-mix(in srgb, var(--text) 5%, transparent) 8px 16px);
  color: var(--text-3);
}
.tile-out .tile-name { color: var(--text-3); }
.tile-out .tile-price { text-decoration: line-through; text-decoration-thickness: 1px; }
/* Skoro dochází — jen tenká linka vlevo, nic víc. */
.tile-low::before {
  content: '';
  position: absolute;
  left: 0; top: 14%; bottom: 14%;
  width: 3px;
  border-radius: var(--r-full);
  background: var(--s-warning);
}
.tile-sm { min-height: 72px; padding: var(--s-3) var(--s-4); }
.tile-sm .tile-name { font-size: var(--fs-sm); }

/* ============================================================================
   7. SEZNAMY
   ========================================================================= */

.list { display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid var(--border-soft); }

.rowitem {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  min-height: var(--tap);
  padding: var(--s-3) var(--s-4);
  text-align: left;
  background: none;
  transition: background-color var(--dur-2) var(--ease-out);
}
.rowitem:hover { background: var(--surface-2); }
.rowitem:active { background: var(--surface-3); }
.rowitem-main { flex: 1; min-width: 0; }
.rowitem-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rowitem-sub {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rowitem-end { flex: 0 0 auto; text-align: right; }
.rowitem-amount {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
}
.rowitem-selected { background: var(--accent-soft); }
.rowitem-selected:hover { background: var(--accent-soft-2); }
.rowitem-danger .rowitem-title { color: var(--s-danger); }

/* Řádek účtu — množství, název, částka. Sloupec částek musí držet. */
.lineitem {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
}
.lineitem-qty {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  min-width: 22px;
}
.lineitem-body { min-width: 0; }
.lineitem-name { font-size: var(--fs-md); line-height: 1.3; text-wrap: pretty; }
.lineitem-mods {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-top: 2px;
  text-wrap: pretty;
}
.lineitem-note {
  font-size: var(--fs-sm);
  color: var(--s-warning);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.lineitem-amount {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.lineitem-sent { opacity: .58; }
.lineitem-done .lineitem-name::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 6px;
  vertical-align: -2px;
  background: currentColor;
  color: var(--s-success);
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}
.lineitem + .lineitem { border-top: 1px solid var(--border-soft); }

/* Prázdný stav — vždy s jasnou další akcí, nikdy jen obrázek. */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-9) var(--s-5);
  text-align: center;
}
.empty-icon {
  width: 56px; height: 56px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: var(--r-full);
}
.empty-title { font-size: var(--fs-lg); font-weight: var(--fw-semi); }
.empty-text { font-size: var(--fs-sm); color: var(--text-2); max-width: 34ch; text-wrap: pretty; }

/* ============================================================================
   8. AVATAR
   ========================================================================= */

.avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: 0 0 auto;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  letter-spacing: .02em;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: var(--r-full);
}
.avatar-lg { width: 52px; height: 52px; font-size: var(--fs-md); }
.avatar-sm { width: 30px; height: 30px; font-size: var(--fs-xs); }
.avatar-tone-i { color: var(--s-info); background: var(--s-info-soft); }
.avatar-tone-w { color: var(--s-warning); background: var(--s-warning-soft); }
.avatar-tone-d { color: var(--s-danger); background: var(--s-danger-soft); }

/* ============================================================================
   9. ČÍSELNÍK A POČÍTADLO MNOŽSTVÍ
   ========================================================================= */

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 3px;
  gap: 2px;
}
.stepper button {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  color: var(--text);
  border-radius: var(--r-full);
  transition: background-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.stepper button:hover { background: var(--surface); }
.stepper button:active { transform: scale(.9); }
.stepper button:disabled { opacity: .35; }
.stepper-value {
  min-width: 44px;
  text-align: center;
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
}
.stepper-lg button { width: 48px; height: 48px; }
.stepper-lg .stepper-value { min-width: 56px; font-size: var(--fs-lg); }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}
.keypad button {
  min-height: 60px;
  font-size: var(--fs-xl);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border-radius: var(--r-md);
  transition: background-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.keypad button:hover { background: var(--surface-3); }
.keypad button:active { transform: scale(.96); background: var(--accent-soft); }
.keypad-key-action { color: var(--text-2); }
.keypad-key-ok { background: var(--accent); color: var(--text-on-accent); }
.keypad-key-ok:hover { background: var(--accent-hover); }

/* PIN zámek */
.pin-dots { display: flex; gap: var(--s-4); justify-content: center; }
.pin-dot {
  width: 14px; height: 14px;
  border-radius: var(--r-full);
  border: 2px solid var(--border-strong);
  transition: background-color var(--dur-2) var(--ease-spring), border-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-spring);
}
.pin-dot[data-filled="true"] { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }

/* ============================================================================
   10. PLOVOUCÍ VRSTVY — SHEET, DIALOG, TOAST, RYCHLÝ PANEL
   ========================================================================= */

.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  background: var(--overlay);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  animation: fade-in var(--dur-3) var(--ease-out) forwards;
}
.scrim[data-closing="true"] { animation: fade-out var(--dur-2) var(--ease-in) forwards; }
@keyframes fade-in { to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* Bottom sheet — na telefonu základní stavební kámen všech voleb. */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-sheet);
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 92vh);
  background: var(--raised);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  border-top: 1px solid var(--border);
  box-shadow: var(--elev-3);
  transition: transform var(--dur-4) var(--ease-out);
  will-change: transform;
}
.sheet[data-snap="half"] { max-height: 58dvh; }
.sheet[data-closing="true"] { transform: translateY(100%); }
.sheet-grab {
  width: 40px; height: 5px;
  margin: var(--s-3) auto var(--s-1);
  border-radius: var(--r-full);
  background: var(--border-strong);
  flex: 0 0 auto;
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5) var(--s-4);
  flex: 0 0 auto;
}
.sheet-title { flex: 1; font-size: var(--fs-lg); font-weight: var(--fw-semi); letter-spacing: var(--tracking-tight); }
.sheet-sub { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; font-weight: var(--fw-regular); }
.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--s-5) var(--s-5);
}
.sheet-foot {
  flex: 0 0 auto;
  padding: var(--s-4) var(--s-5) calc(var(--s-4) + var(--safe-b));
  border-top: 1px solid var(--border-soft);
  background: var(--raised);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Na široké obrazovce se sheet mění na plovoucí panel u strany. */
@media (min-width: 1024px) {
  .sheet {
    left: auto;
    right: var(--s-6);
    bottom: var(--s-6);
    width: min(520px, calc(100vw - var(--s-10)));
    max-height: min(84dvh, 780px);
    border-radius: var(--r-2xl);
    border: 1px solid var(--border);
  }
  .sheet[data-snap="half"] { max-height: min(60dvh, 560px); }
  .sheet-grab { display: none; }
  .sheet-head { padding: var(--s-5) var(--s-6) var(--s-4); }
  .sheet-body { padding: 0 var(--s-6) var(--s-6); }
  .sheet-foot { padding: var(--s-4) var(--s-6) var(--s-5); border-radius: 0 0 var(--r-2xl) var(--r-2xl); }
  .sheet[data-closing="true"] { transform: translateY(12px); opacity: 0; }
  .sheet-center {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - var(--s-10)));
  }
  .sheet-center[data-closing="true"] { transform: translate(-50%, calc(-50% + 8px)); opacity: 0; }
}
@media (max-width: 1023px) {
  .sheet-center { top: auto; }
}

/* Toasty — dole, nikdy nepřekryjí hlavní akci (ta je výš nebo v sheetu). */
.toast-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--s-5) + var(--safe-b));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--s-2);
  width: min(520px, calc(100vw - var(--s-8)));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  background: var(--n-900);
  color: var(--n-50);
  border-radius: var(--r-md);
  box-shadow: var(--elev-3);
  pointer-events: auto;
  animation: toast-in var(--dur-3) var(--ease-spring);
}
:root[data-theme="dark"] .toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); }
.toast-icon { flex: 0 0 auto; display: flex; }
.toast-ok .toast-icon     { color: #7fd7a4; }
.toast-warn .toast-icon   { color: #f3c069; }
.toast-danger .toast-icon { color: #f79b8d; }
.toast-info .toast-icon   { color: #9cb8f5; }
:root[data-theme="dark"] .toast-ok .toast-icon     { color: var(--s-success); }
:root[data-theme="dark"] .toast-warn .toast-icon   { color: var(--s-warning); }
:root[data-theme="dark"] .toast-danger .toast-icon { color: var(--s-danger); }
:root[data-theme="dark"] .toast-info .toast-icon   { color: var(--s-info); }
.toast-text { flex: 1; min-width: 0; }
.toast-title { font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.toast-body { font-size: var(--fs-xs); opacity: .78; margin-top: 1px; }
.toast-action {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 var(--s-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: #9fe0c4;
  border-radius: var(--r-sm);
}
.toast-action:hover { background: rgba(255,255,255,.1); }
:root[data-theme="dark"] .toast-action { color: var(--accent-text); }
.toast-close { flex: 0 0 auto; display: flex; padding: 6px; opacity: .6; border-radius: var(--r-sm); }
.toast-close:hover { opacity: 1; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@media (min-width: 1024px) {
  .toast-stack { left: auto; right: var(--s-6); transform: none; bottom: var(--s-6); }
}

/* ============================================================================
   11. GRAFY
   Bez mřížek a os. Hodnota je vidět z délky, čas z popisků.
   ========================================================================= */

.bars {
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  height: 132px;
}
.bars-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}
.bars-bar {
  width: 100%;
  max-width: 46px;
  min-height: 3px;
  background: var(--accent-soft-2);
  border-radius: var(--r-sm) var(--r-sm) 3px 3px;
  transition: height var(--dur-4) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}
.bars-col:hover .bars-bar { background: var(--accent-line); }
.bars-col[data-current="true"] .bars-bar { background: var(--accent); }
.bars-col[data-empty="true"] .bars-bar { background: var(--surface-3); }
.bars-label { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.bars-value { font-size: var(--fs-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Podíl — vodorovný pruh. */
.share-bar {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
}
.share-seg { height: 100%; transition: width var(--dur-4) var(--ease-out); }
.share-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
.share-legend-item { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.share-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* Jiskrový graf (sparkline) — trend bez jediného popisku. */
.spark { display: block; width: 100%; height: 36px; overflow: visible; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: var(--accent-soft); stroke: none; opacity: .7; }

/* Teplotní pruh hodin — kdy je provoz. */
.heatmap { display: flex; gap: 3px; align-items: flex-end; height: 72px; }
.heatmap-col {
  flex: 1;
  border-radius: var(--r-xs);
  background: color-mix(in oklab, var(--accent) calc(var(--intensity) * 100%), var(--surface-2));
  min-height: 6px;
  transition: height var(--dur-4) var(--ease-out);
}
.heatmap-labels { display: flex; gap: 3px; margin-top: 6px; }
.heatmap-labels span {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   12. ÚČTENKA
   Jediné místo, kde je dekorace povolená — a má funkci: vypadá jako doklad.
   ========================================================================= */

.receipt {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-5);
  font-family: var(--font-num);
  font-size: var(--fs-sm);
  color: var(--text);
}
.receipt-head { text-align: center; padding-bottom: var(--s-3); }
.receipt-venue { font-size: var(--fs-md); font-weight: var(--fw-semi); letter-spacing: var(--tracking-tight); }
.receipt-meta { font-size: var(--fs-xs); color: var(--text-2); line-height: 1.6; }
/* Děrování okraje — naznačuje, že doklad byl odtržen. */
.receipt-tear {
  height: 8px;
  margin: 0 calc(var(--s-5) * -1) var(--s-3);
  background-image: radial-gradient(circle at 4px 4px, var(--bg) 3.5px, transparent 4px);
  background-size: 8px 8px;
  background-repeat: repeat-x;
}
.receipt-rule {
  border: 0;
  border-top: 1px dashed var(--border-strong);
  margin: var(--s-3) 0;
}
.receipt-line {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: var(--s-2);
  padding: 3px 0;
  line-height: 1.4;
}
.receipt-line-amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.receipt-mods { grid-column: 2 / -1; font-size: var(--fs-xs); color: var(--text-2); padding-left: 0; }
.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semi);
  padding-top: var(--s-2);
}
.receipt-foot { text-align: center; font-size: var(--fs-xs); color: var(--text-2); padding-top: var(--s-3); line-height: 1.7; }
.receipt-qr {
  width: 96px; height: 96px;
  margin: var(--s-3) auto;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-align: center;
  padding: var(--s-2);
}

/* ============================================================================
   13. PLOVOUCÍ TLAČÍTKO
   ========================================================================= */

.fab {
  position: fixed;
  z-index: var(--z-nav);
  right: calc(var(--s-4) + var(--safe-r));
  bottom: calc(var(--tabbar) + var(--s-4) + var(--safe-b));
  width: 60px; height: 60px;
  display: grid;
  place-items: center;
  color: var(--text-on-accent);
  background: var(--accent);
  border-radius: var(--r-full);
  box-shadow: 0 4px 14px -2px rgba(20,17,15,.28), 0 2px 5px rgba(20,17,15,.14);
  transition: transform var(--dur-2) var(--ease-spring), background-color var(--dur-2) var(--ease-out);
}
.fab:hover { background: var(--accent-hover); }
.fab:active { transform: scale(.93); }
.fab-wide {
  width: auto;
  padding: 0 var(--s-5) 0 var(--s-4);
  height: 60px;
  gap: var(--s-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  display: flex;
  align-items: center;
}
:root[data-handed="left"] .fab { right: auto; left: calc(var(--s-4) + var(--safe-l)); }
:root[data-handed="left"] .toast-stack { /* zrcadlení na přání — obsah zůstává čitelný */ }

/* ============================================================================
   14. IKONY
   Jednotná sada, tah 1,75 px, zakončení oblá. Velikost se dědí z fontu, když
   není zadána. `currentColor` — ikona nikdy nemá vlastní barvu.
   ========================================================================= */

.icon {
  width: 20px; height: 20px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 28px; height: 28px; }
.icon-2xl { width: 36px; height: 36px; }
.icon-fill { fill: currentColor; stroke: none; }

/* ============================================================================
   15. POMOCNÉ BLOKY
   ========================================================================= */

.scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex: 0 0 auto;
}

.meter {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--dur-4) var(--ease-out);
}
.meter-fill[data-state="low"] { background: var(--s-warning); }
.meter-fill[data-state="empty"] { background: var(--s-danger); }

/* Svislé děrování — opakuje se jen tam, kde odděluje obsah od akcí. */
.hairline { height: 1px; background: var(--border-soft); }


/* ============================================================================
   16. GESTA NA TELEFONU
   Swipe na řádku, stažení seznamu dolů. Gesto je zkratka, ne jediná cesta —
   totéž jde vždy udělat i tlačítkem, takže nic nezávisí na obratnosti prstu.
   ========================================================================= */

.swipe { position: relative; overflow: hidden; }
.swipe-surface {
  position: relative;
  z-index: 1;
  background: var(--surface);
  touch-action: pan-y;
}
.swipe-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: #fff;
  opacity: 0;
  transition: opacity var(--dur-1) var(--ease-out);
}
.swipe-bg svg { width: 20px; height: 20px; }
.swipe-bg-left { background: var(--s-danger); justify-content: flex-end; }
.swipe-bg-right { background: var(--accent); justify-content: flex-start; }
.swipe[data-swipe="left"] .swipe-bg-left,
.swipe[data-swipe="right"] .swipe-bg-right { opacity: 1; }
/* Přejetí za prahem se ohlásí i barvou pruhu, ne jen vzdáleností. */
.swipe[data-ready="true"] .swipe-bg-left { background: var(--s-danger); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.swipe[data-ready="true"] .swipe-bg-right { background: var(--accent-hover); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }

.pull-hint {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 44px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-2);
  opacity: 0;
  pointer-events: none;
}
.pull-hint::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: var(--r-full);
  animation: spin 900ms linear infinite;
}
