/* Archiva — светла тема, телефон и компютър */
:root {
  --bg: #F4F6F8; --surface: #FFFFFF; --soft: #F7F9FB; --line: #DDE2E6; --line-strong: #C9D1D8;
  --text: #16202A; --muted: #55606B; --primary: #0B5CAD; --primary-strong: #0B4F94; --primary-weak: #E7F0FA;
  --amber: #8A5300; --amber-bg: #FFF2DC; --green: #1E6B34; --green-bg: #E6F4EA; --red: #A4271F; --red-bg: #FDECEA;
  --slate: #3F4B57; --slate-bg: #ECEFF2; --blue-bg: #E7F0FA; --yellow: #FFF6CC; --yellow-line: #EAD68A;
  --radius: .625rem; --gap: 1rem; --nav-w: 15.5rem; --rail-w: 3.75rem; --facets-w: 16.5rem; --top-h: 3.5rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
/* Компютър: по-плътно (като 75–90% в браузъра); на екрани с увеличение (лаптопи) — по-малко. Изборът е под инициалите. */
@media (min-width: 821px) { html { font-size: 14px; } }
@media (min-width: 821px) and (min-resolution: 1.2dppx) { html { font-size: 12.5px; } }
@media (min-width: 821px) {
  html.ui-s { font-size: 12.5px; }
  html.ui-m { font-size: 14.5px; }
  html.ui-l { font-size: 16px; }
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: .9375rem/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--primary); }
a:hover { color: var(--primary-strong); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #7FB0E6; outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { width: 1.125rem; height: 1.125rem; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: .875rem; }
.danger { color: var(--red); }

/* ---------------------------------------------------------------- горна лента */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .625rem; height: var(--top-h);
  padding: 0 max(.75rem, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--line);
}
/* менюто и логото — колкото е широко страничното меню: превключвателят започва от линията му */
.top-l { display: flex; align-items: center; gap: .625rem; flex: none; width: calc(var(--nav-w) - max(.75rem, env(safe-area-inset-left)) - .625rem); }
.brand { display: inline-flex; align-items: center; gap: .4375rem; flex: none; text-decoration: none; }
.brand img { display: block; width: auto; }
.brand-mark { height: 1.875rem; }
.brand-word { height: 1.1875rem; }
.org { color: var(--muted); font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 12rem; }
.env { background: var(--amber-bg); color: var(--amber); border: 1px solid #F0C98A; border-radius: 62.4375rem; padding: 1px .625rem; font-size: .75rem; font-weight: 700; }
.spacer { flex: 1; }
.gsearch { position: relative; flex: 0 1 26rem; margin-left: 1rem; }
.gsearch .ic { position: absolute; left: .625rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 1rem; height: 1rem; }
.gsearch input { width: 100%; height: 2.25rem; padding: 0 .75rem 0 2rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--soft); }
.gsearch input:focus { background: #fff; border-color: var(--primary); }
.icon-btn.gsearch-btn { display: none; }
.big-search { display: flex; gap: .5rem; margin-bottom: .75rem; max-width: 46rem; }
.big-search .search-w { max-width: none; flex: 1; }
.big-search input { height: 2.75rem; font-size: 1.0625rem; }
.user {
  width: 2.125rem; height: 2.125rem; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 600; font-size: .8125rem; flex: none; border: 0; cursor: pointer; padding: 0;
}
.user:hover { background: var(--primary-strong); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: .5rem;
  border: 0; background: transparent; cursor: pointer; color: var(--slate); flex: none;
}
.icon-btn:hover { background: var(--slate-bg); }
.icon-btn .ic { width: 1.375rem; height: 1.375rem; }
.icon-btn.sm { width: 1.75rem; height: 1.75rem; }
.icon-btn.sm .ic { width: .9375rem; height: .9375rem; }

/* ---------------------------------------------------------------- рамка: меню + съдържание */
.shell { min-height: calc(100vh - var(--top-h)); }
.nav {
  position: fixed; top: var(--top-h); left: 0; bottom: 0; width: var(--nav-w); z-index: 20; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; background: var(--surface); border-right: 1px solid var(--line); padding: .625rem .5rem .75rem;
  display: flex; flex-direction: column; gap: .375rem;
}
.shell.collapsed .nav { width: var(--rail-w); }
main { margin-left: var(--nav-w); }
.shell.collapsed main { margin-left: var(--rail-w); }
.shell.facets-on main { margin-left: calc(var(--rail-w) + var(--facets-w)); }
/* умните филтри — на мястото на менюто: излизат изпод иконите */
.facets-dock {
  position: fixed; top: var(--top-h); bottom: 0; left: var(--rail-w); width: var(--facets-w); z-index: 15;
  background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain;
  padding: .75rem .625rem 1rem; transform: translateX(-100%); visibility: hidden;
  transition: transform .26s var(--ease), visibility 0s linear .26s;
}
.shell.facets-on .facets-dock { transform: none; visibility: visible; transition: transform .26s var(--ease), visibility 0s; }
.facets-inline { display: none; }
.nv {
  display: flex; align-items: center; gap: .625rem; min-height: 2.375rem; padding: .375rem .625rem .375rem .8125rem; border-radius: .5rem;
  color: var(--text); text-decoration: none; font-size: .9062rem; min-width: 0; white-space: nowrap;
}
.nv:hover { background: var(--soft); color: var(--text); }
.nv.on { background: var(--primary-weak); color: var(--primary-strong); font-weight: 600; }
.nv .ic { color: var(--muted); }
.nv.on .ic { color: var(--primary); }
.nv-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-count { font-size: .75rem; color: var(--muted); font-weight: 600; min-width: 1.25rem; text-align: right; }
.nv-count.strong { background: var(--primary); color: #fff; border-radius: 62.4375rem; padding: 1px .5rem; min-width: 0; }
.nv-main { display: flex; flex-direction: column; gap: 2px; padding-bottom: .375rem; border-bottom: 1px solid var(--line); }
.nv-sec { display: flex; flex-direction: column; gap: 1px; padding: .375rem 0; border-bottom: 1px solid #EEF1F3; }
.nv-sec-title { display: flex; align-items: center; justify-content: space-between; padding: 2px .25rem .25rem .625rem; font-size: .75rem; font-weight: 650;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.nv-add { border: 0; background: none; width: 1.625rem; height: 1.625rem; border-radius: .375rem; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.nv-add:hover { background: var(--slate-bg); color: var(--primary); }
/* секцията се свива с клик върху заглавието; в свитото меню (иконки) редовете ѝ пак се виждат */
.nv-sec-tog { display: inline-flex; align-items: center; gap: .25rem; border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.nv-sec-tog:hover { color: var(--text); }
.nv-sec-tog .ic { width: .875rem; height: .875rem; }
.shell:not(.collapsed) .nv-sec.closed > :not(.nv-sec-title) { display: none; }
/* скриване на ред: окото е при посочване (само с мишка); скритите — под „Още N“ в края на секцията */
.nv-h { position: relative; }
.nv-eye { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); display: none; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border: 0; border-radius: .375rem; background: var(--surface); color: var(--muted); cursor: pointer; }
.nv-eye:hover { background: var(--slate-bg); color: var(--primary); }
.nv-eye .ic { width: 1rem; height: 1rem; }
@media (hover: hover) { .nv-h:hover > .nv-eye, .nv-h:focus-within > .nv-eye { display: inline-flex; } }
.nv-hidden .nv:not(.on) { color: var(--muted); }
.nv-more { border: 0; background: none; width: 100%; font: inherit; font-size: .8438rem; cursor: pointer; text-align: left; color: var(--muted); }
.nv-more .ic { color: var(--muted); }
.nv-add .ic { width: 1rem; height: 1rem; }
.nv-empty { color: var(--muted); font-size: .8125rem; margin: 2px .625rem .25rem; }
.nv-system { margin-top: 2px; }
.nv-system .nv { font-size: .875rem; }
.tree-row { display: flex; align-items: center; min-width: 0; }
.tree-row .nv { flex: 1; padding-left: .25rem; }
.tree-row[data-depth="1"] { padding-left: .875rem; }
.tree-row[data-depth="2"] { padding-left: 1.75rem; }
.tree-row[data-depth="3"], .tree-row[data-depth="4"] { padding-left: 2.625rem; }
.tw, .tw-sp { width: 1.375rem; height: 1.875rem; flex: none; }
.tw { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; border-radius: .375rem; }
.tw:hover { background: var(--slate-bg); }
.tw .ic { width: .9375rem; height: .9375rem; }
.team-ini { display: none; }
.team.not-member .nv-label { color: var(--muted); font-style: italic; }
.nv-group { border: 0; background: none; width: 100%; font: inherit; cursor: pointer; text-align: left; }
.nv-chev { display: inline-flex; color: var(--muted); }
.nv-chev .ic { width: .9375rem; height: .9375rem; }
.nv-sub { display: flex; flex-direction: column; gap: 1px; padding-left: 1.375rem; }
.nv-sub .nv { font-size: .875rem; min-height: 2.125rem; }
.nv-collapse {
  margin-top: auto; display: flex; align-items: center; gap: .625rem; border: 0; background: none; color: var(--muted);
  padding: .5rem .625rem .5rem .8125rem; border-radius: .5rem; cursor: pointer; font-size: .8438rem; text-align: left; white-space: nowrap;
}
.nv-collapse:hover { background: var(--soft); }
.nav-backdrop { display: none; }

/* свито меню — само иконите: еднакви квадрати в колона по средата. Лентата за превъртане (на Windows ~15px) е скрита —
   иначе изяжда от тясната колона и всичко се разминава; превърта се с колелцето, както досега */
@media (min-width: 821px) {
  .shell.collapsed .nav { padding: .625rem 0; align-items: center; scrollbar-width: none; }
  .shell.collapsed .nav::-webkit-scrollbar { display: none; }
  .shell.collapsed .nv-label, .shell.collapsed .nv-sec-title, .shell.collapsed .nv-empty, .shell.collapsed .tree,
  .shell.collapsed .tw, .shell.collapsed .tw-sp, .shell.collapsed .nv-system, .shell.collapsed .nv-chev { display: none; }
  .shell.collapsed .nv-main, .shell.collapsed .nv-sec, .shell.collapsed .nv-sub { align-items: center; }
  .shell.collapsed .nv-sec { padding: .25rem 0; }
  .shell.collapsed .rail-off { display: none !important; }
  .shell.collapsed .nv-sec:not(:has(> .nv:not(.rail-off), > .team, > .nv-grp, > .nv-h, > .nv-hidden:not(.rail-off))) { display: none; }   /* празна в свито меню — без двойна линия */
  .shell.collapsed .nv-hidden { display: flex; flex-direction: column; align-items: center; }
  .shell.collapsed .nv-eye { display: none !important; }
  .shell.collapsed .nv-sub { padding-left: 0; }
  .shell.collapsed .tree-row { padding-left: 0; }
  .shell.collapsed .nv, .shell.collapsed .tree-row .nv {
    flex: none; width: 2.5rem; height: 2.5rem; min-height: 0; padding: 0; justify-content: center; gap: 0; position: relative;
  }
  .shell.collapsed .nv-count { position: absolute; top: -.1875rem; right: -.3125rem; font-size: .625rem; padding: 0 .3125rem; }
  .shell.collapsed .nv-count:not(.strong) { display: none; }
  .shell.collapsed .nv-dot { position: absolute; top: .375rem; right: .375rem; }
  .shell.collapsed .team-ini { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem;
    border-radius: .375rem; background: var(--slate-bg); color: var(--slate); font-size: .6875rem; font-weight: 700; }
  .shell.collapsed .nv.on .team-ini { background: var(--primary); color: #fff; }
  .shell.collapsed .nv-start { padding: .25rem 0 .375rem; }
  .shell.collapsed .nv-new { width: 2.5rem; height: 2.5rem; padding: 0; justify-content: center; }
  .shell.collapsed .nv-new .nv-label { display: none; }
  .shell.collapsed .nv-collapse { width: 2.5rem; height: 2.5rem; padding: 0; justify-content: center; flex: none; }
  .top-l #nav-toggle { margin-left: -.125rem; }   /* ☰ точно над колоната на свитото меню (центърът ѝ е на 1.875rem) */
}

main { min-width: 0; padding: 1.125rem 1.25rem 6rem; outline: none; }
.loading { color: var(--muted); padding: 1.5rem 0; }
h1 { font-size: 1.5rem; margin: 0; font-weight: 650; overflow-wrap: anywhere; }
h2 { font-size: 1.0625rem; margin: 0 0 .625rem; font-weight: 650; }
.sub { color: var(--muted); margin: 2px 0 0; font-size: .875rem; }

/* ---------------------------------------------------------------- бутони */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4375rem; min-height: 2.375rem; padding: .4375rem .875rem;
  border: 1px solid var(--line-strong); border-radius: .5rem; background: var(--surface); color: var(--text);
  font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap; font-size: .9062rem;
}
.btn:hover { border-color: var(--primary); color: var(--primary-strong); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-strong); color: #fff; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ok:hover { background: #17582A; color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.btn .ic { width: 1rem; height: 1rem; }
.btn.icon { padding: .4375rem .5625rem; }
/* „Обработи отново с AI“ — лупа с вълшебни звездички */
.btn.magic .ic-magic { width: 1.375rem; height: 1.375rem; color: var(--slate); overflow: visible; }
.btn.magic .spark { transform-box: fill-box; transform-origin: center; }
.btn.magic .s1 { color: #7C4DFF; }
.btn.magic .s2 { color: #F5A623; }
.btn.magic .s3 { color: #7C4DFF; opacity: .8; }
.btn.magic:hover { border-color: #7C4DFF; background: #F5F1FF; }
.btn.magic:hover .lens { color: #5B33D6; }
.btn.magic:hover .spark, .btn.magic:focus-visible .spark { animation: twinkle .9s ease-in-out infinite; }
.btn.magic:hover .s2 { animation-delay: .25s; }
.btn.magic:hover .s3 { animation-delay: .5s; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.55) rotate(45deg); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .btn.magic .spark { animation: none !important; } }
.btn.ghost { opacity: .35; pointer-events: none; }
.btn[aria-pressed="true"] { background: var(--primary-weak); border-color: var(--primary); color: var(--primary-strong); }
.phone-only, .phone-inline { display: none !important; }
.facet-empty { color: var(--muted); font-size: .8125rem; margin: .375rem .25rem 2px; }

/* ---------------------------------------------------------------- списък: глава и инструменти */
.lv { position: relative; }
.lv-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.lv-title { min-width: 0; }
.lv-acts { display: flex; flex-wrap: wrap; gap: .5rem; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; font-size: .8438rem; color: var(--muted); margin-bottom: 2px; }
.crumbs a { text-decoration: none; }
.crumbs .sep { color: var(--line-strong); }
.lv-row { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem; margin-bottom: .75rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: .5rem; overflow: hidden; background: var(--surface); }
.seg > a, .seg > button { border: 0; background: none; padding: .4375rem .875rem; font-size: .875rem; color: var(--text); text-decoration: none; cursor: pointer; font-weight: 550; }
.seg > * + * { border-left: 1px solid var(--line-strong); }
.seg > .on { background: var(--primary); color: #fff; }
.subfolders { display: flex; flex-wrap: wrap; gap: .5rem; }
.sf { display: inline-flex; align-items: center; gap: .375rem; padding: .375rem .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem;
  text-decoration: none; color: var(--text); font-size: .875rem; }
.sf:hover { border-color: var(--primary); }
.sf .ic { color: #C28A1E; width: 1rem; height: 1rem; }
.lv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.search-l { font-size: .875rem; color: var(--muted); }
.search-w { position: relative; flex: 1 1 16.25rem; max-width: 32.5rem; display: flex; }
.search-w .ic { position: absolute; left: .625rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 1rem; height: 1rem; }
.search-w input { width: 100%; height: 2.375rem; padding: 0 .625rem 0 2rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: var(--surface); }
.lv-body { display: block; }
.lv-main { min-width: 0; }

/* жълта лента — какво е скрито */
.fbar { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .625rem; background: var(--yellow); border: 1px solid var(--yellow-line);
  border-radius: .5rem; padding: .4375rem .75rem; margin-bottom: .625rem; font-size: .875rem; }
.fbar-t { color: #6B5300; font-weight: 600; }
.fchip { display: inline-flex; align-items: center; gap: 2px; background: #fff; border: 1px solid var(--yellow-line); border-radius: 62.4375rem; padding: 1px .25rem 1px .625rem; }
.fchip button { border: 0; background: none; cursor: pointer; width: 1.375rem; height: 1.375rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); }
.fchip button:hover { background: var(--slate-bg); }
.fchip .ic { width: .8125rem; height: .8125rem; }

.pending { display: flex; flex-direction: column; gap: .375rem; margin-bottom: .75rem; }
.note { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; border-radius: .5rem; padding: .5625rem .75rem; font-size: .875rem; border: 1px solid transparent; }
.note.info { background: var(--blue-bg); border-color: #C7DBF1; }
.note.bad { background: var(--red-bg); border-color: #F2C3BE; color: var(--red); }
.note.warn { background: var(--amber-bg); border-color: #F0C98A; margin-bottom: .875rem; }
.note .btns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.spin { width: .875rem; height: .875rem; border: 2px solid #9CC0E8; border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- умни филтри */
.facets-inline { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; padding: .625rem .625rem .75rem; margin-bottom: .75rem; }
.facets-h { display: flex; align-items: center; justify-content: space-between; font-weight: 650; font-size: .875rem; padding: 0 2px .25rem .25rem; }
.facet { padding: .5rem 0 .25rem; border-top: 1px solid #EEF1F3; }
.facet h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 .25rem .25rem; font-weight: 650; }
.facet ul { list-style: none; margin: 0; padding: 0; }
.facet .linkish { margin: 2px 0 0 .375rem; font-size: .8125rem; }
.fv { display: flex; align-items: center; gap: .5rem; width: 100%; border: 0; background: none; padding: .25rem .25rem; border-radius: .375rem; cursor: pointer; text-align: left; font-size: .875rem; min-height: 1.875rem; }
.fv:hover { background: var(--soft); }
.fv-box { width: 1rem; height: 1rem; border: 1.5px solid var(--line-strong); border-radius: .25rem; flex: none; display: inline-flex; align-items: center; justify-content: center; background: #fff; }
.fv.on .fv-box { background: var(--primary); border-color: var(--primary); color: #fff; }
.fv-box .ic { width: .75rem; height: .75rem; stroke-width: 3; }
.fv-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-n { color: var(--muted); font-size: .7812rem; }
.fv.on .fv-l { font-weight: 600; }

/* ---------------------------------------------------------------- решетката */
.grid-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
table.grid { table-layout: fixed; border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: .875rem; }
.grid th { position: relative; background: #FAFBFC; border-bottom: 1px solid var(--line); text-align: left; font-weight: 600; color: var(--slate); padding: 0; font-size: .8125rem; }
.grid th + th { border-left: 1px solid #EEF1F3; }
.grid .th { display: flex; align-items: center; gap: 2px; min-height: 2.5rem; padding: 0 .25rem 0 .375rem; }
.grid th.num .th { flex-direction: row; }
.grid .grip { color: #B3BCC5; cursor: grab; font-size: .6875rem; letter-spacing: -2px; padding: 0 .25rem 0 0; user-select: none; }
.rsz { position: absolute; top: 0; right: -5px; bottom: 0; width: .625rem; cursor: col-resize; z-index: 2; touch-action: none; }
.rsz::after { content: ""; position: absolute; top: 25%; bottom: 25%; left: .25rem; width: 2px; border-radius: 2px; background: transparent; }
.grid th:hover .rsz::after { background: var(--line-strong); }
.rsz:hover::after, body.resizing .rsz::after { background: var(--primary) !important; }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
.grid th:last-child .rsz { right: 0; }
.grid th.dragging { opacity: .4; }
.grid th.drop-before { box-shadow: inset 3px 0 0 var(--primary); }
.th-l { flex: 1; min-width: 0; display: flex; align-items: center; gap: .25rem; border: 0; background: none; padding: .5rem 2px; cursor: pointer; font-weight: 600; color: inherit; text-align: left; }
.grid th.num .th-l { justify-content: flex-end; }
.th-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort { color: var(--primary); font-size: .625rem; white-space: nowrap; }
.sort sup { font-size: .5625rem; margin-left: 1px; }
.fn { width: 1.625rem; height: 1.625rem; border: 0; background: none; border-radius: .375rem; cursor: pointer; color: #A3ADB7; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.fn:hover { background: var(--slate-bg); color: var(--slate); }
.fn.on { color: var(--primary); background: var(--primary-weak); }
.fn .ic { width: .875rem; height: .875rem; }
.grid td { padding: .5625rem .625rem; border-bottom: 1px solid #EEF1F3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: #F7FAFD; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td.num { text-align: right; }
.grid td.t { padding-left: .25rem; }
.grid td.t a { color: var(--text); font-weight: 600; text-decoration: none; }
.eye { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; margin-right: .25rem; vertical-align: middle;
  border: 0; background: none; border-radius: .375rem; color: #A3ADB7; cursor: zoom-in; flex: none; }
.eye:hover, .eye:focus-visible { background: var(--primary-weak); color: var(--primary); }
.eye .ic { width: 1rem; height: 1rem; }
.grid td.t a:hover { color: var(--primary); text-decoration: underline; }
.grid .lg { color: var(--muted); margin-left: .375rem; font-size: .8125rem; }
.grid tr.logical td.t a { font-weight: 550; }
.grid td.late { color: var(--red); font-weight: 600; }
.grid tfoot td { background: #FAFBFC; border-top: 1px solid var(--line); border-bottom: 0; font-weight: 650; padding: .5625rem .625rem; }
.rowcount { color: var(--muted); font-size: .8125rem; margin: .5rem 2px 0; }
.empty-state { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: .75rem; padding: 1.75rem 1.25rem; text-align: center; }
.empty-state h3 { margin: 0 0 .375rem; font-size: 1.0625rem; }
.empty-state p { margin: 0 0 .75rem; color: var(--muted); }

/* чипове */
.chip { display: inline-flex; align-items: center; gap: .25rem; border-radius: 62.4375rem; padding: 2px .625rem; font-size: .7812rem; font-weight: 600; white-space: nowrap; }
.st-review { background: var(--amber-bg); color: var(--amber); }
.st-trash { background: var(--slate-bg); color: var(--slate); }
.st-accounting { background: var(--blue-bg); color: var(--primary-strong); }
.st-posted { background: var(--slate-bg); color: var(--slate); }
.st-done { background: var(--green-bg); color: var(--green); }
.st-error { background: var(--red-bg); color: var(--red); }
.st-pending { background: var(--slate-bg); color: var(--muted); }
.chip.home { background: var(--primary-weak); color: var(--primary-strong); margin-left: .375rem; }
.ai { font-weight: 600; }
.ai.low { color: var(--red); } .ai.mid { color: var(--amber); } .ai.high { color: var(--green); }
.chip.new { background: #EDE7F6; color: #4A2C8A; }

/* ---------------------------------------------------------------- падащ панел */
.dpan { position: fixed; z-index: 50; min-width: 15rem; max-width: min(22.5rem, calc(100vw - 1rem)); overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: .625rem; box-shadow: 0 .625rem 2rem rgba(22, 32, 42, .18); padding: .5rem; }
.pan-h { display: flex; align-items: center; justify-content: space-between; gap: .625rem; padding: .25rem .375rem .375rem; font-size: .8438rem; }
.pan-h + .pan-list { margin-top: 0; }
.pan-list { list-style: none; margin: 0 0 .375rem; padding: 0; }
.pan-list li { display: flex; align-items: center; gap: .25rem; border-radius: .375rem; }
.pan-list li:hover { background: var(--soft); }
.pan-list label { flex: 1; display: flex; align-items: center; gap: .5rem; padding: .3125rem .375rem; cursor: pointer; min-width: 0; font-size: .875rem; }
.pan-list .pl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pan-list .pn { color: var(--muted); font-size: .7812rem; }
.pan-list li.fixed { opacity: .7; }
.updn { display: inline-flex; gap: 2px; padding-right: .25rem; }
.updn button { width: 1.625rem; height: 1.625rem; border: 1px solid var(--line); background: #fff; border-radius: .375rem; cursor: pointer; font-size: .8125rem; line-height: 1; }
.updn button:disabled { opacity: .3; cursor: default; }
.pan-search { width: 100%; height: 2.125rem; padding: 0 .625rem; border: 1px solid var(--line-strong); border-radius: .5rem; margin-bottom: .375rem; }
.pan-note { color: var(--muted); font-size: .7812rem; margin: .25rem .375rem 2px; }
.pan-menu { list-style: none; margin: 0; padding: 0; }
.pan-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; border: 0; background: none; padding: .5rem .625rem; border-radius: .5rem; cursor: pointer; text-align: left; }
.pan-menu button:hover { background: var(--soft); }
.pan-menu span { color: var(--muted); font-size: .8125rem; }

/* пускане на файл където и да е */
.drop { position: fixed; inset: .625rem; z-index: 70; display: flex; align-items: center; justify-content: center; gap: .75rem;
  background: rgba(231, 240, 250, .92); border: 3px dashed var(--primary); border-radius: 1rem; font-size: 1.25rem; font-weight: 650;
  color: var(--primary-strong); pointer-events: none; text-align: center; padding: 1.25rem; }
.drop .ic { width: 1.875rem; height: 1.875rem; }

/* ---------------------------------------------------------------- състояние */
.nv-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--red); flex: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: .75rem; margin-bottom: var(--gap); }
.tile { background: var(--surface); border: 1px solid var(--line); border-left: .3125rem solid var(--line-strong); border-radius: .75rem; padding: .75rem .875rem; }
.tile-h { display: flex; justify-content: space-between; gap: .5rem; font-size: .8125rem; color: var(--muted); font-weight: 600; }
.tile-s { text-transform: uppercase; letter-spacing: .4px; font-size: .6875rem; }
.tile-v { font-size: 1.25rem; font-weight: 650; margin: .25rem 0; overflow-wrap: anywhere; }
.tile-n { margin: 0; font-size: .8125rem; color: var(--slate); }
.tile.st-ok { border-left-color: var(--green); } .tile.st-ok .tile-s { color: var(--green); }
.tile.st-warn { border-left-color: #E0A030; } .tile.st-warn .tile-s { color: var(--amber); }
.tile.st-bad { border-left-color: var(--red); background: #FFF8F7; } .tile.st-bad .tile-s { color: var(--red); }
.tile.st-off { border-left-color: var(--line-strong); } .tile.st-off .tile-v { color: var(--muted); }
.tile.all { grid-column: span 2; }
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: var(--gap); }
.st-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .5rem; }
.st-count { display: flex; flex-direction: column; padding: .5rem .625rem; border: 1px solid var(--line); border-radius: .5rem; color: var(--text); text-decoration: none; }
a.st-count:hover { border-color: var(--primary); }
.st-count b { font-size: 1.25rem; }
.st-count span { font-size: .8125rem; color: var(--muted); }
.st-probs { list-style: none; margin: 0; padding: 0; }
.st-probs li { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-top: 1px solid #EEF1F3; }
.st-probs li:first-child { border-top: 0; }
.pr-t { flex: 1; min-width: 0; }
.pr-t a { font-weight: 600; text-decoration: none; }
.pills { display: flex; flex-wrap: wrap; gap: .375rem; }
table.kv th { text-align: left; color: var(--muted); font-weight: 550; width: 40%; vertical-align: top; }
table.kv td { overflow-wrap: anywhere; }
code { background: var(--soft); border: 1px solid var(--line); border-radius: .25rem; padding: 0 .25rem; font-size: .8125rem; }

/* ---------------------------------------------------------------- широк изглед (карти) */
.seg.icons > button { padding: .4375rem .625rem; display: inline-flex; align-items: center; }
.seg.icons .ic { width: 1.125rem; height: 1.125rem; }
.cards { display: flex; flex-direction: column; gap: .625rem; }
.card-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: .75rem; padding: .75rem; content-visibility: auto; contain-intrinsic-size: auto 13rem; }
.card-row:hover { border-color: var(--line-strong); }
.thumb { display: block; width: 7.5rem; height: 10.5rem; padding: 0; border: 1px solid var(--line); border-radius: .375rem; background: #F3F5F7;
  overflow: hidden; cursor: zoom-in; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; background: #fff; }
.thumb:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.thumb-x { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .75rem; }
.c-main { min-width: 0; display: flex; flex-direction: column; gap: .375rem; }
.c-top { display: flex; align-items: baseline; gap: .75rem; }
.c-title { flex: 1; min-width: 0; font-weight: 650; font-size: 1rem; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.c-title:hover { color: var(--primary); text-decoration: underline; }
.c-amt { font-weight: 650; white-space: nowrap; font-size: 1rem; }
.c-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: var(--muted); font-size: .8125rem; }
.c-ctx { background: var(--blue-bg); border-radius: .5rem; padding: .375rem .625rem; font-size: .875rem; }
.c-msg { color: var(--slate); }
.c-sum { margin: 0; font-size: .875rem; color: var(--slate); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.c-reasons { background: #FFFAF1; border: 1px solid #F0C98A; border-radius: .5rem; padding: .375rem .625rem; font-size: .8125rem; }
.c-reasons b { color: var(--amber); font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; }
.c-reasons ul { margin: .125rem 0 0; padding-left: 1.125rem; }
.c-reasons li + li { margin-top: .125rem; }
.c-more { font-size: .8125rem; }
.c-acts { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: auto; padding-top: .25rem; }
.c-acts .btn { min-height: 2rem; padding: .3125rem .75rem; font-size: .875rem; }
.c-acts .btn.icon { padding: .3125rem .5rem; }
.c-acts .btn.magic .ic-magic { width: 1.25rem; height: 1.25rem; }
.card-row.logical { border-style: dashed; }

/* ---------------------------------------------------------------- преглед при посочване */
.pv { position: fixed; z-index: 55; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: .75rem; box-shadow: 0 1.125rem 3.125rem rgba(22, 32, 42, .28); overflow: hidden; pointer-events: none; }
.pv.pinned { pointer-events: auto; }
.pv-bar { display: flex; align-items: center; gap: .5rem; padding: .5rem .625rem .5rem .875rem; border-bottom: 1px solid var(--line); background: #FAFBFC; min-height: 2.75rem; }
.pv-t { flex: 1; min-width: 0; font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-n { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.pv-btns { display: none; align-items: center; gap: .25rem; }
.pv.pinned .pv-btns { display: inline-flex; }
.pv-open { min-height: 1.875rem; padding: .25rem .625rem; font-size: .8125rem; }
.pv-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #EEF1F4; padding: .625rem; overflow: auto; }
.pv-body img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 2px .625rem rgba(0,0,0,.12); border-radius: .25rem; }
.pv.pinned .pv-body img { max-height: none; }
.pv-load { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .875rem; }
.pan-link { display: block; padding: .5rem .625rem; border-radius: .5rem; text-decoration: none; color: var(--text); }
.pan-link:hover { background: var(--soft); }

/* ---------------------------------------------------------------- списък на телефона */
.li-sort { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font-size: .875rem; color: var(--muted); }
.li-sort select { flex: 1; min-height: 2.375rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: var(--surface); padding: 0 .5rem; }
.li-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; }
.li-list li + li { border-top: 1px solid var(--line); }
.li-row { display: flex; align-items: stretch; }
.li-row .eye { width: 2.5rem; height: auto; margin: 0; border-radius: 0; color: var(--muted); }
.li-row .li { flex: 1; min-width: 0; padding-left: 2px; }
.li { display: flex; flex-direction: column; gap: .25rem; padding: .6875rem .875rem; color: inherit; text-decoration: none; }
.li:active { background: var(--soft); }
.li-top { display: flex; align-items: baseline; gap: .625rem; }
.li-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-right { font-weight: 600; white-space: nowrap; }
.li-meta { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .8125rem; min-width: 0; }
.li-meta > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li.late .li-meta { color: var(--red); }

/* ---------------------------------------------------------------- документ */
.d-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .625rem; }
.back { display: inline-flex; align-items: center; gap: .25rem; text-decoration: none; font-size: .875rem; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.back .ic { width: 1.125rem; height: 1.125rem; }
.pn { display: inline-flex; align-items: center; gap: .375rem; }
.pn-t { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.d-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.d-title { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.unsaved { font-size: .8125rem; color: var(--primary-strong); font-weight: 550; }
@media (min-width: 821px) {   /* заглавието и бутоните остават горе при превъртане — „Запази“ е винаги под ръка */
  .d-head { position: sticky; top: var(--top-h); z-index: 12; background: var(--bg); padding: .5rem 0 .625rem; margin: -.5rem 0 .5rem; }
  .d-head.stuck { box-shadow: 0 1px 0 var(--line); }
}
@media (min-width: 901px) {
  .d-grid .preview { top: calc(var(--top-h) + var(--dhead-h, 0px) + .75rem); max-height: calc(100vh - var(--top-h) - var(--dhead-h, 0px) - 1.5rem); }
}
.title-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 2px 6px; }
.title-row h1 { cursor: text; }
.edit-t { margin-top: .25rem; color: var(--muted); opacity: .55; }
.title-row:hover .edit-t, .edit-t:focus-visible { opacity: 1; }
.ai-t { align-self: center; font-size: .8125rem; }
.title-edit { display: flex; flex-wrap: wrap; gap: .5rem; width: min(52rem, 100%); }
.title-in { flex: 1 1 22rem; min-width: 0; font-size: 1.25rem; font-weight: 600; padding: .375rem .625rem; border: 1px solid var(--primary);
  border-radius: .5rem; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: .375rem; align-items: center; color: var(--muted); font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.d-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--gap); align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; padding: 1rem; }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.preview { position: sticky; top: calc(var(--top-h) + .75rem); max-height: calc(100vh - var(--top-h) - 1.5rem); overflow: auto; padding: .5rem; }
.preview img { display: block; width: calc(100% * var(--zoom, 1)); max-width: none; height: auto; border: 1px solid var(--line); border-radius: .375rem; background: #fff; }
/* документът: лентата горе стои, страниците се превъртат (и встрани, когато са увеличени) */
.d-preview { display: flex; flex-direction: column; overflow: hidden; }
.prev-pages { flex: 1 1 auto; min-height: 0; overflow: auto; }
.prev-pages.zoomed img { cursor: grab; }
.prev-pages.panning, .prev-pages.panning img { cursor: grabbing; user-select: none; }
img { -webkit-user-drag: none; }   /* картинките в приложението не се влачат (пуснати, щяха да се качат) */
.preview img + img { margin-top: .5rem; }
.prev-bar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .25rem .25rem .5rem; color: var(--muted); font-size: .8125rem; }
.prev-links { display: flex; gap: .875rem; }
.zoom { display: inline-flex; align-items: center; gap: .125rem; }
.zoom:empty { display: none; }
.zoom .icon-btn { width: 1.75rem; height: 1.75rem; font-size: 1.0625rem; font-weight: 600; line-height: 1; }
.zoom-pct { min-width: 3.25rem; border: 0; background: none; color: var(--muted); font: inherit; font-size: .8125rem; cursor: pointer; border-radius: .375rem; padding: .25rem; }
.zoom-pct:hover { background: var(--soft); color: var(--text); }
.reasons { border-color: #F0C98A; background: #FFFAF1; }
.reasons ul, .remarks ul { margin: 0; padding-left: 1.25rem; }
.reasons .minor-h { margin: .625rem 0 .25rem; font-size: .8125rem; color: var(--muted); }
.reasons ul.minor { color: var(--muted); font-size: .875rem; list-style: circle; }
.reasons.soft { border-color: var(--line); background: var(--surface); }
.reasons.soft h2 { color: var(--text); }
.reasons .soft-note { margin: -.25rem 0 .5rem; font-size: .8125rem; }
.c-reasons.soft { background: var(--soft); border-color: var(--line); }
.c-reasons li.minor { color: var(--muted); }
.c-reasons.soft b { color: var(--muted); }
.reasons li + li, .remarks li + li { margin-top: .25rem; }
/* потвърден след проверка — без жълто */
.checked { padding-top: .75rem; padding-bottom: .75rem; }
.checked-h { display: flex; align-items: center; gap: .5rem; font-size: .9375rem; }
.checked-h svg { width: 18px; height: 18px; color: #1E7B45; flex: none; }
.checked details { margin-top: .375rem; font-size: .8125rem; color: var(--muted); }
.checked summary { cursor: pointer; }
.checked ul { margin: .375rem 0 0; padding-left: 1.25rem; }
.checked li + li { margin-top: .25rem; }
.remarks { color: var(--muted); font-size: .875rem; }
.summary { margin: 0; }
.info { color: var(--muted); font-size: .875rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.mine { border-color: #9CC0E8; background: #F5F9FE; }
.mine-item { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.mine-item + .mine-item { border-top: 1px solid #DCE8F5; margin-top: .625rem; padding-top: .625rem; }
.mine-t { min-width: 0; font-size: .875rem; }
.msg { margin: .25rem 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9062rem; }
.late { color: var(--red); font-weight: 600; }
.places, .sends { list-style: none; margin: 0; padding: 0; }
/* „Сподели“ папката: с кого и с какво право */
.shares { list-style: none; margin: .5rem 0; padding: 0; display: flex; flex-direction: column; gap: .375rem; }
.shares li { display: flex; align-items: center; gap: .5rem; padding: .375rem .5rem; border: 1px solid var(--line); border-radius: .5rem; }
.shares li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shares li .ic { width: 1.125rem; height: 1.125rem; color: var(--muted); flex: none; }
dialog .shares select { width: auto; min-height: 2rem; padding: .25rem .5rem; }
.sh-ini { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--slate-bg); color: var(--slate); font-size: .6875rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.share-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: .625rem; margin-top: .5rem; }
.places li { display: flex; align-items: center; gap: .5rem; padding: .375rem 0; font-size: .875rem; border-top: 1px solid #EEF1F3; }
.places li:first-child { border-top: 0; }
.places .ic { color: #C28A1E; width: 1rem; height: 1rem; }
.places a { text-decoration: none; }
.places .icon-btn { margin-left: auto; }
.sends li { padding: .5rem 0; border-top: 1px solid #EEF1F3; font-size: .875rem; }
.sends li:first-child { border-top: 0; }
.sends .chip { margin-top: 2px; }
/* дошъл по пощата dms@ */
.mail-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: .5rem; padding: .25rem 0; font-size: .875rem; }
.mail-row span:last-child { overflow-wrap: anywhere; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem .875rem; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: .8125rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 2.5rem; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff;
}
.field input[readonly] { background: #F7F8FA; }
.field.dirty input, .field.dirty select, .field.dirty textarea { border-color: var(--primary); background: #F5F9FE; }
/* несигурно — да се прегледа: светложълто, с рамка в тон, и знак пред името */
.field.doubt input, .field.doubt select, .field.doubt textarea { background: #FFFDF0; border-color: #E9D9A6; }
.field.doubt input:focus, .field.doubt select:focus, .field.doubt textarea:focus { border-color: #D2B456; box-shadow: 0 0 0 3px rgba(233, 217, 166, .4); }
.field.doubt .money-w .cur { background: #F8F1D9; }
.field label .doubt-i { display: inline-flex; vertical-align: -2px; margin-right: .25rem; padding: 0; border: 0; background: none; color: #B58A1E; cursor: help; }
.doubt-note { font-size: .75rem; line-height: 1.3; color: #86671A; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.field:not(.doubt) .doubt-note { display: none; }
.field label .doubt-i .ic { width: .875rem; height: .875rem; }
.party { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: .625rem .875rem; padding-top: .25rem; }
.save-bar { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
.sugg { align-self: flex-start; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 .375rem; max-width: 100%; margin-top: 2px; padding: .25rem .375rem .25rem .625rem;
  border: 1px solid #9CC0E8; background: var(--blue-bg); color: var(--primary-strong); border-radius: .875rem; font: inherit; font-size: .8125rem;
  cursor: pointer; text-align: left; }
.sugg:hover { border-color: var(--primary); background: #DCEBFA; }
.sugg-src { color: var(--muted); white-space: nowrap; }
.sugg-v { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }   /* дългото име се пренася — да се вижда цялото */
.sugg .ic { width: .9375rem; height: .9375rem; flex: none; padding: 1px; border-radius: 50%; background: var(--primary); color: #fff; }
.sugg.undo { border-color: var(--line-strong); background: var(--surface); color: var(--muted); padding-right: .625rem; }

.table-wrap { overflow-x: auto; }
table.lines { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.lines th { text-align: left; color: var(--muted); font-weight: 550; font-size: .8125rem; border-bottom: 1px solid var(--line); padding: .375rem .5rem; white-space: nowrap; }
table.lines th.num { text-align: right; }
table.lines td { border-bottom: 1px solid #EEF1F3; padding: .4375rem .5rem; vertical-align: top; }
table.lines td.n { text-align: right; white-space: nowrap; }

.btn.danger-o { color: var(--red); }
.btn.danger-o:hover { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.t-del { color: var(--text); font-weight: 600; }
.toast-act { margin-left: .75rem; border: 0; background: none; color: #9CC9FF; font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
p.danger { color: var(--red); font-weight: 600; }

/* избор на много документи и общото действие */
.selb { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.75rem; margin-right: .125rem; vertical-align: middle; cursor: pointer; flex: none; }
.selb input { width: 1rem; height: 1rem; margin: 0; cursor: pointer; accent-color: var(--primary); }
.selb.big { width: 2.5rem; height: auto; align-self: stretch; }
.selb.big input { width: 1.25rem; height: 1.25rem; }
.grid th .th .selb { margin-right: .25rem; }
table.grid tr.sel td { background: #EEF5FD; }
.li-row.sel { background: #EEF5FD; }
.card-row.sel { border-color: #9CC0E8; background: #F5F9FE; }
.c-top .selb { margin-right: .25rem; }
.bulk { position: sticky; top: calc(var(--top-h) + .25rem); z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .875rem;
  margin: 0 0 .625rem; padding: .5rem .75rem; border: 1px solid #9CC0E8; background: var(--blue-bg); border-radius: .625rem; }
.bulk[hidden] { display: none; }
.bulk-n { font-weight: 650; color: var(--primary-strong); }
.bulk .btn.magic { background: var(--surface); }

/* откъсите от търсенето */
.hits { display: flex; flex-direction: column; gap: 2px; font-size: .8125rem; color: var(--muted); min-width: 0; }
.hit { display: flex; gap: .5rem; min-width: 0; }
.hit-p { flex: none; color: var(--muted); font-size: .75rem; padding-top: 1px; min-width: 3.25rem; }
.hit-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hit mark { background: #FFE58F; color: inherit; padding: 0 1px; border-radius: 2px; font-weight: 600; }
.hit-more { font-size: .75rem; }
table.grid tr.has-hits td { border-bottom-color: transparent; }
table.grid tr.hits-row td { padding-top: 0; padding-bottom: .5rem; cursor: pointer; }
table.grid tr.hits-row .hits { position: sticky; left: .5rem; max-width: min(56rem, calc(100vw - 22rem)); padding-left: 1.75rem; }
.li .hits { margin-top: .25rem; }
.li .hit-t { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.card-row .hits { margin: .25rem 0; }

.tables-note { margin: -.25rem 0 .5rem; font-size: .8125rem; }
.dtab { border-top: 1px solid #EEF1F3; padding: .375rem 0; }
.dtab:first-of-type { border-top: 0; }
.dtab > summary { display: flex; align-items: center; gap: .625rem; cursor: pointer; padding: .375rem 0; list-style: none; }
.dtab > summary::-webkit-details-marker { display: none; }
.dtab > summary::before { content: "›"; display: inline-block; width: .75rem; color: var(--muted); font-weight: 700; transition: transform .15s; }
.dtab[open] > summary::before { transform: rotate(90deg); }
.dtab-t { font-weight: 600; font-size: .9062rem; min-width: 0; flex: 1; }
.dtab-t .ai-read { margin-left: .5rem; font-weight: 500; background: #EEF3FB; color: #1F4E8C; vertical-align: 1px; }
.dtab-n { font-size: .8125rem; white-space: nowrap; }
.dtab .table-wrap { max-height: 32rem; overflow: auto; }
table.lines.dtable th { position: sticky; top: 0; background: var(--surface); white-space: normal; vertical-align: bottom;
  min-width: 4.5rem; max-width: 15rem; line-height: 1.3; cursor: pointer; }
table.lines.dtable th .dth { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  overflow-wrap: break-word; }
table.lines.dtable thead.full th .dth { display: block; -webkit-line-clamp: unset; line-clamp: none; }
table.lines.dtable thead.full th { max-width: 22rem; }
table.lines.dtable .wcol { min-width: 14rem; }   /* колона с дълъг текст (описание) — по-широка, по-малко редове */
table.dtable { width: auto; min-width: 100%; }
table.dtable td { min-width: 4.5rem; max-width: 24rem; overflow-wrap: break-word; }
table.dtable td.n { white-space: nowrap; }
.more-rows { margin: .5rem 0 0; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: .5rem 0; border-top: 1px solid #EEF1F3; font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.history li:first-child { border-top: 0; }
.history .when { color: var(--muted); font-size: .7812rem; display: block; }
.history summary { cursor: pointer; color: var(--text); }
.history .note-full { margin-top: .375rem; color: var(--muted); font-size: .8125rem; }

/* ---------------------------------------------------------------- контрагенти и настройки */
.party-page { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--gap); align-items: start; }
.from-docs { color: var(--primary-strong); font-size: .75rem; }
.with-btn { display: flex; gap: .5rem; align-items: center; }
.with-btn input { flex: 1; min-width: 0; }
.with-btn .btn { flex: none; min-height: 2.5rem; }
.vies-out { grid-column: 1 / -1; }
.vies-out[hidden] { display: none; }
.sb-note { margin-right: auto; align-self: center; font-size: .8125rem; }
.party-stats { margin: 0 0 .625rem; font-size: .875rem; }
td.nowrap { white-space: nowrap; }
.lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(26rem, 100%), 1fr)); gap: var(--gap); align-items: start; }
.list-card > p { margin: 0 0 .5rem; font-size: .8125rem; }
.opt-list { list-style: none; margin: .25rem 0 .625rem; padding: 0; display: flex; flex-direction: column; gap: .375rem; }
.opt { display: flex; align-items: center; gap: .375rem; }
.opt input { flex: 1; min-width: 0; min-height: 2.375rem; padding: .375rem .625rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff; }
.opt.renamed input { border-color: var(--primary); background: #F5F9FE; }
.opt-ord { display: inline-flex; flex-direction: column; }
.opt-ord .icon-btn.sm { width: 1.5rem; height: 1.125rem; border-radius: .25rem; }
.opt-ord .icon-btn.sm:first-child .ic { transform: rotate(180deg); }
.opt-ord .icon-btn:disabled, .opt .icon-btn:disabled { opacity: .3; cursor: default; }
.opt-used { font-size: .75rem; min-width: 6.5rem; text-align: right; white-space: nowrap; }
.opt-add { display: flex; gap: .5rem; }
.opt-add input { flex: 1; min-width: 0; min-height: 2.375rem; padding: .375rem .625rem; border: 1px dashed var(--line-strong); border-radius: .5rem; background: #fff; }
.ar-form { max-width: 52rem; }
.check-l { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-bottom: .875rem; }
.check-l input { width: 1.125rem; height: 1.125rem; }
#ar-fmt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; }
.tok-chips { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .375rem; }
.tok { border: 1px solid var(--line-strong); background: var(--soft); border-radius: .375rem; padding: .1875rem .5rem; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; color: var(--text); }
.tok:hover { border-color: var(--primary); color: var(--primary-strong); }
.tok-help { margin: .375rem 0 0; padding-left: 1.125rem; font-size: .8125rem; columns: 2; column-gap: 1.5rem; }
.tok-help code { color: var(--text); }
.field .lbl { font-size: .8125rem; color: var(--muted); }
.ar-sample { display: flex; align-items: center; min-height: 2.5rem; padding: .375rem .75rem; border-radius: .5rem; background: var(--primary-weak);
  color: var(--primary-strong); font-weight: 650; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.0625rem; }
.ar-codes { display: contents; }
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .375rem .875rem; }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) 7rem; align-items: center; gap: .5rem; font-size: .875rem; color: var(--text) !important; }
.code-row input { min-height: 2.25rem; padding: .25rem .5rem; border: 1px solid var(--line-strong); border-radius: .375rem; background: #fff; }
.ar-form .dlg-err { margin: .75rem 0 0; }

/* ---------------------------------------------------------------- екипи и хора */
.new-team { margin-bottom: var(--gap); max-width: 47.5rem; }
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(18.75rem, 1fr)); gap: var(--gap); }
.tc-h { display: flex; align-items: baseline; justify-content: space-between; gap: .625rem; }
.tc-h a { color: var(--text); text-decoration: none; }
.tc-h a:hover { color: var(--primary); }
.members { list-style: none; margin: .5rem 0 .75rem; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.member { display: flex; align-items: center; gap: .5rem; font-size: .875rem; padding: 3px 0; }
.member .icon-btn { margin-left: auto; }
.people-card { margin-top: 1rem; }
.people-card .member { flex-wrap: wrap; }
.people-card .member .btn { margin-left: auto; }
.people-card .member.off .pc-name { color: var(--muted); text-decoration: line-through; }
.av { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--slate-bg); color: var(--slate); font-size: .6875rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.team-card select { width: 100%; min-height: 2.375rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff; padding: 0 .5rem; }

/* ---------------------------------------------------------------- съобщения и диалог */
.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: #1F2A35; color: #fff; padding: .625rem 1rem; border-radius: .625rem; max-width: calc(100vw - 2rem); box-shadow: 0 .375rem 1.5rem rgba(0,0,0,.18);
}
.toast.err { background: var(--red); }
/* качването: напредъкът (компютър — долу вдясно; телефон — горе, под лентата), прекъснат интернет, неуспелите */
.upq { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 55; width: min(24rem, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; box-shadow: 0 .5rem 1.75rem rgba(0,0,0,.16); padding: .75rem .875rem; }
.upq[hidden] { display: none; }
.upq-h { display: flex; align-items: center; gap: .5rem; font-weight: 650; }
.upq-h .ic { width: 1.125rem; height: 1.125rem; color: var(--primary); flex: none; }
.upq-bar { height: .375rem; border-radius: 1rem; background: var(--primary-weak); margin: .5rem 0 .375rem; overflow: hidden; }
.upq-bar > i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .25s; }
.upq-t { color: var(--muted); font-size: .8438rem; }
.upq.warn .upq-t { color: var(--amber); font-weight: 600; }
.upq.bad .upq-bar > i { background: var(--amber); }
.upq ul { margin: .375rem 0 0; padding-left: 1.125rem; font-size: .8438rem; overflow-wrap: anywhere; }
.upq-acts { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .625rem; }
@media (max-width: 820px) { .upq { left: .75rem; right: .75rem; width: auto; top: calc(var(--top-h) + .5rem); bottom: auto; } }
dialog { border: 0; border-radius: .875rem; padding: 0; width: min(30rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); box-shadow: 0 .75rem 2.5rem rgba(0,0,0,.25); }
dialog:has(form.wide) { width: min(45rem, calc(100vw - 1.5rem)); }
dialog::backdrop { background: rgba(22, 32, 42, .35); }
dialog form { padding: 1.125rem; display: flex; flex-direction: column; gap: .625rem; }
dialog h2 { overflow-wrap: anywhere; }
dialog textarea, dialog input[type=text], dialog input[type=search], dialog input[type=date] {
  width: 100%; min-height: 2.5rem; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff; }
dialog textarea { resize: vertical; }
dialog p { margin: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .25rem; }
/* телефон: „Качи“ от долната лента — меню отдолу; снимките — на цял екран */
dialog.sheet { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 1.125rem 1.125rem 0 0; }
dialog.sheet.full { margin: 0; height: 100%; max-height: 100%; border-radius: 0; }
.sh-body { display: flex; flex-direction: column; gap: .75rem; padding: .5rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); }
.sh-body::before { content: ""; align-self: center; width: 2.5rem; height: .25rem; border-radius: .125rem; background: var(--line-strong); }
.sh-h { display: flex; align-items: center; justify-content: space-between; }
.sh-h h2 { margin: 0; font-size: 1.1875rem; }
.up-opt { display: flex; align-items: center; gap: .875rem; padding: .875rem; border: 1px solid var(--line); border-radius: .75rem;
  background: var(--soft); text-align: left; cursor: pointer; }
.up-opt:hover { border-color: var(--primary); }
.up-ic { width: 3rem; height: 3rem; flex: none; border-radius: .75rem; background: var(--primary-weak); color: var(--primary); display: inline-flex;
  align-items: center; justify-content: center; }
.up-ic.strong { background: var(--primary); color: #fff; }
.up-ic .ic { width: 1.625rem; height: 1.625rem; }
.up-t { display: flex; flex-direction: column; gap: .125rem; }
.up-t b { font-size: 1rem; }
.up-t span { color: var(--muted); font-size: .8125rem; }
.up-where { display: flex; gap: .625rem; align-items: flex-start; padding: .625rem .75rem; border-radius: .625rem; background: var(--primary-weak);
  color: var(--primary-strong); font-size: .8125rem; }
.up-where .ic { width: 1.125rem; height: 1.125rem; flex: none; margin-top: 1px; }
.ph { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.ph-h { display: flex; align-items: center; gap: .375rem; min-height: var(--top-h); padding: 0 .375rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.ph-h > div { display: flex; flex-direction: column; line-height: 1.2; }
.ph-main { flex: 1; overflow: auto; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .875rem; }
.ph-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.ph-page { position: relative; margin: 0; height: 14.375rem; border: 1px solid var(--line); border-radius: .625rem; background: var(--surface); overflow: hidden; }
.ph-page img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ph-page figcaption { position: absolute; left: .5rem; bottom: .5rem; background: var(--text); color: #fff; font-size: .75rem; font-weight: 600;
  border-radius: 62.4375rem; padding: 1px .5rem; }
.ph-x { position: absolute; right: .375rem; top: .375rem; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--slate); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ph-x .ic { width: .875rem; height: .875rem; }
.ph-more { height: 14.375rem; border: 2px dashed #9CC0E8; border-radius: .625rem; background: var(--surface); color: var(--primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; font-weight: 600; cursor: pointer; }
.ph-more .ic { width: 1.875rem; height: 1.875rem; }
.ph-foot { display: flex; flex-direction: column; gap: .5rem; padding: .75rem .75rem calc(1rem + env(safe-area-inset-bottom)); background: var(--surface);
  border-top: 1px solid var(--line); }
.ph-foot .btn { justify-content: center; min-height: 2.75rem; }
.ph-foot .btn.primary { min-height: 3.125rem; font-size: 1rem; font-weight: 700; }
.dlg-err { color: var(--red); background: var(--red-bg); border-radius: .5rem; padding: .5rem .625rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .875rem; }
.two > div { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.lbl { font-size: .9375rem; }
.pick-list { list-style: none; margin: 0; padding: .25rem; border: 1px solid var(--line); border-radius: .5rem; max-height: 13.75rem; overflow-y: auto; }
.pick-list li { border-radius: .375rem; }
.pick-list li:hover { background: var(--soft); }
.pick-list label { display: flex; align-items: center; gap: .375rem; padding: .375rem .5rem; cursor: pointer; font-size: .875rem; }
.pick-list .ic { width: .9375rem; height: .9375rem; color: #C28A1E; }
.tree-pick { max-height: 17.5rem; }
.tree-pick li[data-depth="1"] { padding-left: 1.125rem; }
.tree-pick li[data-depth="2"] { padding-left: 2.25rem; }
.tree-pick li[data-depth="3"], .tree-pick li[data-depth="4"] { padding-left: 3.375rem; }
.pick-h { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: .5rem .5rem 2px; font-weight: 650; }
.radios { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .375rem; }
.radios legend { padding: 0 0 .25rem; }
.radios label { display: flex; align-items: center; gap: .5rem; font-size: .9062rem; cursor: pointer; }
.task-row { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem 1.25rem; }
.task-row label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.due-l input { width: auto !important; }
.err-box { background: var(--red-bg); color: var(--red); border-radius: .625rem; padding: .75rem .875rem; }

/* ---------------------------------------------------------------- таблет и телефон */
@media (max-width: 1100px) {
  .lv-body { grid-template-columns: 12.5rem minmax(0, 1fr); }
  .org { max-width: 5rem; }   /* тясна лента — търсачката да не изчезне заради дълго име */
}
@media (max-width: 900px) {
  .d-grid { grid-template-columns: 1fr; }
  .preview { position: static; max-height: none; }
  .d-preview { order: 2; }
}
@media (max-width: 820px) {
  main, .shell.collapsed main, .shell.facets-on main { margin-left: 0; }
  .facets-dock { display: none; }
  .facets-inline { display: block; }
  .nav, .shell.collapsed .nav {
    position: fixed; top: var(--top-h); left: 0; bottom: 0; height: auto; width: min(18.75rem, 86vw); z-index: 40;
    transform: translateX(-102%); transition: transform .18s ease-out; box-shadow: 0 .5rem 1.875rem rgba(0,0,0,.18);
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
  }
  .shell.nav-open .nav { transform: none; }
  .nav-backdrop { display: block; position: fixed; inset: var(--top-h) 0 0 0; background: rgba(22, 32, 42, .35); z-index: 35; }
  .nv-collapse { display: none; }
  main { padding: .875rem .75rem 6.875rem; }
  h1 { font-size: 1.3125rem; }
  .org, .desk-only { display: none !important; }
  .top-l { width: auto; }
  .inbox-row .vsep { display: none; }   /* на телефона чиповете заемат реда — Чакащи | Приключени са на следващия */
  .brand .brand-word { display: none; }   /* на телефона — само знакът, освен ако има място (по-долу) */
  .gsearch { display: none; }
  .icon-btn.gsearch-btn { display: inline-flex; }
  .phone-only { display: inline-flex !important; }
  .phone-inline { display: inline !important; }
  .desk-inline { display: none; }
  .lv-head { align-items: flex-start; }
  .lv-acts .btn { padding: .4375rem .6875rem; }
  .search-l { display: none; }
  .search-w { flex-basis: 100%; max-width: none; order: -1; }
  .pv { inset: var(--top-h) 0 0 0; border-radius: 0; border: 0; }
  .fields { grid-template-columns: 1fr; }
  .party { grid-template-columns: 1fr 1fr; }
  .party .field:first-child { grid-column: 1 / -1; }
  .two { grid-template-columns: 1fr; }
  .party-page { grid-template-columns: 1fr; }
  .tok-help { columns: 1; }
  .opt-used { min-width: 0; }
  .actions.d-actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: .625rem .75rem calc(.625rem + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto;
  }
  .actions.d-actions .btn { flex: 1 0 auto; }
  .actions.d-actions .btn.magic { flex: none; }
  .actions.d-actions .save-btn[disabled] { display: none; }   /* на телефона „Запази“ се появява, щом има промени */
  .mine-item { flex-direction: column; }
  .st-grid { grid-template-columns: 1fr; }
  .tile.all { grid-column: auto; }
  /* на телефона: умаленото изображение до заглавието, останалото — на цялата ширина */
  .card-row { grid-template-columns: 4.5rem minmax(0, 1fr); column-gap: .75rem; row-gap: .5rem; padding: .625rem; align-items: start; }
  .c-main { display: contents; }
  .thumb { width: 4.5rem; height: 6.25rem; grid-row: 1 / span 2; }
  .c-top { grid-column: 2; flex-direction: column; gap: .125rem; }
  .c-meta { grid-column: 2; }
  .c-ctx, .c-sum, .c-lines, .c-reasons, .c-acts { grid-column: 1 / -1; }
  .c-sum { -webkit-line-clamp: 2; }
  .mine-item .btn { align-self: stretch; }
}

/* ---------------------------------------------------------------- AI чат (панел вдясно; на телефона — на цял екран) */
:root { --chat-w: 27rem; }
.chat-btn {
  display: inline-flex; align-items: center; gap: .375rem; height: 2.25rem; padding: 0 .75rem 0 .625rem; border-radius: 62.4375rem;
  border: 1px solid #C7DBF1; background: linear-gradient(135deg, #F2F7FD, #E7F0FA); color: var(--primary-strong); cursor: pointer;
  font-weight: 600; font-size: .875rem; flex: none;
}
.chat-btn:hover, .chat-btn.on { border-color: var(--primary); background: var(--primary-weak); }
.chat-btn.on { box-shadow: inset 0 0 0 1px var(--primary); }
.chat-btn .ic { width: 1.125rem; height: 1.125rem; color: var(--primary); }
@media (min-width: 821px) { .shell.chat-on main { margin-right: var(--chat-w); } }
@media (min-width: 380px) and (max-width: 820px) { .top:has(#env[hidden]) .brand .brand-word { display: block; height: 1rem; } }
.chat {
  position: fixed; top: var(--top-h); right: 0; bottom: 0; width: var(--chat-w); z-index: 26; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -.25rem 0 1rem rgba(22, 32, 42, .06);
}
.ch-head { display: flex; align-items: center; gap: .375rem; padding: .5rem .5rem .5rem .875rem; border-bottom: 1px solid var(--line); min-height: 3rem; }
.ch-head > .ic { color: var(--primary); }
.ch-title { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; padding: .5rem .875rem 0; }
.ch-chip { background: var(--primary-weak); color: var(--text); font-weight: 400; padding: 2px .25rem 2px .625rem; max-width: 100%; }
.ch-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 15rem; }
.ch-chip-x { border: 0; background: none; cursor: pointer; display: inline-flex; padding: .125rem; border-radius: 50%; color: var(--muted); }
.ch-chip-x:hover { background: #fff; color: var(--red); }
.ch-chip-x .ic { width: .875rem; height: .875rem; }
.ch-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .875rem; display: flex; flex-direction: column; gap: .875rem; }
.ch-empty { color: var(--muted); }
.ch-empty p { margin: .25rem 0 .75rem; }
.ch-sugg { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .375rem; }
.ch-sug { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--soft); border-radius: .625rem; padding: .5rem .75rem;
  cursor: pointer; color: var(--text); font-size: .875rem; }
.ch-sug:hover { border-color: var(--primary); background: var(--primary-weak); }
.ch-msg.me { align-self: flex-end; max-width: 88%; }
.ch-bub { background: var(--primary); color: #fff; border-radius: .875rem .875rem .25rem .875rem; padding: .5rem .75rem; white-space: pre-wrap; word-break: break-word; }
.ch-msg.bot { display: flex; flex-direction: column; gap: .625rem; }
.ch-msg.bot.busy { flex-direction: row; align-items: center; gap: .5rem; color: var(--muted); font-size: .875rem; }
.ch-msg.bot.err .ch-text { color: var(--red); }
.ch-text p { margin: 0 0 .375rem; }
.ch-text p:last-child { margin-bottom: 0; }
.ch-text ul { margin: .25rem 0 .375rem; padding-left: 1.25rem; }
.ch-unv { background: var(--amber-bg); color: var(--amber); border-radius: .25rem; padding: 0 .1875rem; }
.ch-note { margin: 0; }
.ch-cites { display: flex; flex-direction: column; gap: .375rem; }
.ch-cite { display: block; border-left: 3px solid var(--primary); background: var(--soft); padding: .375rem .625rem; border-radius: 0 .375rem .375rem 0;
  color: var(--text); text-decoration: none; font-size: .875rem; }
.ch-cite:hover { background: var(--primary-weak); color: var(--text); }
.ch-cite.nf { border-left-color: var(--amber); }
.ch-cite-p { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--primary-strong); margin-right: .375rem; }
.ch-cite q { font-style: italic; }
.ch-clar { display: flex; flex-direction: column; gap: .375rem; }
.ch-q { margin: 0; font-weight: 600; }
.ch-cards { display: flex; flex-direction: column; gap: .3125rem; }
.ch-card { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: .5rem; padding: .375rem .5rem; background: var(--surface); }
.ch-card:hover { border-color: var(--line-strong); }
.ch-card .eye { flex: none; }
.ch-card-m { flex: 1; min-width: 0; }
.ch-card-t { display: block; font-weight: 600; font-size: .875rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-card-m .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-card-a { font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.ch-card .chip { flex: none; }
.btn.sm { min-height: 1.875rem; padding: .25rem .625rem; font-size: .8125rem; }
.btn.sm .ic { width: .9375rem; height: .9375rem; }
.ch-tbl-w { border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; }
.ch-tbl-t { font-weight: 600; font-size: .8125rem; padding: .375rem .625rem; background: #FAFBFC; border-bottom: 1px solid var(--line); }
.ch-tbl-s { overflow-x: auto; max-height: 22rem; overflow-y: auto; }
.ch-tbl { border-collapse: collapse; width: 100%; font-size: .8125rem; }
.ch-tbl th, .ch-tbl td { padding: .3125rem .5rem; border-bottom: 1px solid #EEF1F3; text-align: left; white-space: nowrap; }
.ch-tbl th { position: sticky; top: 0; background: #FAFBFC; font-weight: 600; color: var(--muted); }
.ch-tbl td:first-child { white-space: normal; min-width: 8rem; }
.ch-tbl .num { text-align: right; }
.ch-tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); background: #FAFBFC; }
.ch-docs { display: inline-flex; gap: .375rem; }
.ch-basis { margin: 0; padding: .375rem .625rem; border-top: 1px solid var(--line); }
.ch-chart-w { border: 1px solid var(--line); border-radius: .5rem; padding: .375rem .5rem .25rem; }
.ch-chart { width: 100%; height: auto; display: block; }
.ch-chart .grid { stroke: #E5E9ED; stroke-width: 1; }
.ch-chart .ax { fill: var(--muted); font-size: 9px; }
.ch-chart .bar.b0, .ch-legend .b0 { fill: var(--primary); background: var(--primary); }
.ch-chart .bar.b1, .ch-legend .b1 { fill: #9DB6CF; background: #9DB6CF; }
.ch-chart .bar:hover { opacity: .8; }
.ch-legend { display: flex; gap: .75rem; font-size: .75rem; color: var(--muted); padding: 0 .25rem .25rem; }
.ch-legend i { display: inline-block; width: .625rem; height: .625rem; border-radius: 2px; margin-right: .25rem; vertical-align: -1px; }
.ch-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.ch-rate { margin-left: auto; display: inline-flex; gap: .125rem; }
.ch-rate .icon-btn { color: var(--muted); }
.ch-rate .icon-btn.on { color: var(--primary); background: var(--primary-weak); }
.ch-rate .icon-btn.on.bad { color: var(--red); background: var(--red-bg); }
.ch-foot { border-top: 1px solid var(--line); padding: .625rem .75rem calc(.5rem + env(safe-area-inset-bottom)); background: var(--surface); }
.ch-form { display: flex; align-items: flex-end; gap: .5rem; }
.ch-in { flex: 1; resize: none; min-height: 2.5rem; max-height: 9rem; border: 1px solid var(--line-strong); border-radius: .625rem; padding: .5rem .75rem; line-height: 1.4; }
.ch-in:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px #CFE2F6; }
.ch-send { min-height: 2.5rem; width: 2.75rem; padding: 0; justify-content: center; }
.ch-hint { margin: .375rem 0 0; font-size: .75rem; color: var(--muted); }
.ch-hist-h { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.ch-hist-h .linkish { margin-left: auto; }
.ch-hist ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.ch-hist li { display: flex; align-items: center; gap: .25rem; border-radius: .5rem; }
.ch-hist li.on { background: var(--primary-weak); }
.ch-hist-t { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; border: 0; background: none;
  padding: .4375rem .625rem; border-radius: .5rem; cursor: pointer; }
.ch-hist-t:hover { background: var(--soft); }
.ch-hist-t > span:first-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 820px) {
  .chat { inset: var(--top-h) 0 0 0; width: auto; z-index: 45; border-left: 0; box-shadow: none; }
  .chat-btn { width: 2.375rem; padding: 0; justify-content: center; }
  .chat-btn-l { display: none; }
  .ch-in { font-size: 1rem; }   /* без увеличаване от iPhone при фокус */
}
.ch-clar .ch-card-t, .ch-clar .ch-card-m .small { white-space: normal; }   /* при избор заглавието се чете цялото */
.ch-totals { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; font-size: .8125rem; padding: .375rem .5rem;
  background: var(--soft); border: 1px solid var(--line); border-radius: .5rem; }
.ch-tot { white-space: normal; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.card-h h2 { margin: 0; }
.money-w { position: relative; }
.money-w input { padding-right: 3.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.money-w .cur { position: absolute; right: .4375rem; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-size: .75rem; font-weight: 650; letter-spacing: .3px; color: var(--slate); background: var(--slate-bg); border-radius: .3125rem; padding: .125rem .375rem; }
.field.dirty .money-w .cur { background: var(--primary-weak); color: var(--primary-strong); }
.gen-w { display: flex; gap: .375rem; align-items: stretch; }
.gen-w input { flex: 1; min-width: 0; }
.gen-w .btn { white-space: nowrap; }
.lines-digest, .c-lines { margin: .375rem 0 0; font-size: .8438rem; color: var(--slate); }

/* ---------------------------------------------------------------- AI работи по документа: напредък */
.prog { display: inline-flex; flex-direction: column; gap: .25rem; min-width: 0; max-width: 100%; vertical-align: middle; }
.prog-l { display: flex; align-items: center; gap: .375rem; font-size: .8125rem; color: var(--primary); min-width: 0; }
.prog-l .spin { width: .75rem; height: .75rem; flex: none; }
.prog.sm { width: 100%; max-width: 13rem; }
.prog.sm .prog-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar { position: relative; height: 4px; background: #E3ECF7; border-radius: 2px; overflow: hidden; }
.pbar > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 2px; transition: width .6s ease; }
.pbar.run > i { background-image: linear-gradient(45deg, rgba(255,255,255,.28) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.28) 50%, rgba(255,255,255,.28) 75%, transparent 75%);
  background-size: 12px 12px; animation: pstripes 1s linear infinite; }
.pbar.indet > i { width: 35%; animation: pindet 1.4s ease-in-out infinite; }
@keyframes pstripes { to { background-position: 12px 0; } }
@keyframes pindet { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
.prog-card { border-color: #BFD5F2; background: #F7FAFE; }
.prog-h { display: flex; align-items: center; gap: .5rem; margin-bottom: .625rem; }
.prog-h h2 { margin: 0; flex: 1; }
.prog-pct { font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.prog-card .pbar { height: 8px; border-radius: 4px; }
.prog-now { margin: .5rem 0 .25rem; font-size: .9375rem; }
.psteps { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: .5rem 0 0; padding: 0; font-size: .8125rem; }
.psteps li { display: flex; align-items: center; gap: .3rem; color: var(--muted); }
.psteps li svg { width: 14px; height: 14px; color: #1E7B45; }
.psteps li.done { color: var(--text); }
.psteps li.cur { color: var(--primary); font-weight: 600; }
.psteps .dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid currentColor; display: inline-block; }
.psteps li.cur .dot { background: currentColor; }
.prog-note { margin: .625rem 0 0; font-size: .8125rem; }
@media (prefers-reduced-motion: reduce) { .pbar > i, .spin { animation: none !important; } }

/* ---------------------------------------------------------------- Процеси: превключвател, Начало, задачи, искания, искане */
.secsw { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; background: var(--slate-bg); border-radius: .625rem; }
.hdr-sw { flex: none; }
.hdr-sw .sw-b { min-height: 2rem; padding: 0 .75rem; }
.hdr-sw + .gsearch { margin-left: .75rem; }
.sw-b {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .375rem; min-height: 2.25rem; padding: 0 .375rem;
  border: 0; border-radius: .5rem; background: transparent; color: var(--muted); cursor: pointer; font-size: .875rem; font-weight: 550; white-space: nowrap;
}
.sw-b .ic { width: 1rem; height: 1rem; }
.sw-b:hover { color: var(--text); }
.sw-b.on { background: var(--surface); color: var(--primary-strong); font-weight: 650; box-shadow: 0 1px 3px rgba(22, 32, 42, .14); }
.sw-n { min-width: 1.125rem; height: 1.125rem; padding: 0 .3125rem; border-radius: 62.4375rem; background: var(--primary); color: #fff; font-size: .6875rem;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.secbar { display: none; }
.nv-start { padding: .25rem 0 .375rem; }
.nv-new { width: 100%; }
.nv-new .nv-label { flex: none; }
.nv-count.warn { background: var(--amber-bg); color: var(--amber); border-radius: 62.4375rem; padding: 1px .4375rem; }
.ptag { display: inline-flex; align-items: center; gap: .3125rem; max-width: 100%; min-height: 1.5rem; padding: 0 .5625rem; border-radius: 62.4375rem;
  background: var(--soft); border: 1px solid var(--line); color: var(--slate); font-size: .8125rem; font-weight: 500; text-decoration: none; overflow: hidden; }
.ptag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptag .ic { width: .8125rem; height: .8125rem; }
.ptag:hover { border-color: var(--primary); color: var(--primary-strong); }
.ptag.mine { background: var(--primary-weak); border-color: #9CC0E8; color: var(--primary-strong); font-weight: 600; }
.srcchips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.schip { min-height: 2.125rem; padding: 0 .8125rem; border-radius: 62.4375rem; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: .8438rem; }
.schip:hover { border-color: var(--primary); }
.schip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 650; }
/* „Входящи“: откъде (чипове) | черта | Чакащи · Приключени — две отделни групи на един ред */
.inbox-row .srcchips { margin-bottom: 0; }
.vsep { align-self: stretch; width: 1px; min-height: 1.75rem; background: var(--line-strong); margin: 0 .375rem; }
.st-mine { background: var(--primary-weak); color: var(--primary-strong); }
.st-proc { background: var(--slate-bg); color: var(--slate); }
.proc-card { border-color: #C7DBF1; }
.pc-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.pc-item + .pc-item { border-top: 1px solid #EEF1F3; margin-top: .625rem; padding-top: .625rem; }
.pc-t { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.pc-t .muted { font-size: .8438rem; }
.btn.sm { min-height: 2rem; padding: .25rem .75rem; font-size: .8438rem; }
.btn.big { min-height: 3rem; font-size: 1rem; width: 100%; }
.btn.amber-o { color: var(--amber); }
.btn.amber-o:hover { border-color: #E0A030; background: var(--amber-bg); color: var(--amber); }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.amber:hover, .btn.danger:hover { color: #fff; filter: brightness(.92); }
.ok-note { color: var(--green); font-weight: 650; font-size: .875rem; white-space: nowrap; }
.spill { display: inline-flex; align-items: center; padding: 2px .625rem; border-radius: 62.4375rem; font-size: .8125rem; font-weight: 650; white-space: nowrap; }
.spill.blue { background: var(--primary-weak); color: var(--primary-strong); }
.spill.amber { background: var(--amber-bg); color: var(--amber); }
.spill.green { background: var(--green-bg); color: var(--green); }
.spill.red { background: var(--red-bg); color: var(--red); }
.spill.gray { background: var(--slate-bg); color: var(--slate); }
.kpill { display: inline-block; min-width: 5.75rem; text-align: center; padding: 3px .625rem; border-radius: 62.4375rem; background: var(--slate-bg); color: var(--slate);
  font-size: .8125rem; font-weight: 650; white-space: nowrap; }
.kpill.a { background: var(--primary-weak); color: var(--primary-strong); }
.kpill.ok { background: var(--green-bg); color: var(--green); }
.kpill.f { background: var(--amber-bg); color: var(--amber); }
.kpill.r { background: var(--red-bg); color: var(--red); }
.due { font-size: .875rem; color: var(--slate); white-space: nowrap; }
.due.late { color: var(--red); font-weight: 650; }
.due.today { color: var(--amber); font-weight: 650; }
.flash { border-radius: .625rem; padding: .625rem .875rem; margin-bottom: .75rem; font-weight: 550; }
.flash a { font-weight: 650; white-space: nowrap; }
.flash.green { background: var(--green-bg); color: var(--green); }
.flash.amber { background: var(--amber-bg); color: var(--amber); }
.flash.red { background: var(--red-bg); color: var(--red); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Начало */
.htiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .75rem; margin-bottom: var(--gap); }
.htile { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem;
  padding: .75rem .875rem; color: var(--text); text-decoration: none; min-width: 0; }
a.htile:hover { border-color: var(--primary); color: var(--text); }
.ht-l { font-size: .8125rem; color: var(--muted); }
.ht-v { font-size: 1.75rem; font-weight: 650; line-height: 1.2; }
.ht-v.late { color: var(--red); }
.ht-v.warn { color: var(--amber); }
.ht-s { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-s.late { color: var(--red); font-weight: 650; }
.hgrid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.hcol { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.hcard { padding: .875rem 1rem .5rem; }
.hc-h { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding-bottom: .5rem; border-bottom: 1px solid #EEF1F3; }
.hc-h h2 { margin: 0; display: inline-flex; align-items: center; gap: .375rem; }
.hc-h a { font-size: .875rem; text-decoration: none; white-space: nowrap; }
.hc-empty { margin: .75rem 0; }
.hlist { list-style: none; margin: 0; padding: 0; }
.hlist li + li { border-top: 1px solid #EEF1F3; }
.hl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .6875rem .25rem; color: var(--text); text-decoration: none; }
.hl:hover { background: var(--soft); color: var(--text); }
.hl-m { display: flex; flex-direction: column; min-width: 0; }
.hl-m > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-m .muted { font-size: .8438rem; }
.hl-time { font: .8125rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); min-width: 3rem; }
.nlabel { display: inline-flex; align-items: center; gap: .25rem; padding: 2px .5625rem; border-radius: 62.4375rem; font-size: .7812rem; font-weight: 650;
  white-space: nowrap; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.nlabel .ic { width: .75rem; height: .75rem; }
.nlabel.proc { background: var(--primary-weak); color: var(--primary-strong); border: 1px solid #9CC0E8; }
.nlabel.ok { background: var(--green-bg); color: var(--green); }
.nlabel.review { background: var(--amber-bg); color: var(--amber); }
.nlabel.pending { background: var(--slate-bg); color: var(--muted); }
.lead { list-style: none; margin: .25rem 0 0; padding: 0; }
.lead li { display: grid; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr) 4.5rem 4.5rem; gap: .75rem; align-items: center; padding: .625rem 0; }
.ld-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-bar { display: flex; height: .5rem; border-radius: 62.4375rem; background: #ECEFF2; overflow: hidden; }
.ld-bar .ok { background: var(--primary); }
.ld-bar .lt { background: #E08A2E; }
.ld-c { text-align: right; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .875rem; }
.ld-a { text-align: right; color: var(--muted); font-size: .8438rem; }
.legend { display: flex; gap: 1rem; font-size: .8125rem; color: var(--muted); padding: .25rem 0 .5rem; }
.legend span::before { content: ""; display: inline-block; width: .625rem; height: .625rem; border-radius: 2px; margin-right: .375rem; vertical-align: -1px; }
.lg-ok::before { background: var(--primary); }
.lg-lt::before { background: #E08A2E; }
.hm { display: block; padding: .625rem .25rem; color: var(--text); text-decoration: none; }
.hm:hover { background: var(--soft); color: var(--text); }
.hm-t { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.hm-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Чака мен */
.ptabs { margin-bottom: .75rem; }
.ptable { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); table-layout: fixed; }
.ptable th { text-align: left; font-size: .8125rem; font-weight: 600; color: var(--slate); background: #FAFBFC; padding: .625rem .75rem; border-bottom: 1px solid var(--line); }
.ptable th:nth-child(1) { width: 12rem; } .ptable th:nth-child(3) { width: 11rem; } .ptable th:nth-child(5) { width: 9.5rem; } .ptable th:nth-child(6) { width: 9rem; }
.ptable td { padding: .6875rem .75rem; border-bottom: 1px solid #EEF1F3; vertical-align: middle; }
.ptable td.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptable td.t > * { overflow: hidden; text-overflow: ellipsis; }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:hover td { background: var(--soft); }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable td.act { text-align: right; white-space: nowrap; }
/* „Какво“: дългото действие („Вземи подписан CMR“, до 40 знака от конструктора) — в колоната, с „…“; цялото — в title */
.ptable td .kpill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.ptable .linkish { text-decoration: none; }
.pnote { margin: .625rem 0 0; }
.tcards { display: flex; flex-direction: column; gap: .625rem; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; padding: .75rem .875rem; }
.tcard.busy { opacity: .6; }
.tc-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .8125rem; }
.tc-k { color: var(--primary-strong); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-main { display: block; color: var(--text); text-decoration: none; margin-top: .125rem; }
.tc-main b { font-size: 1rem; }
.tc-acts { display: flex; gap: .5rem; margin-top: .625rem; }
.tc-acts .btn { flex: 1; min-height: 2.75rem; }
.tcard .flash { margin: 0; }

/* Моите искания */
.mcards { display: flex; flex-direction: column; gap: .75rem; max-width: 56rem; }
.mc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.mc-t { font-size: 1.0625rem; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .5rem; margin: .625rem 0; font-size: .875rem; }
.ch-i { display: inline-flex; align-items: center; gap: .375rem; }
.ch-dot { width: .625rem; height: .625rem; border-radius: 50%; box-sizing: border-box; flex: none; }
.ch-done .ch-dot { background: var(--green); }
.ch-cur { color: var(--primary-strong); font-weight: 650; }
.ch-cur .ch-dot { width: .75rem; height: .75rem; border: 3px solid var(--primary); }
.ch-cur.late { color: var(--red); }
.ch-stop { color: var(--amber); font-weight: 650; }
.ch-stop .ch-dot { background: var(--amber); }
.ch-next { color: var(--muted); }
.ch-next .ch-dot { border: 2px solid var(--line-strong); }
.ch-arr { color: #9AA5AF; }
.mc-ret { background: var(--amber-bg); color: var(--amber); border-radius: .5rem; padding: .5rem .75rem; margin: 0 0 .625rem; }
.mc-acts { display: flex; flex-wrap: wrap; gap: .5rem; }
.pm-h2 { margin: 1.5rem 0 .5rem; }
.recent { list-style: none; margin: 0; padding: 0; max-width: 56rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.recent li + li { border-top: 1px solid #EEF1F3; }
.recent a { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .625rem .875rem; color: var(--text); text-decoration: none; }
.recent a:hover { background: var(--soft); }
.rc-m { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* искането */
.pc-head { margin-bottom: .75rem; }
.pc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .75rem; margin-top: .375rem; font-size: .875rem; }
.c-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.c-actions .btn { min-height: 2.625rem; padding-left: 1.125rem; padding-right: 1.125rem; font-weight: 650; }
.c-actions .rel { margin-left: .25rem; }
.c-actions .wd { margin-left: auto; }
.task-note { margin: -.25rem 0 .75rem; }
.cpanel { margin-bottom: .75rem; border-color: #E0C48A; }
.cpanel form { display: flex; flex-direction: column; gap: .5rem; }
.cpanel h2 { margin: 0; }
.cpanel textarea, form.fix textarea { width: 100%; min-height: 4.5rem; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: .5rem; resize: vertical; }
.qreasons { display: flex; flex-wrap: wrap; gap: .5rem; }
.rchip { min-height: 2.25rem; padding: 0 .8125rem; border-radius: 62.4375rem; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: .875rem; }
.rchip:hover { border-color: #E0A030; }
.rchip.on { background: var(--amber-bg); border-color: #E0A030; color: var(--amber); font-weight: 650; }
.cp-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.done-form { margin-bottom: .75rem; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.df-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .625rem; flex: 1; min-width: 13rem; }
.pc-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.big-sum { font: 650 1.25rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.cdoc { display: grid; grid-template-columns: 4rem minmax(0, 1fr) auto; gap: .75rem; align-items: start; padding: .625rem; margin-top: .625rem;
  border: 1px solid var(--line); border-radius: .625rem; color: var(--text); text-decoration: none; }
a.cdoc:hover { border-color: var(--primary); color: var(--text); }
.cd-th { width: 4rem; height: 5.25rem; border: 1px solid var(--line); border-radius: .375rem; overflow: hidden; background: var(--soft); display: flex; align-items: center; justify-content: center; }
.cd-th img { width: 100%; height: 100%; object-fit: cover; object-position: top; -webkit-user-drag: none; user-select: none; }
.cd-th .thumb-x { font-size: .6875rem; color: var(--muted); text-align: center; }
.cd-m { display: flex; flex-direction: column; gap: .1875rem; min-width: 0; }
.cd-m b { overflow-wrap: anywhere; }
.cd-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.cd-amt { font: 600 .9375rem/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: nowrap; }
.cdoc.pend { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .875rem; border-style: dashed; }
.cdoc.pend.bad { color: var(--red); border-color: #F2B8B3; }
.cd-foot { margin-top: .75rem; }
.note-card p { margin: .25rem 0 0; white-space: pre-wrap; }
.askl { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .375rem 1rem; margin: 0; }
.askl dt { color: var(--muted); }
.askl dd { margin: 0; font-weight: 550; }
.links-card h2 .ic { color: var(--primary); }
.plink { margin-top: .625rem; }
.plink.off { opacity: .7; }
.pl-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.plink code { background: var(--soft); border: 1px solid var(--line); border-radius: .375rem; padding: .3125rem .5rem; font-size: .8125rem; word-break: break-all; }
.plink p { margin: .375rem 0; }
.pl-acts { display: flex; flex-wrap: wrap; gap: .5rem; }
.fix-card { border-color: #F0C98A; background: #FFFBF3; }
.fix-h { display: flex; gap: .625rem; align-items: flex-start; }
.fix-h > .ic { color: var(--amber); margin-top: .1875rem; }
.fix-h p { margin: .25rem 0 0; }
form.fix { display: flex; flex-direction: column; gap: .375rem; margin-top: .875rem; padding-top: .75rem; border-top: 1px solid #F3DDB3; }
form.fix label { font-size: .8125rem; color: var(--muted); }
.fx-docs { display: flex; flex-direction: column; gap: .25rem; margin: .25rem 0; }
.fx-d { display: flex; align-items: center; gap: .5rem; color: var(--text) !important; font-size: .875rem !important; cursor: pointer; }
.tl { list-style: none; margin: .5rem 0 0; padding: 0; }
.tl li { position: relative; padding: 0 0 1rem 2.125rem; }
.tl li::before { content: ""; position: absolute; left: .6875rem; top: 1.625rem; bottom: .125rem; width: 2px; background: var(--line); }
.tl li:last-child { padding-bottom: .25rem; }
.tl li:last-child::before { display: none; }
.tl li.tl-done::before { background: #A9D8B6; }
.tl-dot { position: absolute; left: 0; top: .0625rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box; background: var(--surface); border: 2px solid var(--line-strong); }
.tl-dot .ic { width: .875rem; height: .875rem; stroke-width: 3; }
.tl-done .tl-dot { background: var(--green); border-color: var(--green); color: #fff; }
.tl-cur .tl-dot { border: .1875rem solid var(--primary); }
.tl-cur.late .tl-dot { border-color: var(--red); }
.tl-skip .tl-dot { border-style: dashed; }
.tl-stop .tl-dot { background: var(--amber); border-color: var(--amber); }
.tl-t { font-weight: 650; }
.tl-cur .tl-t { color: var(--primary-strong); }
.tl-cur.late .tl-t { color: var(--red); }
.tl-next .tl-t { font-weight: 500; color: var(--slate); }
.tl-skip .tl-t { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.tl-stop .tl-t { color: var(--amber); }
.tl-w { font-size: .8438rem; color: var(--muted); }
.tl-n { font-size: .8438rem; }
.tl-cur .tl-n { color: var(--primary-strong); }
.tl-cur.late .tl-n { color: var(--red); font-weight: 600; }
.if-late { background: var(--soft); border-radius: .5rem; padding: .625rem .75rem; font-size: .8438rem; color: var(--muted); margin: .5rem 0 0; }
.busy-case { cursor: progress; }

/* „Започни процес“ */
.sform { display: flex; flex-direction: column; gap: .75rem; }
.sf-h { font-size: .9375rem; font-weight: 650; margin: .125rem 0 0; }
.sf-procs { display: flex; flex-direction: column; gap: .5rem; }
.sf-p { display: flex; align-items: center; gap: .75rem; text-align: left; padding: .625rem .75rem; border: 1px solid var(--line); border-radius: .625rem;
  background: var(--surface); cursor: pointer; color: var(--text); }
.sf-p:hover { border-color: var(--primary); }
.sf-p.on { border: 2px solid var(--primary); background: var(--primary-weak); padding: calc(.625rem - 1px) calc(.75rem - 1px); }
.sf-dot { width: 1.125rem; height: 1.125rem; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; background: #fff; box-sizing: border-box; }
.sf-p.on .sf-dot { border: .3125rem solid var(--primary); }
.sf-pm { display: flex; flex-direction: column; min-width: 0; }
.sf-up { margin: 0; }
/* „Започни процес“, стъпка 1: кратък списък (име · през кого), последните горе, търсене при много процеси */
.sf-q { width: 100%; min-height: 2.5rem; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff; }
.sf-pick { display: flex; flex-direction: column; gap: .375rem; }
.sf-gl { margin: .375rem 0 0; font-size: .75rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sf-rows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: .625rem; overflow: hidden; background: var(--surface); }
.sf-row { display: flex; align-items: baseline; gap: .75rem; width: 100%; padding: .5625rem .75rem; border: 0; border-top: 1px solid #EEF1F3;
  background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.sf-row:first-child { border-top: 0; }
.sf-row:hover, .sf-row:focus-visible { background: var(--primary-weak); }
.sf-row b { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-r { flex: 1; min-width: 0; text-align: right; color: var(--muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* стъпка 2: избраният процес и „Смени“ */
.sf-picked { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .75rem;
  border: 1px solid var(--primary); border-radius: .625rem; background: var(--primary-weak); }
.sf-picked h3 { margin: 0; font-size: 1rem; }
@media (max-width: 820px) {
  .sf-row { flex-direction: column; align-items: flex-start; gap: .125rem; padding: .625rem .75rem; }
  .sf-row b { max-width: 100%; }
  .sf-r { text-align: left; width: 100%; }
}
.sf-files { display: flex; flex-direction: column; gap: .5rem; }
.sf-files p { margin: 0; }
.sf-list { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sf-file { display: inline-flex; align-items: center; gap: .375rem; max-width: 100%; padding: .25rem .25rem .25rem .375rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--soft); font-size: .875rem; }
.sf-n { min-width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--text); color: #fff; font-size: .6875rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sf-fn { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-add { display: inline-flex; align-items: center; gap: .375rem; min-height: 2.375rem; padding: 0 .875rem; border: 1px dashed var(--line-strong); border-radius: .5rem;
  background: var(--surface); color: var(--primary-strong); cursor: pointer; font-weight: 600; font-size: .875rem; }
.sf-add:hover { border-color: var(--primary); background: var(--primary-weak); }
.sf-through { border: 1px solid var(--line); border-radius: .75rem; padding: .75rem .875rem; background: var(--surface); }
.sf-through > b { font-size: .875rem; }
.thru { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin: .5rem 0 .25rem; }
.pill { padding: 3px .625rem; border-radius: 62.4375rem; background: var(--slate-bg); color: var(--slate); font-size: .875rem; font-weight: 500; }
.pill.me { background: var(--primary-weak); color: var(--primary-strong); }
.hint { color: var(--amber); font-size: .875rem; margin: .25rem 0 0; }
.sf-through .muted { margin: .25rem 0 0; }
.sf-ask { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .625rem; }
.sf-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.sform textarea { resize: vertical; }
.pnew { max-width: 44rem; }
.pnew .sform { margin-top: .5rem; }
.pnew-send { margin-top: 1rem; }
.procbar { display: none; }

@media (max-width: 1100px) {
  .hgrid, .pc-grid { grid-template-columns: minmax(0, 1fr); }
  .hdr-sw .sw-b { padding: 0 .5rem; }
}
@media (max-width: 820px) {
  .hdr-sw { display: none; }
  .secbar { display: block; padding: .5rem .75rem; background: var(--surface); border-bottom: 1px solid var(--line); }
  .secbar[hidden] { display: none !important; }
  .secbar .secsw { margin: 0; }
  .secbar .sw-b { min-height: 2.625rem; font-size: .9375rem; }
  .procbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .procbar[hidden] { display: none !important; }
  .pb { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .4375rem; font-size: .75rem; color: var(--slate); text-decoration: none; }
  button.pb { border: 0; background: none; font: inherit; font-size: .75rem; cursor: pointer; }
  body.has-pbar .toast { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }   /* над долната лента */
  .pb.on { color: var(--primary-strong); font-weight: 650; }
  .pb-i { position: relative; display: inline-flex; }
  .pb-i .ic { width: 1.375rem; height: 1.375rem; }
  .pb-n { position: absolute; top: -.25rem; right: -.75rem; min-width: 1.125rem; height: 1.125rem; padding: 0 .25rem; border-radius: 62.4375rem; background: var(--primary);
    color: #fff; font-size: .6875rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
  .desk-block, .desk-flex { display: none !important; }
  .htiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .ht-v { font-size: 1.5rem; }
  .ptabs { display: flex; overflow-x: auto; }
  .ptabs > a { white-space: nowrap; }
  .c-actions.has-task { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0; padding: .625rem .75rem calc(.625rem + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; }
  .c-actions.has-task .btn { flex: 1 1 0; min-width: 0; min-height: 3rem; padding-left: .5rem; padding-right: .5rem; }
  .hl { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "k . d" "m m m"; row-gap: .25rem; }
  .hl .kpill { grid-area: k; }
  .hl .due { grid-area: d; }
  .hl .hl-m { grid-area: m; }
  .cdoc { grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .625rem; }
  .cd-th { width: 3rem; height: 4rem; }
  .c-actions.has-task .rel, .c-actions.has-task .wd { display: none; }
  .cpanel.open { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; margin: 0; border-radius: 1rem 1rem 0 0; max-height: 85vh; overflow-y: auto;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)); box-shadow: 0 -.5rem 2rem rgba(22, 32, 42, .22); }
  body.sheet-on::after { content: ""; position: fixed; inset: 0; background: rgba(22, 32, 42, .35); z-index: 44; }
  .cpanel .rchip { min-height: 2.5rem; }
  .cpanel .cp-acts .btn { flex: 1; min-height: 3rem; }
  .lead li { grid-template-columns: minmax(0, 1fr) 4rem; }
  .pnew-send { position: fixed; left: 0; right: 0; bottom: calc(3.625rem + env(safe-area-inset-bottom)); z-index: 24; margin: 0; padding: .625rem .75rem;
    background: var(--surface); border-top: 1px solid var(--line); }
  .pnew { padding-bottom: 5rem; }
  .sf-fn { max-width: 9rem; }
}

/* Процеси, етап 4: Всички в ход, Изключения, Настройка */
.htiles.watch { grid-template-columns: repeat(auto-fit, minmax(10.5rem, 13.5rem)); }
.schip { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }
.schip.on { color: #fff; }
.schip.late-chip:not(.on) { color: var(--red); border-color: #F2B8B3; }
.schip.late-chip.on { background: var(--red); border-color: var(--red); }
.ptable th.num, .ptable td.num { text-align: right; }
.ptable td.num.late { color: var(--red); font-weight: 650; }
.ptable tr.exc td:first-child { box-shadow: inset 3px 0 0 #E0A030; }
.pall-t th:nth-child(1) { width: auto; } .pall-t th:nth-child(2) { width: 11rem; } .pall-t th:nth-child(3) { width: 12rem; }
.pall-t th:nth-child(4) { width: 16rem; } .pall-t th:nth-child(5) { width: 6.5rem; } .pall-t th:nth-child(6) { width: 9rem; }
.tc-link { display: block; color: var(--text); text-decoration: none; }
.tc-link:hover { border-color: var(--primary); color: var(--text); }
.ecards { display: flex; flex-direction: column; gap: .75rem; max-width: 56rem; }
.ec-top { display: flex; justify-content: space-between; gap: .75rem; }
.ec-t { display: block; margin-top: 2px; }
.ec-why { color: var(--amber); margin: .25rem 0 .625rem; }
.ec-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.ec-acts .linkish { text-decoration: none; }
.ecard .flash { margin: 0; }
.kdot { display: inline-block; width: .875rem; height: .875rem; border-radius: .25rem; background: #5E6A75; flex: none; }
.k-approve { background: #0B5CAD; } .k-task { background: #3F4B57; } .k-cond { background: #B26F00; } .k-notify { background: #0F6B66; }
.k-action { background: #3B4BA8; } .k-ai { background: #6B47DC; } .k-end { background: #16202A; } .k-start { background: #5E6A75; }
.kchain { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.kleg { margin: .5rem 0 1rem; flex-wrap: wrap; }
.kleg span { display: inline-flex; align-items: center; gap: .375rem; }
.kleg span::before { display: none; }
.padm-t th:nth-child(1) { width: 15rem; } .padm-t th:nth-child(3) { width: 9rem; } .padm-t th:nth-child(4),
.padm-t th:nth-child(5) { width: 6.5rem; } .padm-t th:nth-child(6) { width: 6.5rem; } .padm-t th:nth-child(7) { width: 11rem; }
.padm-t th:nth-child(8) { width: 8.5rem; }
.padm-t td a { text-decoration: none; color: var(--text); }
.chip.dr { margin-left: .375rem; }
.padm-cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.deps { list-style: none; margin: .5rem 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.dep { position: relative; border: 1px solid var(--line); border-radius: .625rem; padding: .5rem 2.5rem .5rem .75rem; }
.dep-t { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.dep-t .ic { width: .875rem; height: .875rem; color: var(--muted); }
.dep-x { position: absolute; top: .375rem; right: .375rem; }
.sets { grid-template-columns: minmax(9rem, auto) 1fr; margin-top: .5rem; font-size: .875rem; }
.sets dd { font-weight: 450; }
.role-row { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; align-items: center; margin-top: .375rem; }
.role-row select, dialog select, dialog input[type=number] { width: 100%; min-height: 2.5rem; padding: .375rem .5rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff; }
.dp-procs { display: flex; flex-direction: column; gap: .25rem; margin-top: .375rem; }
dialog details summary { cursor: pointer; color: var(--primary); font-size: .875rem; }
.amber-t { color: var(--amber); }
.vers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.vers-stop { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding-top: .875rem; border-top: 1px solid var(--line); }
.vers-stop > div { flex: 1; min-width: 0; }
.vers-stop p { margin: .125rem 0 0; }
/* Настройка › Процеси › Спрени */
.pstopped { margin-top: 1rem; }
.pst { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.pst li { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--line); border-radius: .625rem; padding: .5rem .75rem; }
.pst-t { flex: 1; min-width: 0; }
.vers li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .375rem 0; border-bottom: 1px solid #EEF1F3; }
@media (max-width: 1100px) { .padm-cards { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .padm-t { min-width: 72rem; }
  .htiles.watch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sets, .role-row { grid-template-columns: minmax(0, 1fr); }
}
.pinfo { background: var(--blue-bg); border: 1px solid #C7DBF1; border-radius: .5rem; padding: .5625rem .75rem; font-size: .875rem; margin: 0 0 .75rem; }

/* Процесът като схема (по мокъпа на конструктора): стъпките една под друга, разклоненията — колони, които се събират */
.pdef .crumbs { margin-bottom: .25rem; }
.pdef-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.utabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: var(--gap); overflow-x: auto; }
.utabs > a { padding: .625rem .875rem; color: var(--slate); text-decoration: none; font-weight: 550; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.utabs > a:hover { color: var(--text); }
.utabs > a.on { color: var(--primary-strong); border-bottom-color: var(--primary); font-weight: 650; }
.fgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 25rem); gap: var(--gap); align-items: start; }
.fcanvas { padding: 1.5rem 1rem; overflow-x: auto; }
.flow { display: flex; flex-direction: column; align-items: center; width: 100%; }
.fline { display: block; width: 2px; height: 1.75rem; background: var(--line-strong); flex: none; }
.fline.short { height: .625rem; }
.fnode { width: 100%; max-width: 29rem; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: .75rem; align-items: start; text-align: left;
  padding: .75rem .875rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.fnode:hover { border-color: #9CC0E8; }
.fnode.on { border: 2px solid var(--primary); padding: calc(.75rem - 1px) calc(.875rem - 1px); box-shadow: 0 0 0 3px rgba(11, 92, 173, .12); }
.fnode.empty { display: block; text-align: center; color: var(--muted); border-style: dashed; cursor: default; font-size: .875rem; padding: .625rem; }
.fn-ic { width: 2.25rem; height: 2.25rem; border-radius: .5rem; display: inline-flex; align-items: center; justify-content: center; background: var(--slate-bg); color: var(--slate); flex: none; }
.fn-ic .ic { width: 1.125rem; height: 1.125rem; }
.t-approve .fn-ic, .fn-ic.t-approve { background: var(--primary-weak); color: var(--primary); }
.t-ai .fn-ic, .fn-ic.t-ai { background: #F0EBFD; color: #6B47DC; }
.t-cond .fn-ic, .fn-ic.t-cond { background: var(--amber-bg); color: #B26F00; }
.t-notify .fn-ic, .fn-ic.t-notify { background: #E3F3F1; color: #0F6B66; }
.t-action .fn-ic, .fn-ic.t-action { background: #E8EAF8; color: #3B4BA8; }
.fn-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fn-type { font-size: .6875rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.fn-name { font-size: .9688rem; }
.fn-desc { font-size: .8438rem; color: var(--muted); }
.fn-chips { display: flex; flex-wrap: wrap; gap: .25rem .375rem; margin-top: .25rem; }
.fnchip { display: inline-flex; padding: 1px .5rem; border-radius: .375rem; background: var(--slate-bg); color: var(--slate); font-size: .75rem; font-weight: 500; }
.fnchip.esc { background: var(--primary-weak); color: var(--primary-strong); }
.fnchip.cond { background: var(--amber-bg); color: var(--amber); }
.fbr { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(13rem, 1fr); width: 100%; max-width: 44rem; }
.fcol { display: flex; flex-direction: column; align-items: center; padding: 0 .5rem; min-width: 0; }
.fc-top, .fc-bot { position: relative; display: block; width: calc(100% + 1rem); margin: 0 -.5rem; height: .875rem; flex: none; }
.fc-top::before, .fc-bot::before { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--line-strong); }
.fc-top::before { top: 0; }
.fc-bot::before { bottom: 0; }
.fcol.first .fc-top::before, .fcol.first .fc-bot::before { left: 50%; }
.fcol.last .fc-top::before, .fcol.last .fc-bot::before { right: 50%; }
.fc-top::after, .fc-bot::after { content: ""; position: absolute; left: calc(50% - 1px); top: 0; bottom: 0; width: 2px; background: var(--line-strong); }
.fc-fill { display: block; flex: 1; width: 2px; min-height: .875rem; background: var(--line-strong); }
.blabel { display: inline-flex; padding: 2px .75rem; border-radius: 62.4375rem; background: var(--amber-bg); color: #8A5300; border: 1px solid #F0C98A;
  font-size: .8125rem; font-weight: 650; white-space: nowrap; }
.blabel.else { background: #FFF8EA; color: #8A5300; }
.fpanel { position: sticky; top: calc(var(--top-h) + .75rem); }
.fp-h { display: flex; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.fp-h h2 { margin: 0; }
.fp-desc { margin: 0 0 .75rem; color: var(--muted); font-size: .875rem; }
.fp-rows { display: flex; flex-direction: column; }
.fp-row { display: grid; grid-template-columns: minmax(7rem, 38%) 1fr; gap: .75rem; padding: .5rem 0; border-top: 1px solid #EEF1F3; font-size: .875rem; }
.fp-l { color: var(--muted); }
.fp-v { font-weight: 500; }
.fp-sec { border-top: 1px solid #EEF1F3; padding-top: .625rem; margin-top: .5rem; display: flex; flex-direction: column; gap: .375rem; }
.fp-sec p { margin: 0; }
.fp-dec { display: flex; justify-content: space-between; gap: .5rem; padding: .375rem .625rem; border: 1px solid var(--line); border-radius: .5rem; font-size: .875rem; }
.fp-dec.ok > span:first-child { color: var(--green); font-weight: 650; }
.fp-dec.ret > span:first-child { color: var(--amber); font-weight: 650; }
.fp-dec.rej > span:first-child { color: var(--red); font-weight: 650; }
.fp-br { display: flex; flex-direction: column; gap: 2px; padding: .375rem 0; }
.fp-br .blabel { align-self: flex-start; }
.fp-note { margin: .75rem 0 0; }
.exc-rules .fp-row { grid-template-columns: minmax(12rem, 35%) 1fr; }
.chip.own { margin-left: .5rem; }
@media (max-width: 1100px) { .fgrid { grid-template-columns: minmax(0, 1fr); } .fpanel { position: static; } }
@media (max-width: 820px) {
  .fcanvas { padding: 1rem .5rem; }
  .fbr { grid-auto-flow: row; grid-auto-columns: auto; max-width: none; }
  .fc-top::before, .fc-bot::before { display: none; }
  .fcol { padding: 0; }
}

/* Конструкторът (етап 5): „+“ между стъпките с палитра, панел с формата на стъпката, „Тествай с документ“ */
.btn.sm { min-height: 2rem; padding: .3125rem .625rem; font-size: .8438rem; }
.btn.sm.icon { padding: .3125rem .4375rem; }
.btn.danger-b { color: var(--red); }
.btn.danger-b:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.ped .pdef-head { align-items: flex-start; }
.pe-ttl { min-width: 0; }
.pe-acts { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pe-acts .btn { min-height: 2.625rem; padding: .5rem 1rem; }
.pe-status { margin-left: .25rem; }
.pe-status.err { color: var(--red); }
.pprob { display: flex; gap: .625rem; align-items: flex-start; background: #FFF8EA; border: 1px solid #F0C98A; border-radius: .625rem; padding: .625rem .875rem; margin-bottom: .75rem; font-size: .875rem; }
.pprob > .ic { color: #B26F00; margin-top: 2px; }
.pprob ul { margin: .25rem 0 0; padding-left: 1.125rem; }
.pprob p { margin: .25rem 0 0; }
/* схемата за редакция */
.fcanvas.edit { padding-bottom: 2rem; }
.fplus { display: flex; flex-direction: column; align-items: center; width: 100%; }
.fline.xs { height: .375rem; }
.fp-btn { width: 2.25rem; height: 2.25rem; border: 0; background: transparent; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fp-dot { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; transition: transform .12s var(--ease); }
.fp-dot .ic { width: .875rem; height: .875rem; stroke-width: 2.5; }
.fp-btn:hover .fp-dot, .fplus.open .fp-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.fplus.open .fp-dot { transform: rotate(45deg); }
.fpal { width: min(31rem, 100%); margin: .125rem 0 .375rem; padding: .75rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: .75rem; box-shadow: 0 .625rem 1.75rem rgba(22, 32, 42, .14); }
.fpal-h { font-size: .8125rem; font-weight: 650; color: var(--slate); margin-bottom: .5rem; }
.fpal-g { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .375rem; }
.fpal-i { display: flex; gap: .625rem; align-items: flex-start; padding: .5rem .625rem; border: 1px solid var(--line); border-radius: .625rem; background: var(--surface); text-align: left; cursor: pointer; min-height: 2.75rem; font: inherit; color: var(--text); }
.fpal-i:hover:not(:disabled) { border-color: var(--primary); background: #F5F9FE; }
.fpal-i:disabled { opacity: .5; cursor: default; }
.fpal-i .fn-ic { width: 1.875rem; height: 1.875rem; }
.fpal-i .fn-ic .ic { width: 1rem; height: 1rem; }
.fpal-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fpal-t b { font-size: .875rem; }
.fpal-t span { font-size: .75rem; color: var(--muted); }
button.blabel { cursor: pointer; font-family: inherit; }
button.blabel:hover { border-color: #D9A44E; }
.fcol .fplus .fp-dot { width: 1.25rem; height: 1.25rem; }
/* „Тествай с документ“: пътят светва, прескоченото избледнява, под стъпката — при кого отива */
.fn-test { margin-top: .375rem; font-size: .8125rem; font-weight: 600; color: var(--green); }
.fnode.tst-on, .fnode.tst-branch { border-color: #8CC79F; background: #F4FBF6; }
.fnode.tst-on.on, .fnode.tst-branch.on { border-color: var(--primary); }
.fnode.tst-skip { opacity: .6; background: #FAFBFC; border-style: dashed; }
.fnode.tst-skip .fn-test, .fnode.tst-off .fn-test { color: var(--muted); font-weight: 450; font-style: italic; }
.fnode.tst-off { opacity: .45; border-style: dashed; }
.fnode.tst-exception { border-color: #E8A39D; background: #FFF8F7; }
.fnode.tst-exception .fn-test { color: var(--red); }
.fnode.tst-ask { border-color: #F0C98A; background: #FFFBF2; }
.fnode.tst-ask .fn-test { color: var(--amber); }
.fcol.tst-off > .blabel, .fcol.tst-off > .fnode { opacity: .45; }
.blabel.hit { background: var(--green-bg); color: var(--green); border-color: #8CC79F; }
.ptest { display: flex; flex-direction: column; gap: .5rem; padding: .75rem 1rem; border: 1px solid #9CC0E8; background: #F5F9FE; border-radius: .75rem; margin-bottom: var(--gap); }
.pt-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pt-l { font-size: .875rem; font-weight: 650; color: var(--primary-strong); }
.pt-sub { margin-left: .5rem; }
.pt-doc { display: inline-flex; align-items: center; gap: .375rem; padding: 2px 2px 2px .625rem; border-radius: 62.4375rem; background: var(--surface); border: 1px solid var(--line-strong); font-size: .8125rem; max-width: 22rem; }
.pt-doc > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-doc button { border: 0; background: none; cursor: pointer; color: var(--muted); display: inline-flex; padding: .125rem; border-radius: 50%; }
.pt-doc button:hover { background: var(--slate-bg); }
.pt-doc .ic { width: .75rem; height: .75rem; }
.pt-sel { width: auto; max-width: 16rem; min-height: 2rem; padding: .25rem .5rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff; }
.pt-doc .muted { white-space: nowrap; }
.pt-x { margin-left: auto; }
.pt-ask { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; }
.pt-ask .pe-f { min-width: 9rem; }
.pt-res { display: flex; flex-wrap: wrap; gap: .375rem 1rem; font-size: .875rem; }
.pt-list { display: flex; flex-direction: column; gap: .25rem; max-height: 22rem; overflow-y: auto; margin-top: .25rem; }
.pt-item { display: flex; flex-direction: column; gap: 1px; text-align: left; padding: .5rem .625rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.pt-item:hover { border-color: var(--primary); }
.pt-item.on { border: 2px solid var(--primary); padding: calc(.5rem - 1px) calc(.625rem - 1px); background: #F5F9FE; }
.pt-t { font-weight: 600; font-size: .875rem; }
/* панелът на стъпката */
.pe-panel { display: flex; flex-direction: column; gap: .875rem; max-height: calc(100vh - var(--top-h) - 1.5rem); overflow-y: auto; }
.pe-panel .fp-h { margin-bottom: 0; }
.pe-f { display: flex; flex-direction: column; gap: .3125rem; min-width: 0; }
.pe-f > label { font-size: .8125rem; font-weight: 650; color: var(--slate); }
.pe-panel input[type=text], .pe-panel input[type=number], .pe-panel input[type=date], .pe-panel input:not([type]), .pe-panel select, .pe-panel textarea,
.pt-ask input[type=text], .pt-ask input[type=date], .pt-ask select {
  width: 100%; min-height: 2.375rem; padding: .375rem .625rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: #fff; min-width: 0; }
.pe-panel textarea { resize: vertical; line-height: 1.45; }
.pe-panel input:focus, .pe-panel select:focus, .pe-panel textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(11, 92, 173, .12); }
.pe-sec { display: flex; flex-direction: column; gap: .5rem; padding-top: .875rem; border-top: 1px solid #EEF1F3; }
.pe-h { font-size: .8125rem; font-weight: 650; color: var(--slate); }
.pe-h.sub { margin-top: .25rem; }
.pe-hint { margin: 0; font-size: .8125rem; color: var(--muted); line-height: 1.45; }
.pe-p { margin: 0; font-size: .875rem; color: var(--slate); line-height: 1.5; }
.pe-rule { margin: 0; font-size: .875rem; }
.pe-ck { display: flex; gap: .5rem; align-items: flex-start; font-size: .875rem; cursor: pointer; }
.pe-ck input { width: 1.0625rem; height: 1.0625rem; margin: .125rem 0 0; flex: none; }
.pe-radios { display: flex; flex-direction: column; gap: .375rem; }
.pe-link { align-self: flex-start; border: 0; background: none; padding: .25rem 0; color: var(--primary); font: inherit; font-size: .8438rem; cursor: pointer; font-weight: 550; }
.pe-link:hover { text-decoration: underline; }
.pe-num { width: 5rem !important; flex: none; }
.pe-mono { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: .8125rem; }
.pe-who { display: flex; flex-direction: column; gap: .5rem; }
.pe-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .375rem; }
.pe-seg button { min-height: 2.25rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); font: inherit; font-size: .8438rem; cursor: pointer; }
.pe-seg button:hover { border-color: var(--primary); }
.pe-seg button[aria-pressed="true"] { border: 2px solid var(--primary); background: var(--primary-weak); color: var(--primary-strong); font-weight: 650; padding: calc(.25rem - 1px) calc(.5rem - 1px); }
.pe-due { display: flex; gap: .5rem; }
.pe-due select { flex: 1; }
.pe-esc { display: flex; flex-direction: column; gap: .375rem; }
.pe-erow { display: flex; flex-direction: column; gap: .375rem; padding: .5rem; border: 1px solid var(--line); border-radius: .625rem; background: var(--soft); }
.pe-erow-t { display: flex; align-items: center; gap: .375rem; }
.pe-erow-t select { flex: 1; }
.pe-erow-t .icon-btn { margin-left: auto; }
.pe-cond { display: flex; flex-direction: column; gap: .375rem; }
.pe-crow { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .8fr) minmax(0, 1fr) 1.75rem; gap: .375rem; align-items: center; }
.pe-crow.nested { grid-template-columns: 1fr 1.75rem; padding: .375rem .5rem; border: 1px dashed var(--line-strong); border-radius: .5rem; }
.pe-cv { display: flex; gap: .25rem; min-width: 0; }
.pe-cv:empty { display: block; }
.pe-cv.two input { min-width: 0; }
.pe-brs { display: flex; flex-direction: column; gap: .5rem; }
.pe-br { display: flex; flex-direction: column; gap: .5rem; padding: .625rem; border: 1px solid var(--line); border-radius: .625rem; background: var(--soft); }
.pe-br.else { background: var(--surface); }
.pe-br-h { display: flex; align-items: center; gap: .375rem; }
.pe-br-n { width: 1.375rem; height: 1.375rem; border-radius: 50%; background: var(--amber-bg); color: var(--amber); font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pe-br-h .pe-bname { flex: 1; font-weight: 600; }
.pe-rows { display: flex; flex-direction: column; gap: .375rem; }
.pe-row { display: flex; gap: .375rem; align-items: center; }
.pe-row > input[type=text] { flex: 1; }
.pe-row > select { width: auto; flex: none; max-width: 45%; }
.pe-row .pe-ck { flex: none; white-space: nowrap; font-size: .8125rem; }
.pe-row.sub { padding-left: .25rem; }
.pe-askrow { display: flex; flex-direction: column; gap: .25rem; padding: .5rem; border: 1px solid var(--line); border-radius: .5rem; }
.pe-key { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.pe-det > summary { cursor: pointer; font-size: .8438rem; font-weight: 600; color: var(--primary); }
.pe-det[open] > summary { margin-bottom: .25rem; }
.pe-toks { display: flex; flex-wrap: wrap; gap: .375rem; align-items: center; }
.pe-tok { padding: 2px .5rem; border-radius: .375rem; background: #F4F6F8; border: 1px solid var(--line); font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: .75rem; cursor: pointer; }
.pe-tok:hover { border-color: var(--primary); color: var(--primary-strong); }
.pe-panel .pe-tok-sel { width: auto; min-height: 1.75rem; padding: 0 .375rem; font-size: .75rem; }
.pe-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.pe-two .pe-num { width: 100% !important; }
.pe-indent { display: flex; flex-wrap: wrap; gap: .375rem; align-items: center; padding-left: 1.5625rem; }
.pe-chip { display: inline-flex; align-items: center; gap: .25rem; padding: 2px 2px 2px .625rem; border-radius: 62.4375rem; background: var(--primary-weak); color: var(--primary-strong); font-size: .8125rem; font-weight: 550; }
.pe-chip.all { padding-right: .625rem; }
.pe-chip button { border: 0; background: none; color: inherit; cursor: pointer; display: inline-flex; padding: .125rem; border-radius: 50%; }
.pe-chip button:hover { background: rgba(11, 92, 173, .12); }
.pe-chip .ic { width: .75rem; height: .75rem; }
.pe-panel select.pe-add { width: auto; min-height: 1.875rem; padding: 0 .375rem; font-size: .8125rem; color: var(--primary); border-style: dashed; }
.pe-foot { display: flex; flex-wrap: wrap; gap: .375rem; align-items: center; padding-top: .875rem; border-top: 1px solid #EEF1F3; }
.pe-plist { margin: 0; padding-left: 1.125rem; font-size: .875rem; }
.pe-exv { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.pe-exv .pe-num { width: 4rem !important; min-height: 2rem; padding: .25rem .5rem; border: 1px solid var(--line-strong); border-radius: .375rem; }
.np-tpls { display: flex; flex-direction: column; gap: .375rem; max-height: 22rem; overflow-y: auto; }
.np-tpls .kchain { margin-top: .25rem; }
.vers li .spacer { flex: 1; }
@media (max-width: 1100px) { .pe-panel { max-height: none; overflow: visible; } }
