/* RevizeApp V2 — styly. Výchozí téma „mr" = vzhled portálu Můj Revizák (11. 9. 2026): krémová stránka, bílé karty,
   zlatá pro akce (tmavý text na zlaté!), Inter, lucide ikony. Tmavé/lesní téma přepisuje tokeny přes js/utils/theme.js. */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/assets/fonts/inter-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-soft: #F3EEE4;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #C7A86B;
  --primary-hover: #B8955A;
  --primary-text: #7a5f26;
  --on-primary: #0f172a;
  --ok: #15803d;
  --fail: #dc2626;
  --danger: #dc2626;
  --warn: #b45309;
  --border: #E9E1D3;
  --overlay: rgba(15,23,42,0.45);
  --shadow-card: 0 1px 2px rgba(15,23,42,0.05);
  --radius: 8px;
  --row-h: 56px;
  --nav-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 14px; }
/* Mobil (E 12. 9. 2026): tažení dolů na vrchu stránky NESMÍ obnovit appku (Chrome Android pull-to-refresh
   restartoval rozepsanou kartu). Obnovení verze hlásí toast v app.js. */
html, body { overscroll-behavior-y: none; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

#app {
  max-width: 640px;
  margin: 0 auto;
  /* boky: min. 12 px, na iPhonu na šířku respektuj výřez (viewport-fit=cover) */
  padding: 0 max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
}

/* ========== HEADER ========== */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}
.app-header h1 {
  flex: 1;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== BOTTOM NAV ========== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15,23,42,0.06);
  display: flex;
  z-index: 100;
}
/* Při otevřené klávesnici dolní lištu skryj — jinak ji iOS připne nad
   klávesnici a překáží při psaní. */
body.kb-open .bottom-nav { display: none !important; }
.bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
  background: none;
  transition: color 0.15s;
}
.bottom-nav .nav-item.active,
.bottom-nav .nav-item:active { color: var(--primary-text); font-weight: 600; }
.bottom-nav .nav-item .nav-icon { font-size: 1.3rem; display: flex; }
.bottom-nav .nav-item .nav-icon svg { width: 22px; height: 22px; }

/* ========== BUTTONS ========== */
.btn {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:active { opacity: 0.75; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-fail { background: var(--fail); border-color: var(--fail); color: #fff; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #000; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 0.85rem; min-height: 40px; }
.btn-xs { padding: 10px 14px; font-size: 0.8rem; min-height: 40px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:active { background: var(--bg-soft); }
.btn-ghost.active { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary-text); }
.btn-group { display: flex; gap: 6px; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 10px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}
/* Přetečení na mobilu (E 12. 9. 2026): <input type=date> má v Chromiu vnitřní min. šířku ~178 px a fieldset
   výchozí min-width: min-content → dva datumy vedle sebe roztáhly stránku na 402 px a fixní lišta vypadla z displeje. */
fieldset { min-width: 0; }
.form-row > * { min-width: 0; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* CRITICAL: 16px MUSÍ být s !important. iOS Safari zoomuje cokoli < 16px
     (input, select, textarea = vše triggeruje auto-zoom). Bez !important
     specifičtější selektory (.setting-row select, .search-full) přepsaly
     globální 16px → uživatel viděl zoom při kliknutí na list/dropdown.
     Pevně 16px (ne rem) protože root font-size se mění s theme.fontSize. */
  font-size: 16px !important;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
/* Checkboxy: globální appearance:none (pro textová pole) jim vypínal nativní
   vzhled → fajfka po zaškrtnutí NEBYLA vidět. Vrátit nativní render + barva appky. */
input[type="checkbox"] {
  -webkit-appearance: checkbox;
  appearance: auto;
  width: 20px;
  height: 20px;
  padding: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}
.form-row > div { display: flex; flex-direction: column; justify-content: flex-end; }
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}
.form-row-3 > div { display: flex; flex-direction: column; justify-content: flex-end; }
.input-with-btn {
  display: flex;
  gap: 4px;
}
.input-with-btn input { flex: 1; }

/* Input clear button */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap input { flex: 1; padding-right: 28px; }
.input-wrap .input-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.input-wrap input:not(:placeholder-shown) + .input-clear { display: inline-flex; }

/* ========== LOGIN — 1:1 podle přihlášení portálu (PrihlaseniStranka.tsx); vždy světlé, nezávisle na tématu ========== */
.login-screen {
  position: fixed; inset: 0; overflow: auto; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); box-sizing: border-box;
  background: linear-gradient(180deg, #F0EDE5 0%, #ffffff 50%, #F0EDE5 100%);
  color: #0f172a;
}
.login-screen::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 45% at 50% 0%, rgba(199,168,107,0.14), transparent 70%); }
.login-shell {
  position: relative; width: 100%; max-width: 1040px; display: grid; grid-template-columns: 1fr;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 24px; overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(15,23,42,0.14);
}
.login-brand { position: relative; background: #F7F4EC; padding: 28px 24px; border-bottom: 1px solid #e2e8f0; display: flex; flex-direction: column; justify-content: space-between; text-align: left; }
.login-brand::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(80% 60% at 0% 100%, rgba(199,168,107,0.16), transparent 65%); }
.login-brand > * { position: relative; }
.login-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-logo img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 0 0 1px rgba(199,168,107,0.3); }
.login-logo strong { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; color: #0f172a; }
.login-brand h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; color: #0f172a; margin: 0; }
.login-brand h1 span { display: block; color: #C7A86B; }
.login-lead { margin-top: 12px; color: #475569; font-size: 0.9rem; line-height: 1.55; }
.login-benefits { display: none; list-style: none; margin: 28px 0 0; padding: 0; }
.login-benefits li { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.login-benefit-ico { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px #e2e8f0, 0 1px 2px rgba(15,23,42,0.06); display: flex; align-items: center; justify-content: center; color: #C7A86B; margin-top: 2px; }
.login-benefits b { display: block; font-size: 0.9rem; font-weight: 600; color: #0f172a; }
.login-benefits small { display: block; margin-top: 2px; font-size: 0.8rem; color: #64748b; line-height: 1.5; }
.login-brand-foot { margin-top: 28px; font-size: 11px; color: #94a3b8; }
.login-form-panel { padding: 28px 24px; text-align: left; display: flex; flex-direction: column; justify-content: center; }
.login-form-panel h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; color: #0f172a; margin: 0 0 4px; }
.login-sub { color: #475569; font-size: 0.9rem; margin: 0 0 22px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; font-weight: 500; color: #0f172a; margin-bottom: 6px; }
.login-forgot { font-size: 0.8rem; font-weight: 600; color: #A8853B; text-decoration: none; padding: 8px 0; margin: -8px 0; }
.login-forgot:hover { text-decoration: underline; }
.login-input { position: relative; display: flex; align-items: center; }
.login-input > .ico { position: absolute; left: 14px; color: #94a3b8; pointer-events: none; }
.login-input input { height: 48px; padding: 0 44px 0 44px; background: #fff; color: #0f172a; border: 1px solid #cbd5e1; border-radius: 10px; }
.login-input input::placeholder { color: #94a3b8; }
.login-input input:focus { border-color: #A8853B; box-shadow: 0 0 0 3px rgba(199,168,107,0.22); }
.login-eye { position: absolute; right: 4px; width: 40px; height: 40px; border: none; background: none; color: #94a3b8; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.login-eye:hover { color: #475569; background: #f1f5f9; }
.btn-login { width: 100%; height: 48px; margin-top: 4px; background: #C7A86B; color: #0f172a; border: none; border-radius: 10px; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(15,23,42,0.08); }
.btn-login:hover { background: #B8955A; }
.btn-login:disabled { opacity: 0.6; cursor: wait; }
.btn-offline { width: 100%; height: 44px; margin-top: 10px; background: #fff; color: #0f172a; border: 1px solid #cbd5e1; border-radius: 10px; font-weight: 600; font-size: 0.85rem; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.btn-offline:hover { border-color: #A8853B; }
.login-note { margin-top: 20px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 16px; font-size: 0.8rem; color: #475569; text-align: center; line-height: 1.5; }
.login-note a { color: #A8853B; font-weight: 600; text-decoration: none; }
.login-secure { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.8rem; color: #94a3b8; }
.login-verze { margin-top: 4px; text-align: center; font-size: 10px; color: #cbd5e1; }
.login-offline-hint { margin: -8px 0 14px; font-size: 0.8rem; color: #64748b; }
.error-msg { color: #b04545; font-size: 0.85rem; margin-top: 8px; }
.login-form-panel .error-msg[hidden] { display: none; }
.login-form-panel .error-msg { margin-top: 12px; background: #fbecec; border: 1px solid #f2c2c2; border-radius: 10px; padding: 10px 12px; display: flex; gap: 8px; align-items: flex-start; }
@media (min-width: 900px) {
  .login-shell { grid-template-columns: 1fr 1fr; }
  .login-brand { border-bottom: none; border-right: 1px solid #e2e8f0; padding: 40px; }
  .login-form-panel { padding: 40px; }
  .login-benefits { display: block; }
  .login-brand h1 { font-size: 2rem; }
}

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: border 0.15s;
  border: 1px solid transparent;
}
.stat-box.active { border-color: var(--primary); }
.stat-value { display: block; font-size: 1.4rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }
.stat-box .stat-value.text-ok { color: var(--ok); }
.stat-box .stat-value.text-fail { color: var(--fail); }
.stat-box .stat-value.text-warn { color: var(--warn); }

/* ========== STATUS BLOCKS (V1-style) ========== */
.status-blocks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.status-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 2px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.status-block .sb-count {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
}
.status-block .sb-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.status-block-vyprselo { border-color: var(--fail); }
.status-block-vyprselo .sb-count { color: var(--fail); }
.status-block-brzy { border-color: var(--warn); }
.status-block-brzy .sb-count { color: var(--warn); }
.status-block-nevyhovuje { border-color: #b71c1c; }
.status-block-nevyhovuje .sb-count { color: #ef5350; }
.status-block-vyhovuje { border-color: var(--ok); }
.status-block-vyhovuje .sb-count { color: var(--ok); }
.status-block-dnes { border-color: #42a5f5; }
.status-block-dnes .sb-count { color: #42a5f5; }

.status-block.active {
  background: var(--bg-soft);
}
.status-block-vyprselo.active { background: rgba(244,67,54,0.15); }
.status-block-brzy.active { background: rgba(255,152,0,0.15); }
.status-block-nevyhovuje.active { background: rgba(183,28,28,0.15); }
.status-block-vyhovuje.active { background: rgba(76,175,80,0.15); }
.status-block-dnes.active { background: rgba(66,165,245,0.15); }

/* === NOVÁ STAVOVÁ LIŠTA: počty (pilulky) + termínové koše === */
/* 5 chipů VŽDY vedle sebe (grid, ne wrap). Mobil (E 12. 9. 2026): číslo NAD popiskem — na 360 px vyjde 64 px na chip,
   vedle sebe se 4místný počet s 11px popiskem nevešel; pod sebou stačí ~40 px a chip má 44 px na dotyk (HIG). */
.zc-counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 4px 0 7px; }
.zc-cnt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 4px 2px; min-height: 44px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); cursor: pointer;
  font-weight: 600; user-select: none; min-width: 0; overflow: hidden; }
.zc-cnt i { font-style: normal; font-size: 0.78rem; opacity: 0.85; white-space: nowrap; line-height: 1.1; }
.zc-cnt b { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.15; }
.zc-cnt.active { filter: brightness(1.15); }
.zc-all.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }
.zc-vyh { color: var(--ok); } .zc-vyh.active { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok) inset; }
.zc-nev { color: var(--fail); } .zc-nev.active { border-color: var(--fail); box-shadow: 0 0 0 2px var(--fail) inset; }
.zc-dnes { color: #0e7490; } .zc-dnes.active { border-color: #0e7490; box-shadow: 0 0 0 2px #0e7490 inset; }
.zc-bezrev { color: var(--warn); } .zc-bezrev.active { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn) inset; }
/* Řádek spotřebiče bez revize — jantarový pruh vlevo, ať je v seznamu vidět „chybí". */
.device-row.bkt-bezrevize { box-shadow: inset 3px 0 0 var(--warn); }

.zc-buckets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.zc-bkt { border: 1px solid var(--border); border-top-width: 3px; border-radius: 12px; padding: 7px 4px 6px; min-height: 48px; text-align: center; cursor: pointer; user-select: none; color: var(--text); background: var(--bg-card); box-shadow: var(--shadow-card); }
.zc-bkt .zc-n { font-size: 1.2rem; font-weight: 900; line-height: 1; }
.zc-bkt .zc-l { font-size: 0.78rem; margin-top: 3px; letter-spacing: 0.01em; line-height: 1.1; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.zc-bkt.active { box-shadow: 0 0 0 2px #A8853B inset; background: color-mix(in srgb, var(--primary) 12%, var(--bg-card)); }
.zc-vyprselo { border-top-color: #565d6b; } .zc-vyprselo .zc-n { color: #475569; }
.zc-brzy { border-top-color: #9c6738; } .zc-brzy .zc-n { color: #9c6738; }
.zc-mesic { border-top-color: #1d4ed8; } .zc-mesic .zc-n { color: #1d4ed8; }
.zc-rok { border-top-color: #0f766e; } .zc-rok .zc-n { color: #0f766e; }

.zc-toolbar { display: flex; align-items: center; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.zc-toolbar .btn-filter-toggle {
  margin-left: auto; padding: 6px 12px; font-size: 0.8rem; font-weight: 600; min-height: 40px;
  border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--text); white-space: nowrap;
  /* Pojistka: kdyby popisek přece jen narostl, tlačítko se smrskne místo toho,
     aby kvůli nowrap spadlo pod řádek s ŘAZENÍ. */
  min-width: 0; overflow: hidden; flex-shrink: 1;
}
.zc-toolbar .adv-label { display: inline; }  /* .adv-label má display:block — v řádku by lámal */

/* ========== FILTER ROW (Vše + Filtry) ========== */
.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.btn-filter-all, .btn-filter-toggle {
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.btn-filter-all:active, .btn-filter-toggle:active { background: var(--bg-input); }

/* ========== ADVANCED FILTERS ========== */
.adv-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.adv-filter-group { margin-bottom: 8px; }
.adv-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.chip-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.adv-chip {
  padding: 6px 12px;
  min-height: 40px;
  min-width: 44px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.adv-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

/* Našeptávač značek pod polem výrobce */
.vyrobce-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.vyrobce-chip {
  padding: 6px 12px;
  min-height: 40px;
  border-radius: 20px;
  font-size: 0.85rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.vyrobce-chip:hover, .vyrobce-chip:active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
/* Když je pole Výrobce aktivní (vyjíždí roletka značek), chipy skryj — jinak se
   roletka a chipy překrývaly a klik padal na zakrytý chip pod roletkou. */
.ac-wrap:focus-within + .vyrobce-chips { display: none; }

/* ========== PC TABULKA (široká obrazovka) ========== */
/* Vstupní tlačítko jen na širokém displeji (PC/notebook), na mobilu skryté */
.pc-only { display: none; }
@media (min-width: 1024px) {
  .pc-only { display: inline-flex; }
}
.pctab-screen { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.pctab-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; }
.pctab-inner { display: flex; flex-direction: column; height: 100%; }
.pctab-head {
  display: flex;
  position: sticky; top: 0;
  background: var(--bg-card);
  border-bottom: 2px solid var(--primary);
  font-weight: 600; font-size: 0.74rem;
  color: var(--text-muted);
  z-index: 2;
}
.pctab-body { flex: 1; min-height: 0; }
.pctab-row { display: flex; border-bottom: 1px solid var(--border); }
.pctab-row.pctab-odd { background: var(--bg-soft); }
.pctab-row:hover { background: rgba(80,140,255,0.08); }
.pctab-cell {
  flex: 0 0 auto;
  padding: 6px 8px;
  font-size: 0.8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid var(--border);
  display: flex; align-items: center;
}
.pctab-hcell { padding-top: 8px; padding-bottom: 8px; }
.pctab-center { justify-content: center; text-align: center; }
.pctab-ok { color: var(--ok); }
.pctab-nok { color: var(--fail, #e53935); font-weight: 600; }
.pctab-vyprselo { color: var(--fail, #e53935); font-weight: 600; }
.pctab-brzy { color: #ef6c00; }

/* ========== SEARCH ROW ========== */
.search-row {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  margin-bottom: 8px;
}
.search-icon {
  font-size: 0.9rem;
  margin-right: 8px;
  opacity: 0.5;
}
.search-full {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  color: var(--text);
  border: none;
  /* Min 16px — viz globální pravidlo input/select/textarea. iOS jinak zoomuje. */
  font-size: 16px;
  outline: none;
}
.search-full::placeholder { color: var(--text-muted); }
.search-clear {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); font-size: 0.95rem; cursor: pointer;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; margin-left: 6px; flex-shrink: 0; line-height: 1;
}
.search-clear:hover { color: var(--text); border-color: var(--primary); }

/* === POSUN INVENTÁRNÍCH ČÍSEL === */
.posun-ov { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; z-index: 3000; }
.posun-box { background: var(--bg); border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }
.posun-hd { display: flex; align-items: center; font-weight: 600; font-size: 0.95rem; }
.posun-x { margin-left: auto; background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.posun-info { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; margin: 6px 0 10px; }
.posun-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 9px; margin-bottom: 8px; }
.posun-lbl { font-size: 0.8rem; color: var(--text-muted); }
.posun-seg { display: flex; gap: 5px; }
.posun-seg button { padding: 7px 11px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-muted); border-radius: 8px; font-size: 0.8rem; cursor: pointer; font-weight: 600; }
.posun-seg button.on { border-color: var(--primary); color: var(--text); background: color-mix(in srgb, var(--primary) 22%, transparent); }
.posun-step { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.posun-step button { width: 30px; height: 30px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text); border-radius: 8px; font-size: 1.1rem; cursor: pointer; }
.posun-step #posun-amt { min-width: 24px; text-align: center; font-weight: 800; }
.posun-bar { display: flex; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.posun-bar a { color: var(--primary); cursor: pointer; }
.posun-bar .posun-sp { margin-left: auto; }
.posun-sortrow { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.posun-sb { padding: 5px 10px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-muted); border-radius: 8px; font-size: 0.8rem; cursor: pointer; }
.posun-sb.on { border-color: var(--primary); color: var(--text); background: color-mix(in srgb, var(--primary) 20%, transparent); }
.posun-list { flex: 1; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; min-height: 120px; }
.posun-r { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; }
.posun-r:last-child { border-bottom: none; }
.posun-r.sel { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.posun-box2 { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #4a5578; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.85rem; }
.posun-r.sel .posun-box2 { background: var(--primary); border-color: var(--primary); }
.posun-old { font-weight: 700; color: #5bd3a6; min-width: 66px; }
.posun-arr { color: var(--text-muted); }
.posun-new { font-weight: 700; }
.posun-new.ok { color: var(--ok); }
.posun-new.col { color: #f5484d; }
.posun-dup { font-size: 0.58rem; background: #f5484d; color: #fff; font-weight: 800; padding: 1px 6px; border-radius: 5px; }
.posun-nm { flex: 1; font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.posun-warn { margin-top: 10px; background: rgba(245,72,77,0.12); border: 1px solid #f5484d; color: #ffd0d2; border-radius: 8px; padding: 9px 11px; font-size: 0.8rem; display: none; }
.posun-warn.show { display: block; }
.posun-actions { display: flex; gap: 10px; margin-top: 12px; }
.posun-actions .btn { flex: 1; }

/* ========== ADD DEVICE BUTTON ========== */
.btn-add-device {
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ========== FILTER TABS (legacy) ========== */
.filter-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-tab.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.filter-tab .tab-count {
  font-weight: 700;
  margin-left: 4px;
}

/* ========== HEADER COUNT ========== */
.header-count {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ========== ZAKÁZKA CARD ========== */
.zak-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  gap: 10px;
}
.zak-card:active { background: var(--bg-input); }
.zak-card-main { flex: 1; min-width: 0; }
.zak-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.zak-card-stats {
  display: flex;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.zak-card-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ========== SECTION ========== */
.section { margin-bottom: 16px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.section-header h2 { font-size: 1rem; }

/* ========== LIST / DEVICE ROWS ========== */
.list-container { display: flex; flex-direction: column; gap: 3px; }

/* ===== Rozbalovací sekce (collapse) ===== */
.collapse-section {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}
.collapse-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  min-height: 48px;
}
.collapse-toggle:active { background: var(--bg-soft); }
.collapse-arrow {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.collapse-section.open .collapse-arrow { transform: rotate(90deg); }
.collapse-body {
  display: none;
  padding: 8px 14px 14px;
  border-top: 1px solid var(--border);
}
.collapse-section.open .collapse-body { display: block; }

/* ===== Správa místností (nastaveni → Místnosti) ===== */
.rooms-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.rooms-add-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
}
.rooms-list { display: flex; flex-direction: column; gap: 6px; }
.room-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  overflow: hidden;
}
.room-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.room-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.room-name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.room-actions { display: flex; gap: 4px; flex-shrink: 0; }
.room-devices {
  border-top: 1px solid var(--border);
  padding: 6px 0;
  background: var(--bg-soft);
}
.room-devices.hidden { display: none; }
.room-device {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  min-height: 54px;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1.5px solid transparent;
  border-radius: 9px;
  margin: 5px 6px;
  background: var(--bg-input);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: border-color 0.1s, background 0.1s;
}
.room-device.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 13%, transparent); }
.room-device .rd-box {
  width: 26px; height: 26px; border-radius: 7px; border: 2px solid #4a5578;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: transparent; background: transparent; transition: 0.1s;
}
.room-device.sel .rd-box { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.room-device .rd-inv { font-weight: 600; color: var(--primary); min-width: 56px; }
.room-device .rd-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-move-device {
  font-size: 1rem;
  min-width: 44px;
  min-height: 40px;
  flex-shrink: 0;
}

/* Výběr cílové místnosti = spodní panel s dlaždicemi (nahrazuje roletku) */
.room-picker-ov {
  position: fixed; inset: 0; background: var(--overlay);
  display: flex; align-items: flex-end; justify-content: center; z-index: 2000;
}
.room-picker-sheet {
  background: var(--bg); border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0; width: 100%; max-width: 560px;
  max-height: 84vh; overflow-y: auto; padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
}
.room-picker-sheet .rp-title { font-size: 1.05rem; margin: 0 0 2px; }
.rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.rp-cell {
  padding: 16px 12px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--bg-input); color: var(--text); cursor: pointer;
  font-size: 0.9rem; text-align: center; min-height: 58px; line-height: 1.2;
  display: flex; align-items: center; justify-content: center; transition: 0.1s;
}
.rp-cell.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 16%, transparent); font-weight: 600; box-shadow: 0 0 0 1px var(--primary) inset; }
.rp-cell.rp-new { border-style: dashed; color: var(--text-muted); }
.rp-newname { width: 100%; margin: 0 0 12px; background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; }
.rp-actions { display: flex; gap: 10px; position: sticky; bottom: -18px; background: var(--bg); padding: 8px 0 0; }
.rp-actions .btn { flex: 1; }

/* Generování PDF — klikací výběr stran + podrobnější nastavení */
.pdf-pages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.pdf-page { position: relative; cursor: pointer; border: 2px solid var(--border); border-radius: 10px;
  padding: 8px 6px 6px; background: var(--bg-input); display: flex; flex-direction: column; align-items: center; gap: 5px; transition: 0.1s; }
.pdf-page.sel { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.pdf-page:not(.sel) { opacity: 0.5; filter: grayscale(0.4); }
.pdf-page svg { width: 100%; height: auto; border-radius: 4px; }
.pdf-page .pp-name { font-size: 0.8rem; text-align: center; line-height: 1.15; }
.pdf-page .pp-check { position: absolute; top: 5px; right: 5px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-size: 0.65rem; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(0.6); transition: 0.12s; }
.pdf-page.sel .pp-check { opacity: 1; transform: scale(1); }
.pdf-adv-toggle { width: 100%; text-align: left; display: flex; align-items: center; gap: 8px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 0.8rem; padding: 10px 0; min-height: 44px; }
.pdf-adv-toggle .chev { transition: transform 0.15s; }
.pdf-adv-toggle.open .chev { transform: rotate(90deg); }
.pdf-adv { display: none; padding: 12px; margin: 4px 0 8px; background: var(--bg-soft); border: 1px dashed var(--border); border-radius: 8px; }
.pdf-adv.open { display: block; }
.pdf-seg { display: flex; gap: 6px; margin: 4px 0 0; }
.pdf-seg button { flex: 1; padding: 8px; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-muted); border-radius: 7px; font-size: 0.8rem; cursor: pointer; }
.pdf-seg button.on { border-color: var(--primary); color: var(--text); background: color-mix(in srgb, var(--primary) 12%, transparent); font-weight: 600; }
.pdf-rooms { margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; max-height: 180px; overflow-y: auto; background: var(--bg-input); }
.pdf-rooms .prh { position: sticky; top: 0; background: var(--bg-card); padding: 7px 10px; font-size: 0.8rem; color: var(--text-muted); display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.pdf-rooms .prh b { color: var(--primary); }
.pdf-rooms .prh a { color: var(--primary); cursor: pointer; }
.pdf-rooms label { display: flex; align-items: center; gap: 9px; padding: 8px 10px; font-size: 0.8rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.pdf-rooms label:last-child { border-bottom: none; }
.pdf-rooms label input { width: 17px; height: 17px; accent-color: var(--primary); flex-shrink: 0; }
.list-item {
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, transform 0.2s;
}
.list-item:active { background: var(--bg-input); }
.list-item-main {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.list-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Device row — fixed 56px for virtual scroll */
.device-row {
  display: flex;
  align-items: center;
  min-height: var(--row-h);
  padding: 6px 10px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
  cursor: pointer;
  gap: 8px;
  transition: background 0.15s;
  overflow: hidden;
  margin-bottom: 2px;
}
.device-row:active { background: var(--bg-input); }
.device-row.status-ok { border-left-color: var(--ok); }
.device-row.status-fail { border-left-color: var(--fail); }
.device-row.status-vyprselo { border-left-color: var(--fail); }
.device-row.status-brzy { border-left-color: var(--warn); }
.device-row.status-vyhovuje { border-left-color: var(--ok); }
.device-row.status-nevyhovuje { border-left-color: var(--fail); }
/* Levý proužek dle TERMÍNOVÉHO koše (colorblind-safe: šedá/hnědá/modrá/zlatá) — přebíjí status- výše */
.device-row.bkt-vyprselo { border-left-color: #565d6b; }
.device-row.bkt-brzy { border-left-color: #9c6738; }
.device-row.bkt-mesic { border-left-color: #1d4ed8; }
.device-row.bkt-rok { border-left-color: #0f766e; }
.device-row .dr-line1 { display: flex; align-items: center; gap: 6px; }
.device-row .dr-inv { color: var(--text); }         /* zelenkavá INV (čitelné i pro barvosleposti) */
.device-row .dr-zminula { font-size: 0.8rem; opacity: 0.75; }
.device-row .dr-meta.dr-fail { color: #f5484d; font-weight: 600; }

.device-row .dr-status {
  width: 26px;
  text-align: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.device-row .dr-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.device-row .dr-inv {
  font-weight: 600;
  font-size: 0.85rem;
  margin-right: 6px;
}
.device-row .dr-name {
  font-size: 0.8rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.device-row .dr-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.device-row .dr-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-action-row {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.btn-action-row:active { opacity: 0.7; }

/* Zakázka detail — flex layout so device list fills remaining space */
.zakazka-detail {
  display: flex;
  flex-direction: column;
  /* Mobil (E 12. 9. 2026): 100vh = výška se schovanou lištou prohlížeče → poslední řádky pod lištou/klávesnicí.
     --vvh nastavuje app.js z visualViewport (fáze 2); do té doby dvh. */
  height: calc(100dvh - 12px);
  height: calc(var(--vvh, 100dvh) - 12px);
  margin-bottom: calc(-1 * var(--nav-h));
  padding-bottom: var(--nav-h);
  box-sizing: border-box;
}

/* Device list wrap — fills remaining space, scrolls */
#device-list-wrap {
  flex: 1 1 auto;
  min-height: 100px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Čtečka mode indicator */
.ctecka-active #search-device {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
}
.ctecka-badge {
  position: absolute;
  /* 8px + místo pro tlačítko ✕ (search-clear), ať se nepřekrývají */
  right: 46px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  pointer-events: none;
}

/* Device stats bar */
.device-stats {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

/* ========== BADGES ========== */
.badge {
  font-size: 0.8rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-input);
}
.badge-active { color: var(--ok); }
.badge-closed { color: var(--text-muted); }
.badge-ok { background: rgba(76,175,80,0.2); color: var(--ok); }
.badge-fail { background: rgba(244,67,54,0.2); color: var(--fail); }
.badge-warn { background: rgba(255,152,0,0.2); color: var(--warn); }

/* ========== TOOLBAR ========== */
.toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 100px;
  padding: 6px 10px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

/* ========== KOMBI SCREEN ========== */
.kombi-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 12px;
}
.kombi-section legend {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0 6px;
}
.kombi-prev { background: var(--bg-soft); }
.kombi-new { border-color: var(--primary); }
.prev-result { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.prev-note { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.prev-values { display: flex; gap: 10px; font-size: 0.8rem; color: var(--text-muted); flex-wrap: wrap; }
.result-row { margin-top: 10px; }

/* Presety bar */
.presety-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0;
  scrollbar-width: none;
}
.presety-bar::-webkit-scrollbar { display: none; }
.preset-chip {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
}
.preset-chip:active { background: var(--primary); border-color: var(--primary); }

/* old ac-wrap moved to kombi section */

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box h2 { font-size: 1rem; margin-bottom: 12px; }
.modal-box .modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15,23,42,0.12);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-info { background: var(--bg-card); }
.toast-ok { background: var(--ok); color: #fff; }
.toast-error { background: var(--fail); color: #fff; }
.toast-warn { background: var(--warn); color: #fff; }

/* ========== SCANNER ========== */
.scanner-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 500;
  display: flex;
  flex-direction: column;
}
.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  color: #fff;
  font-size: 0.85rem;
}
.scanner-video {
  flex: 1;
  width: 100%;
  object-fit: cover;
}
.scanner-line {
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--primary);
  opacity: 0.7;
  animation: scanline 2s ease-in-out infinite;
}
@keyframes scanline {
  0%, 100% { top: 35%; }
  50% { top: 65%; }
}
.scanner-manual {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
}
.scanner-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Min 16px — iOS by jinak zoomoval po focusu (čtečka skenuje rychle, zoom by rušil). */
  font-size: 16px;
}

/* ========== TABS (Šablony, Admin) ========== */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  min-height: 44px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== ZAKAZKA INFO ========== */
.zakazka-info {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ========== SWIPE ========== */
.swipe-wrap {
  touch-action: pan-y;
  overflow: hidden;
}
.swipe-hint {
  pointer-events: none;
  z-index: -1;
}
.swipe-tip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.swipe-tip strong { color: var(--text); }
.swipe-tip-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 4px;
}

/* ========== SETTINGS ========== */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row label { font-size: 0.85rem; }
.setting-row select, .setting-row input {
  padding: 4px 8px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Min 16px — viz globální pravidlo. iOS Safari zoomuje cokoli pod. */
  font-size: 16px;
}

/* ========== SHARING ========== */
.share-code {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin: 12px 0;
}
.share-qr {
  display: block;
  margin: 12px auto;
  max-width: 200px;
  border-radius: var(--radius);
}

/* ========== PROFIL ========== */
.profil-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 12px;
}

/* ========== UTILITIES ========== */
.text-ok { color: var(--ok); }
.text-fail { color: var(--fail); }
.text-warn { color: var(--warn); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.loading { color: var(--text-muted); text-align: center; padding: 20px; }
.empty-state { color: var(--text-muted); text-align: center; padding: 20px; font-size: 0.85rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ========== OFFLINE BAR ========== */
.offline-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #fff7e6;
  color: #92400e;
  border-bottom: 1px solid #f5d9a8;
  text-align: center;
  padding: calc(4px + env(safe-area-inset-top, 0px)) 4px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 1000;
  display: none;
}
body.offline .offline-bar { display: block; }
body.offline #app { padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
/* sticky hlavička pod offline pruhem, ne pod ním schovaná */
body.offline .app-header { top: calc(28px + env(safe-area-inset-top, 0px)); }

/* ========== VIRTUAL SCROLL ========== */
.vs-viewport {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========== HISTORY TABLE ========== */
.history-table {
  width: 100%;
  font-size: 0.74rem;
  border-collapse: collapse;
  line-height: 1.15;
}
.history-table th {
  text-align: left;
  padding: 3px 4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.7rem;
}
.history-table td {
  padding: 3px 4px;
  border-bottom: 1px solid var(--border);
}
/* Mobil (E 12. 9. 2026): 8 sloupců se na 360 px nevejde v čitelném písmu → sloupec Technik skryj (je v detailu revize) */
@media (max-width: 420px) {
  .history-table th:nth-child(7), .history-table td:nth-child(7) { display: none; }
}
.history-table tr.rv-ok td:first-child { color: var(--ok); }
.history-table tr.rv-fail td:first-child { color: var(--fail); }

/* Full-width buttons */
.btn-full { width: 100%; padding: 12px; font-size: 1rem; }
.btn-fail { background: var(--fail); color: #fff; border: none; }
.btn-fail:active { opacity: 0.8; }

/* ========== RESPONSIVE ========== */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 641px) {
  #app { max-width: 960px; }
  .device-row { padding: 0 16px; }
}

/* ========== KOMBI SCREEN ========== */
.kombi-screen {
  padding-bottom: 24px;
}

/* Numbered section labels with line */
.kombi-label-line {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* Uppercase sub-labels */
.kombi-sub-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
  min-height: 1.9em;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 4px;
}

/* Preset icon grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.preset-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.preset-icon-btn:active,
.preset-icon-btn.active {
  background: var(--primary);
  border-color: var(--primary);
}
.pi-icon {
  font-size: 1.2rem;
  line-height: 1;
}
.pi-label {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Bigger inputs for main fields */
.input-big {
  /* max(16px, …): pod 16 px iOS Safari při fokusu přiblíží stránku (INV a Název = nejpoužívanější pole) */
  font-size: max(16px, 1.05rem) !important;
  padding: 10px 28px 10px 10px !important;
}

/* Round S+1 button */
.btn-round {
  min-width: 48px;
  height: 42px;
  border-radius: 21px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 12px;
}

/* Toggle row (Třída I / II) */
.toggle-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.toggle-btn {
  flex: 1;
  padding: 10px;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.toggle-btn:not(.active):active {
  background: var(--bg-card);
}

/* Fix input-clear always visible inside kombi */
.kombi-screen .input-wrap .input-clear {
  display: inline-flex;
  opacity: 0.4;
}
.kombi-screen .input-wrap input:not(:placeholder-shown) + .input-clear,
.kombi-screen .input-wrap input:focus + .input-clear {
  opacity: 1;
}

/* Autocomplete wrap — focus-within raises z-index above siblings */
.ac-wrap {
  position: relative;
  z-index: 1;
}
.ac-wrap:focus-within {
  z-index: 9000;
}
.ac-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: 0 0 var(--radius) var(--radius);
  /* dvh respektuje vyjetou klávesnici (dynamic viewport height).
     Dropdown tak nezůstane částečně pod klávesnicí. */
  max-height: min(45dvh, 340px);
  /* Fallback pro starší prohlížeče bez dvh */
  max-height: min(45vh, 340px);
  max-height: min(45dvh, 340px);
  overflow-y: auto;
  padding-bottom: 8px;
  z-index: 9999;
  display: none;
  box-shadow: 0 8px 24px rgba(15,23,42,0.18);
  -webkit-overflow-scrolling: touch;
  /* pan-y: dovolí vertikální scroll prstem (= seznam značek/místností lze
     procházet), ale vypne pinch-zoom a horizontální gesta. Manipulation tady
     bylo nesprávně — ta neumí rozlišit scroll od tap a v kombinaci s pointerdown
     dělala seznam "neslétavatelný". */
  touch-action: pan-y;
}
.ac-list.show { display: block; }
/* Překlopení nahoru — když je pole u klávesnice, seznam se otevře nad polem,
   aby spodní položky neskončily za klávesnicí (iPhone). */
.ac-list.ac-up {
  top: auto;
  bottom: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 24px rgba(15,23,42,0.18);
}
.ac-item {
  padding: 14px 14px;
  min-height: 48px;
  box-sizing: border-box;
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Rychlejší tap + prevence selection během scrollu */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--primary) 20%, transparent);
}
.ac-item:active,
.ac-item.highlighted {
  background: var(--primary);
  color: var(--on-primary);
}
.ac-item .ac-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Header buttons alignment for kombi */
.kombi-screen .app-header {
  gap: 6px;
}
.btn-ok {
  background: var(--ok);
  color: #fff;
  border: none;
}
.btn-ok:active { opacity: 0.8; }

/* Majitel / Provozovatel row */
.kombi-screen .form-row {
  margin-bottom: 4px;
}

/* Textarea full-width */
.kombi-screen textarea {
  width: 100%;
  resize: vertical;
}

/* Input-wrap inside kombi textarea */
.kombi-screen .input-wrap textarea {
  flex: 1;
  padding-right: 28px;
}

/* Disabled fields (bez přívodu) */
.kombi-screen select:disabled,
.kombi-screen input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: var(--bg-card);
}

/* === Measurement validation === */
.limit-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}
.val-msg {
  font-size: 0.8rem;
  min-height: 0;
  line-height: 1.3;
  padding: 0 2px;
  transition: all 0.15s;
}
.val-msg-warn {
  color: #f59e0b;
  padding-top: 2px;
}
.val-msg-fail {
  color: #ef4444;
  font-weight: 600;
  padding-top: 2px;
}
input.val-ok {
  border-color: var(--ok) !important;
}
input.val-warn {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.08) !important;
}
input.val-fail {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  animation: val-pulse 0.4s ease;
}
@keyframes val-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* ===== Multi-select advanced filters + Dnes sort + souhrn ===== */
.adv-filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  gap: 8px;
}
.filter-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 400;
}
.dnes-sort-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.dnes-sort-row .adv-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.sort-btn {
  font-size: 0.8rem;
  padding: 6px 12px;
  min-height: 40px;
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
}
.sort-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

/* ===== Historie revizí — poslední zvýrazněná ===== */
.history-table tr.last-rev-ok {
  background: rgba(76,175,80,0.18);
  font-weight: 600;
}
.history-table tr.last-rev-fail {
  background: rgba(244,67,54,0.18);
  font-weight: 600;
}
.history-table tr.rev-editable { transition: background 0.2s; }
.history-table tr.rev-editable:hover { filter: brightness(1.1); }
/* Ikonky v historii revizí — hit target 36x36 aby šly trefit prstem */
.history-table .rev-edit-icon,
.history-table .rev-delete-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  font-size: 1rem;
  padding: 4px;
  margin: 0 2px;
  border-radius: 4px;
}
.history-table .rev-edit-icon:active,
.history-table .rev-delete-icon:active { background: var(--bg-soft); }
.last-rev-badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}
.last-rev-badge.ok { background: var(--ok); color: #fff; }
.last-rev-badge.fail { background: var(--fail); color: #fff; }

/* ===== Zvýraznění povinných kolonek ===== */
.highlight-required input,
.highlight-required select,
.highlight-required textarea,
input.highlight-required,
select.highlight-required,
textarea.highlight-required {
  border: 2px solid var(--ok) !important;
  box-shadow: 0 0 0 1px rgba(76,175,80,0.25);
}

/* ===== Centrování vycentrovaného řádku s jedním polem ===== */
.form-row-center {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.form-row-center > div { width: 48%; }

/* ===== Historie revizí — zjištěno na druhém řádku ===== */
.history-table tr.hist-zjist td {
  border-bottom: 1px solid var(--border);
  padding: 2px 6px 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: normal;
}
.history-table tr.hist-zjist td b {
  color: var(--text);
  font-weight: 500;
  margin-right: 6px;
}


/* ========== VRSTVA VZHLEDU MŮJ REVIZÁK (11. 9. 2026) — sjednocení s portálem (/portal/klienti, /portal/kalendar) ========== */
h1, h2, h3 { letter-spacing: -0.01em; }
.ico { flex-shrink: 0; vertical-align: -0.2em; }
.btn .ico { vertical-align: middle; }

/* Hlavička obrazovky = PortalPageHeader: nadpis + linka, akce vpravo jako kulatá ikonová tlačítka */
.app-header { background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 8px 0; gap: 4px; flex-wrap: nowrap; }
/* Mobil (E 12. 9. 2026): hlavička se NESMÍ lámat na dva řádky (na 360 px koš spadl pod titulek, sticky pruh měl 103 px).
   Titulek se zkrátí elipsou, akce mají 44 px (Apple HIG). */
.app-header h1 { font-size: 1.05rem; font-weight: 600; color: var(--text); flex: 1 1 0; min-width: 40px; }
.header-actions { flex-wrap: nowrap; margin-left: auto; justify-content: flex-end; flex-shrink: 0; }
.app-header .btn-ghost { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.app-header .btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.app-header .btn-sm:not(.btn-ghost):not(.btn-primary):not(.btn-ok) { background: var(--bg-card); }
.header-count { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--bg-soft); color: var(--text-muted); font-size: 0.8rem; font-weight: 600; margin-left: 6px; vertical-align: middle; }
.header-actions { gap: 6px; }
.header-actions .btn-sm { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }

/* Tlačítka: rounded-lg, tři styly (primary zlatá s tmavým textem, outline bílá, danger červený obrys) */
.btn { border-radius: 10px; font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:not(.btn-primary):not(.btn-ok):not(.btn-fail):not(.btn-warn):not(.btn-danger):hover { background: var(--bg-soft); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ok:hover { background: var(--ok); filter: brightness(0.95); }
.btn-fail:hover { background: var(--fail); filter: brightness(0.95); }
.btn-outline { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--bg-card); border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 40px; padding: 6px 12px; }
.btn-xs { min-height: 40px; }

/* Pole: bílá, jemný okraj, zlatý fokus s prstencem (jako portál focus:ring-primary/20) */
input, select, textarea { border-radius: 10px; min-height: 44px; border: 1px solid #d6d0c4; }
input:focus, select:focus, textarea:focus { border-color: #A8853B; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
input[type="checkbox"] { min-height: 0; }
.form-group label { color: var(--text); font-weight: 500; font-size: 0.8rem; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); }

/* Karty (rounded-xl, okraj, jemný stín) */
.zak-card, .stat-box, .collapse-section, .modal-box, .status-block, .kombi-section, .search-row { border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.zak-card { border-radius: 12px; padding: 14px 16px; }
.zak-card:hover { background: var(--bg-soft); }
.zak-card-title { font-size: 0.95rem; }
.zak-card-stats { font-size: 0.8rem; }
.list-container { gap: 8px; }
.kombi-section { background: var(--bg-card); border-radius: 12px; padding: 12px; }
.kombi-section legend { color: var(--primary-text); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.modal-box { border-radius: 16px; }
.modal-box h2 { font-size: 1.05rem; font-weight: 600; }

/* Řádky spotřebičů: PEVNĚ 56 px (virtuální scroll), tabulkový vzhled = bílý blok s dělítky, bez mezer */
.device-row { border-radius: 0; border-bottom: 1px solid var(--border); box-shadow: none; }
.device-row:hover { background: var(--bg-soft); }
.device-row .dr-inv { color: var(--text); font-weight: 700; }
.device-row .dr-name { color: var(--text-muted); }
.device-row .dr-meta.dr-fail { color: var(--fail); }
#device-list, .vs-viewport { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); overflow: hidden; }

/* Chipy a taby: rounded-full, aktivní = zlatý obrys + tint (jako Sloupce v tabulce Klienti) */
.filter-tab, .adv-chip, .vyrobce-chip, .preset-chip { border-radius: 999px; background: var(--bg-soft); border-color: transparent; color: var(--text); }
.filter-tab.active, .adv-chip.active, .vyrobce-chip:active, .preset-chip:active { background: color-mix(in srgb, var(--primary) 14%, transparent); border-color: #A8853B; color: var(--primary-text); font-weight: 600; }
.tab-btn { font-weight: 500; }
.tab-btn.active { color: var(--primary-text); border-bottom-color: #A8853B; font-weight: 600; }
.zc-toolbar .btn, .zc-cnt { border-radius: 999px; }
.zc-bkt { border-radius: 12px; }
.status-block { border-radius: 12px; background: var(--bg-card); }
.stat-box { border-radius: 12px; }
.search-row { border-radius: 999px; padding: 0 14px; }
.search-row .search-icon { display: flex; opacity: 0.6; color: var(--text-muted); }
.btn-add-device { border-radius: 12px; }

/* Spodní navigace: bílá, zlatá aktivní, lucide ikony */
.bottom-nav .nav-item { font-size: 0.78rem; color: var(--text-muted); gap: 3px; flex: 1 1 0; min-width: 0; padding-left: 2px; padding-right: 2px; white-space: nowrap; }
@media (max-width: 400px) { .bottom-nav .nav-item { font-size: 0.7rem; } }

/* Toasty: bílé s barevným proužkem vlevo (jen info/warn), ok a error plné */
.toast { border-radius: 12px; border-left-width: 4px; }
.toast-info { border-left-color: var(--primary); }
.toast-warn { background: #fff7e6; color: #92400e; border-color: #f5d9a8; border-left-color: var(--warn); }

/* Prázdný stav / načítání */
.loading, .empty-state { color: var(--text-muted); }

/* ===== Fáze 3: rychlý výběr, přepínače, taby, menu karty ===== */
.preset-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preset-icon-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; color: var(--text-muted); min-height: 64px; gap: 4px; box-shadow: var(--shadow-card); }
.preset-icon-btn .pi-icon { color: #334155; display: flex; }
.preset-icon-btn .pi-label { font-size: 0.72rem; color: var(--text); }
.preset-icon-btn:active, .preset-icon-btn.active { background: color-mix(in srgb, var(--primary) 14%, var(--bg-card)); border-color: #A8853B; }
.preset-icon-btn.active .pi-icon { color: var(--primary-text); }
.toggle-row { background: var(--bg-soft); border-radius: 999px; padding: 4px; gap: 4px; }
.toggle-btn { border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--text-muted); }
.toggle-btn.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.toggle-btn:not(.active):active { background: var(--bg-card); }
.tab-bar { border-bottom: none; background: var(--bg-soft); border-radius: 999px; padding: 4px; gap: 4px; }
.tab-btn { border-radius: 999px; border-bottom: none; margin-bottom: 0; padding: 8px 14px; flex: 1 0 auto; text-align: center; }
.tab-btn.active { background: var(--bg-card); color: var(--primary-text); box-shadow: var(--shadow-card); border-bottom: none; }
.zak-card-actions { position: relative; }
.zak-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 210px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,0.14); padding: 4px; text-align: left; }
.zak-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; background: none; border: none; border-radius: 8px; font: inherit; font-size: 0.85rem; color: var(--text); cursor: pointer; text-align: left; }
.zak-menu-item:hover { background: var(--bg-soft); }
.zak-menu-danger { color: var(--danger); }
.zak-card { overflow: visible; }

/* Pruh „Nová verze appky" (app.js controllerchange) — nad dolní lištou, mimo klávesnici */
.verze-pruh { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px)); z-index: 350;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  background: var(--bg-card); color: var(--text); border: 1px solid #A8853B; border-left-width: 4px; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.14); font-size: 0.9rem; }
.verze-pruh span { display: inline-flex; align-items: center; gap: 8px; }

/* Nová zakázka: výběr firmy z CRM + pobočky (provozovny) */
.crm-vysledky { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.crm-item { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; min-height: 48px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; color: var(--text); cursor: pointer; font: inherit; }
.crm-item:active { border-color: #A8853B; background: color-mix(in srgb, var(--primary) 10%, var(--bg-card)); }
.crm-item span { font-size: 0.8rem; color: var(--text-muted); }
.crm-item i { font-style: normal; font-size: 0.78rem; color: var(--primary-text); }
.pob-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pob-chip { padding: 6px 12px; min-height: 40px; border-radius: 20px; background: var(--bg-soft); border: 1px solid transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 0.85rem; display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; line-height: 1.2; }
.pob-chip span { font-size: 0.75rem; color: var(--text-muted); }
.pob-chip.active { background: color-mix(in srgb, var(--primary) 14%, transparent); border-color: #A8853B; color: var(--primary-text); font-weight: 600; }
.pob-chip.pob-jina { border-style: dashed; border-color: var(--border); color: var(--text-muted); }

/* Výzva „Přidat na plochu" (js/utils/instalace.js) */
.inst-pruh { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; box-shadow: var(--shadow-card); }
.inst-ico { color: var(--primary-text); display: flex; margin-top: 2px; }
.inst-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.inst-text > span { color: var(--text-muted); line-height: 1.4; }
.inst-akce { margin-top: 4px; }
.inst-navod { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--text); background: var(--bg-soft); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; line-height: 1.4; }
.inst-zavrit { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 999px; flex-shrink: 0; color: var(--text-muted); }

/* Přehled: pruh tří akcí pod hlavičkou (Nová / Import / Z portálu), 44 px na dotyk */
.dash-akce { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
.dash-akce .btn { min-height: 44px; padding: 8px 6px; font-size: 0.9rem; white-space: nowrap; }
.dash-akce .btn.btn-outline { background: var(--bg-card); }

/* ===== Dodělávky: plovoucí „+", prázdný stav ===== */
.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px); width: 56px; height: 56px; border-radius: 999px; border: none; background: var(--primary); color: var(--on-primary); box-shadow: 0 10px 24px rgba(15,23,42,0.22); display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 90; transition: transform 0.15s; }
.fab.show { display: flex; }
.fab:active { transform: scale(0.94); }
body.kb-open .fab { display: none !important; }
.empty-box { margin: 40px auto 0; max-width: 360px; text-align: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 28px 20px; box-shadow: var(--shadow-card); }
.empty-ico { color: #94a3b8; display: flex; justify-content: center; margin-bottom: 10px; }
.empty-box h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.empty-box p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; margin-bottom: 16px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* === PDF protokol: Zobrazit / Stáhnout / Sdílet (Ř 17. 9. 2026) === */
.pdf-akce { margin-top: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.pdf-akce-nazev { font-size: 0.8rem; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; word-break: break-all; }
.pdf-akce-radek { display: flex; gap: 8px; flex-wrap: wrap; }
.pdf-akce-radek .btn { flex: 1 1 120px; min-height: 44px; }
/* === Karta pobočky (Hub & Spoke zpráva 4, E 17. 9. 2026; vstup z portálu) === */
.prace-stav { font-size: 0.8rem; padding: 0 2px 8px; }
.prace-sipka { color: var(--text-muted); display: flex; }
.termin-po { color: #b42318; font-weight: 600; }
.termin-brzy { color: #b54708; font-weight: 600; }
.termin-ok { color: #1b7a3d; }
.termin-neni { color: var(--text-muted); }
.pobocka-hlava { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; display: grid; gap: 4px; font-size: 0.9rem; }
.pobocka-firma, .pobocka-adresa { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pobocka-sekce { margin-bottom: 16px; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.pobocka-sekce .section-header { margin: 0; font-size: 0.95rem; }
.agenda-karta { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 3px; }
.agenda-hlava { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-kod { background: #1f1a10; color: #f3eee4; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.04em; border-radius: 4px; padding: 1px 6px; }
.agenda-lhuta { margin-left: auto; font-size: 0.78rem; }
.agenda-radek { font-size: 0.82rem; color: var(--text-muted); }
.agenda-ukol { font-size: 0.82rem; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* === Zámek odevzdané zakázky (Revizní program fáze 4, 18. 9. 2026) === */
.zamek-pruh { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0 10px; padding: 10px 12px; border-radius: var(--radius); background: #f3eee4; border: 1px solid #e0d5bd; color: #4a3d1f; font-size: 0.86rem; }
.zamek-pruh .zamek-text { display: flex; align-items: center; gap: 6px; }
.zamek-pruh-mini { margin: 6px 0; padding: 8px 10px; font-size: 0.8rem; }

/* === Revizní program v appce: Klient → Pobočka → Akce (fáze 5, 18. 9. 2026) === */
.program-sloupce { display: grid; gap: 12px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.program-strom, .program-akce, .pobocka-sekce, .program-tabulka { min-width: 0; max-width: 100%; }
.program-tabulka table { min-width: 560px; }
@media (min-width: 900px) { .program-sloupce { grid-template-columns: 360px minmax(0, 1fr); align-items: start; } .program-strom { position: sticky; top: 8px; max-height: calc(100vh - 140px); overflow-y: auto; } }
.program-strom { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.program-firma { border-bottom: 1px solid var(--border); }
.program-firma-radek { display: flex; align-items: flex-start; gap: 6px; width: 100%; padding: 8px 6px; background: none; border: 0; text-align: left; color: var(--text); cursor: pointer; font: inherit; }
.program-firma.otevrena > .program-firma-radek { background: var(--bg-input); border-radius: 8px; }
.program-firma-text { display: grid; gap: 2px; min-width: 0; }
.program-firma-text b { font-size: 0.9rem; }
.program-firma-text small, .program-pobocka small { color: var(--text-muted); font-size: 0.75rem; }
.program-pobocky { padding: 0 0 4px 18px; }
.program-pobocka { display: flex; align-items: flex-start; gap: 6px; width: 100%; padding: 7px 8px; background: none; border: 0; border-radius: 8px; text-align: left; color: var(--text); cursor: pointer; font: inherit; min-height: 44px; }
.program-pobocka span { display: grid; gap: 1px; min-width: 0; }
.program-pobocka b { font-size: 0.85rem; }
.program-pobocka.aktivni { background: var(--bg-input); box-shadow: inset 0 0 0 1px #C7A86B; }
.program-pobocka.bez-prava { opacity: 0.5; }
.program-terminy { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.program-termin { font-size: 0.78rem; background: var(--bg-input); border-radius: 999px; padding: 2px 8px; }
.program-tabulka { overflow-x: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.program-tabulka table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.program-tabulka th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 6px 8px; background: var(--bg-input); }
.program-tabulka td { padding: 7px 8px; border-top: 1px solid var(--border); vertical-align: top; }
.program-tabulka tr.rozdelana td { background: rgba(255, 193, 7, 0.08); }
.program-tabulka .stred { text-align: center; }
.program-tabulka .nowrap { white-space: nowrap; }
.program-tabulka .misto { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.program-tabulka .hotovo { color: #1b7a3d; display: inline-flex; align-items: center; }
.program-tabulka .rozdel { font-size: 0.7rem; font-weight: 600; color: #8a5a00; background: #fff3cd; border-radius: 999px; padding: 1px 6px; }
.program-tabulka .moje { color: #1b7a3d; font-weight: 600; }
