/* Vzhled podle webu hitechdent.cz: červená #b41412, tmavě šedá #4c4c4c, světle šedá #eee, písmo Barlow */
:root {
  --red: #b41412;
  --font-title: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; /* nadpisy: Segoe UI (Windows), jinde systémové písmo zařízení */
  --red-dark: #921010;
  --red-ink: var(--red);   /* červená pro text (v tmavém režimu světlejší) */
  --dark-gray: #4c4c4c;
  --light-gray: #eeeeee;
  --gray: #dedede;
  --azure: #00b4ba;
  --green: #00bd7b;
  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --border: #dedede;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: var(--red-ink);
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e9;
  --info: #00868b;
  --info-soft: #e0f6f7;
  --pohoda: #1a62c4;       /* modrá štítku POHODA (zakázka zapsaná do POHODY) */
  --pohoda-soft: #e6effb;
  --danger: #b41412;
  --danger-soft: #fbe9e9;
  --warn: #a35d00;
  --warn-soft: #fff1dc;
  --ok: #00875a;
  --ok-soft: #e2f7ef;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --header-h: 78px;
  --tabbar-h: 64px;
  color-scheme: light;
}

/* Tmavý režim – <html data-theme="dark">, nastavuje ho skript v index.html a app.js (applyTheme).
   Jen pro obrazovku: tisk protokolu je vždy světlý. */
@media screen {
  :root[data-theme="dark"] {
    --red-dark: #8a0f0e;
    --red-ink: #ff6b63;
    --dark-gray: #d0d0d0;
    --light-gray: #2c2c2c;
    --gray: #454545;
    --bg: #121212;
    --surface: #1e1e1e;
    --surface-2: #262626;
    --border: #363636;
    --text: #e9e9e9;
    --muted: #a2a2a2;
    --accent-soft: #3b1717;
    --info: #4fd3d8;
    --info-soft: #113a3c;
    --pohoda: #7fb0ff;
    --pohoda-soft: #142844;
    --danger: #ff6b63;
    --danger-soft: #3b1717;
    --warn: #f2a94a;
    --warn-soft: #3a2a12;
    --ok: #43d99b;
    --ok-soft: #11331f;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
  :root[data-theme="dark"] .logo-light { display: none; }
  :root:not([data-theme="dark"]) .logo-dark { display: none; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* iPhone/Android nezvětšují písmo samy (PDF pole) */
body {
  font-family: 'Barlow', "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--azure); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 30px; font-weight: 600; color: var(--red-ink); }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout: horní lišta jako na hitechdent.cz (červený pruh nahoře, logo, menu) */
.app { min-height: 100%; }
.appbar {
  position: sticky; top: 0; z-index: 40; background: var(--surface); border-top: 8px solid var(--red);
  box-shadow: 0 4px 4px rgba(0, 0, 0, .12);
}
.appbar-in { max-width: 1320px; margin: 0 auto; height: var(--header-h); padding: 0 28px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none !important; flex: none; }
.brand img { height: 28px; width: auto; display: block; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--dark-gray); font-size: 18px; font-weight: 500;
  text-decoration: none !important; border-bottom: 3px solid transparent; white-space: nowrap; }
.nav a .icon { display: none; }
.nav a:hover { color: var(--azure); }
.nav a.active { color: var(--red-ink); border-bottom-color: var(--red); }
.appbar-right { display: flex; align-items: center; gap: 6px; flex: none; }
.appbar-right .icon-link { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--dark-gray); }
.appbar-right .icon-link:hover { background: var(--light-gray); color: var(--azure); }
@media (max-width: 1180px) { .nav a { font-size: 16px; padding: 8px 8px; } .appbar-in { gap: 16px; } .me-link .me-text { display: none; } }

.main { max-width: 1320px; margin: 0 auto; padding: 28px 28px 56px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { flex: 1; min-width: 0; }
/* záhlaví klienta: červený pruh Hi Tech Dent přes celou šířku, tlačítka v něm vpravo (bílý obrys, hlavní akce plná bílá) */
.topbar.client-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 7px 12px 7px 16px;
  background: var(--red); border-left: 10px solid #6e0c0b; border-radius: 10px; }
.client-title { flex: 1 1 280px; min-width: 0; margin: 0; font-family: var(--font-title); font-weight: 600; letter-spacing: 0; color: #fff; }
.client-title span { display: block; line-height: 1.25; overflow-wrap: anywhere; }
.client-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.client-top .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .85); }
.client-top .btn:hover { background: rgba(255, 255, 255, .16); color: #fff; border-color: #fff; }
.client-top .btn.primary { background: #fff; color: var(--red); border-color: #fff; }
.client-top .btn.primary:hover { background: #fde9e8; color: var(--red-dark); border-color: #fde9e8; }
@media print { .topbar.client-top { background: none; border-left: 0; padding: 0; } .client-title { color: var(--red); } }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--dark-gray); font-size: 18px; font-weight: 500; margin-bottom: 8px; }
.back svg { width: 22px; height: 22px; }

.tabbar { display: none; }

@media (max-width: 899px) {
  :root { --header-h: 58px; }
  .appbar { border-top-width: 6px; }
  .appbar-in { padding: 0 14px; }
  .brand img { height: 22px; }
  .nav, .appbar-right .desk-only { display: none; }
  .appbar-right { margin-left: auto; }
  .main { padding: 18px 14px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 6px rgba(0,0,0,.06);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--dark-gray); font-size: 11.5px; font-weight: 500; text-decoration: none; border-top: 3px solid transparent;
  }
  .tabbar a.active { color: var(--red-ink); border-top-color: var(--red); }
  .tabbar .icon { width: 22px; height: 22px; }
  h1 { font-size: 24px; }
}

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
  border-radius: 9999px; border: 1px solid var(--gray); background: var(--surface); color: var(--dark-gray);
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { border-color: var(--azure); color: var(--azure); background: var(--surface); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.green:hover { background: #00a36a; border-color: #00a36a; color: #fff; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn.icon-only { width: 40px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn[hidden] { display: none; }
@media (max-width: 599px) { .topbar .btn .label { display: none; } .topbar .btn { padding: 0 12px; } }

.search {
  position: relative; flex: 1; min-width: 200px; max-width: 420px;
}
.search input { padding-left: 38px; }
/* větší křížek pro smazání hledání (vlastní místo malého nativního) */
input[type=search]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin: 0 -4px 0 6px; cursor: pointer; border-radius: 50%;
  background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7l10 10M17 7L7 17' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7l10 10M17 7L7 17' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}
input[type=search]::-webkit-search-cancel-button:hover { background-color: var(--red-ink); }
.search .icon { position: absolute; left: 11px; top: 10px; color: var(--muted); }

input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 9px 11px; min-height: 42px; outline: none;
}
textarea { min-height: 80px; resize: vertical; }
input.invalid { border-color: var(--red); }
/* jen pro čtení (např. poznámka ze šablony ve formuláři zařízení) */
.readonly-box { border: 1px dashed var(--border); border-radius: 6px; padding: 9px 11px; min-height: 42px; color: var(--text); background: transparent; white-space: pre-wrap; overflow-wrap: anywhere; }
.readonly-box:empty::before { content: '—'; color: var(--muted, #8a8a8a); }
/* rozbalovací seznam – vlastní šipka místo systémové */
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
select:hover { border-color: var(--gray); }
/* našeptávač (combo) – nabídka pod polem */
.combo-list { position: fixed; z-index: 300; overflow-y: auto; padding: 4px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .08); }
.combo-opt { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 15px; }
.combo-opt small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.combo-opt:hover { background: var(--surface-2); }
.combo-opt.active { background: var(--info-soft); color: var(--info); }
input[list], input[data-combo] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 189, 123, .18); }
@media (max-width: 899px) { input, select, textarea { font-size: 16px; } } /* iOS bez zoomu */

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--gray); border-radius: 9999px; padding: 3px; }
.seg a { padding: 6px 16px; border-radius: 9999px; color: var(--dark-gray); font-weight: 600; font-size: 15px; text-decoration: none; }
.seg a:hover { color: var(--azure); }
.seg a.active { background: var(--red); color: #fff; }
/* počet v záložce (např. Fotografie 3) – malé kolečko */
.seg-n { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--light-gray); color: var(--dark-gray); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; vertical-align: 1px; }
.seg a.active .seg-n { background: rgba(255, 255, 255, .25); color: #fff; }
@media (max-width: 599px) { .seg a { padding: 6px 11px; font-size: 14px; } }

/* ---------- cards & lists */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; display: block; color: inherit; text-decoration: none !important; min-width: 0;
}
a.card:hover, .card.clickable:hover { border-color: var(--red); box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.card-title { font-weight: 600; font-size: 17px; display: flex; align-items: flex-start; gap: 8px; }
.card-title > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-sub { color: var(--muted); font-size: 14.5px; margin-top: 2px; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: var(--light-gray); color: var(--dark-gray); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--info-soft); color: var(--info); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-head h2 { color: var(--red-ink); }
.panel-head h2 { flex: 1; font-family: var(--font-title); font-size: 20px; letter-spacing: 0; }
.panel-body { padding: 14px 16px; }
.panel-empty { padding: 18px 16px; color: var(--muted); font-size: 14px; }

.rows { list-style: none; margin: 0; padding: 0; }
/* dlouhý seznam (např. zařízení klienta): nejvýš N řádků, dál posouvání uvnitř panelu */
.rows.scroll-list { overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--border); }
.rows > li { border-bottom: 1px solid var(--border); }
.rows > li:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: inherit; text-decoration: none !important; }
a.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: 14.5px; overflow-wrap: anywhere; }
.row-side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 599px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* karta klienta: užší sloupec klienta, zařízení a zakázky celé (stránka se posouvá jako celek) */
.client-grid { display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.25fr) minmax(0, 0.95fr); grid-template-areas: "client devices orders"; }
.cg-client { grid-area: client; } .cg-devices { grid-area: devices; } .cg-orders { grid-area: orders; }
.main:has(.client-grid) { max-width: 1760px; } /* tři sloupce potřebují víc šířky */
@media (max-width: 1199px) { .client-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "client devices" "orders devices"; } }
@media (max-width: 899px) { .client-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "client" "devices" "orders"; } }
@media (max-width: 1099px) { .detail-grid { grid-template-columns: 1fr; } }


.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9999px; background: var(--surface); border: 1px solid var(--gray); color: var(--dark-gray); font-size: 14.5px; font-weight: 500; text-decoration: none !important; }
.chip-link:hover { border-color: var(--azure); color: var(--azure); }
.chip-link .icon { width: 16px; height: 16px; }
.chip-lbl { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--red-ink); }

/* ---------- fotografie a dokumenty zařízení */
#dropOverlay { position: fixed; inset: 0; z-index: 90; display: none; padding: 24px; background: rgba(16, 24, 32, .55); pointer-events: none; }
#dropOverlay.show { display: grid; }
.drop-box { place-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 3px dashed var(--green);
  border-radius: 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); text-align: center; padding: 20px; }
.drop-box .icon { width: 56px; height: 56px; color: var(--green); }
.drop-box b { font-size: 26px; }
.drop-box span { color: var(--muted); }
.panel-head label.btn { cursor: pointer; }
/* filtry pod hledáním na stránce Zakázky: přepínače vše / jen s příznakem (✓) / jen bez příznaku (×) */
.filter-pills { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-pills .pohoda-all { margin-left: auto; } /* hromadné Do POHODY vpravo nad seznamem */
.filter-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.filter-pill:hover { border-color: var(--muted); }
.filter-pill .icon { width: 14px; height: 14px; }
.filter-pill.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.filter-pill[data-filter="pohoda"].on { background: var(--pohoda-soft); border-color: var(--pohoda); color: var(--pohoda); }
.filter-pill.off { background: var(--accent-soft); border-color: var(--red-ink); color: var(--red-ink); }
/* štítek POHODA v seznamu zakázek: šedý = nezapsáno, modrý = zapsáno do POHODY */
.pohoda-pill { display: inline-block; margin-left: 8px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px; line-height: 18px; color: var(--muted); vertical-align: 1px; white-space: nowrap; }
.pohoda-pill.on { background: var(--pohoda-soft); border-color: var(--pohoda); color: var(--pohoda); }
/* Na fakturaci ve formuláři zakázky: šedé, dokud nejsou splněné podmínky BTK; pak zelené (CTA) */
.btn.invoice-btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.invoice-btn.ready { background: var(--green, #00bd7b); border-color: var(--green, #00bd7b); color: #fff; }
.btn.invoice-btn.ready:hover { background: #00b4ba; border-color: #00b4ba; }
.pohoda-box { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 12px; }
.dev-head { flex-wrap: wrap; }
.dev-head .dev-search { flex: 1 0 100%; max-width: none; min-width: 0; }
.dev-list > li[hidden] { display: none; }
@media (max-width: 599px) { .panel-head .btn .label { display: none; } .panel-head label.btn { padding: 0 12px; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 14px 16px; }
@media (max-width: 599px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px; } }
.thumb { aspect-ratio: 1; padding: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.thumb:hover img { transform: scale(1.04); }
.file-ext { flex: none; width: 44px; height: 44px; border-radius: 6px; background: var(--light-gray); color: var(--red-ink); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; }
.row-side.row-actions { flex-direction: row; align-items: center; gap: 6px; }
a.row-title { color: inherit; }
a.row-title:hover { color: var(--azure); }
/* tabulka (BTK) – na telefonu se řádky skládají do karet */
.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table a { color: inherit; } .data-table a:hover { color: var(--azure); }
.btk-toolbar { align-items: center; }
.btk-month { font-size: 18px; min-width: 150px; text-align: center; }
.btk-toolbar input[type=month] { width: auto; }
.btk-toolbar .btn.active { background: var(--red); border-color: var(--red); color: #fff; }
.btk-actions { white-space: nowrap; text-align: right; }
.btk-actions .btn + .btn { margin-left: 4px; }
.btk-doc { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.btk-doc a:not(.btn) { font-weight: 600; overflow-wrap: anywhere; }
.btk-doc .spacer { flex: 1; }
.badge .icon { width: 13px; height: 13px; }
.kv dd a .icon { width: 16px; height: 16px; vertical-align: -3px; }
.print-only { display: none; }
@media (max-width: 799px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .data-table td { border: 0; padding: 2px 0; position: relative; }
  .data-table td[data-l] { padding-left: 116px; min-height: 22px; }
  .data-table td[data-l]::before { content: attr(data-l); position: absolute; left: 0; top: 3px; width: 108px; color: var(--muted); font-size: 13px; }
  .btk-actions { text-align: left; padding-top: 8px !important; }
  .btk-month { min-width: 0; flex: 1; }
}
@media print {
  .print-only { display: block; margin-bottom: 10px; }
  .data-table { font-size: 11px; } .data-table td, .data-table th { padding: 5px 6px; }
  .panel { box-shadow: none; border: 0; }
}

/* náhledová fotka zařízení */
.icon.filled { fill: currentColor; }
.device-cover { display: block; width: 100%; max-width: 360px; aspect-ratio: 4 / 3; margin: 0 0 14px; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.device-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* obrázek ze šablony: celý (contain) na bílém, se štítkem */
.device-cover.tpl { position: relative; background: #fff; cursor: pointer; }
.device-cover.tpl img { object-fit: contain; }
.cover-tag { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 600; }
/* náhled obrázku ve formuláři šablony */
.tpl-image { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.tpl-image img { width: 160px; height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.device-cover.empty { aspect-ratio: auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-style: dashed; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: none !important; }
/* detail zařízení: údaje přes celou šířku – fotka vlevo, údaje vpravo (na telefonu pod sebou) */
/* fotka | údaje o zařízení | data (instalace, záruka, prevence…); na užší obrazovce se data zalomí pod */
.device-info .kv + .kv { margin-top: 8px; }
@media (min-width: 800px) {
  .device-info { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-start; }
  .device-info > .device-cover { flex: 0 0 300px; margin: 0; }
  .device-info > .kv { flex: 1 1 300px; min-width: 0; margin-top: 0; grid-template-columns: 120px 1fr; }
  .device-info > .device-qr { flex: 0 0 auto; margin: 0 32px 0 auto; }
}
.device-cover.empty:hover { border-color: var(--azure); color: var(--azure); }
.thumb-cover { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #ffc93c; display: grid; place-items: center; }
.thumb-cover .icon { width: 16px; height: 16px; }
.viewer-btn.on { color: #ffc93c; }

/* výběr více fotek */
.select-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--info-soft); border-bottom: 1px solid var(--border); }
.select-bar[hidden] { display: none; }
.select-bar .spacer { flex: 1; }
.thumb { position: relative; }
.thumb-check { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .35);
  display: none; place-items: center; color: transparent; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.thumb-check .icon { width: 16px; height: 16px; }
.gallery.selecting .thumb { cursor: pointer; }
.gallery.selecting .thumb-check { display: grid; }
.gallery.selecting .thumb:hover img { transform: none; }
.thumb.selected { outline: 3px solid var(--green); outline-offset: -3px; }
.thumb.selected img { opacity: .75; }
.thumb.selected .thumb-check { background: var(--green); border-color: var(--green); color: #fff; }

/* prohlížeč fotek přes celou obrazovku */
dialog.viewer-full { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; background: #000; color: #fff; box-shadow: none; }
dialog.viewer-full::backdrop { background: #000; }
.viewer { position: relative; width: 100%; height: 100%; }
.viewer-img { position: absolute; inset: 0; display: grid; place-items: center; touch-action: pan-y pinch-zoom; }
.viewer-img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none; }
.viewer-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 4px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 24px 18px; background: linear-gradient(rgba(0, 0, 0, .7), transparent); }
.viewer-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-title b, .viewer-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title small { color: rgba(255, 255, 255, .7); font-size: 13px; }
.viewer-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.viewer-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; cursor: pointer; }
.viewer-nav:hover { background: rgba(0, 0, 0, .7); }
.viewer-nav.prev { left: 16px; } .viewer-nav.next { right: 16px; }
@media (max-width: 599px) { .viewer-nav { display: none; } } /* na telefonu se listuje tahem prstu */

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; margin-bottom: 8px; opacity: .6; }

/* ---------- modal */
dialog {
  border: 0; padding: 0; border-radius: 14px; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25); color: var(--text); background: var(--surface);
}
dialog::backdrop { background: rgba(16, 24, 32, .45); }
.modal:focus { outline: none; }
.modal { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head { border-top: 6px solid var(--red); }
.modal-head h2 { flex: 1; font-size: 21px; color: var(--red-ink); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }
@media (max-width: 599px) {
  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .modal { height: 100dvh; max-height: 100dvh; }
  .modal-body { flex: 1; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* prohlížeč BTK formuláře (PDF.js) přes celou obrazovku */
dialog.pdf-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; padding: 0; background: var(--bg);
  -webkit-text-size-adjust: none; text-size-adjust: none; } /* telefon nesmí zvětšovat písmo v polích PDF (přetékalo by z rámečků) */
.pdf-bar { position: absolute; top: 0; left: 0; right: 0; height: 76px; display: flex; align-items: center; gap: 10px; padding: 0 20px;
  background: var(--surface); border-top: 4px solid var(--red); border-bottom: 1px solid var(--border); z-index: 2; }
.pdf-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.pdf-title b { color: var(--red-ink); font-size: 21px; }
.pdf-title small { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* větší tlačítka v hlavičce prohlížeče PDF (lépe se trefují i na tabletu) */
.pdf-bar .btn.sm { height: 46px; padding: 0 20px; font-size: 16px; }
.pdf-bar .btn.sm.icon-only { width: 46px; padding: 0; }
.pdf-bar .btn .icon { width: 20px; height: 20px; }
.pdf-status { color: var(--muted); white-space: nowrap; margin-right: 6px; font-size: 15px; }
.pdf-status.warn { color: var(--warn); } .pdf-status.ok { color: var(--ok); } .pdf-status.err { color: var(--danger); }
.pdf-scroll { position: absolute; top: 76px; left: 0; right: 0; bottom: 0; overflow: auto; background: var(--bg); }
.pdf-scroll .pdfViewer .page { box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
/* PDF.js počítá rozměr stránky BEZ rámečku – globální box-sizing: border-box by zmenšil obrázek stránky, ale ne vrstvu polí
   (na telefonu se pole posouvala mimo rámečky) */
.pdf-scroll .pdfViewer .page { box-sizing: content-box; }
/* formulářové prvky PDF.js: papír je vždy světlý (CanvasText by v tmavém režimu byl bílý), tmavé kroužky a čtverečky,
   tmavá tečka / křížek po zaškrtnutí, bez červeného rámečku povinných polí */
.pdf-scroll { color-scheme: light; }
.pdf-dialog .annotationLayer :is(input, textarea, select):required { outline: none !important; }
/* zrušit obecné styly polí aplikace (min. výška 42 px, vnitřní okraje, zaoblení, barva textu z motivu) –
   pole v PDF se musí zmenšovat a zvětšovat přesně se stránkou (jinak na telefonu přetékají) */
.pdf-dialog .annotationLayer :is(input, textarea, select) {
  min-height: 0 !important; padding: 0 calc(2px * var(--scale-factor, 1)) !important; border-radius: 0 !important;
  color: #111 !important; box-shadow: none !important; line-height: normal;
}
.pdf-dialog .annotationLayer textarea { padding-top: calc(1px * var(--scale-factor, 1)) !important; }
.pdf-dialog .annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input { padding: 0 !important; }
/* bez modrého podkladu polí – vidět jsou jen rámečky z formuláře; aktivní pole dostane jemný rámeček */
.pdf-dialog .annotationLayer .textWidgetAnnotation :is(input, textarea),
.pdf-dialog .annotationLayer .choiceWidgetAnnotation select {
  background-image: none !important; background-color: transparent !important; border-color: transparent !important;
}
.pdf-dialog .annotationLayer .textWidgetAnnotation :is(input, textarea):hover,
.pdf-dialog .annotationLayer .choiceWidgetAnnotation select:hover { border-color: rgba(0, 0, 0, .18) !important; }
.pdf-dialog .annotationLayer .textWidgetAnnotation :is(input, textarea):focus,
.pdf-dialog .annotationLayer .choiceWidgetAnnotation select:focus { border-color: rgba(0, 189, 123, .7) !important; outline: none !important; }
.pdf-dialog .annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) { display: flex; align-items: center; justify-content: center; }
.pdf-dialog .annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
  width: 100% !important; height: 100% !important; position: relative; margin: 0; /* velikost = obdélník pole v PDF */
  background: #fff !important; background-image: none !important; outline: none !important; box-shadow: none !important;
  border: max(1.5px, calc(var(--scale-factor, 1) * 1.1px)) solid #4c4c4c !important;
}
.pdf-dialog .annotationLayer .buttonWidgetAnnotation.radioButton input { border-radius: 50% !important; }
.pdf-dialog .annotationLayer .buttonWidgetAnnotation.checkBox input { border-radius: 18% !important; }
.pdf-dialog .annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input:is(:checked, :hover, :focus) { border-color: #111 !important; }
.pdf-dialog .annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before { background-color: #111 !important; }
.pdf-dialog .annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
.pdf-dialog .annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after {
  background-color: #111 !important; width: max(2px, calc(var(--scale-factor, 1) * 1.6px)) !important; height: 76% !important; top: 12% !important;
  left: calc(50% - max(1px, calc(var(--scale-factor, 1) * 0.8px))) !important;
}
@media (max-width: 599px) { .pdf-bar .btn .label, .pdf-status { display: none; } .pdf-bar { gap: 6px; padding: 0 10px; height: 64px; } .pdf-scroll { top: 64px; }
  .pdf-bar .btn.sm, .pdf-bar .btn.sm.icon-only { height: 42px; width: 42px; padding: 0; } .pdf-title b { font-size: 18px; } .pdf-title small { font-size: 13px; } }

/* potvrzovací okno (ask) – malé i na telefonu */
dialog.ask { width: min(440px, calc(100vw - 32px)); height: fit-content; max-height: calc(100dvh - 32px); margin: auto; border-radius: 14px; }
dialog.ask .modal { height: auto; }
dialog.ask .modal-body p { margin: 0 0 4px; }
dialog.ask .modal-body input { margin-top: 10px; }
dialog.ask .modal-foot { padding-bottom: 14px; }

.form { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px 12px; }
.f { grid-column: span 6; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f.c3 { grid-column: span 3; } .f.c2 { grid-column: span 2; } .f.c4 { grid-column: span 4; }
@media (max-width: 599px) { .f.c3, .f.c2, .f.c4 { grid-column: span 6; } }
.f > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.f .req { color: var(--danger); }
.f .hint { font-size: 12.5px; color: var(--muted); }
.f .hint.warn { color: var(--warn); font-weight: 600; }
.f .sub-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.btk-folder-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.btk-folder-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.btk-folder-list li b { overflow-wrap: anywhere; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { flex: 1; }
.pc-field .inline > select { flex: 0 0 calc(50% - 6px); } /* třída ochrany: výběr v levé polovině, nápověda vpravo */
.pc-hint { font-size: 12px; color: var(--muted); line-height: 1.35; }
.pc-field .inline { align-items: flex-start; }
.pc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 12px; margin-top: 5px; } /* nápověda pod výběrem ve dvou sloupcích */
.pc-toggle { flex: 0 0 calc(50% - 6px); flex-wrap: nowrap; } .pc-toggle label { flex: 1; } .pc-toggle span { width: 100%; justify-content: center; }
.tariff-check { flex: none; padding: 0 4px; white-space: nowrap; }
input:disabled { opacity: .55; cursor: not-allowed; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 500; color: var(--text); }
.check input { width: 18px; height: 18px; min-height: 0; }
.section-label { grid-column: span 6; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-top: 6px; }

.ares { background: var(--light-gray); border-radius: 8px; padding: 12px; grid-column: span 6; }
.ares-title { font-weight: 600; font-size: 15px; margin-bottom: 8px; color: var(--red-ink); display: flex; gap: 6px; align-items: center; }
.ares-results { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.ares-item { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
.ares-item:hover { border-color: var(--accent); }
.ares-item b { display: block; }
.ares-msg { font-size: 13px; margin-top: 8px; color: var(--muted); }

/* ---------- toast & login */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 100;
  background: #17222b; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; transition: .2s; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }
@media (max-width: 899px) { .toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); } }

/* přihlášení – červený blok s logem + formulář (jako blok na hitechdent.cz) */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; border-top: 8px solid var(--red); background: var(--light-gray); }
.login-card { display: grid; grid-template-columns: 1fr 1fr; width: min(880px, 100%); background: var(--surface); box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.login-hero { background: var(--red); color: #fff; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-hero img { width: 220px; max-width: 100%; }
.login-hero p { font-size: 24px; line-height: 1.35; margin: 0; }
.login-hero small { font-size: 15px; opacity: .85; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.login form { padding: 40px; display: flex; flex-direction: column; gap: 14px; }
.login form h2 { font-size: 28px; color: var(--red-ink); }
@media (max-width: 699px) {
  .login { padding: 0; place-items: stretch; border-top: 0; background: var(--surface); }
  .login-card { grid-template-columns: 1fr; box-shadow: none; }
  .login-hero { padding: 28px 22px; gap: 10px; } .login-hero img { width: 170px; } .login-hero p { font-size: 19px; }
  .login form { padding: 24px 22px 40px; }
}
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* =====================================================================  v2: uživatelé, kalendář, zakázky */
.text-danger { color: var(--danger); font-weight: 600; }
.mobile-only { display: none !important; }
@media (max-width: 899px) { .mobile-only { display: inline-flex !important; } .hide-xs { display: none; } }
.avatar { font-family: inherit; display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--c); color: #fff; font-weight: 700; letter-spacing: .02em; }
.me-link { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 9999px; color: var(--text); text-decoration: none !important; border: 1px solid transparent; }
.me-link:hover, .me-link.active { border-color: var(--gray); color: var(--text); }
.me-link b { display: block; font-size: 15px; font-weight: 600; line-height: 1.1; }
.me-link small { color: var(--muted); font-size: 13px; }
.foot-row { display: flex; gap: 6px; flex-wrap: wrap; }
.me-btn { text-decoration: none !important; }
.auth-foot { text-align: center; font-size: 14px; color: var(--muted); }

.ok-btn { background: var(--green); border-color: var(--green); color: #fff; }
.ok-btn:hover { background: #00a36a; border-color: #00a36a; color: #fff; }

/* uvítací červený blok na Přehledu */
.hero { background: var(--red); color: #fff; padding: 26px 30px; margin-bottom: 18px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; box-shadow: var(--shadow); }
.hero-text { flex: 1; min-width: 240px; }
.hero h1 { color: #fff; font-size: 32px; }
.hero p { margin: 6px 0 0; font-size: 18px; opacity: .92; }
.hero .btn { border-color: #fff; }
.hero .btn.white { background: #fff; color: var(--red); }
.hero .btn.white:hover { color: var(--azure); }
/* vánoční vločky v pruhu s pozdravem (isXmas / xmasSnow v app.js) */
.hero.xmas { position: relative; overflow: hidden; padding-top: 19px; padding-bottom: 19px; } /* s nápisem Veselé Vánoce o 15 % nižší */
.hero.xmas p { margin-top: 2px; }
.hero.xmas > :not(.snow) { position: relative; z-index: 1; }
.snow { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.snow i { position: absolute; top: -20px; color: #fff; font-style: normal; line-height: 1; animation: snow-fall linear infinite; }
@keyframes snow-fall { to { transform: translate(18px, 260px) rotate(220deg); } }
@media (prefers-reduced-motion: reduce) { .snow i { animation-play-state: paused; } } /* vločky stojí na náhodných místech */
@media print { .snow { display: none; } }
@media (max-width: 599px) { .hero { padding: 20px 18px; } .hero h1 { font-size: 24px; } .hero p { font-size: 16px; } .hero .btn { flex: 1; } .hero.xmas { padding-top: 12px; padding-bottom: 12px; } }

/* řádek se dvěma akcemi (odkaz + tlačítko) */
.row.split { padding: 0 12px 0 0; }
.row-btns { display: flex; gap: 6px; flex: none; }
.row-link { display: block; padding: 12px 16px; color: inherit; text-decoration: none !important; }
.row-link:hover { background: var(--surface-2); }
/* seznam zařízení u klienta: miniatura náhledu na začátku řádku */
.row-link.with-thumb { display: flex; align-items: center; gap: 14px; }
.row-text { flex: 1; min-width: 0; }
.dev-thumb { flex: none; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.dev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dev-thumb.tpl { background: #fff; } .dev-thumb.tpl img { object-fit: contain; }
.dev-thumb.empty { color: var(--muted); } .dev-thumb.empty .icon { width: 24px; height: 24px; }
@media (max-width: 599px) { .dev-thumb { width: 48px; height: 48px; } .row-link.with-thumb { gap: 10px; } }
.tpl-card-head { display: flex; align-items: flex-start; gap: 10px; }
.tpl-card-text { flex: 1; min-width: 0; }
.tpl-card-img { width: 44px; height: 44px; }
.tpl-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 10px; }
.tpl-card { padding: 10px 12px; }
.tpl-card .card-title { font-size: 15.5px; }
.tpl-card .card-sub { font-size: 13.5px; }
.tpl-card .card-meta { margin-top: 6px; } /* zalomí se, když je karta úzká */
.tpl-card .icon-badge { padding-left: 6px; padding-right: 6px; }
@media (max-width: 599px) { .label-sm { display: none; } }

.ev-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- kalendář */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { margin-left: 8px; font-size: 18px; text-transform: none; }
.cal-title::first-letter { text-transform: uppercase; }
.cal-opts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cal-user { width: auto; min-width: 170px; }
@media (max-width: 599px) { .cal-opts { width: 100%; } .cal-user { flex: 1; } .cal-title { font-size: 16px; } }

.month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.month-head, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head div { padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.mcell { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell:hover { background: var(--surface-2); }
.mcell.other { background: var(--surface-2); color: var(--muted); }
.mnum { font-size: 13px; font-weight: 600; padding: 2px 4px; align-self: flex-start; border-radius: 999px; min-width: 24px; text-align: center; }
.mcell.today .mnum { background: var(--red); color: #fff; }
.mev { display: block; font-size: 12px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 3px solid var(--c);
  color: var(--text); text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mev .mt { font-weight: 700; margin-right: 4px; }
.mev.done, .tev.done { opacity: .55; }
.mev.cancelled, .tev.cancelled { opacity: .45; text-decoration: line-through !important; }
.mmore { font-size: 11.5px; color: var(--muted); padding: 0 6px; }
@media (max-width: 699px) {
  .mcell { min-height: 64px; padding: 2px; }
  .mev { font-size: 10.5px; padding: 1px 3px; border-left-width: 2px; }
}

.tg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tg-head, .tg-allday { display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.tg-day-h { padding: 8px 4px; text-align: center; font-size: 13px; color: var(--muted); display: flex; gap: 4px; justify-content: center; align-items: baseline; border-left: 1px solid var(--border); }
.tg-day-h b { font-size: 17px; color: var(--text); }
.tg-day-h.today b { color: var(--accent); }
.tg-day-h.today { background: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--red); }
.tg-gutter { position: relative; }
.tg-allday .tg-gutter { padding: 6px; font-size: 11px; }
.tg-ad-cell { border-left: 1px solid var(--border); padding: 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tg-scroll { height: calc(100vh - 250px); min-height: 360px; overflow-y: auto; }
@media (max-width: 899px) { .tg-scroll { height: calc(100dvh - 300px - var(--tabbar-h)); } }
.tg-body { display: grid; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); position: relative;
  background-image: repeating-linear-gradient(to bottom, var(--border) 0, var(--border) 1px, transparent 1px, transparent 48px); }
.tg-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.tg-col { position: relative; border-left: 1px solid var(--border); cursor: copy; }
.tg-col.today { background: rgba(180, 20, 18, .03); }
.tg-col:hover { background: rgba(0, 180, 186, .06); }
.tev { position: absolute; border-radius: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.25; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-left: 3px solid var(--c); color: var(--text); text-decoration: none !important;
  display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tev:hover { z-index: 2; box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.tev b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tev span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tev.short span:nth-of-type(n+2) { display: none; }
.tev.tiny span { display: none; }
/* týden na telefonu: 7 úzkých sloupců */
@media (max-width: 699px) {
  .tg.days-7 .tg-head, .tg.days-7 .tg-allday, .tg.days-7 .tg-body { grid-template-columns: 30px repeat(var(--days), minmax(0, 1fr)); }
  .tg.days-7 .tg-day-h { flex-direction: column; align-items: center; gap: 0; padding: 5px 0; font-size: 10.5px; line-height: 1.15; }
  .tg.days-7 .tg-day-h b { font-size: 14px; }
  .tg.days-7 .tg-hour { right: 3px; font-size: 9.5px; }
  .tg.days-7 .tg-allday .tg-gutter { padding: 4px 2px; font-size: 9px; }
  .tg.days-7 .tg-ad-cell { padding: 1px; }
  .tg.days-7 .tev { padding: 1px 2px; font-size: 9.5px; line-height: 1.15; border-radius: 3px; border-left-width: 2px; }
  .tg.days-7 .tev span { display: none; }
  .tg.days-7 .tev b { white-space: normal; overflow-wrap: anywhere; font-weight: 600; }
  .seg a { padding: 6px 9px; }
}
.tg-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.tg-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* ---------- zakázka – formulář */
dialog.wide { width: min(980px, calc(100vw - 32px)); }
@media (max-width: 599px) { dialog.wide { width: 100vw; max-width: 100vw; } }
.type-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.type-pick label { cursor: pointer; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; } /* skrytý přepínač nesmí roztáhnout okno */
.type-pick span { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 9999px; border: 1px solid var(--gray); background: var(--surface); font-weight: 600; font-size: 15px; color: var(--dark-gray); }
.type-pick span:hover { border-color: var(--azure); color: var(--azure); }
.type-pick input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
/* zamčený výběr (úprava zakázky): ostatní volby utlumené, nejde kliknout */
.type-pick label:has(input:disabled) { cursor: default; }
.type-pick input:disabled:not(:checked) + span { opacity: .4; }
.type-pick input:disabled + span:hover { border-color: var(--gray); color: var(--dark-gray); }
.type-pick input:disabled:checked + span:hover { border-color: var(--red); color: #fff; }
.oi-fixed input[value="1"]:checked + span { background: var(--green); border-color: var(--green); }
.oi-fixed .icon { width: 16px; height: 16px; }
.oi-fixed { gap: 10px; margin: 8px 0 12px; } /* odsazení od Provedených prací a Náhradních dílů */
.type-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* zakázka: datum, od, do, strávený čas v jednom řádku (na telefonu po dvou) */
.order-when { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.order-when > .f { grid-column: auto; }
.order-when > .f.when-wide { grid-column: span 3; }
@media (max-width: 599px) { .order-when > .f.when-wide { grid-column: 1 / -1; } }
/* elektrické měření u zařízení v BTK zakázce */
.el-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.el-label > label { margin: 0; }
.vis-toggle { margin-left: auto; }
.oi-vis-f .vis-list { margin-top: 6px; }
.oi-details .oi-parts-f, .oi-details .oi-note-f { margin-top: 14px; }
.p-note-text { white-space: pre-wrap; } /* odstup náhradních dílů od elektrického měření */
/* vizuální kontrola v BTK zakázce: bod | vyhovuje / nevyhovuje */
.vis-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.vis-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 12px; }
.vis-row:nth-child(even) { background: var(--surface-2); }
.vis-row > span { flex: 1; min-width: 0; }
.vis-pick { flex: none; flex-wrap: nowrap; gap: 4px; }
.vis-pick span { height: 30px; padding: 0 12px; font-size: 13px; }
.vis-pick label:last-child input:checked + span { background: var(--danger, #c62828); border-color: var(--danger, #c62828); }
.vis-pick label:first-child input:checked + span { background: var(--ok, #1b8a3a); border-color: var(--ok, #1b8a3a); }
.el-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } /* dva sloupce – nižší blok */
.el-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 30px; gap: 8px; align-items: center; padding: 7px 10px 7px 12px; }
.el-row:nth-child(4n+3), .el-row:nth-child(4n+4) { background: var(--surface-2); }
.el-row:nth-child(odd) { border-right: 1px solid var(--border); }
.el-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.el-name { font-weight: 600; }
.el-name small { font-weight: 400; }
.el-lim { color: var(--muted); font-size: 12.5px; }
.el-unit { color: var(--muted); }
.el-row input { min-height: 36px; padding: 6px 9px; text-align: right; }
@media (max-width: 699px) { .el-table { grid-template-columns: minmax(0, 1fr); } .el-row:nth-child(odd) { border-right: 0; } .el-row:nth-child(n) { background: none; } .el-row:nth-child(even) { background: var(--surface-2); } }
@media (max-width: 599px) { .order-when { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper output { flex: 1; text-align: center; font-weight: 700; font-size: 17px; min-width: 64px; height: 40px; line-height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.stepper .btn { width: 44px; height: 40px; }

.order-item { border: 1px solid var(--border); border-left: 4px solid var(--red); border-radius: 6px; padding: 12px; margin-bottom: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.oi-head { display: flex; gap: 8px; align-items: center; }
.oi-num { font-weight: 700; font-size: 15px; color: var(--red-ink); white-space: nowrap; }
.oi-head select, .oi-head input { flex: 1; min-width: 0; }
.oi-info { margin-top: -4px; }
.add-item { align-self: flex-start; border-style: dashed; }
/* fotky ze servisu v bloku zařízení zakázky */
.oi-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.oi-thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.oi-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.oi-thumb.pending { border: 2px dashed var(--green); }
.oi-thumb-del { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }
.oi-thumb-del .icon { width: 14px; height: 14px; }
.order-photos { max-width: 900px; margin-top: 16px; }
.order-photos-group { padding: 12px 16px 0; }
.order-photos-group .gallery { padding: 8px 0 14px; }
.oi-btk { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.oi-btk[hidden] { display: none; }
/* ukazatel: BTK formulář vyplněný (zelená) / chybí (červená) */
.btk-state { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; }
.btk-state .icon { width: 18px; height: 18px; stroke-width: 3; }
.btk-state b { font-size: 18px; font-weight: 800; line-height: 1; }
.btk-state.ok { background: var(--ok); }
.btk-state.missing { background: var(--danger); }
.btk-state.sm { width: 20px; height: 20px; }
.btk-state.sm .icon { width: 12px; height: 12px; }
.btk-state.sm b { font-size: 13px; }
.type-line { display: inline-flex; align-items: center; gap: 6px; }
/* štítek typu (Servis / BTK) stejně široký, aby byly příznaky ✓ / ! v seznamech zarovnané pod sebou */
.type-line > .badge:first-child { min-width: 54px; justify-content: center; text-align: center; box-sizing: border-box; }
.btk-missing { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--gray); border-radius: 8px; color: var(--muted); width: 100%; }
.btk-missing .icon { width: 18px; height: 18px; flex: none; }
.extra-techs { display: flex; flex-direction: column; gap: 6px; }
.extra-techs:not(:empty) { margin-top: 2px; }

.parts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.part-row { display: grid; grid-template-columns: 70px 64px minmax(110px, 0.55fr) 2.5fr 92px 36px; gap: 6px; align-items: center; }
.part-row input[type=text] { min-height: 36px; padding: 6px 9px; }
.part-head span { font-size: 12px; font-weight: 600; color: var(--muted); }
.sp-list { display: flex; flex-direction: column; gap: 6px; }
.sp-body { display: flex; flex-direction: column; gap: 6px; }
.sp-row { display: grid; grid-template-columns: 1fr 140px 36px; gap: 6px; align-items: center; }
.sp-row input[type=text] { min-height: 36px; padding: 6px 9px; }
.sp-head span { font-size: 12px; font-weight: 600; color: var(--muted); }
.sp-add { align-self: stretch; justify-content: center; }.p-bill { display: flex; align-items: center; gap: 6px; font-size: 13px; justify-content: center; height: 36px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; }
.p-bill input { width: 18px; height: 18px; min-height: 0; }
.p-bill span { display: none; }
.p-del { width: 36px; height: 36px; }
@media (max-width: 699px) {
  .part-head { display: none; }
  .part-row { grid-template-columns: 60px 56px 1fr 80px 36px; grid-template-areas: "qty unit name name name" "serial serial serial bill del";
    padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
  .p-qty { grid-area: qty; } .p-unit { grid-area: unit; } .p-name { grid-area: name; } .p-serial { grid-area: serial; } .p-bill { grid-area: bill; } .p-del { grid-area: del; }
  .p-bill span { display: inline; }
}

.sigpad { position: relative; height: 170px; border: 1.5px dashed #b8c4cc; border-radius: 10px; background: #fff; touch-action: none; }
.sigpad canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: #a3afb8; font-size: 13px; pointer-events: none; }
.sigpad.signed .sig-hint { display: none; }
.sigpad.signed { border-style: solid; border-color: var(--border); }
.sig-clear { position: absolute; right: 6px; top: 6px; height: 28px; font-size: 12px; }

/* ---------- profil */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.user-actions .role-select { width: auto; min-height: 32px; height: 32px; padding: 0 30px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
@media (max-width: 699px) { .user-actions { width: 100%; justify-content: flex-start; } .row:has(.user-actions) { flex-wrap: wrap; } }

/* ---------- servisní protokol */
/* protokol je „papír“ – zůstává světlý i v tmavém režimu */
.protocol { --text: #1a1a1a; --muted: #6b6b6b; --border: #dedede; --surface-2: #f7f7f7; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; max-width: 900px; box-shadow: var(--shadow); font-size: 14px; }
/* detail zakázky: stránka široká jako protokol (tlačítka nad ním nepřesahují), na počítači protokol zvětšený pro čitelnost */
@media screen and (min-width: 1000px) {
  .protocol { zoom: 1.15; }
  .main:has(> .protocol) { max-width: calc(900px * 1.15 + 56px); }
}
.main:has(> .protocol) :is(.btk-pages, .btk-missing-note, .order-photos) { max-width: none; }
.p-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 3px solid var(--red); padding-bottom: 12px; margin-bottom: 16px; }
.p-company img { height: 30px; display: block; margin-bottom: 6px; }
.p-company-name { font-size: 20px; font-weight: 700; color: var(--red); }
.p-title b { color: var(--red); }
.p-label { color: var(--red) !important; }
.p-num { background: var(--red) !important; }
.p-title { text-align: right; } .p-title div { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); } .p-title b { font-size: 18px; }
.p-small { font-size: 12.5px; color: var(--muted); }
.p-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.p-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.p-zasah { margin-bottom: 14px; } /* Zásah přes celou šířku, pod ním zákazník a dodavatel */
.p-legal { font-size: 12.5px; color: var(--muted); margin: 1px 0 3px; } /* právní věta pod typem BTK */
.p-party { border: 1px solid var(--border); border-left: 4px solid var(--red); border-radius: 0 10px 10px 0; padding: 10px 14px; line-height: 1.5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.p-party-name { font-family: var(--font-title); font-weight: 700; font-size: 17px; margin: 2px 0 4px; }
.p-kv td { padding: 1px 10px 1px 0; vertical-align: top; } .p-kv td:first-child { color: var(--muted); white-space: nowrap; }
.p-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; break-inside: avoid; }
.p-item-head { display: flex; gap: 10px; align-items: flex-start; }
.p-num { width: 24px; height: 24px; border-radius: 50%; background: var(--text); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.p-work { margin: 8px 0 0 34px; white-space: pre-wrap; }
.p-parts { width: calc(100% - 34px); margin: 8px 0 0 34px; border-collapse: collapse; font-size: 13px; }
.p-parts th, .p-parts td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.p-parts th { background: var(--surface-2); font-size: 12px; }
.p-parts .num { width: 60px; text-align: right; } .p-parts .c { width: 80px; text-align: center; }
.p-el { white-space: normal; } /* elektrické měření v protokolu BTK */
.p-el-note { margin-top: 5px; }
.p-verdict { margin-top: 8px; padding: 6px 10px; border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 0 6px 6px 0; }
.p-verdict.ok { border-left-color: #1b8a3a; } .p-verdict.ok b { color: #1b8a3a; }
.p-verdict.fail { border-left-color: var(--red); } .p-verdict.fail b { color: var(--red); }
.p-el-table tr.p-fail td { color: var(--red); }
.p-el .p-parts { margin-left: 0; width: 100%; margin-top: 6px; }
.p-el-table .num { width: 120px; white-space: nowrap; }
.p-el-table td:nth-child(2) { color: var(--muted); white-space: nowrap; }
/* telefon: limit se zalomí a sloupec Naměřeno nemá pevnou šířku, aby se tabulka vešla na šířku obrazovky */
@media screen and (max-width: 599px) {
  .p-el-table { table-layout: fixed; }
  .p-el-table th, .p-el-table td { padding: 4px 6px; overflow-wrap: anywhere; }
  .p-el-table td:nth-child(2) { white-space: normal; }
  .p-el-table th:nth-child(1), .p-el-table td:nth-child(1) { width: 38%; }
  .p-el-table .num { width: 27%; white-space: normal; }
}
/* číslované sekce protokolu: 1 Zařízení, 2 Elektrické měření / Provedené práce, 3 Použité náhradní díly */
.p-sec-title { align-self: center; font-family: var(--font-title); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--red-ink); }
.p-sec-body { margin: 8px 0 0 34px; }
.p-sec-body .p-work, .p-sec-body .p-parts { margin-left: 0; width: 100%; }
.p-sec-body .p-work:first-child, .p-sec-body .p-parts:first-child { margin-top: 0; }
.p-dev { display: flex; gap: 14px; align-items: flex-start; }
.p-dev-img { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; flex: none; }
.p-dev .p-kv { margin-top: 4px; align-self: start; }
.p-dev-info { flex: 1; min-width: 0; }
.p-dev-cols .p-kv { width: auto; justify-self: start; }
.p-dev-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; } /* zařízení: údaje | klasifikace */
@media (max-width: 599px) { .p-dev-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 599px) { .p-sec-body { margin-left: 0; } .p-dev-img { width: 72px; height: 72px; } }
.p-note { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; margin-top: 6px; }
.p-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 48px; break-inside: avoid; }
.p-sign { height: 90px; border-bottom: 1px solid var(--text); display: flex; align-items: flex-end; justify-content: center; }
.p-sign img { max-height: 86px; max-width: 100%; }
.p-sign { position: relative; }
.p-qualif { font-size: 11.5px; color: var(--muted); margin-top: 2px; } /* kvalifikace technika pod jménem */
.p-sign .p-stamp { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); mix-blend-mode: multiply; }
.p-sign .p-sig { position: relative; z-index: 1; }
.sigpad.has-stamp { background-repeat: no-repeat; background-position: center; background-size: auto 75%; }
.sigpad.has-stamp .sig-hint { display: none; }
/* profil: pole zůstává bílé, razítko se ukáže až s podpisem */
.sigpad.stamp-when-signed:not(.signed) { background-image: none !important; }
.sigpad.stamp-when-signed:not(.signed) .sig-hint { display: block; }
.stamp-preview { max-height: 110px; max-width: 100%; display: block; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 6px; }
.p-sign-label { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
@media (max-width: 599px) {
  .protocol { padding: 16px; } .p-grid, .p-signs { grid-template-columns: 1fr; gap: 10px; }
  .p-head { flex-direction: column; } .p-title { text-align: left; }
  .p-work, .p-parts { margin-left: 0; width: 100%; }
}
/* BTK formuláře za protokolem zakázky (jeden dokument) */
.btk-pages { max-width: 900px; }
.btk-missing-note { max-width: 900px; margin-top: 16px; }
.btk-page { display: block; width: 100%; height: auto; margin-top: 16px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); }
@media print {
  @page btk { size: A4; margin: 0; }
  .btk-pages { max-width: none; }
  .btk-page { page: btk; break-before: page; width: 210mm; height: 297mm; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .appbar, .tabbar, .no-print, .toast { display: none !important; }
  .protocol, .protocol * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .main { margin: 0; padding: 0; max-width: none; }
  .protocol { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 12px; }
  .p-page2 { break-before: page; } /* BTK: vizuální kontrola, měření a podpis na 2. straně */
  .p-grid, .p-signs { grid-template-columns: 1fr 1fr !important; }
  .p-head { flex-direction: row !important; } .p-title { text-align: right !important; }
}

/* drobnosti podle webu */
input[type=checkbox], input[type=radio] { accent-color: var(--red); }
.f > label { font-size: 14px; color: var(--dark-gray); }
.login .hint { font-size: 13px; color: var(--muted); }
.section-label { color: var(--red-ink); }
::selection { background: rgba(180, 20, 18, .15); }

/* QR kód zařízení v Údajích o zařízení */
.device-qr { margin: 16px 0 0; text-align: center; }
.device-qr > svg { display: block; width: 150px; height: 150px; border: 1px solid var(--border); border-radius: 8px; }
.device-qr figcaption { margin-top: 6px; font-size: 12px; color: var(--muted); }
.device-qr .qr-print { margin-top: 8px; }
@media print { .device-qr .qr-print { display: none; } }
/* servisní historie zařízení – čísla zakázek zarovnaná pod sebou */
.hist-head { display: inline-grid; grid-template-columns: 100px 70px 28px; align-items: center; justify-items: start; margin-right: 12px; vertical-align: middle; }
/* tlačítka BTK / Servis u zařízení v kartě klienta – stejná šířka */
.row-btn-txt { min-width: 88px; padding: 0 12px; justify-content: center; font-weight: 600; }
/* zamčené pole (např. neznámé datum instalace) */
.is-locked { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.install-unknown { white-space: nowrap; }
.chip:disabled { opacity: .45; cursor: default; }
/* našeptávání náhradních dílů v zakázce */
.part-row { position: relative; }
.part-suggest { position: absolute; top: calc(100% + 4px); z-index: 30; width: min(560px, 90vw); max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px; }
.ps-item { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.ps-item:hover, .ps-item.active { background: var(--surface-2); }
.ps-code { font-weight: 700; font-size: 14px; white-space: nowrap; }
.ps-name { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-meta { grid-column: 2; font-size: 12px; color: var(--muted); }
.ps-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }
/* naplánované zásahy: první sloupec datum a čas */
.ev-row { align-items: flex-start; }
.ev-when { flex: 0 0 96px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; white-space: nowrap; }
/* detail zařízení: popis zásahu zarovnaný s čísly zakázek v servisní historii (sloupce .hist-head) */
.ev-row-device .ev-when { flex-basis: 198px; }
/* stránka Fakturace: klient (+ problém) | zařízení s datem | štítky svisle na střed */
.ow-row { align-items: flex-start; gap: 16px; }
.ow-client { flex: 0 0 24%; min-width: 0; }
.ow-no { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; }
.ow-dev { flex: 0 1 300px; min-width: 0; }
.ow-dev-name { font-size: 15px; }
/* štítek POHODA hned za příznakem ✓ / ! (typ zakázky má pevnou šířku, takže jsou štítky pod sebou) */
.type-line .pohoda-pill { margin-left: 0; }
.ow-tags { flex: none; align-self: center; }
.ow-tags .type-line > .badge { min-width: 54px; justify-content: center; text-align: center; box-sizing: border-box; } /* typ za příznakem, stejně široký */
@media (max-width: 699px) { .ow-row { flex-wrap: wrap; } .ow-client { flex: 1 1 0; } .ow-tags { align-self: flex-start; margin-left: auto; } .ow-dev { order: 3; flex-basis: 100%; } }
/* informativní součet cen dílů nad popiskem Fakturovat */
.ph-bill { display: flex; flex-direction: column; line-height: 1.2; }
.parts-sum { font-size: 12px; font-weight: 600; white-space: nowrap; }
/* text pod poznámkou v servisním protokolu (podmínky, ceník práce) */
.p-terms { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; line-height: 1.45; color: var(--dark-gray, #444); white-space: pre-wrap; break-inside: avoid; }
