/* KeyMan.bg — стилът на сайта: тъмночервена лента с бялото лого (#A01D21), тъмносиньото от логото (#283670) за акценти,
   тюркоазени бутони със стрелка като „виж повече“ (#73BFC1), Open Sans навсякъде, почти прави ъгли,
   скосен долен ръб на червените ленти като на началната страница. */
:root {
  --bg: #F2F2F2;
  --surface: #FFFFFF;
  --surface-2: #F6F6F6;
  --surface-3: #E9E9E9;
  --ink: #222222;
  --ink-2: #444444;
  --muted: #6E6E6E;
  --line: #E1E1E1;
  --line-strong: #CBCBCB;
  --red: #A01D21;
  --red-strong: #85161A;
  --red-2: #8B181C;
  --red-soft: #FBEBEB;
  --red-ink: #A01D21;
  --red-muted: #F2CFC9;
  --on-red: #FFFFFF;
  --navy: #283670;
  --navy-soft: #E9EBF4;
  --brand-navy: #283670; /* не се сменя в тъмния режим */
  --teal: #73BFC1;
  --teal-strong: #5EAFB2;
  --on-teal: #1B2650;
  --profit: #1C7A45;
  --profit-soft: #E2F2E8;
  --danger: #B3261E;
  --danger-soft: #FCE8E6;
  --warn: #8F5B00;
  --warn-soft: #FFF2D4;
  --focus: #283670;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, .25);
  --scrim: rgba(24, 10, 10, .5);

  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --r-s: 3px;
  --r-m: 4px;
  --r-l: 6px;
  --tab-h: 60px;
  --top-h: 58px;
  --kb: 0px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --surface: #1C1C1C;
    --surface-2: #232323;
    --surface-3: #2D2D2D;
    --ink: #EEEEEE;
    --ink-2: #C9C9C9;
    --muted: #9C9C9C;
    --line: #2F2F2F;
    --line-strong: #404040;
    --red: #A01D21;
    --red-strong: #B9262B;
    --red-2: #86171B;
    --red-soft: #3A1517;
    --red-ink: #F1898C;
    --red-muted: #EDC4BE;
    --on-red: #FFFFFF;
    --navy: #A9B3E8;
    --navy-soft: #1F2442;
    --teal: #73BFC1;
    --teal-strong: #86CACC;
    --on-teal: #10183A;
    --profit: #5CC98D;
    --profit-soft: #15301F;
    --danger: #F2796B;
    --danger-soft: #3A1814;
    --warn: #E9B24C;
    --warn-soft: #33260C;
    --focus: #A9B3E8;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 12px 40px rgba(0, 0, 0, .6);
    --scrim: rgba(0, 0, 0, .62);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212;
  --surface: #1C1C1C;
  --surface-2: #232323;
  --surface-3: #2D2D2D;
  --ink: #EEEEEE;
  --ink-2: #C9C9C9;
  --muted: #9C9C9C;
  --line: #2F2F2F;
  --line-strong: #404040;
  --red: #A01D21;
  --red-strong: #B9262B;
  --red-2: #86171B;
  --red-soft: #3A1517;
  --red-ink: #F1898C;
  --red-muted: #EDC4BE;
  --on-red: #FFFFFF;
  --navy: #A9B3E8;
  --navy-soft: #1F2442;
  --teal: #73BFC1;
  --teal-strong: #86CACC;
  --on-teal: #10183A;
  --profit: #5CC98D;
  --profit-soft: #15301F;
  --danger: #F2796B;
  --danger-soft: #3A1814;
  --warn: #E9B24C;
  --warn-soft: #33260C;
  --focus: #A9B3E8;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, .6);
  --scrim: rgba(0, 0, 0, .62);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
#app { min-height: 100%; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; display: block; }
.icon-s { width: 16px; height: 16px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.profit { color: var(--profit); }
.danger-t { color: var(--danger); }
.label { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.wrap { padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { margin-left: auto; }
.center { text-align: center; }

/* ---------- бутони ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-m);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn-dark { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ok { background: var(--profit); border-color: var(--profit); color: #fff; }
.btn-teal { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
/* стрелка в края — като „виж повече“ на сайта */
.btn-arrow { border: 0; border-radius: 0; padding-right: 30px; clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%); }
.btn-block { width: 100%; }
.btn-l { min-height: 52px; font-size: 16px; }
.btn-s { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: var(--r-s); }
.btn-s.btn-arrow { padding-right: 24px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-m); border: 0; background: transparent; color: var(--ink-2); }
@media (hover: hover) {
  .btn-primary:hover { background: var(--red-strong); border-color: var(--red-strong); }
  .btn-teal:hover { background: var(--teal-strong); }
  .btn-ghost:hover, .iconbtn:hover { background: var(--surface-2); }
  .topbar .iconbtn:hover { background: var(--red-2); }
  .entry:hover, .client-row:hover, .chip-btn:hover { border-color: var(--line-strong); }
  .role-card:hover { border-color: var(--red); }
}

/* ---------- полета ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r-m);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 16px; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 16%, transparent); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.4; }
.input-grow { resize: none; overflow: hidden; line-height: 1.35; min-height: 46px; }
.input-money { font-size: 20px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-icon { position: relative; display: block; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.hint { font-size: 13px; color: var(--muted); }
.hint .icon, .err .icon { display: inline-block; vertical-align: -3px; width: 15px; height: 15px; }
.err { font-size: 13.5px; color: var(--danger); font-weight: 600; }

.seg { display: flex; background: var(--surface-3); border-radius: var(--r-m); padding: 3px; gap: 3px; }
.seg button { flex: 1 1 0; min-height: 38px; border: 0; border-radius: var(--r-s); background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button .icon { width: 18px; height: 18px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--red-ink); box-shadow: var(--shadow-1); }

.switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line-strong); position: relative; flex: none; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked { background: var(--red); }
.switch input:checked::after { transform: translateX(18px); }
.switch .t { font-weight: 600; }
.switch .d { font-size: 13px; color: var(--muted); }

/* ---------- чипове ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 8px; border-radius: var(--r-s); background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.chip .icon { width: 14px; height: 14px; }
.chip-price { background: transparent; padding: 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.chip-cost { background: transparent; padding: 0; color: var(--muted); font-weight: 600; }
.chip-profit { background: var(--profit-soft); color: var(--profit); font-weight: 700; font-size: 13.5px; }
.chip-card { background: var(--navy-soft); color: var(--navy); }
.chip-bank { background: var(--surface-3); color: var(--ink-2); }
.chip-unpaid { background: var(--danger-soft); color: var(--danger); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-client { background: var(--red-soft); color: var(--red-ink); }
.chip-btn { cursor: pointer; border-color: var(--line); background: var(--surface); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-s); font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pill-new { background: var(--navy-soft); color: var(--navy); }
.pill-accepted { background: var(--warn-soft); color: var(--warn); }
.pill-done { background: var(--profit-soft); color: var(--profit); }
.pill-cancelled { background: var(--surface-3); color: var(--muted); }
.pill-urgent { background: var(--red); color: #fff; }
.pill .icon { width: 13px; height: 13px; }
/* задачи „за всички“ и „за друг ден и час“ */
.pill-open { background: var(--teal); color: var(--on-teal); }
.pill-when { background: var(--surface-3); color: var(--ink-2); text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 700; }
.pill-when.soon { background: var(--warn-soft); color: var(--warn); }
.open-all { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.open-all .icon { width: 16px; height: 16px; color: var(--teal-strong); }
.av-all { box-shadow: inset 0 0 0 3px var(--teal); color: var(--ink-2); }
.av-all .icon { width: 13px; height: 13px; }
.when-in { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.when-in .suggest { margin: 0; }
.when-in .suggest button[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); color: var(--red-ink); }
.when-box .icon { color: var(--teal-strong); }
.callout-open { display: flex; gap: 10px; align-items: flex-start; border-left-color: var(--teal); }
.callout-open .icon { flex: none; color: var(--teal-strong); margin-top: 1px; }
.later-row { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--r-l); background: var(--surface); color: var(--ink-2); font-size: 14px; text-align: left; }
.later-row > .icon { color: var(--teal-strong); flex: none; }
.later-row .btn { pointer-events: none; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; line-height: 1; }

/* служителите се разпознават по цветен пръстен — като капачетата, които слагате на ключовете */
.av { --c: #5B6672; width: 34px; height: 34px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 4px var(--c); font-weight: 800; font-size: 12.5px; letter-spacing: .02em; }
.av-s { width: 24px; height: 24px; font-size: 9.5px; box-shadow: inset 0 0 0 3px var(--c); }
.av-l { width: 46px; height: 46px; font-size: 15px; box-shadow: inset 0 0 0 5px var(--c); }
.av-stack { display: inline-flex; }
.av-stack .av { margin-left: -8px; border: 2px solid var(--surface); box-sizing: content-box; }
.av-stack .av:first-child { margin-left: 0; }

/* ---------- рамка ---------- */
.demo-strip { background: var(--brand-navy); color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.3; padding-block: 6px; display: flex; gap: 8px; align-items: center; }
.demo-strip b { font-weight: 800; letter-spacing: .06em; flex: none; color: var(--teal); }
.demo-strip .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-strip button { border: 0; background: transparent; color: #fff; font-weight: 700; text-decoration: underline; padding: 4px 0 4px 4px; font-size: 12.5px; flex: none; white-space: nowrap; }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 10px; background: var(--red); color: var(--on-red); box-shadow: 0 1px 0 0 var(--red); }
.topbar .iconbtn { color: #fff; }
.brand { display: flex; align-items: center; text-decoration: none; height: 100%; padding: 6px 0; }
.logo-top { height: 44px; width: auto; display: block; }
.topbar .title { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .av { box-shadow: inset 0 0 0 3px var(--c), 0 0 0 2px rgba(255,255,255,.85); background: #fff; color: #222; width: 34px; height: 34px; }
.topbar-me { border: 0; background: transparent; padding: 4px; border-radius: 99px; display: flex; }

main.content { padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom, 0px)); }
main.content.has-composer { padding-bottom: calc(var(--tab-h) + 96px + env(safe-area-inset-bottom, 0px)); }
main.content.has-tray { padding-bottom: calc(var(--tab-h) + 84px + env(safe-area-inset-bottom, 0px)); }
main.content.has-tray.has-cart { padding-bottom: calc(var(--tab-h) + 132px + env(safe-area-inset-bottom, 0px)); }
.screen { max-width: 760px; margin: 0 auto; }
.screen-wide { max-width: 1120px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabbar-in { display: flex; width: 100%; max-width: 760px; }
.tab { flex: 1 1 0; height: var(--tab-h); border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 600; position: relative; min-width: 0; }
.tab .icon { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--red-ink); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 26%; right: 26%; height: 3px; background: var(--red); }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
body.kb-open .tabbar { display: none; }
.topnav { display: none; }

/* ---------- червената лента с парите за деня (скосен ръб като на сайта) ---------- */
.band { background: var(--red); color: var(--on-red); padding-block: 14px 34px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), 0 100%); }
.band-in { max-width: 760px; margin: 0 auto; }
.band .date { color: var(--red-muted); font-size: 14px; font-weight: 400; }
.band .date b { color: #fff; font-weight: 700; }
.band-main { display: flex; align-items: flex-end; gap: 16px 22px; flex-wrap: wrap; margin-top: 4px; }
.band-big { font-weight: 300; font-size: 50px; line-height: 1; letter-spacing: -.01em; }
.band-big .cur { font-size: .56em; margin-left: 4px; font-weight: 400; }
.band-big-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red-muted); margin-top: 6px; }
.band-stats { display: flex; gap: 18px; flex-wrap: wrap; padding-bottom: 4px; }
.band-stat .v { font-weight: 700; font-size: 19px; }
.band-stat .v.profit { color: #fff; }
.band-stat .k { font-size: 12px; color: var(--red-muted); }
.band-note { margin-top: 12px; font-size: 13px; color: var(--red-muted); }
.band-note button { color: #fff; background: none; border: 0; padding: 0; font-weight: 700; text-decoration: underline; font-size: 13px; }

/* ---------- секции и карти ---------- */
.section { padding-block: 14px 4px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head h2::after { content: ""; display: block; width: 26px; height: 2px; background: var(--red); margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.card-pad { padding: 14px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.empty { border: 1.5px dashed var(--line-strong); border-radius: var(--r-l); padding: 22px 16px; text-align: center; color: var(--ink-2); background: var(--surface); }
.empty h3 { font-size: 16px; margin-bottom: 6px; color: var(--ink); }
.empty p { margin: 0 auto; max-width: 42ch; font-size: 14px; }
.empty code { font-family: var(--font); font-weight: 700; background: var(--red-soft); color: var(--red-ink); padding: 2px 6px; border-radius: var(--r-s); white-space: nowrap; }

.entry { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 11px 12px; text-align: left; width: 100%; cursor: pointer; transition: border-color .15s; }
.entry.no-av { grid-template-columns: 1fr; }
.entry.is-new { animation: pop .6s ease-out; }
.entry.is-deleted { opacity: .55; border-style: dashed; }
.entry.is-deleted .entry-desc { text-decoration: line-through; }
.entry-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.entry-top { display: flex; gap: 10px; align-items: baseline; }
.entry-desc { font-weight: 700; font-size: 15px; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; flex: 1; }
.entry-time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.entry-who { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.entry-note { font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); border-left: 3px solid var(--teal); padding: 6px 9px; overflow-wrap: anywhere; }
@keyframes pop { 0% { background: var(--red-soft); } 100% { background: var(--surface); } }

.day-group { display: flex; flex-direction: column; gap: 8px; }
.day-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 2px 2px; position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); background: var(--bg); z-index: 5; }
.day-head h3 { font-size: 15px; font-weight: 700; }
.day-head .sum { margin-left: auto; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }

/* ---------- задачи ---------- */
.job { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--r-l); padding: 12px; display: flex; flex-direction: column; gap: 9px; position: relative; }
.job.is-new { border-left-color: var(--navy); }
.job.is-urgent { border-left-color: var(--red); background: linear-gradient(90deg, var(--red-soft), var(--surface) 40%); }
.job-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-time { font-size: 12.5px; color: var(--muted); }
.job-desc { font-weight: 700; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.job-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); min-width: 0; }
.job-line .icon { color: var(--muted); width: 17px; height: 17px; }
.job-line span { min-width: 0; overflow-wrap: anywhere; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.job-actions .btn { flex: 1 1 auto; }
.job.is-open { border-left-color: var(--teal); }
.job-open { position: absolute; inset: 0; border: 0; background: transparent; border-radius: var(--r-l); z-index: 0; }
.job > *:not(.job-open) { position: relative; z-index: 1; pointer-events: none; }
.job a, .job button:not(.job-open) { pointer-events: auto; }

/* ---------- долу: търсене на услуга и работната карта ---------- */
.tray { position: fixed; left: 0; right: 0; z-index: 25; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); padding-block: 8px; box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
body.kb-open .tray { bottom: var(--kb); }
.tray-in { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.tray-row { display: flex; gap: 8px; align-items: stretch; }
.tray-q { position: relative; flex: 1 1 auto; min-width: 0; display: block; }
.tray-q .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.tray-q input { width: 100%; height: 46px; padding: 0 12px 0 40px; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 16px; outline: none; }
.tray-q input:focus { border-color: var(--navy); background: var(--surface); }
.tray-go { flex: none; min-width: 46px; height: 46px; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.tray-go.is-ready { background: var(--red); border-color: var(--red); color: #fff; padding: 0 14px; }
.tray-go.pulse { animation: sendpulse .7s ease-out; }
.tray-go[disabled] { opacity: .6; }
.tray-cart { margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); }
.cart-lines { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--gutter-r) 0 var(--gutter-l); }
.cart-lines::-webkit-scrollbar { display: none; }
.cart-chip { flex: none; display: inline-flex; align-items: stretch; border: 1px solid var(--red); background: var(--red-soft); border-radius: var(--r-m); overflow: hidden; }
.cart-chip.miss { border-color: var(--warn); background: var(--warn-soft); }
.cart-open { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 0 2px 0 10px; min-height: 38px; font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.cart-open .sicon { width: 16px; height: 16px; color: var(--red-ink); }
.cart-open .chip-img { width: 20px; height: 20px; border-radius: 5px; object-fit: cover; }
.cart-open i { font-style: normal; color: var(--warn); font-weight: 800; }
.cart-x { border: 0; background: transparent; color: var(--red-ink); width: 34px; display: grid; place-items: center; }
.cart-x .icon { width: 16px; height: 16px; }
.cart-more { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 8px 0 10px; border: 1px dashed var(--line-strong); background: var(--surface); border-radius: var(--r-m); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.cart-more .icon { width: 16px; height: 16px; }
.quick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); padding: 0 var(--gutter-r) 2px var(--gutter-l); }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-s); min-height: 34px; padding: 0 11px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.quick button b { color: var(--red-ink); margin-left: 4px; font-weight: 700; }
.quick button.on { border-color: var(--red); background: var(--red-soft); }
.quick button .n { margin-left: 6px; font-weight: 800; color: var(--red-ink); }
.quick button.other { border-style: dashed; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.quick button.other .icon { width: 16px; height: 16px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-input textarea { flex: 1; min-width: 0; resize: none; min-height: 46px; max-height: 120px; padding: 11px 13px; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; line-height: 1.35; outline: none; }
.chat-input textarea:focus { border-color: var(--navy); }
.send { width: 46px; height: 46px; border-radius: var(--r-m); border: 0; flex: none; background: var(--red); color: #fff; display: grid; place-items: center; }
.send[disabled] { background: var(--surface-3); color: var(--muted); }
.plus { width: 46px; height: 46px; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; flex: none; }

/* ---------- долни прозорци ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; animation: fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: calc(100% - 28px - env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; background: var(--surface); border-radius: 10px 10px 0 0; box-shadow: var(--shadow-2); border-top: 4px solid var(--red); animation: up .22s cubic-bezier(.2,.8,.2,1); padding-bottom: env(safe-area-inset-bottom, 0px); }
.sheet-in { width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px var(--gutter-r) 8px var(--gutter-l); }
.sheet-head h2 { font-size: 18px; font-weight: 700; flex: 1; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 8px auto 0; }
.sheet-body { overflow-y: auto; padding: 4px var(--gutter-r) 16px var(--gutter-l); display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.sheet-body > * { flex-shrink: 0; } /* редове с хоризонтален скрол не бива да се смачкват */
.sheet-foot { padding: 10px var(--gutter-r) 12px var(--gutter-l); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100% - 40px)); border-radius: 6px; max-height: min(86vh, 900px); animation: fadeup .2s; }
  .sheet-grip { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fadeup { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.fieldset { border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.fieldset-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.calc { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-m); font-size: 14px; }
.calc b { font-size: 18px; }
.known { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-m); background: var(--red-soft); color: var(--ink-2); font-size: 14px; border-left: 3px solid var(--red); }
.known b { color: var(--ink); }
.known .icon { color: var(--red-ink); }
.loc { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface-2); font-size: 14px; }
.loc .icon { color: var(--red-ink); }
.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.picker button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 14px 4px 5px; border-radius: 99px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 600; }
.picker button[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red); }
.picker button .check { display: none; color: var(--red-ink); }
.picker button[aria-pressed="true"] .check { display: block; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest button { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-s); padding: 6px 10px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }

.toasts { position: fixed; left: 0; right: 0; z-index: 80; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
main.has-tray ~ .toasts { bottom: calc(var(--tab-h) + 74px + env(safe-area-inset-bottom, 0px)); }
main.has-tray.has-cart ~ .toasts { bottom: calc(var(--tab-h) + 122px + env(safe-area-inset-bottom, 0px)); }
.toast { pointer-events: auto; background: #222; color: #fff; padding: 11px 16px; border-radius: var(--r-m); font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow-2); max-width: 520px; display: flex; gap: 10px; align-items: center; animation: up .2s; border-left: 4px solid var(--teal); }
.toast button { background: none; border: 0; color: var(--teal); font-weight: 800; padding: 0 0 0 6px; }

/* ---------- вход: като началната страница — логото на бяло, мотото с червена черта ---------- */
.login { min-height: 100%; min-height: 100vh; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; }
.login-head { padding-block: 34px 10px; max-width: 460px; margin: 0 auto; width: 100%; text-align: center; }
.logo-hero { width: 190px; max-width: 60%; height: auto; display: block; margin: 0 auto; }
.slogan { margin: 16px 0 0; color: var(--ink-2); font-size: 17px; font-weight: 300; }
.slogan::after { content: ""; display: block; width: 90px; height: 2px; background: var(--red); margin: 12px auto 0; }
.login-card { flex: 1; padding-block: 18px 40px; }
.login-card-in { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 22px; font-weight: 700; }
.role-card { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: var(--r-l); padding: 12px 14px; }
.role-card .t { font-weight: 700; font-size: 16px; }
.role-card .d { font-size: 13.5px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.login-foot { background: var(--red); color: var(--red-muted); text-align: center; font-size: 13px; padding-block: 28px 18px; clip-path: polygon(0 18px, 100% 0, 100% 100%, 0 100%); }
.login-foot b { color: #fff; }

/* ---------- отчети ---------- */
.rep-controls { display: flex; flex-direction: column; gap: 10px; padding-block: 14px 6px; }
.rep-nav { display: flex; align-items: center; gap: 6px; }
.rep-nav .when { flex: 1; min-width: 0; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-m); min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 15px; padding: 0 10px; }
.rep-nav .when span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-nav .when .icon { color: var(--red-ink); }
.who-filter { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.who-filter::-webkit-scrollbar { display: none; }
.who-filter button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 6px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 13.5px; }
.who-filter button.all { padding-left: 12px; }
.who-filter button b { font-weight: 700; }
.who-filter button[aria-pressed="true"] { background: var(--red); color: #fff; border-color: var(--red); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px 14px; min-width: 0; }
.kpi .k { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi .v { font-weight: 700; font-size: 25px; line-height: 1.15; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi-hero { grid-column: 1 / -1; background: var(--red); border-color: var(--red); color: #fff; }
.kpi-hero .k { color: var(--red-muted); }
.kpi-hero .v { font-size: 42px; font-weight: 300; color: #fff; }
.kpi-hero .s { color: var(--red-muted); }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.pay-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.pay-row > div { padding: 10px 12px; border-left: 1px solid var(--line); min-width: 0; }
.pay-row > div:first-child { border-left: 0; }
.pay-row .k { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.pay-row .v { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .pay-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pay-row > div:nth-child(3) { border-left: 0; } .pay-row > div:nth-child(n+3) { border-top: 1px solid var(--line); } }

.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--red); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: right; font-weight: 600; }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); }
.tbl .who { display: flex; align-items: center; gap: 8px; font-weight: 700; }

/* една обща решетка за всички редове — лентите започват и свършват на едно място */
.hbars { display: grid; grid-template-columns: minmax(96px, 34%) minmax(40px, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px; }
.hbar { display: contents; }
.hbar .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 12px; background: var(--surface-3); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--red); }
.hbar .val { font-weight: 700; white-space: nowrap; min-width: 64px; text-align: right; }
.hbar .val small { color: var(--muted); font-weight: 600; margin-left: 4px; }

.vchart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 14px 8px; }
.vchart svg { display: block; width: 100%; height: auto; overflow: visible; }
.vchart .legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.vchart .legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }

.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.actions-bar .btn { flex: 1 1 140px; }

.cal { display: flex; flex-direction: column; gap: 8px; }
.cal-head { display: flex; align-items: center; gap: 6px; }
.cal-head h3 { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-day { border: 1px solid transparent; background: var(--surface-2); border-radius: var(--r-m); min-height: 54px; padding: 4px 2px 5px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px; min-width: 0; }
.cal-day .d { font-weight: 700; font-size: 14px; }
.cal-day .m { font-size: 11px; font-weight: 700; color: var(--profit); white-space: nowrap; overflow: hidden; max-width: 100%; }
.cal-day .heat { width: 70%; height: 4px; background: var(--red); }
.cal-day.out { visibility: hidden; }
.cal-day.today { border-color: var(--red); }
.cal-day.future { opacity: .45; }
.cal-day.in-range { background: var(--red-soft); }
.cal-day.sel { background: var(--red); color: #fff; }
.cal-day.sel .m { color: #fff; }

/* ---------- клиенти ---------- */
.search-bar { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); z-index: 6; background: var(--bg); padding-block: 12px 8px; }
.client-row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); width: 100%; text-align: left; }
.client-row .nm { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-row .tot { text-align: right; flex: none; }
.client-row .tot b { font-size: 16px; display: block; }
.client-row .tot span { font-size: 12px; color: var(--muted); }
.ci { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.ci.biz { background: var(--navy-soft); color: var(--navy); }

.dossier-head { background: var(--red); color: #fff; padding-block: 16px 36px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), 0 100%); }
.dossier-head .over { color: var(--red-muted); margin-bottom: 8px; }
.dossier-head .ci { background: rgba(255,255,255,.16); color: #fff; }
.dossier-head h1 { font-size: 26px; font-weight: 300; }
.dossier-head .ph { font-size: 20px; font-weight: 700; margin-top: 2px; }
.dossier-head .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.dossier-head .btn { background: var(--red-2); border-color: var(--red-2); color: #fff; }
.dossier-head .btn-primary { background: #fff; border-color: #fff; color: var(--red); }
.dossier-head p { color: var(--red-muted); margin: 6px 0 0; }
.dossier-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.dossier-stats div { background: var(--red-2); padding: 8px 10px; min-width: 0; }
.dossier-stats .v { font-weight: 700; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dossier-stats .k { font-size: 12px; color: var(--red-muted); }

.note { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--r-m); padding: 10px 12px; }
.note .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.note .txt { overflow-wrap: anywhere; white-space: pre-wrap; }

.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 18px 1fr; gap: 10px; }
.tl .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin: 5px auto 0; position: relative; }
.tl:not(:last-child) .dot::after { content: ""; position: absolute; left: 4px; top: 12px; width: 2px; height: 28px; background: var(--line); }
.tl.on .dot { background: var(--red); }
.tl .t { font-weight: 600; font-size: 14px; }
.tl .s { font-size: 12.5px; color: var(--muted); padding-bottom: 12px; }

/* ---------- чат ---------- */
.chat { display: flex; flex-direction: column; gap: 4px; padding-block: 12px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.msg .bub { background: var(--surface); border: 1px solid var(--line); border-radius: 8px 8px 8px 2px; padding: 7px 11px 6px; min-width: 0; }
.msg.mine .bub { background: var(--red-soft); border-color: transparent; border-radius: 8px 8px 2px 8px; }
.msg .who { font-size: 12px; font-weight: 800; margin-bottom: 1px; }
.msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.msg .tm { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.msg.cont .av { visibility: hidden; }
.msg.cont .who { display: none; }
.chat-day { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: var(--r-s); padding: 3px 10px; margin: 10px 0 6px; }
.chat-input { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); z-index: 25; background: var(--surface); border-top: 1px solid var(--line); padding-block: 8px; }
body.kb-open .chat-input { bottom: var(--kb); }
.chat-input .composer-row { max-width: 760px; margin: 0 auto; }
.maplink { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--red-ink); }

/* ---------- екип / настройки ---------- */
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); width: 100%; text-align: left; }
.user-row .nm { font-weight: 700; }
.user-row .sub { font-size: 13px; color: var(--muted); }
.user-row.pending { flex-wrap: wrap; border-left: 4px solid var(--warn); }
.user-row .acts { display: flex; gap: 8px; width: 100%; }
.user-row .acts .btn { flex: 1; }
.tpl-row { display: flex; gap: 8px; align-items: center; }
.tpl-row .input { flex: 1; font-weight: 600; }
.colors { display: flex; flex-wrap: wrap; gap: 10px; }
.colors button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: inset 0 0 0 6px var(--c); }
.colors button[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.menu { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.menu button, .menu a { display: flex; align-items: center; gap: 12px; padding: 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; }
.menu button:last-child, .menu a:last-child { border-bottom: 0; }
.menu .icon { color: var(--red-ink); }
.menu .chev { margin-left: auto; color: var(--muted); }
.menu .chev .icon { color: var(--muted); }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: var(--r-m); padding: 8px 8px 8px 12px; border: 1px solid var(--line); }
.copybox code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13.5px; font-weight: 600; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.callout { background: var(--navy-soft); color: var(--ink); border-radius: var(--r-m); padding: 12px 14px; font-size: 14px; border-left: 4px solid var(--navy); }
.callout b { color: var(--navy); }

/* ---------- бързи услуги: квадратчета с иконка или снимка ---------- */
.sicon { width: 28px; height: 28px; display: block; flex: none; }
.svc-search { margin: 0 0 10px; }
.svc-search .input { min-height: 44px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; min-width: 0; min-height: 112px; padding: 10px 6px 9px;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--ink); text-align: center; transition: border-color .15s, background .15s, transform .08s; }
.tile:active { transform: scale(.97); }
.tile-media { width: 50px; height: 50px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red-ink); overflow: hidden; }
.tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-name { font-size: 12px; font-weight: 700; line-height: 1.2; letter-spacing: .01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; }
.tile-price { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--red-ink); white-space: nowrap; }
.tile.is-on { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-soft); }
.tile.is-on .tile-media { background: var(--red); color: #fff; }
.tile-badge { position: absolute; top: 6px; right: 6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; line-height: 1; }
.tile-badge .icon { width: 12px; height: 12px; stroke-width: 3.2; }
.tile-more { border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--ink-2); }
.tile-more .tile-media { background: var(--surface-3); color: var(--ink-2); }
.tile-more .tile-price { color: var(--muted); }
.tiles-empty { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-l); color: var(--ink-2); font-size: 14px; background: var(--surface); }
@media (hover: hover) { .tile:hover { border-color: var(--red); } .svc-main:hover { border-color: var(--line-strong); } .ic:hover { border-color: var(--red); } }
.quick button .sicon { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; margin-right: 5px; color: var(--red-ink); }
.quick button .chip-img { width: 20px; height: 20px; border-radius: 5px; object-fit: cover; display: inline-block; vertical-align: -5px; margin-right: 6px; }
.quick button i { font-style: normal; font-weight: 600; color: var(--muted); margin-left: 4px; font-size: 12px; }
.quick-in { margin: -4px 0 0; }
.send.pulse { animation: sendpulse .7s ease-out; }
@keyframes sendpulse { 0% { box-shadow: 0 0 0 0 rgba(160, 29, 33, .55); } 100% { box-shadow: 0 0 0 14px rgba(160, 29, 33, 0); } }

/* ---------- каталог „Услуги и цени“ ---------- */
.svc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.svc-row { display: flex; align-items: stretch; gap: 6px; }
.svc-star { flex: none; width: 44px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--line-strong); display: grid; place-items: center; }
.svc-star.on { color: #E0B323; }
.svc-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 9px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--ink); text-align: left; transition: border-color .15s; }
.svc-main .nm, .check-row .nm { display: block; font-weight: 700; font-size: 14.5px; line-height: 1.25; overflow-wrap: anywhere; }
.svc-main .meta, .check-row .meta, .bulk-row .meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.svc-media { width: 42px; height: 42px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--red-soft); color: var(--red-ink); overflow: hidden; }
.svc-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.svc-media .sicon { width: 24px; height: 24px; }
.svc-media-l { width: 64px; height: 64px; border-radius: 14px; }
.svc-media-l .sicon { width: 36px; height: 36px; }
.svc-price { flex: none; text-align: right; font-weight: 800; font-size: 15px; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.svc-price small { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.svc-head { display: flex; gap: 12px; align-items: flex-end; }
.svc-photo-box { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.svc-photo-box img { width: 132px; height: 132px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.icon-grid-wrap { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.icon-group .label { margin: 0 0 6px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.ic { height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); display: grid; place-items: center; padding: 0; }
.ic .sicon { width: 24px; height: 24px; }
.ic.on { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-soft); color: var(--red-ink); }
.check-row, .bulk-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); cursor: pointer; }
.check-row input { width: 20px; height: 20px; flex: none; accent-color: var(--red); margin: 0; }
.bulk-row { cursor: default; }
.bulk-row.dup { opacity: .55; }

/* ---------- работна карта: редове (услуги) с брой, цена и консуматив ---------- */
.lines { display: flex; flex-direction: column; gap: 8px; }
.lines-empty { padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-l); color: var(--muted); font-size: 14px; text-align: center; }
.line { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); padding: 8px 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.line.miss { border-color: var(--warn); box-shadow: inset 3px 0 0 var(--warn); }
.line-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.line-top .svc-media { width: 36px; height: 36px; border-radius: 9px; }
.line-top .svc-media .sicon { width: 20px; height: 20px; }
.line-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; overflow-wrap: anywhere; min-width: 0; }
input.line-name { flex: 1 1 auto; min-height: 40px; font-size: 15px; }
.line-top .iconbtn { width: 36px; height: 36px; margin-left: auto; flex: none; }
.line-bot { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-m); overflow: hidden; height: 44px; flex: none; }
.stepper button { width: 42px; height: 100%; border: 0; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; }
.stepper button[disabled] { opacity: .35; }
.stepper b { min-width: 34px; text-align: center; font-size: 17px; }
.line-money { display: flex; flex-direction: column; gap: 3px; flex: 1 1 96px; min-width: 0; }
.line-money > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.line-money .input { min-height: 44px; padding: 6px 10px; }
.line-cost { flex-basis: 84px; }
.line-cost .input { font-size: 16px; font-weight: 600; }
.line-ro { padding: 9px 12px; }
.line-ro .line-top b { margin-left: auto; white-space: nowrap; }
.line.is-deleted { opacity: .55; text-decoration: line-through; }
.input.bad { border-color: var(--danger); }
.warn-t { color: var(--warn); }
.add-svc { display: flex; flex-direction: column; gap: 8px; }
.input-plate { text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }

/* регистрационен номер като истинска табела */
.plate { display: inline-flex; align-items: center; height: 24px; padding-right: 6px; border: 1.5px solid #1D1D1D; border-radius: 4px; background: #fff; color: #111; font-weight: 800; font-size: 13px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; line-height: 1; flex: none; vertical-align: middle; }
.plate i { align-self: stretch; display: flex; align-items: center; justify-content: center; margin-right: 5px; padding: 0 3px; background: #003DA5; color: #fff; font-style: normal; font-size: 8px; font-weight: 700; letter-spacing: 0; }
.plate-s { height: 20px; font-size: 11.5px; }
.plate-l { height: 38px; font-size: 22px; border-width: 2px; padding-right: 10px; }
.plate-l i { font-size: 11px; padding: 0 5px; margin-right: 8px; }
.dossier-head .plate { box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
.ci.car { background: var(--navy-soft); color: var(--navy); }
.client-row .nm-car { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: 15.5px; }
.client-row .nm-car > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-svcs { display: flex; flex-wrap: wrap; gap: 6px; }
.job-svcs .chip b { color: var(--red-ink); }
.job-svcs-l .chip { min-height: 32px; font-size: 14.5px; font-weight: 700; color: var(--ink); padding: 0 10px; }
.quick button .n .icon { display: inline-block; vertical-align: -2px; width: 14px; height: 14px; }
.job-svcs .chip i { font-style: normal; color: var(--muted); font-weight: 600; }
.job-line .plate { margin-left: 2px; }
.callout-warn { background: var(--warn-soft); border-left-color: var(--warn); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.callout-warn b { color: var(--warn); }
.car-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.known-acts { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* ---------- компютър: менюто е в червената лента, като на сайта ---------- */
@media (min-width: 1000px) {
  body { font-size: 15.5px; }
  .tabbar { display: none; }
  .topnav { display: flex; gap: 2px; margin-left: 22px; min-width: 0; height: 100%; align-items: stretch; }
  .topnav .tab { flex: none; height: auto; flex-direction: row; gap: 8px; padding: 0 14px; color: #fff; font-size: 15px; font-weight: 400; }
  .topnav .tab .icon { width: 18px; height: 18px; opacity: .85; }
  .topnav .tab[aria-current="page"] { color: #fff; }
  .topnav .tab[aria-current="page"]::before { top: auto; bottom: 12px; left: 14px; right: 14px; height: 2px; background: #fff; }
  .topnav .tab .badge { position: static; margin-left: 2px; background: #fff; color: var(--red); }
  main.content { padding-bottom: 40px; }
  main.content.has-composer { padding-bottom: 130px; }
  main.content.has-tray { padding-bottom: 110px; }
  main.content.has-tray.has-cart { padding-bottom: 160px; }
  .tray, .chat-input { bottom: 0; }
  main.has-tray ~ .toasts { bottom: 86px; }
  main.has-tray.has-cart ~ .toasts { bottom: 134px; }
  .toasts { bottom: 24px; }
}

@media print {
  .topbar, .tabbar, .tray, .demo-strip, .actions-bar, .rep-controls .rep-nav button, .who-filter, .toasts { display: none !important; }
  main.content { padding: 0 !important; margin: 0 !important; }
  body { background: #fff; color: #000; }
  .card, .kpi, .tbl-wrap, .hbars, .vchart, .entry { break-inside: avoid; box-shadow: none; }
  .day-head { position: static; }
  .band, .dossier-head { clip-path: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- марки коли: значка (кратко име) или лого; подсказки марка → модел → поколение */
.brand-b { --bc: #4A5568; flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--bc); color: #fff; font-weight: 800; font-size: 10.5px; letter-spacing: -.01em; line-height: 1; overflow: hidden; text-transform: uppercase; }
.brand-b.long { font-size: 8.5px; letter-spacing: -.03em; }
.brand-b.has-logo { background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.brand-b.has-logo img { width: 100%; height: 100%; object-fit: contain; padding: 2px; box-sizing: border-box; }
.brand-xs { width: 16px; height: 16px; border-radius: 4px; font-size: 7px; }
.brand-xs.long { font-size: 5.5px; }
.brand-s { width: 20px; height: 20px; border-radius: 5px; font-size: 8.5px; }
.brand-s.long { font-size: 7px; }
.brand-m { width: 26px; height: 26px; }
.brand-l { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.brand-l.long { font-size: 11.5px; }
.brand-xl { width: 56px; height: 56px; border-radius: 14px; font-size: 19px; }
.brand-xl.long { font-size: 15px; }
.ci.has-brand { background: transparent; }
.dossier-head .ci.has-brand { background: transparent; }
.chip-car .brand-b { margin-left: -2px; }
.carf-in { position: relative; display: block; }
.carf-in .carf-badge { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.carf-in .carf-badge > .icon { width: 20px; height: 20px; }
.carf-in .input { padding-left: 44px; }
.carf-sugg { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; align-items: center; margin: -4px calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); padding: 2px var(--gutter-r) 4px var(--gutter-l); }
.carf-sugg::-webkit-scrollbar { display: none; }
.fieldset .carf-sugg { margin: -4px -12px 0; padding: 2px 12px 4px; }
.carf-step { flex: none; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.carf-chip { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 12px 0 9px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.carf-chip i { font-style: normal; font-weight: 600; color: var(--muted); font-size: 12.5px; }
.carf-chip:active { border-color: var(--red); background: var(--red-soft); }
.ccar { display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.ccar-top { display: flex; align-items: flex-end; gap: 8px; }
.ccar-top .btn { flex: none; min-height: 48px; }
.ccar-hint { font-size: 13px; margin-top: -4px; }
.ccar-hint:empty { display: none; }
.client-row .sub-car { display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.brand-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); text-align: left; min-width: 0; }
.brand-tile .nm { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.brand-tile .sub { font-size: 12.5px; color: var(--muted); }
@media (hover: hover) { .carf-chip:hover, .brand-tile:hover { border-color: var(--line-strong); background: var(--surface-2); } }

/* ---- чат: разговори (общ + лични) */
.threads { gap: 8px; margin-top: 14px; }
.thread { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); width: 100%; text-align: left; min-width: 0; }
.thread .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.thread .nm { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.thread .sub { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread.has-new .sub { color: var(--ink); font-weight: 600; }
.thread.is-off { opacity: .6; }
.thread .th-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.thread .th-meta .tm { font-size: 12px; color: var(--muted); }
.thread.has-new .th-meta .tm { color: var(--red-ink); font-weight: 700; }
.thread .av { width: 40px; height: 40px; }
.av-team { background: var(--navy); color: #fff; box-shadow: none; }
.av-team .icon { width: 20px; height: 20px; }
.threads-label { margin: 10px 2px 0; }
.dm-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px 0 10px; font-size: 13px; color: var(--muted); text-align: center; }
@media (hover: hover) { .thread:hover { border-color: var(--line-strong); } }

/* ---- категории на услугите (добавени от шефа) */
.sv-newcat { display: flex; gap: 8px; margin-top: 8px; }
.sv-newcat[hidden] { display: none; }
.cat-ic { display: inline-flex; width: 22px; height: 22px; margin-right: 6px; vertical-align: -3px; color: var(--red-ink); }
.cat-ic .sicon { width: 22px; height: 22px; }

/* ---- 1.3: за какво е работата (кола / имот), подсказки за клиент, нови услуги, фактури */
.place-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.place-pick button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 10px; border-radius: 99px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; }
.place-pick button .icon { width: 18px; height: 18px; }
.place-pick button[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); color: var(--red-ink); box-shadow: inset 0 0 0 1px var(--red); }
.carbox { display: flex; flex-direction: column; gap: 12px; padding: 10px; margin-top: -4px; border-radius: var(--r-m); background: var(--surface-2); border: 1px dashed var(--line-strong); }
.carbox[hidden] { display: none; }
.cs-box { display: flex; flex-direction: column; gap: 4px; margin-top: -6px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); box-shadow: var(--shadow-1); }
.cs-box[hidden] { display: none; }
.cs-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 4px; }
.cs-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 8px; border: 0; border-radius: var(--r-s); background: transparent; text-align: left; color: var(--ink); }
.cs-item .ci { width: 32px; height: 32px; }
.cs-item .ci .icon { width: 17px; height: 17px; }
.cs-item .grow { min-width: 0; display: flex; flex-direction: column; }
.cs-item b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-item small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-item > .icon { color: var(--muted); flex: none; }
.cs-item:active, .cs-item:focus-visible { background: var(--red-soft); }
@media (hover: hover) { .cs-item:hover { background: var(--surface-2); } }
.chip-place { background: var(--navy-soft); color: var(--navy); }
.chip-inv { background: var(--profit-soft); color: var(--profit); }
.new-b { display: inline-block; font-style: normal; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--teal-strong); border-radius: 3px; padding: 1px 5px; vertical-align: 2px; }
.line-prop { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.line-prop input { width: 20px; height: 20px; accent-color: var(--red); flex: none; margin: 0; }
.inv-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-m); background: var(--profit-soft); color: var(--ink); font-size: 14px; border-left: 3px solid var(--profit); }
.inv-box > .icon { color: var(--profit); flex: none; }
.inv-box .grow { flex: 1 1 160px; }
.co-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); font-size: 14px; }
.co-box > .icon { color: var(--navy); flex: none; margin-top: 2px; }
.pend-box { border: 1px solid var(--teal); border-radius: var(--r-l); padding: 12px; background: var(--surface); }
.pend-row .btn { pointer-events: none; flex: none; align-self: center; }
button.svc-row.pend-row { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); text-align: left; align-items: center; gap: 12px; }
.pend-row .nm { display: block; font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.pend-row .meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.later-row.pend-row { border-color: var(--teal); border-style: solid; }
.pend-callout { display: flex; gap: 10px; align-items: flex-start; border-left-color: var(--teal); }
.pend-callout > .icon { flex: none; color: var(--teal-strong); }
.av-btn { border: 0; padding: 0; background: none; border-radius: 50%; flex: none; }
.who-btn { display: block; border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 800; margin-bottom: 1px; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 2px; }
@media (hover: hover) { .who-btn:hover { text-decoration-color: currentColor; } }
.seg-s button { min-height: 34px; font-size: 13.5px; }
.tiles-scope { margin: -2px 0 10px; }
/* формата за фактура */
.iv-line { display: grid; grid-template-columns: minmax(0, 1fr) 64px 104px 40px; gap: 6px; align-items: end; }
.iv-line .iv-desc { min-height: 44px; }
.iv-n { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.iv-n > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.iv-n .input { min-height: 44px; padding: 6px 8px; }
.iv-line .iconbtn { width: 40px; height: 44px; }
@media (max-width: 480px) {
  .iv-line { grid-template-columns: 72px minmax(0, 1fr) 40px; row-gap: 4px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .iv-line .iv-desc { grid-column: 1 / 3; grid-row: 1; }
  .iv-line .iconbtn { grid-column: 3; grid-row: 1; }
  .iv-line .iv-n:not(.iv-a) { grid-column: 1; grid-row: 2; }
  .iv-line .iv-a { grid-column: 2 / 4; grid-row: 2; }
}
.iv-cards { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.iv-cards .chip-btn.on { opacity: .55; }
.iv-calc { flex-wrap: wrap; }
.iv-calc .iv-total { font-size: 18px; }
.iv-calc .iv-words { flex-basis: 100%; font-size: 13px; color: var(--muted); font-weight: 600; }
/* документът в апа */
.inv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.inv-actions .btn { flex: 1 1 140px; }
.inv-paper { margin: 0 calc(-1 * var(--gutter-l)) 16px calc(-1 * var(--gutter-r)); padding: 0 6px; }
@media (min-width: 640px) { .inv-paper { margin-left: 0; margin-right: 0; padding: 0; } }
.inv-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); text-align: left; color: var(--ink); }
.inv-row.is-off { opacity: .6; }
.inv-row-no { flex: none; display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.inv-row-no small { font-weight: 600; color: var(--muted); font-size: 12px; }
.inv-row .grow { min-width: 0; display: flex; flex-direction: column; }
.inv-row .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row .tot { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.inv-row .tot b { font-size: 15.5px; }
.fix-box { border-top: 1px solid var(--line); padding-top: 14px; }
@media (hover: hover) { .inv-row:hover { border-color: var(--line-strong); } }
#print-root { display: none; }
@media print {
  html.print-inv body > *:not(#print-root) { display: none !important; }
  html.print-inv #print-root { display: block !important; }
  html.print-inv, html.print-inv body { background: #fff !important; }
}
.field > span.hint { font-weight: 400; color: var(--muted); }
#iv-body { display: flex; flex-direction: column; gap: 14px; }
#iv-body > * { flex-shrink: 0; }
/* „Да затворя ли без запис?“ — над долните бутони на листа */
.sheet-in { position: relative; }
.sheet-confirm { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; background: var(--surface); border-top: 3px solid var(--danger); box-shadow: 0 -10px 30px rgba(0,0,0,.18); padding: 14px var(--gutter-r) calc(14px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); animation: up .18s cubic-bezier(.2,.8,.2,1); }
.sheet-confirm p { margin: 0 0 12px; font-size: 15px; }
.sheet-confirm-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-confirm-btns .btn { flex: 1 1 150px; min-height: 48px; }
.input.bad, .textarea.bad { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---- 1.3: прегледът за удобство */
/* лентата за деня: предупреждение без консуматив */
.band-warn { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: rgba(0,0,0,.18); border-radius: var(--r-m); color: #fff; }
.band-warn button { flex: none; }
.band-warn .icon { flex: none; }
/* задачите като един ред: свободни и за по-късно */
.job-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: var(--r-l); }
.job-row.is-urgent { border-left-color: var(--red); background: linear-gradient(90deg, var(--red-soft), var(--surface) 45%); }
.job-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; border: 0; background: none; padding: 2px 0; text-align: left; color: var(--ink); }
.job-row-when { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.job-row-t { font-weight: 700; font-size: 15px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.job-row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row > .btn { flex: none; }
@media (hover: hover) { .job-row:hover { border-color: var(--line-strong); } }
/* шефът е избрал служител в „Екипът днес“ */
.who-sum { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: var(--r-m); font-size: 14px; }
.who-sum .grow { flex: 1 1 180px; }
.push-banner { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 6px 8px 12px; background: var(--navy-soft); border-left: 4px solid var(--navy); border-radius: var(--r-m); font-size: 14px; }
.push-banner > .icon { color: var(--navy); }
.push-banner .iconbtn { width: 38px; height: 38px; flex: none; }
.push-banner .btn { flex: none; }
/* готови думи за задачата — един ред, плъзга се */
.suggest-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); padding: 0 var(--gutter-r) 2px var(--gutter-l); }
.suggest-row::-webkit-scrollbar { display: none; }
.suggest-row button { flex: none; white-space: nowrap; }
.fieldset .suggest-row { margin: 0 -12px; padding: 0 12px 2px; }
.line-unit { font-size: 12px; color: var(--muted); font-weight: 600; }
#tr-sugg.pulse { animation: sendpulse .7s ease-out; border-radius: var(--r-m); }
/* досие */
.owes { color: #fff; background: var(--danger); padding: 0 5px; border-radius: 3px; font-weight: 800; white-space: nowrap; }
.ph-copy { border: 0; background: rgba(255,255,255,.16); color: #fff; width: 32px; height: 32px; border-radius: var(--r-m); display: inline-grid; place-items: center; vertical-align: 2px; margin-left: 4px; padding: 0; }
.ph-copy .icon { width: 16px; height: 16px; }
.iconbtn.on-red { color: #fff; background: rgba(255,255,255,.14); flex: none; }
@media (hover: hover) { .iconbtn.on-red:hover { background: var(--red-2); } }
.loc-ok { display: inline-flex; align-items: center; gap: 5px; color: var(--profit); font-weight: 700; }
#k-loc, #j-loc { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
details.tech { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); padding: 0 12px; }
details.tech > summary { cursor: pointer; padding: 12px 0; font-weight: 700; color: var(--ink-2); list-style-position: inside; }
details.tech[open] { padding-bottom: 12px; }
details.tech[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.chip-place { max-width: 100%; min-width: 0; }
.chip-place .cp-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar-me { position: relative; }
.topbar-me.has-dot::after { content: ""; position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px var(--red); }
/* имената в общия чат: цветът на служителя, изсветлен в тъмния режим */
.msg .who { color: var(--uc, inherit); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg .who { color: color-mix(in srgb, var(--uc, #ccc) 50%, #fff); } }
:root[data-theme="dark"] .msg .who { color: color-mix(in srgb, var(--uc, #ccc) 50%, #fff); }
.who-btn { padding: 5px 12px 4px 0; margin: -5px 0 -3px; min-height: 26px; text-align: left; }

/* лентата долу: „Клиент“ стои първо и не се губи; услугите се плъзгат до него */
.tray-cart { display: flex; gap: 6px; align-items: stretch; padding-left: var(--gutter-l); }
.cart-who { max-width: 42%; min-width: 0; border-style: solid; border-color: var(--line-strong); }
.cart-who > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tray-cart .cart-lines { flex: 1 1 auto; min-width: 0; padding: 0 var(--gutter-r) 0 0; }
/* в листа: при 3+ услуги всяка е на един ред — докосване я отваря */
.line-c { flex-direction: row; align-items: center; gap: 4px; padding: 4px 4px 4px 8px; }
.line-c-open { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 2px 0; text-align: left; color: var(--ink); min-height: 40px; }
.line-c-open .svc-media { width: 32px; height: 32px; border-radius: 8px; }
.line-c-open .svc-media .sicon { width: 18px; height: 18px; }
.line-c-open .line-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-c-q { flex: none; font-weight: 800; color: var(--red-ink); font-size: 14px; }
.line-c-p { flex: none; font-size: 15px; white-space: nowrap; }
.line-c-open > .icon { color: var(--muted); }
.line-c > .iconbtn { width: 36px; height: 36px; flex: none; }
/* на компютър редовете с бутони се пренасят, вместо да се плъзгат */
@media (hover: hover) and (pointer: fine) {
  .quick, .who-filter { flex-wrap: wrap; overflow-x: visible; }
  .tray-cart .cart-lines { flex-wrap: wrap; }
  .suggest-row { flex-wrap: wrap; }
}

/* фактура: картите на клиента и последният поглед */
.iv-cards { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.iv-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 8px 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); text-align: left; color: var(--ink); font-size: 14px; }
.iv-card .grow { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.iv-card-p { flex: none; font-weight: 700; white-space: nowrap; }
.iv-card .btn { flex: none; pointer-events: none; }
.iv-card.on { border-color: var(--profit); background: var(--profit-soft); }
.iv-card.on .btn { background: transparent; border-color: transparent; color: var(--profit); }
.iv-card[disabled] { cursor: default; }
.iv-confirm { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.iv-confirm-t { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; padding: 2px 2px 0; }
.iv-confirm-t::before { content: "Проверете: "; font-weight: 700; color: var(--warn); }
.iv-confirm-b { display: flex; gap: 10px; }
.iv-confirm-b .btn { flex: 1; }
.iv-confirm-b .btn-primary { flex: 2; }

/* отчети: „По служители“ — на телефон като карти, на широко като таблица */
.emp-cards { display: none; flex-direction: column; gap: 8px; }
.emp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.emp-card-h { display: flex; align-items: center; gap: 8px; }
.emp-card-h .who { display: flex; align-items: center; gap: 8px; font-weight: 700; flex: 1; min-width: 0; }
.emp-card-p { flex: none; font-size: 16px; }
.emp-card-p small { font-size: 12px; color: var(--muted); font-weight: 600; }
.emp-card-r { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
.emp-card-cash span { display: inline-flex; align-items: center; gap: 5px; }
.emp-card-cash .icon { color: var(--muted); }
@media (max-width: 600px) { .emp-cards { display: flex; } .emp-tbl { display: none; } }
.tbl-fit { min-width: 0; }
.tbl-fit td:first-child { white-space: normal; }
.tbl-fit th, .tbl-fit td { padding-left: 10px; padding-right: 10px; }
html.has-sheet .toasts { top: calc(12px + env(safe-area-inset-top, 0px)) !important; bottom: auto !important; }
#k-loc, #j-loc, #c-loc { flex: 1 1 100%; }
#k-loc:empty, #j-loc:empty, #c-loc:empty { display: none; }
/* долните бутони на листа: два дълги надписа се събират (пренасят се), вместо да излизат от екрана */
.sheet-foot .btn { flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.2; text-align: center; padding-left: 12px; padding-right: 12px; }
.client-row .sub-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* подсказките с услуги в листа: подравнени с полето над тях и плъзгат до ръба */
.quick-in { margin: -4px calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); }
.fieldset .quick-in { margin: -4px -12px 0; padding-left: 12px; padding-right: 12px; }
.client-row .sub-car { flex-wrap: wrap; row-gap: 3px; }

/* ================= 1.4: каса, касови бележки, собственост и подпис, гаранция, справочник, къде е екипът, архив ================= */
.chip-ic { padding: 0 6px; background: var(--surface-2); color: var(--muted); }
.chip-ic .icon, .chip-war .icon { width: 15px; height: 15px; }
.chip-war { padding: 0 6px; background: var(--profit-soft); color: var(--profit); }
.chip-paid { background: var(--profit-soft); color: var(--profit); }
.chip-pf { background: var(--navy-soft); color: var(--navy); }
.chip-paid .icon, .chip-inv .icon { width: 14px; height: 14px; }
/* долу в картата: „бележка“ и „документ?“ с едно докосване */
.cart-flag { flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 0 10px; border: 1px dashed var(--line-strong); background: var(--surface); border-radius: var(--r-m); font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cart-flag .icon { width: 16px; height: 16px; }
.cart-flag.warn { border-style: solid; border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
/* касова бележка под плащането */
.switch-tight { padding: 8px 0 0; border-bottom: 0; }
/* проверка на собственост и подпис */
.own-box.need { border-color: var(--warn); background: var(--warn-soft); }
.own-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
.own-pick button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13.5px; text-align: left; }
.own-pick button .icon { flex: none; color: var(--muted); }
.own-pick button[aria-pressed="true"] { border-color: var(--profit); background: var(--profit-soft); color: var(--profit); }
.own-pick button[aria-pressed="true"] .icon { color: var(--profit); }
/* подпис на цял екран: бял лист и в тъмния режим; в портрет листът е завъртян (клиентът завърта телефона) */
.sigfs {
  position: fixed; inset: 0; z-index: 100; overflow: hidden; overscroll-behavior: none; touch-action: none; color-scheme: light;
  --surface: #FFFFFF; --ink: #1B2350; --ink-2: #3D4466; --line-strong: #C6CAD8; --red: #A01D21; --on-red: #FFFFFF;
  background: #FBFAF6; color: var(--ink);
}
.sigfs:focus { outline: none; }
.sigfs-cv { position: absolute; left: 0; top: 0; display: block; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: crosshair; }
.sigfs-paper {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; display: flex; flex-direction: column; gap: 6px; box-sizing: border-box;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.sigfs.rot .sigfs-paper { padding: 12px max(16px, env(safe-area-inset-bottom, 0px)) 12px max(16px, env(safe-area-inset-top, 0px)); }
.sigfs-top { display: flex; flex-direction: column; gap: 2px; max-width: 64ch; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.sigfs-top b { font-size: 17px; color: var(--ink); }
.sigfs-area { flex: 1; position: relative; min-height: 0; }
.sigfs-line { position: absolute; left: 3%; right: 3%; bottom: 24%; border-bottom: 2px solid #A9AEC4; }
.sigfs-x { position: absolute; left: 2px; bottom: 6px; font-size: 34px; line-height: 1; font-weight: 300; color: var(--red); }
.sigfs-msg { min-height: 20px; text-align: center; font-size: 14px; font-weight: 600; color: #B3261E; }
.sigfs-bar { display: flex; align-items: center; gap: 10px; }
.sigfs-bar .btn { pointer-events: auto; touch-action: manipulation; }
.sigfs-turn { display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); align-items: center; gap: 8px; white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: rgba(27, 35, 80, .08); font-size: 14px; font-weight: 600; pointer-events: none; }
.sigfs-turn .icon { width: 22px; height: 22px; }
.sigfs.rot:not(.drawn) .sigfs-turn { display: inline-flex; }
.sig-done { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.sig-done img { height: 46px; width: auto; max-width: 140px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); }
.sig-done .icon { color: var(--profit); }
.sig-view { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sig-view img { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-m); }
.sig-view figcaption { font-size: 13px; color: var(--muted); }
.info-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.info-row > .icon { flex: none; color: var(--muted); }
/* гаранция */
.war-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; padding: 10px 12px; border-radius: var(--r-m); background: var(--profit-soft); color: var(--ink); font-size: 14px; border-left: 3px solid var(--profit); }
.war-box > .icon { flex: none; color: var(--profit); margin-top: 1px; }
.war-box b:first-child { color: var(--profit); }
.war-row { margin-top: 2px; }
.war-t { color: var(--profit); }
.war-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--profit); border-radius: var(--r-l); text-align: left; color: var(--ink); }
.war-item .grow { min-width: 0; display: flex; flex-direction: column; }
.war-item small { font-size: 12.5px; color: var(--muted); }
.war-ic { flex: none; color: var(--profit); display: grid; }
.war-until { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--muted); }
.war-until b { font-size: 14px; color: var(--profit); font-variant-numeric: tabular-nums; }
.section-head h2 > .icon { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: var(--red-ink); margin-right: 4px; }
/* справочник за колите */
.cn-mini { border: 1px solid var(--line); border-left: 3px solid var(--navy); border-radius: var(--r-m); background: var(--surface); }
.cn-mini-h { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; text-align: left; font-size: 13.5px; color: var(--ink-2); }
.cn-mini-h .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-mini-h b { color: var(--navy); }
.cn-mini-h[aria-expanded="true"] > .icon:last-child { transform: rotate(180deg); }
.cn-ic { flex: none; display: grid; color: var(--navy); }
.cn-mini-b { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cn-dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 14px; }
.cn-dl div { display: contents; }
.cn-dl dt { color: var(--muted); font-size: 13px; }
.cn-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cn-notes { margin: 6px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cn-add { align-self: flex-start; }
.cn-card { padding: 12px 14px; }
.cn-row .sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* каса */
.cash-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); text-align: left; color: var(--ink); font-size: 14px; }
.cash-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cash-row .t { overflow-wrap: anywhere; }
.cash-row small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.cash-row.is-pend { border-color: var(--warn); border-left: 3px solid var(--warn); }
.cash-row .tot { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.cash-row .tot b { font-size: 16px; }
.cash-row .tot span { font-size: 12px; color: var(--muted); }
.cash-row .due { color: var(--danger); }
.cash-acts { flex: none; display: flex; gap: 6px; }
.cash-ic { flex: none; width: 24px; display: grid; place-items: center; color: var(--muted); }
.cash-row.is-accepted .cash-ic { color: var(--profit); }
.cash-row.is-rejected .cash-ic { color: var(--danger); }
.cash-row.is-rejected .cash-amt, .cash-row.is-cancelled .cash-amt { text-decoration: line-through; color: var(--muted); }
.cash-row.is-cancelled { opacity: .7; }
.cash-amt { flex: none; font-variant-numeric: tabular-nums; }
.cash-row .iconbtn { width: 36px; height: 36px; }
.cash-row .iconbtn.armed { background: var(--danger-soft); color: var(--danger); }
.num { font-variant-numeric: tabular-nums; }
.cash-strip { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 8px 8px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: var(--r-l); }
.cash-strip-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 0; text-align: left; color: var(--ink); }
.cash-strip .grow { min-width: 0; display: flex; flex-direction: column; }
.cash-strip .k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cash-strip .v { font-size: 22px; font-weight: 700; line-height: 1.15; }
.cs-ic { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red-ink); }
.cash-pend { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 8px 8px 12px; border-radius: var(--r-m); background: var(--warn-soft); color: var(--ink); font-size: 13.5px; }
.cash-pend > .icon { color: var(--warn); flex: none; }
.cash-pend .grow { min-width: 0; }
.input.cash-in { font-size: 26px; font-weight: 700; min-height: 56px; }
.cash-sum { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.cash-sum div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.cash-sum div:last-child { border-bottom: 0; }
.cash-sum span { color: var(--ink-2); }
.cash-sum .tot { background: var(--red-soft); font-weight: 700; }
.cash-sum .tot b { color: var(--red-ink); font-size: 17px; }
.od-row { border-style: solid; border-color: var(--danger); background: var(--danger-soft); color: var(--ink); }
.od-row > .icon { color: var(--danger); }
.od-row small { color: var(--ink-2); }
/* къде е екипът: служителят вижда, че е включено */
.loc-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; padding: 10px 12px; border-radius: var(--r-m); background: var(--navy-soft); color: var(--ink); font-size: 14px; border-left: 3px solid var(--navy); }
.loc-ask > .icon { flex: none; color: var(--navy); }
.loc-ask .grow { flex: 1 1 220px; min-width: 0; }
.loc-ask-b { display: flex; gap: 6px; margin-left: auto; }
.loc-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; max-width: 100%; text-align: left; }
.loc-pill.on { color: var(--navy); border-color: var(--navy-soft); background: var(--navy-soft); }
.loc-pill.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); border-radius: var(--r-m); }
.plain-list { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.tm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 10px; }
.tm-head .right { flex: 1; }
.tm-map { position: relative; height: min(56vh, 520px); min-height: 280px; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; background: var(--surface-2); z-index: 0; }
.tm-off { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; color: var(--muted); }
.tm-off .icon { width: 40px; height: 40px; }
.tm-schema { height: 100%; overflow: auto; }
.tm-schema svg { display: block; width: 100%; height: 100%; }
.tm-list { margin-top: 12px; }
.tm-row { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); transition: box-shadow .3s; }
.tm-row.hl { box-shadow: 0 0 0 3px var(--teal); }
.tm-row.no-pt { opacity: .75; }
.tm-row-main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; border: 0; background: transparent; padding: 2px; text-align: left; color: var(--ink); }
.tm-row-main .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tm-row-main small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.tm-row-main small .icon { width: 13px; height: 13px; vertical-align: -2px; }
.tm-row.stale .tm-row-main > .grow > small:first-of-type { color: var(--warn); }
.tm-job { color: var(--navy) !important; font-weight: 600; }
.tm-acts { flex: none; display: flex; gap: 6px; }
.tm-acts .btn { padding: 0 10px; }
.tm-pin-wrap { background: transparent; border: 0; }
.tm-pin { --c: #5B6672; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font: 800 13px/1 var(--font); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.tm-pin.stale { opacity: .5; }
/* касови бележки в отчета */
/* фактури: платена / чака / просрочена, проформа */
.pay-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; padding: 12px 14px; border-radius: var(--r-m); background: var(--warn-soft); color: var(--ink); font-size: 14px; border-left: 4px solid var(--warn); }
.pay-box > .icon { flex: none; color: var(--warn); }
.pay-box .grow { flex: 1 1 220px; min-width: 0; }
.pay-box.is-paid { background: var(--profit-soft); border-left-color: var(--profit); }
.pay-box.is-paid > .icon { color: var(--profit); }
.pay-box.is-late { background: var(--danger-soft); border-left-color: var(--danger); }
.pay-box.is-late > .icon, .pay-box.is-late b { color: var(--danger); }
.pay-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-st { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }
.inv-st .chip { min-height: 22px; font-size: 12px; padding: 0 6px; }
.inv-row.is-pf { border-style: dashed; }
.inv-row-wrap { display: flex; flex-direction: column; align-items: stretch; }
.inv-row-wrap .inv-row { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.inv-paid-q { align-self: stretch; border-top-left-radius: 0; border-top-right-radius: 0; justify-content: center; }
.inv-view, .iv-kind { margin-bottom: 4px; }
.kpi-bad .v { color: var(--danger); }
.menu .menu-note { margin-left: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.bk-list { margin-top: 8px; }
.bk-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.bk-row .grow { min-width: 0; display: flex; flex-direction: column; }
.bk-row small { font-size: 12.5px; color: var(--muted); }
.tl-hours { margin-top: 10px; }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { flex: 1 0 auto; min-width: 52px; }
@media (max-width: 420px) {
  .cash-row.is-pend { flex-wrap: wrap; }
  .cash-row.is-pend .cash-acts { width: 100%; justify-content: flex-end; }
  .tm-acts .btn { padding: 0 8px; }
}
/* картата от плочки (tilemap.js) */
.tmap { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; background: var(--surface-3); }
.tmap:active { cursor: grabbing; }
.tmap-tiles, .tmap-marks { position: absolute; inset: 0; }
.tmap-tiles img { position: absolute; left: 0; top: 0; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.tmap-marks { pointer-events: none; }
.tmap-mark { position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; border: 0; background: none; pointer-events: auto; cursor: pointer; }
.tmap-mark .tm-pin { position: absolute; left: -19px; top: -19px; }
.tmap-acc { position: absolute; left: 0; top: 0; border-radius: 50%; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); pointer-events: none; }
.tmap-zoom { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 1px; background: var(--line-strong); border-radius: var(--r-m); overflow: hidden; box-shadow: var(--shadow-1); z-index: 2; }
.tmap-zoom button { width: 40px; height: 40px; border: 0; background: var(--surface); color: var(--ink); font-size: 22px; font-weight: 700; line-height: 1; }
.tmap-attr { position: absolute; right: 0; bottom: 0; padding: 2px 6px; background: rgba(255, 255, 255, .85); color: #333; font-size: 11px; z-index: 2; }
.tmap-attr a { color: #283670; }
/* иконки в текст (не в flex ред) */
.tm-row-main small .icon, .sig-done .grow .icon, .cash-row small .icon, .war-row .icon, .od-row small .icon { display: inline-block; vertical-align: -3px; }
#set-loc, #set-backup { scroll-margin-top: calc(var(--top-h) + 14px); }
.textarea-s { min-height: 64px; }

/* ---------- 1.4.1: много лога на марките наведнъж ---------- */
.br-multi-box { margin: 10px 0; display: flex; gap: 10px; align-items: flex-start; }
.br-multi-box > .icon { flex: none; margin-top: 2px; color: var(--navy); }
.br-multi-box code { font-size: 12.5px; }
.br-multi-row { align-items: center; margin-bottom: 12px; }
.bl-list { display: flex; flex-direction: column; gap: 8px; }
.bl-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-areas: "th nm" "sel sel"; gap: 6px 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
.bl-row .bl-th { grid-area: th; }
.bl-row .grow { grid-area: nm; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bl-row .bl-sel { grid-area: sel; min-height: 42px; }
/* шахматен фон — да се вижда и бяло лого на прозрачен фон */
.bl-th { width: 48px; height: 48px; border-radius: 10px; background: repeating-conic-gradient(#E4E4E4 0% 25%, #FFFFFF 0% 50%) 50% / 12px 12px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.bl-th img { width: 100%; height: 100%; object-fit: contain; padding: 4px; box-sizing: border-box; }
.bl-nm { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-row small { color: var(--muted); font-size: 12.5px; }
.bl-row.is-skip { background: var(--surface-2); }
.bl-row.is-skip .bl-nm { color: var(--muted); }
.bl-row.is-done { border-color: var(--profit); background: var(--profit-soft); }
.bl-row.is-done small { color: var(--profit); font-weight: 600; }
.bl-row.is-err { border-color: var(--danger); background: var(--danger-soft); }
.bl-row.is-err small { color: var(--danger); font-weight: 600; }
@media (min-width: 640px) {
  .bl-row { grid-template-columns: 48px minmax(0, 1fr) 220px; grid-template-areas: "th nm sel"; }
}

/* ---------- задача стъпка по стъпка ---------- */
.wz { display: flex; flex-direction: column; gap: 8px; }
.wz-step { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
.wz-step.open { border-color: var(--line-strong); box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.wz-head { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px; background: none; border: 0; border-radius: var(--r-l); text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.wz-n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font-weight: 800; font-size: 14px; }
.wz-n .icon { display: none; }
.wz-step.open .wz-n { background: var(--red); color: var(--on-red); }
.wz-step.done .wz-n { background: var(--profit); color: #fff; }
.wz-step.done .wz-n b { display: none; }
.wz-step.done .wz-n .icon { display: block; }
.wz-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wz-t { font-weight: 800; font-size: 16px; line-height: 1.25; }
.wz-sum { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wz-sum:empty { display: none; }
.wz-step.open .wz-sum { display: none; }
.wz-opt { color: var(--muted); }
.wz-need { color: var(--warn); font-weight: 700; }
.wz-tag { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--profit-soft); color: var(--profit); font-size: 11.5px; font-weight: 700; vertical-align: 1px; }
.wz-chev { flex: none; color: var(--muted); display: grid; place-items: center; transition: transform .18s ease; }
.wz-step.open .wz-chev { transform: rotate(180deg); }
.wz-body { display: none; padding: 2px 14px 16px; flex-direction: column; gap: 14px; }
.wz-step.open .wz-body { display: flex; animation: wz-in .18s ease-out; }
.wz-body > * { flex-shrink: 0; }
@keyframes wz-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wz-step.open .wz-body { animation: none; } .wz-chev { transition: none; } }
.wz-tip { margin: -4px 0 0; }
.job-chips button { min-height: 40px; }
.job-chips button[aria-pressed="true"] { background: var(--red-soft); border-color: var(--red); color: var(--red-ink); font-weight: 700; }
.sheet-foot .wz-back { flex: 0 0 auto; }
.wz-of { font-weight: 600; opacity: .75; margin-left: 2px; }
/* услуга, която иска документ от клиента */
.doc-hint { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); background: var(--navy-soft); border-radius: var(--r-m); padding: 8px 10px; }
.doc-hint > .icon { flex: none; margin-top: 2px; color: var(--navy); }
.pill-doc { background: var(--navy-soft); color: var(--navy); display: inline-flex; align-items: center; gap: 4px; }
.pill-doc .icon { width: 14px; height: 14px; }
.callout-doc, .callout-job { display: flex; gap: 10px; align-items: flex-start; }
.callout-doc > .icon, .callout-job > .icon { flex: none; margin-top: 2px; color: var(--navy); }
.switch .t .icon { display: inline-block; vertical-align: -2px; margin-right: 2px; }
/* иконка до надписа на поле — на същия ред */
.field > span > .icon { display: inline-block; vertical-align: -2px; margin-right: 4px; }
.known .num { white-space: nowrap; }
.line-prop .icon { display: inline-block; vertical-align: -2px; margin-right: 4px; }

/* завършване на задача: кратко какво е задачата */
.fin-sum { border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: var(--r-l); background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.fin-k { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); display: flex; align-items: center; gap: 6px; }
.fin-k .icon { width: 14px; height: 14px; }
.fin-t { font-weight: 800; font-size: 17px; line-height: 1.3; }
.fin-r { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink-2); min-width: 0; }
.fin-r > span { min-width: 0; overflow-wrap: anywhere; }
.fin-r > .icon, .fin-r > .brand-b { flex: none; }
.fin-edit { align-self: flex-start; margin-top: 2px; padding-left: 0; }
.fin-h { display: flex; flex-direction: column; gap: 2px; }
.fin-h h3 { margin: 0; font-size: 17px; font-weight: 800; }
/* работната карта на стъпки */
.k-clfields { display: flex; flex-direction: column; gap: 12px; }
.wz-clear { align-self: flex-start; }
.wz-body .own-box { border: 0; padding: 0; }
.wz-body .own-box > .fieldset-head { display: none; }
.wz-body .own-box > p.hint { margin-top: 0 !important; }
/* превключвател: обяснението според това дали е включен */
.switch input:checked ~ span .when-off, .switch input:not(:checked) ~ span .when-on { display: none; }
.known-s { padding-block: 8px; }

/* ---------- задача в списъка: накратко ---------- */
.jc { gap: 6px; padding: 12px 12px 12px 14px; }
.jc-top { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.jc-dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--line-strong); }
.jc-new .jc-dot { background: var(--navy); }
.jc-open .jc-dot { background: var(--teal-strong); }
.jc-accepted .jc-dot { background: var(--profit); }
.jc-done .jc-dot { background: var(--muted); }
.jc-cancelled .jc-dot { background: var(--line-strong); }
.jc-st { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: var(--ink-2); line-height: 1.4; }
.jc-urg { color: var(--red); text-transform: uppercase; letter-spacing: .04em; }
.jc-when { flex: none; font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.5; }
.js-top .jc-st { font-size: 14.5px; }
.jc-t { font-weight: 800; font-size: 16.5px; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.jc-l { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); min-width: 0; }
.jc-l > .icon { flex: none; color: var(--muted); }
.jc-l > .brand-b { flex: none; }
.jc-l > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jc-doc { color: var(--navy); font-weight: 600; }
.jc-doc > .icon { color: var(--navy); }
.jc-acts { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.jc-acts .btn { min-width: 132px; }
.jc-ib { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); display: grid; place-items: center; color: var(--ink); }
.job.jc-open { border-left-color: var(--teal); }
.job.jc-accepted { border-left-color: var(--profit); }
.job.jc-new { border-left-color: var(--navy); }
.job.jc.is-urgent { border-left-color: var(--red); }
.jc-when.soon { color: var(--red); }

/* ---------- снимките на екипа: снимката вместо инициалите ---------- */
.av { position: relative; overflow: hidden; }
.av > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; transform: scale(1.22); transform-origin: 50% 30%; }
.av.has-ph { color: transparent; background: var(--surface-3); box-shadow: none; }
.av.has-ph::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--c); pointer-events: none; }
.av-s.has-ph::after { box-shadow: inset 0 0 0 1.5px var(--c); }
.av-l.has-ph::after { box-shadow: inset 0 0 0 2.5px var(--c); }
.av-xl { width: 76px; height: 76px; font-size: 22px; box-shadow: inset 0 0 0 6px var(--c); }
.av-xl > img { transform: none; }
.av-xl.has-ph::after { box-shadow: inset 0 0 0 3px var(--c); }
.topbar .av.has-ph { color: transparent; background: var(--surface-3); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.tm-pin.has-ph { position: relative; overflow: hidden; color: transparent; background: #fff; }
.tm-pin > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.22); transform-origin: 50% 30%; }
.tm-pin.has-ph::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--c); }
.linkbtn { border: 0; padding: 0; background: none; color: var(--navy); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.prof-me { gap: 14px; margin-bottom: 16px; align-items: center; }
.prof-ph { font-size: 13px; color: var(--muted); margin-top: 4px; }
.ph-me { position: relative; border: 0; padding: 0; background: none; border-radius: 50%; flex: none; cursor: pointer; }
.ph-me-cam { position: absolute; right: -3px; bottom: -3px; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; border: 2px solid var(--surface); }
.ph-me-cam .icon { width: 16px; height: 16px; }
.pend-me { display: flex; justify-content: center; }
.u-photo { display: flex; gap: 14px; align-items: center; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.u-photo .grow { display: flex; flex-direction: column; gap: 8px; }
.u-ph-t { font-weight: 700; font-size: 14px; }
.btn.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.ai-steps { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.ai-steps a { color: var(--navy); font-weight: 700; }
.ai-st { display: flex; gap: 8px; align-items: center; }
.ai-st .icon { flex: none; color: var(--profit); }

/* ---------- снимка за профила: инструкции, камера, преглед, обработка ---------- */
.ph-page { min-height: 100vh; background: var(--surface); color: var(--ink); }
.ph-in { max-width: 460px; margin: 0 auto; padding-block: 12px 32px; display: flex; flex-direction: column; gap: 14px; }
.ph-mid { text-align: center; padding-top: 28px; }
.ph-top { display: flex; align-items: center; min-height: 44px; margin-left: -8px; }
.ph-logo .logo-hero { width: 78px; margin: 0 0 0 8px; }
.ph-in h1 { font-size: 23px; font-weight: 800; line-height: 1.25; }
.ph-lead { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.ph-art { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 2px; }
.ph-art figure { margin: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.ph-art svg { display: block; width: 100%; height: auto; border-radius: var(--r-l); background: var(--surface-2); border: 1px solid var(--line); }
.ph-art figcaption { font-size: 12.5px; font-weight: 700; line-height: 1.3; text-align: center; }
.ph-art .ok svg { border-color: var(--profit); background: var(--profit-soft); }
.ph-art .ok figcaption { color: var(--profit); }
.ph-art .no figcaption { color: var(--danger); }
.ph-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ph-tips li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.ph-tips b { display: block; font-size: 15px; color: var(--ink); margin-bottom: 1px; }
.ph-tips .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--navy-soft); color: var(--navy); font-weight: 800; font-size: 13px; display: grid; place-items: center; margin-top: 1px; }
.ph-tips .key { background: var(--red-soft); border-radius: var(--r-l); padding: 12px; color: var(--ink-2); }
.ph-tips .key b { color: var(--red-ink); font-size: 16px; }
.ph-tips .key .n { background: var(--red); color: #fff; }
.ph-acts { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ph-note .icon { width: 14px; height: 14px; vertical-align: -2px; }
.ph-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.ph-check li { display: flex; gap: 8px; align-items: flex-start; }
.ph-check .icon { flex: none; width: 18px; height: 18px; color: var(--profit); margin-top: 1px; }
.ph-review { position: relative; align-self: center; width: min(100%, 320px); margin-bottom: 10px; }
.ph-big { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-l); box-shadow: var(--shadow-1); background: var(--surface-3); }
.ph-mini { position: absolute; right: -8px; bottom: -14px; width: 74px; height: 74px; border-radius: 50%; overflow: hidden; border: 4px solid var(--surface); box-shadow: 0 4px 14px rgba(0, 0, 0, .2); background: var(--surface-3); }
.ph-mini img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.22); transform-origin: 50% 30%; }
.ph-busy-pic { position: relative; width: min(68vw, 250px); aspect-ratio: 1; margin: 0 auto 6px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 6px var(--navy-soft); background: var(--surface-3); }
.ph-busy-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph-scan { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(40, 54, 112, 0) 30%, rgba(40, 54, 112, .5) 50%, rgba(40, 54, 112, 0) 70%); background-size: 100% 250%; animation: phScan 1.8s ease-in-out infinite; }
@keyframes phScan { from { background-position: 0 100%; } to { background-position: 0 0; } }
.ph-bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; width: min(100%, 280px); margin: 6px auto 0; }
.ph-bar span { display: block; width: 40%; height: 100%; border-radius: 6px; background: var(--navy); animation: phBar 1.4s ease-in-out infinite; }
@keyframes phBar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.ph-done-pic { width: min(76vw, 300px); aspect-ratio: 1; margin: 0 auto 4px; border-radius: var(--r-l); overflow: hidden; box-shadow: var(--shadow-1); background: var(--surface-3); }
.ph-done-pic.is-done { box-shadow: 0 0 0 4px var(--navy), var(--shadow-1); }
.ph-done-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph-done-av { display: flex; gap: 10px; align-items: center; justify-content: center; text-align: left; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-l); align-self: center; }
.ph-done-av small { display: block; font-size: 12.5px; color: var(--muted); }
/* камерата: видеото на целия екран, квадратът е точно снимката */
.ph-cam { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; overflow: hidden; }
.ph-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.ph-cam-wait { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 15px; opacity: .85; }
.ph-cam-wait .icon { width: 34px; height: 34px; }
.ph-frame { --s: min(calc(100vw - 32px), calc(100vh - 280px), 460px); position: absolute; left: 50%; top: calc(50% - var(--s) / 2 - 6px); width: var(--s); height: var(--s); margin-left: calc(var(--s) / -2); border-radius: 22px; border: 2px solid rgba(255, 255, 255, .55); box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .55); pointer-events: none; }
.ph-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph-cam-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top, 0px) + 20px) var(--gutter-r) 0 var(--gutter-l); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.ph-cam-top b { font-size: 22px; font-weight: 800; }
.ph-cam-top span { font-size: 15px; opacity: .95; }
.ph-cam-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter-r) calc(env(safe-area-inset-bottom, 0px) + 28px) var(--gutter-l); display: flex; align-items: center; justify-content: space-between; }
.ph-shutter { width: 80px; height: 80px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .92); padding: 4px; background: #fff; background-clip: content-box; cursor: pointer; }
.ph-shutter:active { transform: scale(.95); }
.ph-shutter:disabled { opacity: .4; }
.ph-cam-x { width: 54px; height: 54px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .18); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ph-cam-sp { width: 54px; }
.ph-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .3s; }
.ph-flash.on { opacity: .85; transition: none; }
@media (prefers-reduced-motion: reduce) { .ph-scan, .ph-bar span { animation: none; } }
/* дълъг текст в предупреждението стои до иконката, не под нея */
.callout-warn > .icon + .grow { flex: 1 1 0; }

/* ---- фактура / кредитно известие: винаги като бял лист (и в тъмния режим), годна за печат на A4 */
.inv-doc { position: relative; box-sizing: border-box; max-width: 820px; margin: 0 auto; padding: 26px 26px 22px; background: #fff; color: #1d1d1d;
  font: 13px/1.45 "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; border: 1px solid #d9d9d9; border-radius: 4px; overflow: hidden; }
.inv-doc b { font-weight: 700; }
.inv-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding-bottom: 12px; border-bottom: 3px solid #A01D21; }
.inv-title { font-size: 24px; font-weight: 800; letter-spacing: .04em; color: #A01D21; line-height: 1.1; }
.inv-orig { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6e6e6e; }
.inv-meta { text-align: right; font-size: 12.5px; }
.inv-no { font-size: 17px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.inv-ref { margin-top: 12px; padding: 8px 10px; background: #fbebeb; border-radius: 3px; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.inv-party { padding: 10px 12px; border: 1px solid #e1e1e1; border-radius: 3px; min-width: 0; overflow-wrap: anywhere; }
.inv-k { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6e6e6e; margin-bottom: 3px; }
.inv-name { font-size: 15px; font-weight: 800; margin-bottom: 2px; }
.inv-tbl { width: 100%; border-collapse: collapse; margin-top: 4px; }
.inv-tbl th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #444; text-align: left; background: #f3f3f3; border-bottom: 1px solid #cbcbcb; padding: 7px 6px; }
.inv-tbl td { padding: 7px 6px; border-bottom: 1px solid #e6e6e6; vertical-align: top; overflow-wrap: anywhere; }
.inv-tbl .n, .inv-tot .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-tbl .c { text-align: center; white-space: nowrap; }
.inv-sum { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin: 12px 0 10px; }
.inv-words { flex: 1; min-width: 0; padding-top: 4px; font-weight: 600; }
.inv-tot { border-collapse: collapse; min-width: 250px; }
.inv-tot td { padding: 4px 6px; }
.inv-tot .inv-grand td { border-top: 2px solid #1d1d1d; font-size: 16px; font-weight: 800; padding-top: 7px; }
.inv-line { margin: 5px 0; }
.inv-annul { color: #B3261E; font-weight: 700; }
.inv-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; padding-top: 10px; border-top: 1px solid #e1e1e1; }
.inv-sign { display: block; height: 22px; border-bottom: 1px dotted #999; max-width: 220px; }
.inv-note { margin-top: 12px; font-size: 12px; color: #6e6e6e; text-align: center; }
.inv-stamp { position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 64px; font-weight: 800; letter-spacing: .12em;
  color: rgba(179, 38, 30, .16); border: 6px solid rgba(179, 38, 30, .16); padding: 4px 22px; border-radius: 8px; pointer-events: none; white-space: nowrap; }
.inv-stamp-demo { color: rgba(40, 54, 112, .12); border-color: rgba(40, 54, 112, .12); }
@media (max-width: 560px) {
  .inv-doc { padding: 16px 12px 14px; font-size: 12.5px; }
  .inv-top { flex-direction: column; gap: 8px; }
  .inv-meta { text-align: left; }
  .inv-parties, .inv-foot { grid-template-columns: 1fr; gap: 8px; }
  .inv-sum { flex-direction: column-reverse; gap: 8px; }
  .inv-tot { width: 100%; min-width: 0; }
  /* тесен екран: колоните се побират (мярката се вижда при печат) */
  .inv-tbl { table-layout: fixed; }
  .inv-tbl th:nth-child(3), .inv-tbl td:nth-child(3) { display: none; }
  .inv-tbl th:nth-child(1) { width: 20px; }
  .inv-tbl th:nth-child(4) { width: 34px; }
  .inv-tbl th:nth-child(5) { width: 62px; }
  .inv-tbl th:nth-child(6) { width: 70px; }
  .inv-tbl th { font-size: 9.5px; letter-spacing: .02em; white-space: normal; line-height: 1.25; vertical-align: bottom; }
  .inv-tbl th, .inv-tbl td { padding: 6px 3px; }
  .inv-tbl td.n, .inv-tbl th.n, .inv-tbl th.c { white-space: normal; }
  .inv-stamp { font-size: 40px; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  .inv-doc { border: 0; border-radius: 0; max-width: none; padding: 0; font-size: 12px; }
  .inv-parties { grid-template-columns: 1fr 1fr !important; }
  .inv-tbl tr { break-inside: avoid; }
  .inv-tbl { table-layout: auto !important; }
  .inv-tbl th, .inv-tbl td { display: table-cell !important; width: auto !important; }
  .inv-tbl th { font-size: 10px !important; }
  .inv-tbl td { font-size: 12px !important; }
  .inv-top { flex-direction: row !important; }
  .inv-meta { text-align: right !important; }
  .inv-sum { flex-direction: row !important; }
  .inv-foot { grid-template-columns: 1fr 1fr !important; }
}
