:root {
  --bg: #111; --panel: #1a1a1a; --panel2: #222; --line: #2e2e2e; --text: #f2f2f2; --muted: #9a9a9a; --accent: #ededed;
  --ok: #3ecf8e; --warn: #f5a524; --bad: #f05252; --info: #6aa9ff;
  --r: 12px; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.skryt { display: none !important; }
.muted { color: var(--muted); }
.mala { font-size: 13px; }
.tucne { font-weight: 600; }
.vpravo { text-align: right; }
.radek { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mezera { flex: 1; }
.ik { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* rozložení */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.menu { border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.logo { font-weight: 700; padding: 6px 10px 16px; letter-spacing: .2px; }
.logo small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.menu a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: var(--muted); }
.menu a:hover { background: var(--panel); color: var(--text); }
.menu a.aktivni { background: var(--panel2); color: var(--text); }
.menu .dole { margin-top: auto; font-size: 13px; color: var(--muted); padding: 10px; }
main { padding: 22px 26px 90px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 16px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 14px; margin: 14px 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.dolni-menu { display: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .menu { display: none; }
  main { padding: 14px 14px 96px; }
  .dolni-menu { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #151515; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; justify-content: space-around; }
  .dolni-menu a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 6px; min-width: 56px; }
  .dolni-menu a.aktivni { color: var(--text); }
  h1 { font-size: 20px; }
  .zak-hlava .mezera { flex: 1 1 calc(100% - 60px); }
  .zak-hlava > .radek { width: 100%; }
  .zak-hlava > .radek .btn { flex: 1; justify-content: center; }
  .seznam .polozka { flex-wrap: wrap; }
  .panel { padding: 13px; }
}

/* prvky */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #444; }
.btn.hl { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
.btn.male { padding: 5px 9px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn.cervene { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: #0d0d0d; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #555; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
label.pole { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.pole > span { padding-left: 2px; }
.mrizka { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.panely { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.stitek { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.stitek.ok { color: var(--ok); border-color: #1f4d39; }
.stitek.warn { color: var(--warn); border-color: #5a4415; }
.stitek.bad { color: var(--bad); border-color: #5a2020; }
.stitek.info { color: var(--info); border-color: #24406a; }
.seznam { display: flex; flex-direction: column; }
.seznam .polozka { display: flex; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.seznam .polozka:last-child { border-bottom: 0; }
.seznam .polozka:hover { background: #1e1e1e; }
.prazdne { color: var(--muted); padding: 10px 0; font-size: 14px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.tab-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* čísla */
.karty { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.karta-cislo { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.karta-cislo .h { font-size: 24px; font-weight: 650; margin-top: 4px; }
.karta-cislo .p { font-size: 13px; color: var(--muted); }
.bar { height: 6px; background: var(--panel2); border-radius: 9px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.sloupec { flex: 0 0 250px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-height: 120px; }
.sloupec.nad { border-color: #666; }
.sloupec .hlava { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 2px 4px 10px; }
.karta { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.karta:hover { border-color: #4a4a4a; }
.karta .jm { font-weight: 600; }
.karta .info { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; flex-direction: column; gap: 2px; }

/* zakázka */
.zak-hlava { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.faze-pruh { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 4px; }
.faze-pruh button { flex: 1 0 auto; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12.5px; cursor: pointer; }
.faze-pruh button.hotova { color: var(--text); background: #1f1f1f; }
.faze-pruh button.ted { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
.zalozky { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.zalozky a { padding: 9px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.zalozky a.aktivni { color: var(--text); border-color: var(--text); }

/* protokol */
.protokol td, .protokol th { padding: 4px 6px; white-space: nowrap; }
.protokol input { width: 74px; padding: 6px; text-align: right; }
.bunka { display: flex; gap: 4px; align-items: center; }
.foto-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; flex: none; }
.foto-btn.ma { color: var(--ok); border-color: #1f4d39; }
.sloupec-hlava { font-size: 12px; line-height: 1.3; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.galerie a { display: block; aspect-ratio: 1; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: #000; position: relative; }
.galerie img { width: 100%; height: 100%; object-fit: cover; }
.galerie span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; padding: 3px 5px; background: rgba(0,0,0,.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podpis { background: #fff; border-radius: 10px; width: 100%; height: 220px; touch-action: none; display: block; }

/* okno */
.okno { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px; overflow-y: auto; }
.okno > div { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: 100%; max-width: 620px; }
@media (max-width: 820px) { .okno { padding: 0; align-items: stretch; } .okno > div { border-radius: 0; min-height: 100%; max-width: none; padding-bottom: 100px; } }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--accent); color: #111; padding: 9px 16px; border-radius: 10px; font-weight: 600; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.vid { opacity: 1; }
#toast.chyba { background: var(--bad); color: #fff; }

/* přihlášení */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }

/* tisk dokumentů */
#tisk { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; color: #000; }
  #app, #okno, #toast, .dolni-menu { display: none !important; }
  #tisk { display: block; }
}
.dok { font: 11pt/1.4 -apple-system, "Segoe UI", Arial, sans-serif; color: #000; }
.dok h1 { font-size: 17pt; margin: 0 0 4mm; }
.dok .hl { display: flex; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 3mm; margin-bottom: 5mm; gap: 10mm; }
.dok table { border-collapse: collapse; width: 100%; margin: 3mm 0; }
.dok th, .dok td { border: 1px solid #999; padding: 2mm; font-size: 10pt; color: #000; text-transform: none; letter-spacing: 0; }
.dok th { background: #eee; font-weight: 600; }
.dok .udaje { display: grid; grid-template-columns: 1fr 1fr; gap: 1mm 8mm; margin-bottom: 4mm; }
.dok .podpisy { display: flex; justify-content: space-between; margin-top: 14mm; gap: 10mm; }
.dok .podpisy div { flex: 1; border-top: 1px solid #000; padding-top: 2mm; text-align: center; font-size: 9pt; }
.dok .podpisy img { max-height: 22mm; display: block; margin: 0 auto -2mm; }
.dok .celkem { font-size: 13pt; font-weight: 700; text-align: right; margin-top: 3mm; }
.dok .fotky { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; }
.dok .fotky img { width: 100%; height: 60mm; object-fit: cover; }
