:root {
  --midnight: #191441;
  --tech: #3c2db4;
  --zlta: #ffe100;
  --cervena: #9c1f1f;
  --zelena: #1b7a3d;
  --beton: #eaeaea;
  --papier: #f6f7fa;
  --biela: #ffffff;
  --text: #1a1a1a;
  --tlmene: #5a5f6e;
  --ram: #d5d9e3;
  --tien: 0 1px 3px rgba(25, 20, 65, .12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--papier);
  color: var(--text);
  font-family: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: 76px; }

/* ------------------------------------------------------------ hlavička */

header.hlavicka {
  background: var(--midnight);
  color: var(--biela);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.hlavicka h1 { font-size: 16px; margin: 0; letter-spacing: .5px; font-weight: 800; }
.hlavicka .pod { font-size: 12px; opacity: .75; margin-top: 2px; }
.hlavicka .kto { margin-left: auto; text-align: right; font-size: 12px; line-height: 1.35; }
.hlavicka .kto b { display: block; font-size: 13px; }
.hlavicka .kto button {
  background: none; border: 1px solid rgba(255, 255, 255, .35); color: var(--biela);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; margin-top: 4px; cursor: pointer;
}
.pasik { height: 4px; background: var(--zlta); }

/* --------------------------------------------------------------- obsah */

main { padding: 14px 16px 20px; max-width: 960px; margin: 0 auto; }
h2 { font-size: 18px; margin: 0 0 12px; color: var(--midnight); }
h3 { font-size: 14px; margin: 20px 0 8px; color: var(--midnight); text-transform: uppercase; letter-spacing: .5px; }

.karta {
  background: var(--biela);
  border: 1px solid var(--ram);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--tien);
}

/* ------------------------------------------------------------ formulár */

label.pole { display: block; margin-bottom: 16px; }
label.pole > span.nazov {
  display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--midnight);
}
label.pole > span.nazov em { font-style: normal; color: var(--cervena); }
.napoveda { font-size: 12px; color: var(--tlmene); margin-top: 4px; font-weight: 400; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=search], input[type=date], select, textarea {
  width: 100%;
  padding: 13px 12px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--ram);
  border-radius: 10px;
  background: var(--biela);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(60, 45, 180, .25); border-color: var(--tech); }
textarea { min-height: 72px; resize: vertical; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--tlmene) 50%), linear-gradient(135deg, var(--tlmene) 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.dvojica { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trojica { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* -------------------------------------------------------------- tlačidlá */

button, .tlacidlo {
  font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
  border-radius: 10px; border: 1px solid transparent; padding: 14px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
.hlavne { background: var(--zlta); color: var(--midnight); width: 100%; font-size: 17px; }
.vedlajsie { background: var(--biela); color: var(--midnight); border-color: var(--ram); }
.tmave { background: var(--midnight); color: var(--biela); }
.nebezpecne { background: var(--biela); color: var(--cervena); border-color: var(--cervena); }
.uzky { padding: 9px 12px; font-size: 14px; }
.siroke { width: 100%; }

/* --------------------------------------------------------- nový výdaj */

.krok { font-size: 13px; font-weight: 700; color: var(--midnight); margin-bottom: 8px; display: block; }
.krok em { font-style: normal; color: var(--cervena); }

.skenovacieTlacidlo {
  background: var(--tech); color: var(--biela); width: 100%; font-size: 18px; padding: 20px;
}
.skenovacieTlacidlo .ikona { font-size: 24px; }

.dlazdice { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.dlazdice button {
  flex-direction: column; align-items: flex-start; text-align: left; gap: 3px;
  background: var(--biela); border: 1px solid var(--ram); padding: 11px 12px; font-size: 14px;
}
.dlazdice button b { font-weight: 700; line-height: 1.25; }
.dlazdice button small { color: var(--tlmene); font-size: 12px; font-weight: 500; }

.polozka {
  display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--beton);
}
.polozka:last-child { border-bottom: none; }
.polozka .telo { flex: 1; min-width: 0; }
.polozka .nazovPolozky { font-weight: 700; font-size: 15px; }
.polozka .meta { font-size: 12px; color: var(--tlmene); margin-top: 2px; }
.polozka input.mnozstvo {
  width: 84px; padding: 8px 6px; text-align: center; font-size: 16px; font-weight: 700; flex: none;
}
.polozka select.jednotka { width: 74px; padding: 8px 4px; font-size: 14px; flex: none; background-image: none; padding-right: 4px; text-align: center; }
.polozka .suma { font-weight: 800; white-space: nowrap; min-width: 76px; text-align: right; }
.polozka button.prec {
  background: none; border: none; color: var(--cervena); font-size: 20px; padding: 4px 6px; flex: none;
}

.mnozstvoPlus { display: flex; gap: 4px; align-items: center; }
.mnozstvoPlus button {
  width: 38px; height: 38px; padding: 0; font-size: 20px; background: var(--beton);
  color: var(--midnight); border: none; flex: none;
}

.suhrnDokladu {
  position: sticky; bottom: 76px; background: var(--midnight); color: var(--biela);
  border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; margin-top: 12px;
}
.suhrnDokladu .popis { font-size: 12px; opacity: .8; }
.suhrnDokladu .hodnota { font-size: 20px; font-weight: 800; }

/* ------------------------------------------------------------- zoznam */

.doklad { display: flex; gap: 12px; align-items: flex-start; }
.doklad .telo { flex: 1; min-width: 0; }
.doklad .riadok1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.doklad .cislo { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.doklad .meta { font-size: 13px; color: var(--tlmene); margin-top: 3px; }
.doklad .suma { margin-left: auto; font-weight: 800; font-size: 16px; white-space: nowrap; }
.doklad.storno { opacity: .55; }
.doklad.storno .cislo { text-decoration: line-through; }

.znacka {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px;
  letter-spacing: .3px; vertical-align: middle;
}
.zn-otvoreny { background: #fff9e0; color: #7a5c00; border: 1px solid #ecd98d; }
.zn-uzavrety { background: #f1efff; color: var(--tech); border: 1px solid #d3ccf5; }
.zn-vystaveny { background: #e8f5ec; color: var(--zelena); border: 1px solid #b8dcc4; }
.zn-stornovany { background: var(--beton); color: var(--tlmene); }
.zn-vratka { background: #fdf3f3; color: var(--cervena); border: 1px solid #eccccc; }
.zn-stary { background: var(--cervena); color: #fff; }

/* ------------------------------------------------------------- ostatné */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--biela); border: 1px solid var(--ram); border-radius: 12px; padding: 12px 14px; box-shadow: var(--tien); }
.kpi .popis { font-size: 12px; color: var(--tlmene); }
.kpi .hodnota { font-size: 21px; font-weight: 800; margin-top: 2px; color: var(--midnight); }
.kpi.cervena .hodnota { color: var(--cervena); }

table.tab { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--biela); }
table.tab th, table.tab td { border: 1px solid var(--ram); padding: 8px 10px; text-align: left; }
table.tab th { background: var(--midnight); color: var(--biela); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.tab td.cislo { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tab tr.suchy td { color: var(--tlmene); }
.tabulkaObal { overflow-x: auto; border-radius: 10px; border: 1px solid var(--ram); }

.oznam { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; border: 1px solid; }
.oznam.chyba { background: #fdf3f3; color: var(--cervena); border-color: #eccccc; }
.oznam.ok { background: #e8f5ec; color: var(--zelena); border-color: #b8dcc4; }
.oznam.info { background: #fff9e0; color: #7a5c00; border-color: #ecd98d; }

nav.spodne {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--biela);
  border-top: 1px solid var(--ram); display: flex; z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
nav.spodne button {
  flex: 1; flex-direction: column; gap: 3px; background: none; border: none; border-radius: 0;
  padding: 9px 4px 10px; font-size: 11px; font-weight: 600; color: var(--tlmene);
}
nav.spodne button .ikona { font-size: 20px; line-height: 1; position: relative; display: inline-block; }
nav.spodne button[aria-current=page] { color: var(--tech); box-shadow: inset 0 3px 0 var(--tech); }
.odznak {
  position: absolute; top: -6px; right: -12px; background: var(--cervena); color: #fff;
  font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.prazdne { text-align: center; color: var(--tlmene); padding: 34px 16px; font-size: 15px; }

dialog {
  border: none; border-radius: 14px; padding: 0; max-width: 620px; width: calc(100% - 28px);
  box-shadow: 0 12px 40px rgba(25, 20, 65, .3);
}
dialog::backdrop { background: rgba(25, 20, 65, .55); }
dialog .obsah { padding: 18px; }
dialog h2 { margin-bottom: 4px; }

.hore { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.hore select, .hore input { width: auto; min-width: 160px; }
.hore .vpravo { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.navrhy { border: 1px solid var(--ram); border-radius: 10px; background: var(--biela); max-height: 280px; overflow-y: auto; margin-top: 6px; }
.navrhy button {
  display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 0;
  padding: 10px 12px; font-size: 14px; font-weight: 500; border-bottom: 1px solid var(--beton);
}
.navrhy button:last-child { border-bottom: none; }
.navrhy button b { display: block; font-weight: 700; }
.navrhy button small { display: block; color: var(--tlmene); font-size: 12px; }

.karta.uloha { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.karta.uloha:hover { border-color: var(--tech); }
.ulohaPocet {
  flex: none; min-width: 46px; height: 46px; border-radius: 12px; background: var(--zlta);
  color: var(--midnight); font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 8px;
}
.ulohaTelo { flex: 1; min-width: 0; }
.ulohaTelo .meta { font-size: 13px; color: var(--tlmene); margin-top: 2px; }
.ulohaSipka { font-size: 26px; color: var(--tlmene); line-height: 1; }

.dokladMoney { flex: 1; min-width: 150px; }

/* ---------------------------------------------------- prihlásenie */

.polePin {
  font-size: 30px; letter-spacing: 10px; text-align: center; font-weight: 800; padding: 14px 12px;
}
.polePin::placeholder { font-size: 17px; letter-spacing: normal; font-weight: 500; }
.prihlasenieEmailom summary { cursor: pointer; font-weight: 600; color: var(--tech); list-style: none; padding: 2px 0; }
.prihlasenieEmailom summary::-webkit-details-marker { display: none; }
.prihlasenieEmailom summary::before { content: '▸ '; }
.prihlasenieEmailom[open] summary::before { content: '▾ '; }

/* --------------------------------------------------------- skener */

dialog.kameraDialog {
  max-width: none; width: 100vw; height: 100vh; max-height: 100vh;
  background: #000; border-radius: 0; padding: 0;
}
dialog.kameraDialog::backdrop { background: #000; }
.kameraObal { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.kameraObal video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.kameraOvladanie {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
}
.kameraOvladanie .vedlajsie { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .45); }
.skenerPocet { color: #fff; font-weight: 700; font-size: 15px; }
.skenerRamik {
  position: absolute; left: 6%; right: 6%; top: 37%; height: 26%;
  border: 3px solid var(--zlta); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
}
.skenerPokyn {
  position: absolute; top: 14%; left: 0; right: 0; text-align: center;
  color: #fff; font-size: 15px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.skenerHlaska {
  position: absolute; left: 16px; right: 16px; bottom: 96px; background: rgba(27, 122, 61, .95);
  color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.skenerHlaska.vidno { opacity: 1; }

.sKodom { display: flex; gap: 8px; }
.sKodom input { flex: 1; }
.sKodom button { flex: none; white-space: nowrap; }

@media (min-width: 720px) {
  body { padding-bottom: 0; }
  nav.spodne { position: static; border-top: none; border-bottom: 1px solid var(--ram); }
  nav.spodne button { flex-direction: row; font-size: 13px; padding: 12px 8px; }
  .suhrnDokladu { position: static; }
}

/* --------------------------------------------------------- podpis */

.podpisRamik {
  position: relative; border: 2px dashed var(--ram); border-radius: 12px;
  background: var(--biela); overflow: hidden;
}
.podpisRamik canvas { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.podpisCiara {
  position: absolute; left: 8%; right: 8%; bottom: 34px; border-bottom: 1px solid var(--ram);
  pointer-events: none;
}
.podpisNahlad { border: 1px solid var(--ram); border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; background: var(--biela); }
.podpisNahlad img { display: block; max-width: 280px; width: 100%; margin-top: 4px; }

/* cena položky sa dá doplniť ťuknutím priamo v zozname */
button.cenaPolozky {
  background: none; border: none; padding: 0; font: inherit; font-weight: 600;
  color: var(--tech); text-decoration: underline; text-underline-offset: 2px;
}
button.cenaPolozky.chyba { color: var(--cervena); font-weight: 800; }

/* -------------------------------------------------- odpisy a réžia */

button.spustO {
  width: 76px; height: 76px; border-radius: 50%; background: var(--zlta);
  border: 5px solid rgba(255, 255, 255, .85); padding: 0; flex: none;
}
button.spustO:active { transform: scale(.94); }

.prepinacDruhu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.prepinacDruhu button {
  flex-direction: column; padding: 14px 8px; background: var(--biela);
  border: 2px solid var(--ram); color: var(--tlmene); gap: 3px;
}
.prepinacDruhu button .kod { font-size: 22px; font-weight: 800; line-height: 1; }
.prepinacDruhu button .popis { font-size: 12px; font-weight: 600; }
.prepinacDruhu button[aria-pressed=true].vydaj { border-color: var(--tech); background: #f1efff; color: var(--tech); }
.prepinacDruhu button[aria-pressed=true].odpis { border-color: var(--cervena); background: #fdf3f3; color: var(--cervena); }
.prepinacDruhu button[aria-pressed=true].rezia { border-color: var(--zelena); background: #e8f5ec; color: var(--zelena); }

.fotomriezka { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 6px; }
.fotomriezka figure { margin: 0; position: relative; }
.fotomriezka img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--ram); }
.fotomriezka button.zmazat {
  position: absolute; top: 3px; right: 3px; background: rgba(0, 0, 0, .65); color: #fff;
  border-radius: 50%; width: 24px; height: 24px; padding: 0; font-size: 14px; line-height: 1;
}
.polozkaOdpisu { border-bottom: 1px solid var(--beton); padding: 12px 0; }
.polozkaOdpisu:last-child { border-bottom: none; }
.polozkaOdpisu .hlava { display: flex; gap: 10px; align-items: center; }
.polozkaOdpisu .hlava .telo { flex: 1; min-width: 0; }
.polozkaOdpisu .chybaFotky { color: var(--cervena); font-weight: 700; font-size: 12px; }

.zn-odpis { background: #fdf3f3; color: var(--cervena); border: 1px solid #eccccc; }
.zn-rezia { background: #e8f5ec; color: var(--zelena); border: 1px solid #b8dcc4; }
.zn-vydaj { background: #f1efff; color: var(--tech); border: 1px solid #d3ccf5; }
.zn-krit { background: var(--cervena); color: #fff; }
.zn-opak { background: #fff4d6; color: #8a6100; border: 1px solid #e8d08a; }
.zn-neuznany { background: var(--cervena); color: #fff; }
