/* ===== Barvy a základní nastavení ===== */
:root {
  --navy: #1e3a5f;
  --accent: #f76b15;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1a1f2b;
  --muted: #667085;
  --line: #e4e7ec;
  --danger: #d92d20;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===== Horní lišta ===== */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--navy); color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 14px;
  display: flex; align-items: center; justify-content: center;
  min-height: 60px;
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.back {
  position: absolute; left: 8px; bottom: 10px;
  background: none; border: 0; color: #fff; font-size: 18px;
  padding: 8px 10px; cursor: pointer;
}

.topbtn {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(255, 255, 255, .12); border: 0; border-radius: 10px;
  font-size: 22px; width: 44px; height: 44px; cursor: pointer;
}
.note { color: #344054; line-height: 1.45; margin: 8px 0 12px; }

/* ===== Obsah ===== */
main {
  max-width: 640px; margin: 0 auto;
  padding: 16px 14px calc(env(safe-area-inset-bottom) + 100px);
}

/* ===== Spodní menu ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: 0; background: none; cursor: pointer;
  padding: 10px 0 12px; font-size: 14px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab .ti { font-size: 24px; filter: grayscale(1); opacity: .6; }
.tab.active { color: var(--navy); }
.tab.active .ti { filter: none; opacity: 1; }

/* ===== Tlačítka ===== */
.btn {
  min-height: 50px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  font-weight: 600; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.block { display: flex; width: 100%; margin: 12px 0; }
.btn.small { min-height: 40px; font-size: 15px; padding: 0 14px; }
.btn.icon { width: 54px; padding: 0; font-size: 30px; line-height: 1; }
.btn.ghost { border: 0; background: none; font-size: 22px; width: 44px; min-height: 44px; }
.btn.add {
  width: 100%; margin-top: 8px; border-style: dashed; color: var(--navy);
  background: #f8fafc;
}
.link { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px; font-size: 15px; }

/* ===== Diář ===== */
.weeknav {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.weeklabel { flex: 1; text-align: center; display: flex; flex-direction: column; align-items: center; }
.weeklabel strong { font-size: 18px; }
.day {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  margin-bottom: 12px; border: 2px solid transparent;
}
.day.today { border-color: var(--accent); }
.dayhead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.dayname { font-weight: 700; font-size: 18px; }
.daydate { color: var(--muted); }
.pill { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.job {
  display: flex; gap: 12px; width: 100%; text-align: left;
  background: #f8fafc; border: 1px solid var(--line); border-left: 4px solid var(--navy);
  border-radius: 10px; padding: 10px 12px; margin-top: 8px; cursor: pointer;
}
.jtime { font-weight: 700; font-size: 18px; min-width: 52px; color: var(--navy); }
.jbody { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jtop { font-weight: 600; }
.jdesc { color: var(--muted); font-size: 15px; white-space: pre-line; }

/* SPZ – vypadá jako značka */
.spz {
  display: inline-block; font-family: ui-monospace, Menlo, monospace; font-weight: 700;
  border: 2px solid #1a1f2b; border-radius: 5px; padding: 0 6px; font-size: 14px;
  background: #fff; letter-spacing: .5px; white-space: nowrap;
}
.spz.big { font-size: 18px; padding: 2px 10px; border-left: 10px solid #2559b8; }

/* ===== Karty a seznamy ===== */
.card {
  display: flex; width: 100%; text-align: left; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; cursor: pointer;
}
.cinfo { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cinfo small { color: var(--muted); font-size: 14px; margin-top: 2px; }
.chev { font-size: 28px; color: var(--muted); }

.search {
  width: 100%; min-height: 52px; border-radius: 12px; border: 1px solid var(--line);
  padding: 0 16px; background: #fff; font-size: 17px;
}

.detail { display: block; cursor: default; }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.detail h2 { margin: 12px 0 8px; font-size: 22px; }
.detail dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: 8px 10px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; font-weight: 600; word-break: break-all; }
.mono { font-family: ui-monospace, Menlo, monospace; }

.sect { margin: 22px 0 10px; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--navy); color: #fff; border-radius: 99px; font-size: 13px; padding: 2px 9px; }

/* Kategorie – „čipy“ pro filtrování */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chip {
  flex: none; min-height: 42px; padding: 0 16px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 15px; cursor: pointer;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Záznam servisu */
.rec { flex-direction: column; align-items: stretch; gap: 6px; border-left: 5px solid var(--k, var(--navy)); }
.rtop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kat { background: var(--k); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 13px; font-weight: 700; }
.rdate { font-weight: 700; }
.km { color: var(--muted); margin-left: auto; font-size: 15px; }
.rcar { font-weight: 600; }
.rdesc { color: #344054; white-space: pre-line; }

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary { color: var(--muted); margin: 8px 0 12px; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ===== Vyskakovací formulář ===== */
.overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(16, 24, 40, .5);
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay[hidden] { display: none; }
.sheet {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 18px);
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheethead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sheethead h2 { margin: 0; font-size: 21px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 50px; border: 1px solid #d0d5dd; border-radius: 10px;
  padding: 10px 12px; background: #fff; font-size: 17px; width: 100%;
}
.field textarea { resize: vertical; }
.field .err { border-color: var(--danger); box-shadow: 0 0 0 3px #fee4e2; }
.sheetbtns { display: flex; gap: 10px; margin-top: 6px; }
.sheetbtns .primary { flex: 1; }

/* ---------- Čtení dokladů ---------- */
.twobtn { display: flex; gap: 10px; margin: 12px 0; }
.twobtn .primary { flex: 2; }
.twobtn .btn { flex: 1; }
.btn.doc { border-color: var(--navy); color: var(--navy); font-weight: 700; }
.progress { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.muted { color: var(--muted); font-size: 14px; }
.okmsg { background: #ecfdf3; color: #05603a; border-radius: 10px; padding: 10px 12px; }
.warnmsg { background: #fffaeb; color: #93370d; border-radius: 10px; padding: 10px 12px; }
.polozka { border: 1px solid var(--line); border-left: 5px solid var(--k, var(--muted)); border-radius: 12px; padding: 10px; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.polozka .prow { display: flex; gap: 8px; align-items: center; }
.polozka input, .polozka select { min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 16px; background: #fff; min-width: 0; }
.polozka .pnazev { flex: 1; }
.polozka .pkat { flex: 1.4; }
.polozka .pcena { flex: 1; text-align: right; }
.rsup { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ===== Poslat dodavateli ===== */
.btn.send { background: var(--navy); border-color: var(--navy); color: #fff; }
.sect.small { font-size: 16px; margin: 14px 0 8px; }
.dodrow { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.btn.dod { flex: 1; justify-content: flex-start; text-align: left; gap: 12px; min-height: 60px; padding: 8px 14px; }
.dodi { font-size: 26px; }

/* ===== Nastavení ===== */
.rezimy { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.rezim { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; min-height: 96px;
  border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.rezim strong { font-size: 18px; }
.rezim small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.rezim.on { border-color: var(--accent); background: #fff6ed; }
.muted { color: var(--muted); }
