:root {
  --brand: #00285f;        /* Bidfood tmavě modrá */
  --brand-2: #0a4a9e;      /* tint pro odkazy a aktivní prvky */
  --accent: #e30613;       /* Bidfood červená */
  --bg: #f2f2f7;           /* iOS grouped background */
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6c6c72;
  --line: rgba(60, 60, 67, .16);
  --ok: #248a3d;
  --warn: #b85c00;
  --radius: 14px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);   /* iOS sheet: rychlý start, měkké dosednutí bez překmitu */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #f5f5f7; --muted: #98989f; --line: rgba(84, 84, 88, .55); --brand-2: #5a9cf0; --ok: #30d158; --warn: #ff9f0a; --accent: #ff453a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; padding-bottom: calc(92px + var(--safe-b)); }
#app { max-width: 760px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px 24px; }
h1 { font-size: 32px; font-weight: 700; margin: 8px 0 14px; letter-spacing: -0.02em; }
h2 { font-size: 20px; margin: 22px 0 8px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin: 20px 4px 6px; }
a { color: var(--brand-2); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.header { display: flex; align-items: center; gap: 8px; }
.header h1 { flex: 1; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item:active { background: var(--line); }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.item.done .t { text-decoration: line-through; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.stat b { display: block; font-size: 28px; color: var(--brand-2); }
.stat.alert b { color: var(--accent); }
.stat span { font-size: 13px; color: var(--muted); }

.btn { appearance: none; border: 0; border-radius: 12px; padding: 11px 16px; font: inherit; font-weight: 600; background: var(--brand); color: #fff; cursor: pointer; }
.btn:disabled { opacity: .5; }
.btn.secondary { background: color-mix(in srgb, var(--brand-2) 14%, transparent); color: var(--brand-2); }
.btn.danger { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--brand-2); padding: 8px 10px; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; text-decoration: none; border: 0; background: var(--card); color: var(--brand-2); width: 38px; height: 38px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

input, textarea, select { width: 100%; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--brand-2); }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 2px 4px; }
.search { margin-bottom: 10px; background: color-mix(in srgb, var(--muted) 14%, var(--card)); border: 0; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chip { flex: none; border: 0; border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 14px; background: var(--card); color: var(--text); cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--line); color: var(--muted); }
.badge.attention { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.badge.business { background: color-mix(in srgb, var(--brand-2) 15%, transparent); color: var(--brand-2); }
.badge.cust { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.late { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; background: transparent; cursor: pointer; color: #fff; font-size: 14px; padding: 0; }
.check.on { background: var(--ok); border-color: var(--ok); }

.mail-body { white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.tabbar { position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b) * .6); display: flex; gap: 2px; padding: 6px; background: color-mix(in srgb, var(--card) 82%, transparent); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 26, 69, .16), 0 1px 3px rgba(0, 26, 69, .08); z-index: 10; }
.tabbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 5px; font-size: 10.5px; font-weight: 500; color: var(--muted); border-radius: 16px; -webkit-tap-highlight-color: transparent; transition: color .2s, background .2s, transform .15s; white-space: nowrap; }
.tabbar a:active { transform: scale(.93); }
.tabbar .ti { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.tabbar a.on { color: var(--brand-2); font-weight: 650; background: color-mix(in srgb, var(--brand-2) 12%, transparent); }
.tabbar a.on .ti { stroke-width: 2.2; transform: translateY(-1px) scale(1.08); }

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 18px 18px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); z-index: 21; max-width: 760px; margin: 0 auto; animation: up .22s ease-out; }
.sheet .grab { width: 40px; height: 5px; background: var(--line); border-radius: 3px; margin: 0 auto 8px; }
.sheet .sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sheet .sheet-head h2 { flex: 1; margin: 6px 0; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; max-width: 90vw; }
.toast.error { background: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--brand-2); }
.login { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login .logo { width: 88px; height: 88px; border-radius: 22px; margin-bottom: 12px; box-shadow: 0 12px 30px rgba(11, 58, 140, .35); }
.login-title { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 6px; }
.login-title .ai, .brand-side .ai { background: linear-gradient(135deg, #ff9a5a, #e30613); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ai-box { border: 1px dashed var(--brand-2); }
.item.row { display: flex; gap: 12px; }
.actions .btn { white-space: nowrap; font-size: 15px; padding: 11px 6px; }
a.btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* ---------- Přehled / dashboard ---------- */
.desk, .brand-side, .tabbar a.desk { display: none; }
.tabbar[hidden] { display: none; }
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; }
.dash-head h1 { margin: 2px 0 8px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 14px 16px; }
.kpi[data-go] { cursor: pointer; }
.kpi .kl { font-size: 13px; color: var(--muted); display: block; }
.kpi b { display: block; font-size: 30px; line-height: 1.15; color: var(--brand-2); letter-spacing: -.02em; }
.kpi.alert b { color: var(--accent); }
.kpi .kd { font-size: 12px; color: var(--muted); }
.delta { font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--accent); }
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.dash-grid .card { margin: 0; }
.dash-grid h2 { margin: 0 0 10px; font-size: 16px; }
.chart { width: 100%; height: auto; font-size: 10px; fill: var(--muted); }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.legend b { color: var(--text); }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); }
.hb { display: grid; grid-template-columns: minmax(80px, 38%) 1fr 28px; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.hb .hl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb .ht { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.hb .ht div { height: 100%; border-radius: 4px; }
.hb b { text-align: right; }
.list.inner { background: transparent; margin: 0 -16px -8px; }
.mobile-only { display: block; }

/* ---------- Desktop: boční menu + široké plátno ---------- */
@media (min-width: 1024px) {
  body { padding: 0 0 0 220px; }
  #app { max-width: 1440px; padding: 24px 32px 40px; }
  .mobile-only { display: none; }
  .desk, .tabbar a.desk { display: flex; } .brand-side { display: flex; }
  .tabbar { top: 0; left: 0; right: auto; bottom: 0; align-content: flex-start; width: 220px; flex-direction: column; padding: 18px 12px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; background: var(--card); backdrop-filter: none; -webkit-backdrop-filter: none; gap: 2px; }
  .tabbar[hidden] { display: none; }
  .brand-side { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; letter-spacing: -.02em; color: var(--brand); padding: 4px 8px 20px; }
  .brand-side img { width: 40px; height: 40px; border-radius: 11px; display: block; box-shadow: 0 4px 12px rgba(11, 58, 140, .3); }
  .brand-side small { display: block; font-weight: 500; font-size: 11.5px; letter-spacing: 0; color: var(--muted); }
  .tabbar a { flex: none; flex-direction: row; gap: 12px; text-align: left; font-size: 15px; padding: 10px 12px; border-radius: 12px; position: relative; }
  .tabbar a:active { transform: none; }
  .tabbar .ti { width: 20px; height: 20px; }
  .tabbar a:hover { background: var(--bg); color: var(--text); }
  .tabbar a.on { background: linear-gradient(135deg, #1a5fd0, #0b3a8c); color: #fff; box-shadow: 0 6px 16px rgba(11, 58, 140, .28); }
  .tabbar a.on .ti { transform: none; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
  .dash-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .dash-grid .span2 { grid-column: span 2; }
  .cols2 { display: grid; grid-template-columns: 1fr 1fr; }
  .cols2 .item { border-right: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  /* seznamy ve dvou sloupcích, formuláře jako okno uprostřed */
  .list { display: grid; grid-template-columns: repeat(2, 1fr); }
  .list > .item { border-right: 1px solid var(--line); }
  .list > .empty { grid-column: 1 / -1; }
  .list.inner { display: block; }
  .list.inner:not(.cols2) > .item { border-right: 0; }
  .list.inner.cols2 { display: grid; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(720px, 92vw); max-height: 88vh; border-radius: 18px; animation: none; }
  .toast { bottom: 28px; }
  .chips { overflow: visible; }
}
@media (min-width: 1500px) {
  .kpis { grid-template-columns: repeat(8, 1fr); }
  .kpi b { font-size: 26px; }
}

/* ---------- Master karta zákazníka ---------- */
.back { display: inline-block; margin: 4px 0 8px; font-size: 14px; }
.mc-head { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.mc-title h1 { font-size: 26px; margin: 2px 0 8px; }
.mc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-actions .btn { text-align: center; white-space: nowrap; }
.mc-actions .btn.danger { background: transparent; }
.mc-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.mk { background: var(--card); border-radius: var(--radius); padding: 10px 14px; min-width: 0; }
.mk span { display: block; font-size: 12px; color: var(--muted); }
.mk b { display: block; font-size: 20px; line-height: 1.25; color: var(--brand-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk small { font-size: 12px; color: var(--muted); }
.mk.warn b { color: var(--accent); }
.mc-anchors { margin-bottom: 4px; }
.mc-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.mc-col { min-width: 0; }
.mc { scroll-margin-top: 12px; }
.mc-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mc-h h2 { flex: 1; margin: 0; font-size: 16px; }
.kv.wide { grid-template-columns: 150px 1fr; }
.kv.wide dd { white-space: pre-wrap; }
.addr-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 10px; }
.addr-t { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.addr a { display: inline-block; margin-top: 4px; }
.map { width: 100%; height: 220px; border: 0; border-radius: 12px; background: var(--line); }
.ct-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ct { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ct-l { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 14px; }
.list.inner.flat { display: block; margin: 0 -16px -8px; background: transparent; }
.list.inner.flat > .item { border-right: 0; }
.tl-i { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tl-i:last-child { border-bottom: 0; }
.tl-i[data-mail] { cursor: pointer; }
.tl-d { font-size: 12px; color: var(--muted); padding-top: 2px; }
.tl-t { font-weight: 600; word-break: break-word; }
.tl-s { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
label.chk { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.chk input { width: auto; }
.btn.ghost.danger { color: var(--accent); }
@media (min-width: 600px) {
  .mc-kpis { grid-template-columns: repeat(3, 1fr); }
  .addr-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .mc-anchors { display: none; }
  .mc-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .mc-actions { justify-content: flex-end; max-width: 520px; }
  .mc-kpis { grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 14px; }
  .mc-grid { grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .mc-col.wide { grid-column: 1 / -1; }
  .ct-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1360px) {
  .mc-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1fr); }
  .mc-col.wide { grid-column: auto; }
  .tl { max-height: 78vh; overflow-y: auto; }
}
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos .ph { position: relative; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; display: block; }
.photos .x { position: absolute; top: 2px; right: 2px; border: 0; border-radius: 50%; width: 24px; height: 24px; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.tl-i[data-visit] { cursor: pointer; }
.tl-e { display: inline-block; font-size: 12px; color: var(--brand-2); margin-top: 2px; }

/* ---------- Kalendář ---------- */
.cal { padding: 10px 8px 12px; }
.cal.loading { opacity: .5; }
.cal-nav b { text-transform: capitalize; font-size: 17px; }
.cal-nav .btn { font-size: 24px; line-height: 1; padding: 4px 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-wd { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-day { appearance: none; border: 0; background: transparent; color: var(--text); font: inherit; border-radius: 10px; min-height: 46px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; min-width: 0; overflow: hidden; }
.cal-day .n { font-size: 15px; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; text-align: center; }
.cal-day.other { color: var(--muted); opacity: .55; }
.cal-day.today .n { background: var(--accent); color: #fff; font-weight: 700; }
.cal-day.sel { background: color-mix(in srgb, var(--brand-2) 14%, transparent); }
.cal-day .dots { display: flex; gap: 3px; height: 6px; }
.cal-day .dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.cal-mini { display: none; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.chip:not(.on) .cal-dot { opacity: .4; }
.cal-ev { padding-left: 12px; }
@media (min-width: 1024px) {
  .cal-day { min-height: 96px; align-items: stretch; text-align: left; padding: 4px; }
  .cal-day .n { align-self: flex-start; font-size: 13px; width: 24px; height: 24px; line-height: 24px; }
  .cal-day .dots { display: none; }
  .cal-mini { display: flex; flex-direction: column; gap: 2px; }
  .cal-mini em { font-style: normal; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--line); padding-left: 4px; color: var(--text); }
}
@media (max-width: 420px) { .tabbar { left: 6px; right: 6px; padding: 5px; } .tabbar a { font-size: 9.5px; } .tabbar .ti { width: 22px; height: 22px; } }

/* ---------- Pošta (seznam vlevo, zpráva vpravo) ---------- */
.mi { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.mi.fill { fill: currentColor; }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn .mi { width: 20px; height: 20px; }
.star.on { color: var(--warn); }

.av { --h: 210; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 650; letter-spacing: .02em;
  color: hsl(var(--h) 55% 34%); background: hsl(var(--h) 70% 93%); }
.av.xs { width: 20px; height: 20px; font-size: 9px; }
.av.sm { width: 30px; height: 30px; font-size: 11px; }
.av.lg { width: 48px; height: 48px; font-size: 17px; }
.av.draft { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.av.draft .mi { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { .av { color: hsl(var(--h) 70% 82%); background: hsl(var(--h) 35% 24%); } }

.mb-sync { margin: -8px 4px 10px; }
.mb-tools { display: flex; gap: 8px; margin-bottom: 8px; }
.mb-tools select { flex: 0 0 44%; min-width: 0; }
.mb-tools .search { flex: 1; margin: 0; min-width: 0; }
.mlist { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.mday { position: sticky; top: 0; z-index: 1; padding: 8px 16px 6px; font-size: 12.5px; font-weight: 650; color: var(--muted); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.mail-item { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px 11px 18px; border-bottom: 1px solid var(--line); cursor: pointer; outline: none; transition: background .12s; }
.mail-item:last-child { border-bottom: 0; }
.mail-item:hover { background: color-mix(in srgb, var(--brand-2) 5%, var(--card)); }
.mail-item .dot { position: absolute; left: 6px; top: 26px; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.mail-item.unread .dot { background: var(--brand-2); }
.mi-main { flex: 1; min-width: 0; }
.mi-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mi-from { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-time { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mi-clip, .mi-star, .mi-ans { color: var(--muted); display: inline-flex; }
.mi-clip .mi, .mi-star .mi { width: 14px; height: 14px; }
.mi-star { color: var(--warn); }
.mi-ans .mi { width: 13px; height: 13px; margin-right: 3px; }
.mi-subj { display: flex; align-items: center; gap: 2px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mi-subj { display: block; }
.mi-ans { vertical-align: -2px; }
.mi-count { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--muted); vertical-align: 1px; }
.mi-snip { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mi-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.mail-item.unread .mi-from, .mail-item.unread .mi-subj { font-weight: 700; }
.mail-item.unread .mi-time { color: var(--brand-2); font-weight: 600; }
.mail-item.sel { background: linear-gradient(135deg, #1a5fd0, #0b3a8c); color: #fff; border-bottom-color: transparent; }
.mail-item.sel .mi-time, .mail-item.sel .mi-snip, .mail-item.sel .mi-clip, .mail-item.sel .mi-ans, .mail-item.sel .muted { color: rgba(255, 255, 255, .82); }
.mail-item.sel .mi-count { background: rgba(255, 255, 255, .2); color: #fff; }
.mail-item.sel.unread .dot { background: #fff; }
.mail-item.sel .av { background: rgba(255, 255, 255, .95); }
.mail-item.sel .badge { background: rgba(255, 255, 255, .18); color: #fff; }
#more .btn { margin-top: 10px; }

/* detail */
.mr { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.mr-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--card); }
.tb { appearance: none; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.tb:hover { background: color-mix(in srgb, var(--brand-2) 10%, transparent); }
.tb:disabled { opacity: .5; }
.tb.primary { background: color-mix(in srgb, var(--brand-2) 14%, transparent); color: var(--brand-2); }
.tb.ai { color: #c2410c; }
.tb.ai:hover { background: color-mix(in srgb, #f97316 12%, transparent); }
.tb.icon { padding: 8px; color: var(--muted); }
.tb.icon:hover { color: var(--brand-2); }
.tb.icon.on { color: var(--warn); }
.mr-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 28px; }
.mr-head { margin-bottom: 14px; }
.mr-date { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.mr-date::first-letter { text-transform: uppercase; }
.mr-folder::before { content: '·'; margin-right: 10px; }
.mr-subj { font-size: 21px; line-height: 1.3; margin: 6px 0 14px; font-weight: 700; letter-spacing: -.01em; word-break: break-word; }
.mr-from { display: flex; gap: 12px; align-items: flex-start; }
.mr-people { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mr-prow { display: flex; gap: 8px; align-items: flex-start; }
.mr-prow .lbl { flex: none; width: 44px; font-size: 13px; color: var(--muted); padding-top: 4px; }
.mr-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.more-addr { display: contents; }
.more-addr[hidden] { display: none; }
.pchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 10px 2px 2px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 10%, var(--card)); color: var(--text); font-size: 13.5px; border: 0; font-family: inherit; cursor: pointer; }
.pchip > span:not(.av) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .muted { font-size: 12.5px; }
.pchip:hover { background: color-mix(in srgb, var(--brand-2) 12%, var(--card)); }
.pchip.more { padding: 2px 10px; color: var(--brand-2); font-weight: 600; }
.mr-atts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0 60px; }
.achip { display: inline-flex; align-items: center; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.achip a { color: var(--text); display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; min-width: 0; }
.achip a:hover { background: color-mix(in srgb, var(--brand-2) 7%, transparent); }
.achip .an { font-size: 13.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.achip .as { font-size: 12px; color: var(--muted); white-space: nowrap; }
.achip .adl { color: var(--brand-2); border-left: 1px solid var(--line); padding: 7px 9px; }
.achip .adl .mi { width: 16px; height: 16px; }
.mr-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 14px 0 0 60px; }
.mr-meta label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; }
.mr-meta select { width: auto; max-width: 300px; padding: 5px 10px; font-size: 13.5px; border-radius: 9px; }
.mr-note { font-size: 14px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 12%, transparent); margin-bottom: 12px; }
.mr-body { border-top: 1px solid var(--line); padding-top: 18px; }
.mr-text { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.55; max-width: 820px; }
.mr-body.html { background: #fff; border-radius: 12px; padding: 16px 18px; border-top: 0; box-shadow: 0 0 0 1px var(--line); }
.mr-frame { display: block; width: 100%; height: 200px; border: 0; background: #fff; }
.mr-thread { margin-top: 22px; }
.mr-thread h3 { margin: 0 0 8px; }
.mt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 12px; cursor: pointer; }
.mt:hover { background: color-mix(in srgb, var(--brand-2) 6%, transparent); }
.mt.current { background: color-mix(in srgb, var(--brand-2) 10%, transparent); cursor: default; }
.mt.unread .mi-from { font-weight: 700; }
.mr-empty { height: 100%; min-height: 300px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); }
.mr-empty .mi { width: 54px; height: 54px; stroke-width: 1.2; opacity: .5; }
.mb-read { display: none; }
.mb-read.loading .mr { opacity: .55; transition: opacity .15s; }

/* detail v okně (mobil, karta zákazníka) */
.sheet .mr.in-sheet { margin: 0 -16px; }
.sheet .mr.in-sheet .mr-bar { position: sticky; top: -10px; z-index: 2; padding: 8px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sheet .mr.in-sheet .mr-scroll { overflow: visible; padding: 14px 16px 10px; }
@media (max-width: 700px) {
  .tb span { display: none; }
  .tb { padding: 9px; }
  .mr-atts, .mr-meta { margin-left: 0; }
  .mr-meta select { max-width: 100%; }
  .mr-subj { font-size: 19px; }
  .mr-body.html { margin: 0 -8px; padding: 12px; }
}

@media (min-width: 1024px) {
  body.mail-page #app { max-width: none; padding: 16px 18px 16px; }
  .mailbox { display: grid; grid-template-columns: minmax(340px, 31%) minmax(0, 1fr); gap: 14px; height: calc(100vh - 32px); }
  .mb-list, .mb-read { min-height: 0; display: flex; flex-direction: column; }
  .mb-list .mb-top { padding: 0 2px; }
  .mb-list h1 { font-size: 26px; margin: 2px 0 10px; }
  .mb-list .chips { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .mb-list .chip { font-size: 13px; padding: 6px 11px; }
  .mb-scroll { flex: 1; min-height: 0; overflow-y: auto; border-radius: var(--radius); background: var(--card); }
  .mb-scroll .mlist { border-radius: 0; }
  .mb-scroll #more { padding: 0 12px 12px; }
  .mb-read { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(0, 26, 69, .05); }
  .mb-read .mr-bar { padding: 10px 18px; }
  .mb-read .mr-scroll { padding: 22px 30px 34px; }
}
@media (min-width: 1500px) {
  .mailbox { grid-template-columns: 440px minmax(0, 1fr); }
}
.compose-body { font-size: 15px; line-height: 1.45; min-height: 260px; }
.att-list .att { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.att-list label + .att { border-top: 0; }
.att-list .att > :first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Report pro vedení (náhled A4 + tisk do PDF, max 2 strany) ---------- */
.rprev { overflow-x: auto; padding-bottom: 20px; }
.rdoc { color: #111827; font: 9.4pt/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.rpage { position: relative; background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto 16px; padding: 12mm 13mm 14mm; box-shadow: 0 2px 14px rgba(0,0,0,.14); border-radius: 4px; }
.rdoc h1 { font-size: 19pt; margin: 2px 0 2px; letter-spacing: -.01em; color: #00285f; }
.rdoc h2 { font-size: 10.5pt; margin: 11px 0 5px; color: #00285f; text-transform: none; letter-spacing: 0; padding-bottom: 2px; border-bottom: 1.5px solid #e30613; }
.rhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 3px solid #00285f; padding-bottom: 8px; }
.rbrand { font-weight: 700; font-size: 9pt; color: #e30613; text-transform: uppercase; letter-spacing: .06em; }
.rmeta { color: #4b5563; font-size: 8.6pt; }
.rmeta.right { text-align: right; }
.rsum { font-size: 10.2pt; line-height: 1.45; margin: 10px 0 8px; background: #f2f4f8; border-left: 3px solid #00285f; padding: 7px 10px; }
.rkpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rk { border: 1px solid #e5e7eb; border-radius: 6px; padding: 6px 8px; min-width: 0; }
.rk span { display: block; font-size: 8pt; color: #6b7280; }
.rk b { display: block; font-size: 17pt; line-height: 1.15; color: #00285f; }
.rk small { display: block; font-size: 7.6pt; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd { font-weight: 600; color: #6b7280; }
.rd.up { color: #15803d; }
.rd.down { color: #c2410c; }
.rchart { width: 100%; height: 41mm; display: block; }
.rchart line { stroke: #e5e7eb; stroke-width: 1; }
.rchart text { font-size: 9px; fill: #6b7280; }
.rlegend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 8pt; color: #374151; margin-top: 3px; }
.rlegend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.rcols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 9mm; }
.rcols > div { min-width: 0; }
.rstack { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: #e5e7eb; margin: 4px 0 4px; }
.rnote { font-size: 8pt; color: #6b7280; margin: 4px 0; }
.rt { width: 100%; border-collapse: collapse; font-size: 8.6pt; }
.rt th { text-align: left; font-size: 7.6pt; color: #6b7280; font-weight: 600; border-bottom: 1px solid #d1d5db; padding: 2px 3px; }
.rt th:not(:first-child), .rt td:not(:first-child) { text-align: right; width: 1%; white-space: nowrap; }
.rt td { border-bottom: 1px solid #eef0f3; padding: 2.4px 3px; vertical-align: top; }
.rt td.nw, .rt td:first-child.nw { white-space: nowrap; width: 1%; text-align: left; color: #4b5563; }
.rt td.nw + td { text-align: left; width: auto; white-space: normal; }
.rt small { color: #6b7280; }
.rlnote { display: block; color: #4b5563; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 78mm; }
.rmore { font-size: 8pt; color: #6b7280; margin: 2px 0 0; }
.rcomment { white-space: pre-wrap; font-size: 9.4pt; margin: 4px 0; max-height: 46mm; overflow: hidden; }
.rneg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 9mm; font-size: 8.6pt; }
.rneg span { border-bottom: 1px solid #eef0f3; padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rneg small { color: #6b7280; }
.rdoc .muted { color: #6b7280; }
.rfoot { position: absolute; left: 13mm; right: 13mm; bottom: 7mm; font-size: 7.6pt; color: #9ca3af; text-align: right; }

@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; padding: 0 !important; margin: 0; }
  #tabbar, #toast, #sheet, #sheet-backdrop, .no-print { display: none !important; }
  #app { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  .rprev { overflow: visible; padding: 0; }
  .rpage { width: 210mm; height: 297mm; min-height: 0; overflow: hidden; margin: 0; box-shadow: none; border-radius: 0; break-after: page; page-break-after: always; }
  .rpage:last-child { break-after: auto; page-break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media screen { .rdoc { zoom: var(--z, 1); } }

/* ---------- prohlížeč příloh ---------- */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); animation: up .18s ease-out; }
.vw-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--card); border-bottom: 1px solid var(--line); }
.vw-bar .tb { flex: none; }
.vw-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vw-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.vw-title span { font-size: 12px; color: var(--muted); }
.vw-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
.vw-pdf { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 8px 24px; }
.vw-pdf canvas { background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .18); border-radius: 2px; max-width: 100%; height: auto; }
.vw-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.vw-img { display: grid; place-items: center; min-height: 100%; padding: 10px; }
.vw-img img { max-width: 100%; max-height: calc(100vh - 90px); object-fit: contain; border-radius: 6px; }
.vw-text { white-space: pre-wrap; word-break: break-word; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; padding: 14px 16px 30px; max-width: 900px; }
.vw-tools { padding: 8px 10px 4px; background: var(--card); border-bottom: 1px solid var(--line); }
.vw-sheets { margin-bottom: 6px; }
.vw-sheets .chip b { color: var(--accent); }
.vw-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vw-filter .search { flex: 1; min-width: 140px; max-width: 320px; margin: 0; padding: 7px 11px; }
.vw-filter .chip { background: color-mix(in srgb, var(--muted) 14%, var(--card)); }
.vw-filter .chip.on, .vw-sheets .chip.on { background: var(--brand-2); color: #fff; }
.vw-filter .chip:disabled { opacity: .5; }
.vw-table { padding: 0 0 30px; }
.vw-table table { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; background: var(--card); }
.vw-table th, .vw-table td { padding: 5px 9px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.vw-table thead th { position: sticky; top: 0; background: color-mix(in srgb, var(--muted) 12%, var(--card)); font-weight: 600; z-index: 1; }
.vw-table .rn { color: var(--muted); font-size: 11px; text-align: right; position: sticky; left: 0; background: var(--card); z-index: 1; }
.vw-table thead .rn { z-index: 2; background: color-mix(in srgb, var(--muted) 12%, var(--card)); }
.vw-table .ozc { font-weight: 600; }
.vw-table tr.mine td { background: color-mix(in srgb, #f5b400 22%, var(--card)); }
.vw-table tr.mine td.rn { box-shadow: inset 3px 0 0 #f5b400; }
.vw-table tr.mine.cust td { background: color-mix(in srgb, var(--brand-2) 14%, var(--card)); }
.vw-table tr.mine.cust td.rn { box-shadow: inset 3px 0 0 var(--brand-2); }
.vw-caption { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.vw-kv { font-size: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; color: var(--text); }
.vw-kv i { font-style: normal; color: var(--muted); margin-right: 6px; }
.vw-kv.solo { font-weight: 600; }
.vw-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #f5b400; margin-right: 5px; vertical-align: -1px; }
.vw-key.cust { background: var(--brand-2); margin-left: 4px; }

/* ---------- AI rozbor: plovoucí okno ---------- */
.aiw { --ai1: #7c3aed; --ai2: #2563eb; --ai3: #e11d48; position: absolute; top: 72px; right: 18px; width: 420px; max-width: calc(100vw - 24px); max-height: calc(100% - 96px); display: flex; flex-direction: column; z-index: 5;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid color-mix(in srgb, var(--ai1) 22%, var(--line)); border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .28), 0 2px 8px rgba(15, 23, 42, .12); overflow: hidden; animation: aiw-in .22s cubic-bezier(.2, .9, .3, 1.2); }
.aiw[data-mode="closed"], .aiw[data-mode="min"] { background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; animation: none; pointer-events: none; }
.aiw[data-mode="closed"] > *, .aiw[data-mode="min"] > :not(.aiw-pill) { display: none; }
.aiw.dragging { transition: none; user-select: none; opacity: .96; }
@keyframes aiw-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.aiw::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--ai1), var(--ai2), var(--ai3)); }
.aiw.busy::before { background-size: 200% 100%; animation: aiw-flow 1.4s linear infinite; background-image: linear-gradient(90deg, var(--ai1), var(--ai2), var(--ai3), var(--ai1)); }
@keyframes aiw-flow { to { background-position: -200% 0; } }
.aiw-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 14px; cursor: grab; touch-action: none; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.aiw.dragging .aiw-head { cursor: grabbing; }
.aiw-logo { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--ai1), var(--ai2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--ai1) 40%, transparent); }
.aiw-logo svg { width: 18px; height: 18px; fill: #fff; }
.aiw-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.aiw-t b { font-size: 15px; }
.aiw-t span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aiw-b { flex: none; width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.aiw-b:hover { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--text); }
.aiw-b svg, .aiw-send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aiw-body { overflow-y: auto; padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.aiw-sec { border-radius: 14px; padding: 11px 13px; background: color-mix(in srgb, var(--muted) 7%, var(--card)); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.aiw-sh { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.aiw-si { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--ai2) 14%, transparent); color: var(--ai2); }
.aiw-si svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aiw-note { font-size: 12px; color: var(--muted); }
.aiw-sb { font-size: 14px; line-height: 1.5; }
.aiw-sb p { margin: 4px 0; }
.aiw-sb ul { margin: 4px 0; padding-left: 0; list-style: none; }
.aiw-sb li { position: relative; padding: 3px 0 3px 18px; }
.aiw-sb li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 60%, transparent); }
.aiw-sec.k-me { background: color-mix(in srgb, #f5b400 13%, var(--card)); border-color: color-mix(in srgb, #f5b400 45%, transparent); }
.aiw-sec.k-me .aiw-si { background: #f5b400; color: #fff; }
.aiw-sec.k-me .aiw-si svg { fill: #fff; }
.aiw-sec.k-todo .aiw-si { background: color-mix(in srgb, #16a34a 16%, transparent); color: #16a34a; }
.aiw-sec.k-todo li::before { width: 11px; height: 11px; left: 0; top: 8px; border-radius: 4px; background: none; border: 1.8px solid #16a34a; }
.aiw-sec.k-nums .aiw-si { background: color-mix(in srgb, var(--ai1) 14%, transparent); color: var(--ai1); }
.aiw-sec.k-about { background: transparent; border-color: transparent; padding: 4px 4px 0; }
.aiw-sec.k-about .aiw-sb { font-size: 15px; }
.aiw-q { align-self: flex-end; max-width: 85%; background: linear-gradient(135deg, var(--ai1), var(--ai2)); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; font-size: 14px; }
.aiw-q span { display: block; font-size: 11px; opacity: .75; }
.aiw-load { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 18px 8px 8px; }
.aiw-load span { font-size: 13px; color: var(--muted); }
.aiw-orb { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; background: linear-gradient(135deg, var(--ai1), var(--ai2), var(--ai3)); animation: aiw-pulse 1.6s ease-in-out infinite; }
.aiw-orb svg { width: 24px; height: 24px; fill: #fff; animation: aiw-spin 3s linear infinite; }
@keyframes aiw-pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 10px color-mix(in srgb, var(--ai1) 12%, transparent); } }
@keyframes aiw-spin { to { transform: rotate(360deg); } }
.aiw-sk { width: 100%; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.aiw-sk i { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--line) 0%, color-mix(in srgb, var(--line) 40%, var(--card)) 50%, var(--line) 100%); background-size: 200% 100%; animation: aiw-flow 1.3s linear infinite; }
.aiw-err { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.aiw-foot { font-size: 11.5px; color: var(--muted); padding: 2px 4px 8px; }
.aiw-ask { display: flex; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.aiw-ask input { flex: 1; border-radius: 999px; padding: 9px 14px; background: var(--card); }
.aiw-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--ai1), var(--ai2)); }
.aiw-send:disabled { opacity: .6; }
.aiw-pill { pointer-events: auto; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; padding: 6px 16px 6px 6px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 14px; color: var(--text);
  background: color-mix(in srgb, var(--card) 90%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 10px 30px rgba(15, 23, 42, .25); border: 1px solid color-mix(in srgb, var(--ai1) 30%, var(--line)); animation: aiw-in .2s ease-out; }
.aiw-pill .aiw-logo { width: 28px; height: 28px; border-radius: 50%; }
@media (max-width: 760px) {
  .aiw { top: auto; left: 8px !important; right: 8px !important; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-width: none; max-height: 62vh; }
  .aiw[data-mode="open"] { top: auto !important; }
  .aiw-head { cursor: default; }
}
.aiw-pill[hidden] { display: none; }
.aiw[data-mode="closed"]::before, .aiw[data-mode="min"]::before { display: none; }

/* Zákazníci v okolí */
.nb-open { display: block; text-align: center; margin: 0 0 10px; }
.nb-note { margin: 4px 4px 8px; }
.nb-item .row { align-items: flex-start; gap: 12px; }
.nb-km { flex: none; min-width: 58px; font-weight: 700; color: var(--brand-2, var(--brand)); font-variant-numeric: tabular-nums; padding-top: 1px; }
.nb-item .meta { flex-wrap: wrap; margin-top: 4px; }
.nb-act { display: flex; gap: 8px; margin: 8px 0 0 70px; }

/* Obeslání zákazníků – lišta s výběrem nad tab barem */
.bulk-bar { position: fixed; left: 8px; right: 8px; bottom: calc(84px + var(--safe-b) * .6); z-index: 9; margin: 0; box-shadow: 0 10px 30px rgba(0, 26, 69, .16); }
.bulk-bar[hidden] { display: none; }
@media (min-width: 1024px) { .bulk-bar { left: auto; right: 24px; bottom: 24px; width: 420px; } }

/* =====================================================================
   Apple design vrstva (viz .claude/skills/apple-design)
   – okamžitá odezva na dotyk, hierarchie písma, průsvitné materiály,
     list stažitelný prstem, ohled na „omezit pohyb / průhlednost“.
   ===================================================================== */

/* ---------- typografie: tracking a řádkování podle velikosti ---------- */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-optical-sizing: auto; }
h1 { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; }
h3 { font-size: 12.5px; letter-spacing: .03em; font-weight: 600; margin: 24px 16px 7px; }
.small { line-height: 1.4; }
.stat b, .kpi b, .mk b, .nb-km, .mi-time, .badge, .cal-day .n { font-variant-numeric: tabular-nums; }
.stat b { font-size: 30px; line-height: 1.1; letter-spacing: -.025em; font-weight: 700; margin-bottom: 2px; }
.kpi b { letter-spacing: -.025em; }
@media (max-width: 1023px) { body { font-size: 16.5px; } }

/* ---------- ikony (SVG sprite v index.html) ---------- */
.i { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i { width: 21px; height: 21px; vertical-align: 0; }
.badge .i { width: 1.1em; height: 1.1em; vertical-align: -.22em; stroke-width: 2.1; }
.check .i { width: 15px; height: 15px; stroke-width: 3; vertical-align: 0; }
.back { display: inline-flex; align-items: center; gap: 2px; font-size: 16px; font-weight: 500; margin: 4px 0 8px -4px; padding: 4px 4px; border-radius: 8px; }
.back .i { width: 20px; height: 20px; stroke-width: 2.3; }

/* ---------- tlačítka: odezva už při stisku, ne až po puštění ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; letter-spacing: -.005em;
  transition: transform .2s var(--ease-out), background-color .2s, opacity .2s, box-shadow .2s; }
.btn.small { min-height: 34px; gap: 5px; }
.btn.ghost { min-height: 36px; }
.btn.secondary { background: color-mix(in srgb, var(--brand-2) 11%, var(--card)); }
.btn.danger { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.btn:not(:disabled):active, .chip:active, .icon-btn:active, .tb:not(:disabled):active, .pchip:active, .aiw-send:active, .cal-day:active {
  transform: scale(.96); transition: transform 60ms ease-out; }
.btn:not(.ghost):not(.secondary):not(.danger):not(:disabled):active { opacity: .88; }
@media (hover: hover) {
  .btn:not(.ghost):not(.secondary):not(.danger):not(:disabled):hover { background: color-mix(in srgb, var(--brand) 88%, #fff); }
  .btn.secondary:hover { background: color-mix(in srgb, var(--brand-2) 17%, var(--card)); }
  .icon-btn:hover { background: color-mix(in srgb, var(--brand-2) 10%, var(--card)); }
  .chip:not(.on):hover { background: color-mix(in srgb, var(--brand-2) 8%, var(--card)); }
  .item:hover, .nrow:hover { background: color-mix(in srgb, var(--muted) 6%, var(--card)); }
}
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 40px; height: 40px; transition: transform .2s var(--ease-out), background-color .2s; box-shadow: 0 0 0 .5px var(--line); }
.chip { transition: transform .2s var(--ease-out), background-color .2s, color .2s; font-weight: 500; }
.chip.on { font-weight: 600; }
.header { min-height: 52px; }
.header > span { display: inline-flex; gap: 8px; }

/* řádky seznamu: zvýraznění okamžitě při dotyku, pomalu odeznívá */
.item, .nrow, .mail-item, .tl-i, .mt { transition: background-color .35s ease-out; }
.item:active, .nrow:active, .mail-item:active, .mt:active { background: color-mix(in srgb, var(--muted) 16%, var(--card)); transition: none; }
.stat, .kpi[data-go], .card[data-go], .mk { transition: transform .25s var(--ease-out), box-shadow .25s; }
.stat:active, .kpi[data-go]:active, .card[data-go]:active { transform: scale(.975); transition: transform 60ms ease-out; }
.item { border-bottom-width: .5px; }

/* zaškrtávátko */
.check { transition: background-color .18s, border-color .18s, transform .2s var(--ease-out); border-color: color-mix(in srgb, var(--muted) 70%, transparent); }
.check:active { transform: scale(.88); transition: transform 60ms; }
.check.on { animation: pop .32s var(--ease-out); }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: none; } }

/* ---------- formuláře ---------- */
input, textarea, select { border-width: .5px; transition: border-color .15s, box-shadow .15s; min-height: 44px; }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--brand-2); }
input:focus, textarea:focus, select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 18%, transparent); }
.search { background: color-mix(in srgb, var(--muted) 12%, var(--card)); border: 0; padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m15.5 15.5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: 12px 50%; }
.search:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 18%, transparent); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-2) 45%, transparent); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* ---------- skupiny ve stylu Nastavení (stránka Více) ---------- */
.group { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.nrow { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 9px 14px; color: var(--text); cursor: pointer; }
.nrow + .nrow::before { content: ""; position: absolute; top: 0; left: 56px; right: 0; border-top: .5px solid var(--line); }
.nrow.mobile-only { display: flex; }
.mobile-only + .nrow::before { left: 56px; }
.tile { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--c, var(--brand-2)); }
.tile .i { width: 18px; height: 18px; stroke-width: 2; vertical-align: 0; }
.nl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nl b { font-weight: 500; }
.nl small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nrow .chev { width: 15px; height: 15px; color: color-mix(in srgb, var(--muted) 70%, transparent); stroke-width: 2.4; }
.nrow.danger b { color: var(--accent); }
@media (min-width: 1024px) { .nrow.mobile-only { display: none; } }
.narrow { max-width: 760px; }

/* ---------- materiály: tab bar a plovoucí prvky ---------- */
.tabbar { background: color-mix(in srgb, var(--card) 72%, transparent); border: .5px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 12px 34px rgba(0, 20, 60, .14), 0 1px 2px rgba(0, 20, 60, .06), inset 0 .5px 0 rgba(255, 255, 255, .55); }
.tabbar a { transition: color .2s, background-color .25s, transform .2s var(--ease-out); }
.tabbar a:active { transform: scale(.9); transition: transform 60ms; }
@media (prefers-color-scheme: dark) { .tabbar { box-shadow: 0 12px 34px rgba(0, 0, 0, .5), inset 0 .5px 0 rgba(255, 255, 255, .08); } }
@media (min-width: 1024px) {
  .tabbar { background: color-mix(in srgb, var(--card) 80%, var(--bg)); box-shadow: none; border: 0; border-right: .5px solid var(--line); }
  .tabbar a:active { transform: scale(.98); }
  .tabbar a.on { background: var(--brand-2); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand-2) 35%, transparent); }
}

/* ---------- list (sheet): vyjede zespodu, zavře se stejnou cestou ---------- */
.backdrop { background: rgba(0, 0, 0, .32); animation: fade-in .3s ease-out; transition: opacity .3s ease-out; }
.backdrop.closing { opacity: 0 !important; }
@keyframes fade-in { from { opacity: 0; } }
.sheet { animation: none; transition: transform .5s var(--ease-sheet); box-shadow: 0 -8px 40px rgba(0, 0, 0, .18); overscroll-behavior: contain; will-change: transform; }
.sheet.opening { animation: sheet-in .5s var(--ease-sheet); }
.sheet.closing { transform: translateY(105%); transition: transform .3s cubic-bezier(.4, 0, 1, 1); }
.sheet.dragging { transition: none; }
.sheet .grab { width: 36px; height: 5px; background: color-mix(in srgb, var(--muted) 45%, transparent); margin: 0 auto 10px; touch-action: none; cursor: grab; }
.sheet .sheet-head { position: sticky; top: -10px; z-index: 3; margin: 0 -16px 8px; padding: 4px 16px 6px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); }
.sheet .sheet-head h2 { font-size: 20px; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (min-width: 1024px) {
  .sheet { transition: transform .25s var(--ease-out), opacity .25s; box-shadow: 0 30px 80px rgba(0, 0, 0, .28), 0 0 0 .5px var(--line); }
  .sheet .grab { display: none; }
  .sheet .sheet-head { top: -10px; padding-top: 8px; }
  .sheet.opening { animation: dlg-in .28s var(--ease-out); }
  .sheet.closing { transform: translate(-50%, -50%) scale(.96); opacity: 0; transition: transform .2s ease-in, opacity .2s ease-in; }
  @keyframes dlg-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.96); } }
}

/* ---------- toast: průsvitný materiál, vyjede a zase zajede ---------- */
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 16px 11px 13px; border-radius: 16px; font-weight: 500;
  background: color-mix(in srgb, #1c1c1e 86%, transparent); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22); opacity: 0; transform: translate(-50%, 16px) scale(.96);
  transition: opacity .22s ease-out, transform .35s var(--ease-sheet); pointer-events: none; }
.toast.in { opacity: 1; transform: translate(-50%, 0); }
.toast .i { width: 20px; height: 20px; color: #30d158; stroke-width: 2; }
.toast.error { background: color-mix(in srgb, #1c1c1e 86%, transparent); }
.toast.error .i { color: #ff6961; }
@media (prefers-color-scheme: dark) { .toast { background: color-mix(in srgb, #3a3a3c 88%, transparent); } }

/* ---------- průběh: spinner místo „…“ ---------- */
.spin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- drobnosti ---------- */
.card { border-radius: var(--radius); }
.empty { font-size: 15px; }
.badge { letter-spacing: .01em; }
.login .btn { width: 100%; }
.nb-open { display: flex; }
@media (max-width: 1023px) { .mc-actions { display: grid; grid-template-columns: 1fr 1fr; } }
.ct-l a { display: inline-flex; align-items: center; gap: 5px; }
.tl-t .i { color: var(--muted); margin-right: 2px; }
::selection { background: color-mix(in srgb, var(--brand-2) 25%, transparent); }

/* ---------- přístupnost: méně pohybu, méně průhlednosti, vyšší kontrast ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .sheet, .sheet.closing, .toast, .backdrop { transition: opacity .16s ease !important; }
  .sheet.closing { transform: none; opacity: 0; }
  .toast, .toast.in { transform: translate(-50%, 0); }
  .btn:active, .chip:active, .icon-btn:active, .stat:active, .tabbar a:active, .check:active { transform: none !important; }
  .spin { animation-duration: 1.4s !important; animation-iteration-count: infinite !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar, .toast, .sheet .sheet-head, .mday, .aiw, .aiw-pill { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .tabbar { background: var(--card); }
  .toast { background: #1c1c1e; }
  .sheet .sheet-head { background: var(--bg); }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(60, 60, 67, .45); --muted: #4a4a50; }
  .tabbar { background: var(--card); border: 1px solid var(--text); }
  .card, .list, .group, .stat, .kpi { box-shadow: 0 0 0 1px var(--line); }
}

/* ---------- tab bar: skleněná bublina (Liquid Glass), která klouže mezi záložkami ---------- */
.tab-pill { display: none; }
@media (max-width: 1023px) {
  .tabbar { isolation: isolate; touch-action: none; user-select: none; -webkit-user-select: none; }
  .tabbar a { -webkit-touch-callout: none; }
  .tabbar a.on { background: transparent; }
  .tabbar a.hot { color: var(--brand-2); }
  .tab-pill { display: block; position: absolute; top: 6px; bottom: 6px; left: 0; width: 0; z-index: -1; pointer-events: none; border-radius: 16px;
    transform: translateX(var(--x, 0)) scale(var(--s, 1));
    background:
      radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 60%),
      linear-gradient(180deg, color-mix(in srgb, var(--brand-2) 10%, rgba(255, 255, 255, .35)), color-mix(in srgb, var(--brand-2) 16%, transparent));
    box-shadow: inset 0 1px .5px rgba(255, 255, 255, .95), inset 0 -1px 1px rgba(255, 255, 255, .35), inset 0 0 0 .5px rgba(255, 255, 255, .55),
      inset 0 -6px 10px -6px color-mix(in srgb, var(--brand-2) 30%, transparent), 0 3px 10px rgba(0, 30, 80, .12);
    backdrop-filter: blur(4px) saturate(220%) brightness(1.06); -webkit-backdrop-filter: blur(4px) saturate(220%) brightness(1.06); }
  /* dosednutí s lehkým překmitem – pohyb má hybnost (švih nebo přeskok na jinou záložku) */
  .tab-pill.ready { transition: transform .5s cubic-bezier(.34, 1.36, .64, 1), width .45s cubic-bezier(.34, 1.36, .64, 1), opacity .2s, box-shadow .25s; }
  .tab-pill.lifted { --s: 1.14; transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), width .3s, box-shadow .2s;
    box-shadow: inset 0 1px .5px rgba(255, 255, 255, 1), inset 0 -1px 1px rgba(255, 255, 255, .45), inset 0 0 0 .5px rgba(255, 255, 255, .7),
      inset 0 -8px 12px -6px color-mix(in srgb, var(--brand-2) 35%, transparent), 0 8px 22px rgba(0, 30, 80, .22); }
  .tab-pill.dragging { transition: width .2s, box-shadow .2s; }
}
@media (max-width: 420px) { .tab-pill { top: 5px; bottom: 5px; } }
@media (max-width: 1023px) and (prefers-color-scheme: dark) {
  .tab-pill { background:
      radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%),
      linear-gradient(180deg, color-mix(in srgb, var(--brand-2) 22%, rgba(255, 255, 255, .08)), color-mix(in srgb, var(--brand-2) 26%, transparent));
    box-shadow: inset 0 1px .5px rgba(255, 255, 255, .35), inset 0 0 0 .5px rgba(255, 255, 255, .18), 0 3px 10px rgba(0, 0, 0, .4); }
}
@media (prefers-reduced-motion: reduce) { .tab-pill.ready, .tab-pill.lifted { transition: opacity .15s; --s: 1; } }
@media (prefers-reduced-transparency: reduce) { .tab-pill { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--brand-2) 16%, var(--card)); } }

/* ---------- Obchodní příležitosti (leady) a onboarding ---------- */
.actions { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .actions { grid-template-columns: repeat(4, 1fr); } }
.lp { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; margin: 8px 0 6px; }
.lp i { height: 5px; border-radius: 3px; background: var(--line); transition: background-color .3s ease-out; }
.lp i.on { background: var(--ok); }
.lp i.later:not(.on) { background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 7px); }
.lp-money { font-size: 22px !important; }
.lf-late { color: var(--accent); font-weight: 600; }
.lf-today { color: var(--warn); font-weight: 600; }
.item .meta .i { width: 1em; height: 1em; vertical-align: -.15em; }
.lsteps { display: flex; flex-direction: column; margin: 6px -6px 0; }
.ls { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; border-radius: 12px; padding: 9px 6px; cursor: pointer; position: relative; }
.ls:not(:last-child)::after { content: ""; position: absolute; left: 19px; top: 40px; bottom: -8px; width: 2px; background: var(--line); }
.ls.done:not(:last-child)::after { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.ls:disabled { cursor: default; opacity: .6; }
.ls:not(:disabled):active { background: color-mix(in srgb, var(--muted) 14%, transparent); }
.ls-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--card); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); position: relative; z-index: 1; }
.ls.done .ls-dot { background: var(--ok); color: #fff; box-shadow: none; }
.ls.done .ls-dot .i { width: 16px; height: 16px; stroke-width: 2.6; vertical-align: 0; }
.ls.next .ls-dot { color: var(--brand-2); box-shadow: inset 0 0 0 2px var(--brand-2); }
.ls-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ls-b b { font-weight: 600; font-size: 15px; }
.ls-b small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.ls .btn { flex: none; pointer-events: none; }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
@media (min-width: 1024px) { .lead-grid { grid-template-columns: 1fr 1fr; gap: 0 14px; } }
@media (prefers-reduced-motion: reduce) { .lp i { transition: none; } }

/* =====================================================================
   Dialogy (listy / sheets) ve stylu iOS
   – vyvýšený povrch (v tmavém režimu není splývá s pozadím),
   – pole formuláře jako zaoblené řádky s popiskem uvnitř,
   – datum a čas nepřetékají, tlačítka mají vzduch, spodní okraj respektuje safe-area.
   ===================================================================== */
:root { --sheet-bg: #f2f2f7; --field: #ffffff; --field-line: rgba(60, 60, 67, .12); }
@media (prefers-color-scheme: dark) { :root { --sheet-bg: #1c1c1e; --field: #2c2c2e; --field-line: rgba(84, 84, 88, .45); } }

.sheet { background: var(--sheet-bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(28px + var(--safe-b)); max-height: 92vh; max-height: 92dvh; }
.sheet .grab { margin-bottom: 4px; }
.sheet .sheet-head { background: color-mix(in srgb, var(--sheet-bg) 84%, transparent); min-height: 52px; margin-bottom: 4px; gap: 12px; }
.sheet .sheet-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 8px 0; min-width: 0; overflow-wrap: anywhere; }
/* „Zrušit / Zavřít“ jako skleněná kapsle vpravo nahoře */
.sheet .sheet-head .btn.ghost { flex: none; min-height: 34px; padding: 6px 14px; border-radius: 999px; font-size: 15px; font-weight: 600;
  background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--text); }
.sheet .sheet-head .btn.ghost:hover { background: color-mix(in srgb, var(--muted) 22%, transparent); }
.sheet > p.small.muted:first-of-type, .sheet .sheet-head + p { margin: 0 2px 12px; }

/* samostatná pole (bez popisku) */
.sheet :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select, textarea) {
  display: block; width: 100%; max-width: 100%; min-width: 0; background: var(--field); border: 0; border-radius: 12px; box-shadow: none; padding: 12px 14px; }
.sheet textarea { min-height: 96px; line-height: 1.45; }
.sheet label:not(.chk):not(.btn) { margin: 14px 4px 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
/* pole: popisek a hodnota v jednom zaobleném řádku (obal .field doplní openSheet),
   sousední pole tvoří jednu skupinu s jemnými oddělovači jako v Nastavení iOS */
.sheet .field { position: relative; display: block; margin-top: 12px; padding: 9px 14px 0; background: var(--field); border-radius: 12px; cursor: text; }
.sheet .field + .field { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.sheet .field:has(+ .field) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sheet .field + .field::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: .5px solid var(--field-line); }
.sheet .field > label:not(.chk):not(.btn) { display: block; margin: 0; padding: 0; background: none; font-size: 12.5px; font-weight: 600; line-height: 1.3; color: var(--muted); cursor: inherit; transition: color .15s; }
.sheet .field:focus-within > label:not(.chk):not(.btn) { color: var(--brand-2); }
.sheet .field > :is(input, select, textarea) { margin: 0; padding: 3px 0 11px; min-height: 0; border: 0; border-radius: 0; background-color: transparent; box-shadow: none !important; outline: none; font-size: 16.5px; }
.sheet .field > select { padding-right: 26px; background-position: right 0 center; }
.sheet .field > textarea { min-height: 84px; resize: none; }
.sheet .field > input[type="date"], .sheet .field > input[type="time"] { min-height: 0; height: 36px; padding-top: 0; padding-bottom: 8px; }
.sheet .field > input::placeholder, .sheet .field > textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.sheet :is(input, select, textarea):focus { border: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 30%, transparent); }
.sheet .form-grid > div > .field:first-child { margin-top: 12px; }
.sheet .search { background-color: var(--field); padding-left: 38px; }
.sheet select { -webkit-appearance: none; appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: right 12px center; }
/* iOS Safari: nativní datum/čas má pevnou šířku a přetéká – srovnat do řádku */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; min-height: 44px; }
input::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { opacity: .5; }

/* zaškrtávací řádky jako přepínač-řádek */
.sheet label.chk { margin: 12px 0 0; padding: 12px 14px; background: var(--field); border-radius: 12px; font-size: 15.5px; gap: 12px; min-height: 48px; }
.sheet label.chk input { width: 20px; height: 20px; flex: none; }

/* rozložení a tlačítka */
.sheet form > br { display: none; }
.sheet form > .btn.block, .sheet > .btn.block, .sheet form > .row:last-child { margin-top: 20px; }
.sheet .btn.block { min-height: 50px; border-radius: 14px; font-size: 17px; }
.sheet .btn.block + .btn.block { margin-top: 10px; }
.sheet > br + .btn { margin-top: 0; }
.sheet .row > :is(input, select) { flex: 1; }
.sheet .form-grid { gap: 0 12px; }
.sheet details summary { cursor: pointer; padding: 10px 4px; }
.sheet .list, .sheet .card, .sheet .group { background: var(--field); }
.sheet .item { border-bottom-color: var(--field-line); }
.sheet .card { box-shadow: none; }
.sheet p.small { margin: 8px 4px; }
.sheet h3 { margin: 22px 4px 6px; }
.sheet hr { border: 0; border-top: .5px solid var(--line); margin: 16px 0; }
@media (min-width: 1024px) {
  .sheet { border-radius: 22px; padding: 10px 22px 24px; max-height: 86vh; }
  .sheet .sheet-head { margin: 0 -22px 4px; padding: 10px 22px 8px; }
}
@media (prefers-contrast: more) { .sheet .field, .sheet > :is(input, select, textarea) { box-shadow: 0 0 0 1px var(--line); } }

/* přepínač Zákazníci / Příležitosti (segmentový ovladač ve stylu iOS) */
/* Zákazníci / Příležitosti: dvě samostatné bubliny */
.cpills { display: flex; gap: 8px; margin: 6px 0 14px; flex-wrap: wrap; }
.cpills a { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px; border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--text); text-decoration: none;
  background: var(--card); box-shadow: 0 0 0 .5px color-mix(in srgb, var(--muted) 30%, transparent); transition: background-color .2s ease-out, color .2s ease-out, transform .1s ease-out; }
.cpills a.on { background: var(--brand-2); color: #fff; box-shadow: none; }
.cpills a:active { transform: scale(.97); }
.seg-n { font-size: 12px; font-weight: 600; min-width: 20px; padding: 1px 6px; border-radius: 999px; text-align: center; background: color-mix(in srgb, var(--muted) 22%, transparent); color: var(--muted); font-variant-numeric: tabular-nums; }
.cpills a.on .seg-n { background: rgba(255,255,255,.25); color: #fff; }
.seg-n.alert { background: var(--accent); color: #fff; }
/* formuláře v mřížce: na úzkém displeji (1 sloupec) také jedna souvislá skupina */
@media (max-width: 599px) {
  .sheet .form-grid > div:has(> .field:first-child) + div > .field:first-child { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
  .sheet .form-grid > div:has(> .field:first-child) + div > .field:first-child::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: .5px solid var(--field-line); }
  .sheet .form-grid > div:has(> .field:first-child):has(+ div > .field:first-child) > .field { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
}

/* ---------- vizuální editor e-mailu ---------- */
.rte { margin-top: 12px; background: var(--field, var(--card)); border-radius: 12px; overflow: hidden; border: .5px solid var(--field-line, var(--line)); }
.rte-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 6px; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--field, var(--card)) 88%, transparent); backdrop-filter: blur(16px) saturate(180%); -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: .5px solid var(--field-line, var(--line)); }
.rte-bar::-webkit-scrollbar { display: none; }
.rte-bar button { flex: none; display: grid; place-items: center; width: 36px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; transition: background .15s, color .15s, transform .1s; }
.rte-bar button:hover { background: color-mix(in srgb, var(--muted) 14%, transparent); }
.rte-bar button:active { transform: scale(.92); }
.rte-bar button.on { background: color-mix(in srgb, var(--brand-2) 16%, transparent); color: var(--brand-2); }
.rte-bar button:disabled { opacity: .35; }
.sheet .rte-bar select.rte-block, .rte-bar select.rte-block { flex: none; width: auto; min-height: 0; height: 34px; margin: 0 2px 0 0; padding: 0 26px 0 10px; border: 0; border-radius: 8px; font-size: 14.5px; font-weight: 600;
  background-color: color-mix(in srgb, var(--muted) 12%, transparent); }
.rte-sep { flex: none; width: .5px; height: 20px; margin: 0 4px; background: var(--field-line, var(--line)); }
.rte-dot { width: 16px; height: 16px; border-radius: 50%; background: #1c1c1e; box-shadow: 0 0 0 2px var(--field, var(--card)), 0 0 0 3px color-mix(in srgb, var(--muted) 50%, transparent); }
.rte-pop { display: flex; gap: 10px; padding: 10px 12px; border-bottom: .5px solid var(--field-line, var(--line)); }
.rte-pop[hidden], .rte-img[hidden] { display: none; }
.rte-pop button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .12s; }
.rte-pop button:active { transform: scale(.88); }
.rte-img { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 13.5px; color: var(--muted); border-bottom: .5px solid var(--field-line, var(--line)); overflow-x: auto; }
.rte-img button { flex: none; border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 600; color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 12%, transparent); cursor: pointer; }
.rte-img button.danger { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* papír editoru je vždy bílý jako výsledný e-mail (i v tmavém režimu) */
.rte-doc { background: #fff; color: #1c1c1e; color-scheme: light; min-height: 220px; max-height: 60vh; overflow-y: auto; padding: 14px 16px 18px; outline: none; font-size: 16.5px; line-height: 1.55; -webkit-user-select: text; user-select: text; overflow-wrap: anywhere; }
.rte-doc:empty::before, .rte-doc:has(> p:only-child > br:only-child)::before { content: attr(data-ph); position: absolute; color: var(--muted); pointer-events: none; white-space: pre-line; }
.rte-doc p { margin: 0 0 10px; }
.rte-doc h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 10px; }
.rte-doc h3 { font-size: 18px; font-weight: 650; letter-spacing: -.01em; margin: 4px 0 8px; }
.rte-doc ul, .rte-doc ol { margin: 0 0 10px; padding-left: 24px; }
.rte-doc a { color: #0a63c9; }
.rte-doc:empty::before, .rte-doc:has(> p:only-child > br:only-child)::before { color: #8e8e93; }
.rte-doc img { max-width: 100%; height: auto; border-radius: 6px; cursor: pointer; }
.rte-doc img.rte-sel { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.rte-doc hr { border: 0; border-top: 1px solid #e5e5ea; margin: 16px 0; }
.rte-doc table { border-collapse: collapse; max-width: 100%; }
.rte.disabled .rte-doc { opacity: .7; }
.rte-wrap + .row { margin-top: 8px; }
/* podpis pod editorem */
.sig-box { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--muted) 8%, var(--field, var(--card))); }
.sig-box:empty { display: none; }
.sig-h { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.sig-h a { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--brand-2); }
.sig-body { margin-top: 8px; font-size: 14px; line-height: 1.45; opacity: .85; overflow: hidden; max-height: 220px; }
.sig-body img { max-width: 100%; height: auto; }
.sig-body p { margin: 0 0 4px; }
/* náhled e-mailu */
.prev-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: color-mix(in srgb, var(--muted) 16%, transparent); }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.seg button.on { background: var(--field, var(--card)); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.mail-preview { margin-top: 8px; border-radius: 14px; overflow: hidden; background: #f2f2f7; border: .5px solid var(--line); max-width: 390px; margin-left: auto; margin-right: auto; transition: max-width .25s ease; }
.mail-preview.desktop { max-width: 100%; }
.mail-preview iframe { display: block; width: 100%; height: 360px; border: 0; background: #f2f2f7; }
.mp-meta { padding: 10px 14px; background: #fff; color: #1c1c1e; font-size: 13.5px; border-bottom: .5px solid #e5e5ea; }
.mp-meta .muted { color: #8e8e93; }
.mp-subj { font-weight: 650; font-size: 15px; margin-top: 2px; }
/* iOS přepínač */
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--muted) 30%, transparent); position: relative; cursor: pointer; transition: background .2s; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s cubic-bezier(.3,.7,.4,1); }
input.switch:checked { background: var(--ok, #34c759); }
input.switch:checked::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { input.switch::after, .mail-preview { transition: none; } }

/* citace původní zprávy v okně psaní */
.quote-box { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--muted) 8%, var(--field, var(--card))); }
.quote-box summary { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; cursor: pointer; }
.quote-text { margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--line); white-space: pre-wrap; font-size: 14px; color: var(--muted); max-height: 320px; overflow: auto; }

.bulk-prog { line-height: 1.45; }
.bulk-prog .progress { margin: 2px 0 8px; }

/* Úprava návrhu trasy: tlačítka vyřadit / nahradit u zastávky, patička výběru podniků */
.stop-edit { align-items: center; gap: 8px; cursor: default; }
.icon-btn.sm { width: 34px; height: 34px; background: color-mix(in srgb, var(--muted) 12%, transparent); }
.icon-btn.sm .i { width: 17px; height: 17px; stroke-width: 2.2; vertical-align: 0; }
.icon-btn.sm.danger { color: var(--accent); }
.list > .item { min-width: 0; }
.list.pick { display: block; }
.list.pick > .item { border-right: 0; }
.list.rec .item { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.list.rec .rec-why { white-space: normal; color: var(--text); }
.pick-foot { --pb: calc(28px + var(--safe-b, 0px)); position: sticky; z-index: 2; bottom: calc(-1 * var(--pb)); margin: 0 -16px calc(-1 * var(--pb)); padding: 10px 16px var(--pb); background: var(--sheet-bg, var(--bg)); }
@media (min-width: 1024px) { .pick-foot { --pb: 24px; margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px; } }

/* ---------- mapa zákazníků (#/zakaznici/mapa) ---------- */
.nb-row { display: flex; gap: 8px; margin: 0 0 10px; }
.nb-row .nb-open { flex: 1; margin: 0; justify-content: center; }
.mp-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.mp-tools .search { flex: 1; min-width: 0; margin: 0; }
.mp-mode { display: inline-flex; align-items: center; gap: 5px; }
.mp-mode .i { width: 16px; height: 16px; }
.mp-cnt { opacity: .6; font-variant-numeric: tabular-nums; margin-left: 2px; }
.mp-wrap { position: relative; z-index: 0; isolation: isolate; }
.mp-map { --mp-top: 240px; height: max(340px, calc(100dvh - var(--mp-top) - 140px - var(--safe-b))); border-radius: var(--radius); overflow: hidden; background: color-mix(in srgb, var(--muted) 12%, var(--card)); z-index: 0; }
@media (min-width: 1024px) { .mp-map { height: max(420px, calc(100dvh - var(--mp-top) - 56px)); } }
.mp-map .empty { padding-top: 120px; }
.mp-map.selecting { outline: 2px solid var(--brand-2); outline-offset: -2px; cursor: crosshair; }
.mp-map .leaflet-container, .mp-map.leaflet-container { font: inherit; }
@media (prefers-color-scheme: dark) { .mp-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.6); } }
.mp-pin-wrap { background: none; border: 0; }
.mp-pin { width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; transition: transform .15s var(--ease-out); }
.mp-pin.approx { border-style: dashed; }
.mp-pin.unpaid { box-shadow: 0 0 0 2px var(--accent), 0 1px 4px rgba(0, 0, 0, .35); }
.mp-pin.sel { background: var(--brand) !important; border-width: 3px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 45%, transparent), 0 2px 6px rgba(0, 0, 0, .4); }
.mp-pin .i { width: 16px; height: 16px; stroke-width: 3; }
.k-visit { background: var(--accent); } .k-contact { background: #ff9500; } .k-soon { background: #ffcc00; }
.k-ok { background: var(--ok); } .k-snoozed { background: #8e8e93; }
.mp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.mp-pop .t { font-weight: 650; font-size: 15px; margin-bottom: 2px; }
.mp-pop .s { color: var(--muted); font-size: 13px; margin-top: 3px; }
.mp-pop-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mp-pop-act .btn { text-decoration: none; }
.mp-map .leaflet-popup-content-wrapper { border-radius: 14px; background: var(--card); color: var(--text); }
.mp-map .leaflet-popup-tip { background: var(--card); }
.mp-map .leaflet-popup-content { margin: 12px 14px; }
.mp-hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 6px 12px; border-radius: 999px; font-size: 13px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); white-space: nowrap; pointer-events: none; }
.mp-hint[hidden], .mp-bar[hidden] { display: none; }
.mp-bar { position: absolute; left: 10px; right: 10px; bottom: 26px; z-index: 500; display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-radius: 16px; background: color-mix(in srgb, var(--card) 90%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 6px 24px rgba(0, 26, 69, .22); }
.mp-note { margin: 8px 4px 0; }
.mp-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mp-img { display: block; width: 100%; height: auto; border-radius: 12px; margin-top: 10px; border: 1px solid var(--line); }
.icon-btn.busy { opacity: .5; }
.mp-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 4px; }
.mp-leg { white-space: nowrap; }

/* ---------- účty: přihlášení, registrace, soukromí ---------- */
.login { margin-top: max(10vh, 40px); padding-bottom: 40px; }
.auth-form { display: grid; gap: 10px; margin: 18px 0 14px; text-align: left; }
.auth-form .btn { margin-top: 4px; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; background: color-mix(in srgb, var(--ok) 10%, var(--card)); border-radius: 12px; padding: 12px; text-align: left; }
.privacy-note.plain { background: none; padding: 0; }
.privacy-note > .i { flex: none; width: 20px; height: 20px; color: var(--ok); margin-top: 1px; }
.privacy-note p { margin: 0; font-size: 13px; line-height: 1.45; }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 15px; margin: 2px 0; cursor: pointer; }
.check-row input { width: 22px; height: 22px; flex: none; }
.privacy-hero { display: flex; gap: 12px; align-items: flex-start; }
.privacy-hero p { margin: 0; font-size: 15px; line-height: 1.45; }
.nrow .btn.ghost, .nrow .btn.secondary { flex: none; padding: 7px 12px; font-size: 14px; }
.nl small + small { margin-top: 1px; }
.users-list .nl small, .users-list .nl b { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }

/* ---------- import z Bidea ---------- */
.bi-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.bi-stat { cursor: default; text-align: center; padding: 12px 6px; }
.bi-stat b { font-size: 24px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bi-center { text-align: center; padding: 22px 16px; }
.bi-center .tile { margin: 0 auto; width: 44px; height: 44px; border-radius: 12px; }
.bi-center .tile .i { width: 24px; height: 24px; }
.bi-center .btn { margin-top: 6px; }
.bi-bm { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; cursor: grab; }
.bi-bm:active { cursor: grabbing; transform: scale(.97); transition: transform 100ms ease-out; }
@media (max-width: 380px) { .bi-stats { grid-template-columns: repeat(2, 1fr); } }
.bi-video { padding: 0; overflow: hidden; }
.bi-video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.bi-page { max-width: 1120px; }
.bi-grid { display: grid; gap: 0 28px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "video" "steps" "safari"; }
.bi-grid > section > h3:first-child { margin-top: 18px; }
@media (min-width: 1024px) {
  .bi-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "hero hero" "steps video" "steps safari" "steps ."; grid-template-rows: auto auto auto 1fr; }
}
.bi-drag { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 16px 0 12px; }
.bi-bm .i { width: 18px; height: 18px; }
.bi-safari summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.bi-safari summary::-webkit-details-marker { display: none; }
.bi-safari summary::after { content: "Zobrazit postup ›"; font-size: 14px; color: var(--brand-2); margin-top: 6px; }
.bi-safari[open] summary::after { content: none; }
.bi-ol { padding-left: 20px; margin: 8px 0 0; font-size: 15px; line-height: 1.45; }
.bi-ol li + li { margin-top: 6px; }

/* prázdný seznam zákazníků: výzva k importu */
.c-empty { grid-column: 1 / -1; text-align: center; padding: 34px 22px 26px; max-width: 560px; margin: 8px auto; }
.c-empty .tile { width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 14px; }
.c-empty .tile .i { width: 30px; height: 30px; }
.c-empty h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.01em; }
.c-empty p { margin: 0 auto 18px; color: var(--muted); max-width: 420px; line-height: 1.45; }
.c-empty .btn { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 340px; margin: 0 auto 8px; min-height: 48px; font-size: 16px; }

/* počítač: úzké stránky (nastavení, soukromí, uživatelé…) vycentrovat jako okno Nastavení */
@media (min-width: 1024px) { .narrow, .bi-page { margin-inline: auto; } }
.nb-row[hidden] { display: none; }
.privacy-page .card p.small { font-size: 15px; line-height: 1.5; }

/* odkaz na novou adresu (jen na staré *.workers.dev) */
.newdomain { display: block; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; background: #0b3a8c; color: #fff; text-align: center; font-size: 14px; font-weight: 600; text-decoration: none; }
.install-hint { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; font: inherit; color: var(--text); cursor: pointer; margin-top: 18px; }
.install-hint b { display: block; font-size: 15px; } .install-hint small { color: var(--muted); font-size: 13px; }
.install-hint:active { transform: scale(.98); transition: transform 80ms ease-out; }

/* ---------- Dnes: karta „Dokonči nastavení“ ---------- */
.setup { margin: 4px 0 16px; }
.setup-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; }
.setup-head > div { flex: 1; display: flex; flex-direction: column; }
.setup-head b { font-size: 17px; letter-spacing: -.01em; }
.setup-head small { color: var(--muted); font-size: 13px; }
.setup .small-btn { padding: 6px 12px; font-size: 15px; min-height: 0; }
.setup-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 0 4px 10px; }
.setup-bar > div { height: 100%; background: var(--ok); border-radius: 3px; transition: width .5s var(--ease-out); }
.setup-done .nl b { color: var(--muted); font-weight: 400; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
@media (prefers-reduced-motion: reduce) { .setup-bar > div { transition: none; } }

/* import mrazáků */
.fi-pages .ph img { background: #fff; transition: transform .25s var(--ease-out); }
.fi-pages .rot { position: absolute; bottom: 4px; right: 4px; border: 0; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; padding: 0; }
.fi-pages .rot .i { width: 15px; height: 15px; vertical-align: 0; }
.fi-file { width: 96px; height: 96px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px; text-align: center; }
.fi-file small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.fi-row { transition: opacity .2s; }
.fi-row.off { opacity: .55; }
.fi-row .small-btn { padding: 6px 10px; font-size: 14px; min-height: 0; align-self: flex-start; }
.fi-bar { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 84px); display: flex; gap: 10px; margin-top: 14px; padding: 10px; border-radius: var(--radius); background: color-mix(in srgb, var(--card) 82%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.fi-bar .btn:last-child { flex: 1; }
@media (min-width: 1024px) { .fi-bar { bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .fi-pages .ph img, .fi-row { transition: none; } }
.fi-gap { flex: none; width: 24px; }
/* =====================================================================
   Formuláře „inset grouped“ jako v iOS (Nový lead, Zákazník, Firma, Adresy)
   – sekce s malým nadpisem, řádky 46 px „popisek | pole“ s nápovědou v poli,
   – navigační lišta Zrušit | titulek | Uložit, vyhledání firmy v ARES.
   ===================================================================== */
.sheet .sheet-head.nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.sheet .sheet-head.nav h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; text-align: center; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.sheet .sheet-head.nav > .btn.ghost { justify-self: start; }
.sheet .sheet-head.nav > .btn.save { justify-self: end; flex: none; min-height: 34px; padding: 6px 16px; border-radius: 999px; font-size: 15px; font-weight: 600;
  background: var(--brand-2); color: #fff; border: 0; box-shadow: none; transition: transform .1s ease-out, opacity .15s; }
.sheet .sheet-head.nav > .btn.save:active { transform: scale(.96); }
.sheet .sheet-head.nav > .btn.save:disabled { opacity: .6; }
.sheet .sheet-head.nav > .btn.save .spin { width: 16px; height: 16px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.sheet p.sheet-sub { margin: -2px 4px 4px; text-align: center; }

.sheet .ig-h { margin: 22px 16px 7px; font-size: 13px; font-weight: 400; line-height: 1.2; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.sheet form > .ig-h:first-child, .sheet .ares-res + .ig-h { margin-top: 18px; }
.sheet .ig { background: var(--field); border-radius: 12px; overflow: hidden; }
.sheet .ig-f { margin: 7px 16px 0; font-size: 13px; line-height: 1.38; color: var(--muted); }
.sheet .ig-f:has(> [hidden]:only-child) { display: none; }
.sheet .ig > :is(label, div).ir { position: relative; display: flex; align-items: center; gap: 10px; min-height: 46px; margin: 0; padding: 0 0 0 16px;
  font-size: 16.5px; font-weight: 400; color: var(--text); cursor: text; -webkit-tap-highlight-color: transparent; transition: background-color .5s ease-out; }
.sheet .ig > .ir + .ir::before, .sheet .ig > .ir + textarea::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--field-line); }
.sheet .ig .ir-l { flex: 0 0 108px; min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.sheet .ig .ir-l.wide { flex: 1; }
.sheet .ig .ir > :is(input:not(.sw), select) { flex: 1; min-width: 0; width: auto; height: 46px; min-height: 0; margin: 0; padding: 0 16px 0 0; border: 0; border-radius: 0;
  background-color: transparent; box-shadow: none; outline: none; font-size: 16.5px; color: var(--text); }
.sheet .ig .ir > select { padding-right: 34px; background-position: right 14px center; }
.sheet .ig .ir > select:invalid, .sheet .ig .ir > select:has(option[value=""]:checked) { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.sheet .ig .ir > input[type="date"] { display: flex; align-items: center; line-height: 46px; }
.sheet .ig .ir > :is(input, select, textarea):focus { box-shadow: none; }
.sheet .ig .ir:focus-within .ir-l { color: var(--brand-2); }
.sheet .ig :is(input, textarea)::placeholder { color: color-mix(in srgb, var(--muted) 62%, transparent); opacity: 1; }
.sheet .ig .ir > input:has(+ .ir-sfx, + .ir-btn) { padding-right: 6px; }
.sheet .ig .ir-sfx { flex: none; padding-right: 16px; color: var(--muted); }
.sheet .ig .ir-btn { flex: none; align-self: stretch; margin: 0; padding: 0 16px; border: 0; background: none; color: var(--brand-2); font: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer; }
.sheet .ig .ir-btn:active { opacity: .5; }
.sheet .ig .ir-btn.busy { opacity: .45; pointer-events: none; }
.sheet .ig > textarea { display: block; width: 100%; min-height: 92px; margin: 0; padding: 12px 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 16.5px; resize: none; }
.sheet .ig > textarea:focus { box-shadow: none; }
.sheet .ig .ir.flash { background-color: color-mix(in srgb, var(--brand-2) 12%, var(--field)); transition: none; }
.sheet .ig .ir.flash:not(:focus-within) { animation: ir-flash 1.4s ease-out forwards; }
@keyframes ir-flash { from { background-color: color-mix(in srgb, var(--brand-2) 16%, var(--field)); } to { background-color: var(--field); } }

/* iOS přepínač */
.sheet input.sw { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 51px; height: 31px; margin: 0 16px 0 0; padding: 0; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 32%, transparent); cursor: pointer; transition: background-color .2s ease-out; }
.sheet input.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .25s cubic-bezier(.3,.7,.4,1.2); }
.sheet input.sw:checked { background: #34c759; }
.sheet input.sw:checked::after { transform: translateX(20px); }
.sheet .ig > label.ir:has(> input.sw) { cursor: pointer; }

/* ARES: vyhledávací pole a výsledky */
.sheet .ares-s { position: relative; margin: 6px 0 0; }
.sheet .ares-s > .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.sheet .ares-s > input { height: 40px; min-height: 0; padding: 0 12px 0 36px; border-radius: 11px; font-size: 16.5px; background: color-mix(in srgb, var(--muted) 16%, transparent); }
.sheet .ares-s > input::placeholder { color: var(--muted); opacity: 1; }
.sheet .ares-res { margin-top: 8px; }
.sheet .ares-it { position: relative; display: block; width: 100%; padding: 10px 16px; border: 0; background: none; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.sheet .ares-it + .ares-it::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--field-line); }
.sheet .ares-it:active { background: color-mix(in srgb, var(--muted) 14%, transparent); }
.sheet .ares-n { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.sheet .ares-a { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.3; color: var(--muted); }
.sheet .ares-it em, .sheet [data-ares-msg] em { font-style: normal; color: var(--accent); font-weight: 600; }
.sheet .ares-st { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 14px; color: var(--muted); }
.sheet .ares-st.bad { color: var(--accent); }
.sheet [data-ares-msg] { display: flex; gap: 6px; align-items: flex-start; color: var(--muted); }
.sheet [data-ares-msg][hidden] { display: none; }
.sheet [data-ares-msg] > .i { color: #34c759; margin-top: 1px; }
.sheet [data-ares-msg].bad { color: var(--accent); }
.sheet [data-ares-msg].bad > .i { color: var(--accent); }
.sheet [data-ares-msg] b { color: var(--text); font-weight: 600; }
.sheet .ig-link { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 0; padding: 4px 0; border: 0; background: none; color: var(--brand-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .sheet input.sw::after, .sheet .ig .ir.flash { transition: none; animation: none; } }
/* výběr adresy provozovny (sídlo / provozovny z živnostenského rejstříku) */
.sheet [data-prov] { margin: 2px 0 8px; }
.sheet [data-prov][hidden] { display: none; }
.sheet .prov-t { margin: 0 0 6px; color: var(--muted); }
.sheet .prov-l { display: grid; gap: 6px; margin: 0 -16px; padding: 0; }
.sheet .prov-o { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 14px; border: 0; border-radius: 12px; background: var(--field); color: var(--text); text-align: left; font: inherit; cursor: pointer;
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .15s ease-out, transform .1s ease-out; }
.sheet .prov-o:active { transform: scale(.985); }
.sheet .prov-o.on { box-shadow: inset 0 0 0 2px var(--brand-2); }
.sheet .prov-o > .i { margin-top: 2px; color: var(--brand-2); }
.sheet .prov-o b { display: block; font-size: 15px; font-weight: 600; }
.sheet .prov-o small { display: block; margin-top: 1px; font-size: 13px; color: var(--muted); line-height: 1.3; }
.sheet .prov-n { display: block; }
