/* v2 (Nikolay 26.11) — the new look of Кантора. The colours are the site's tokens (the same names as ../index.html, so
   the theme, the dark mode and the brand colour from shared/palette.js apply); the sizes and the parts are v2's own. */
:root{
  --bg:#e6e9ee; --panel:#f3f5f8; --panel2:#eef1f5; --ink:#1a2230; --muted:#5b6674; --line:#d5dbe3; --hover:#dbe2ea;
  --accent:var(--pal-brand-light, #3a9a46); --accent-ink:var(--pal-brand-ink-light, #fff); --accent-soft:var(--pal-brand-soft-light, rgba(58,154,70,.12));
  --bad:#b3261e; --bad-soft:#fbeceb; --warn:#8a5a00; --warn-soft:#fbf3e0; --epep:#9a3f66; --ssev:#2f6fb0;
  --r:12px; --r-s:8px; --gap:16px;
  --font:Inter, "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"]{
  --bg:#0f1319; --panel:#161c25; --panel2:#131922; --ink:#e6ebf2; --muted:#adb8c7; --line:#232c39; --hover:#28323f;
  --accent:var(--pal-brand-dark, #7ED37A); --accent-ink:var(--pal-brand-ink-dark, #1A2028); --accent-soft:var(--pal-brand-soft-dark, rgba(126,211,122,.16));
  --bad:#f28b82; --bad-soft:#2c1715; --warn:#e0b158; --warn-soft:#2a2413; --epep:#e09bbb; --ssev:#9cc3f0;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0f1319; --panel:#161c25; --panel2:#131922; --ink:#e6ebf2; --muted:#adb8c7; --line:#232c39; --hover:#28323f;
    --accent:var(--pal-brand-dark, #7ED37A); --accent-ink:var(--pal-brand-ink-dark, #1A2028); --accent-soft:var(--pal-brand-soft-dark, rgba(126,211,122,.16));
    --bad:#f28b82; --bad-soft:#2c1715; --warn:#e0b158; --warn-soft:#2a2413; --epep:#e09bbb; --ssev:#9cc3f0;
  }
}
*{box-sizing:border-box}
html,body{margin:0; overflow-x:hidden; background:var(--bg); color:var(--ink); font:14px/1.45 var(--font)}
a{color:inherit; text-decoration:none}
button{font:inherit; color:inherit; cursor:pointer}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px}

/* the top bar */
.top{display:flex; flex-wrap:wrap; align-items:center; gap:10px 14px; padding:10px 20px; background:var(--panel); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:20}
.brand{display:flex; align-items:center; gap:10px; min-width:170px; font-weight:700; letter-spacing:.04em}
.brand .mark{width:28px; height:28px; border-radius:8px; background:var(--accent); color:var(--accent-ink); display:flex; align-items:center; justify-content:center}
.brand i{font-style:normal; font-weight:500; color:var(--muted)}
.search{flex:1 1 220px; min-width:0; max-width:560px; display:flex; align-items:center; gap:8px; background:var(--panel2); border:1px solid var(--line); border-radius:10px; padding:7px 12px; color:var(--muted)}
.search svg{width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; flex:none}
.search input{flex:1; min-width:0; border:0; background:transparent; color:var(--ink); font:inherit; outline:none}
.search kbd{font:12px var(--font); border:1px solid var(--line); border-radius:6px; padding:0 6px}
.status{display:flex; gap:6px; margin-left:auto}
.pill{display:flex; align-items:center; gap:6px; border:1px solid var(--line); border-radius:999px; padding:5px 12px; font-size:13px}
.pill .dot{width:8px; height:8px; border-radius:50%; background:var(--muted)}
.pill.epep{color:var(--epep)} .pill.ssev{color:var(--ssev)}
.pill b{background:var(--warn); color:var(--bg); border-radius:999px; padding:0 6px; font-size:11px}
.btn{border:1px solid var(--line); background:var(--panel2); border-radius:10px; padding:7px 14px}
.btn.primary{background:var(--accent); color:var(--accent-ink); border-color:transparent; font-weight:600}
.avatar{width:34px; height:34px; border-radius:50%; border:0; background:var(--hover); font-weight:600; font-size:13px}
.menu-wrap{position:relative}
.menu{position:absolute; top:calc(100% + 8px); left:0; min-width:220px; background:var(--panel); border:1px solid var(--line); border-radius:var(--r); box-shadow:0 18px 48px rgba(0,0,0,.28); padding:6px; display:flex; flex-direction:column; z-index:30}
.menu.right{left:auto; right:0}
.menu[hidden]{display:none}
.menu a{padding:9px 10px; border-radius:var(--r-s)}
.menu a:hover{background:var(--hover)}
.menu a.epep{color:var(--epep)}
.menu hr{border:0; border-top:1px solid var(--line); margin:6px 4px}
.menu .who{padding:8px 10px; color:var(--muted); font-size:13px}

/* the frame */
.shell{display:flex; min-height:calc(100vh - 57px)}
.side{flex:0 0 200px; display:flex; flex-direction:column; gap:2px; padding:16px 12px; border-right:1px solid var(--line); background:var(--panel2)}
.side a{padding:8px 12px; border-radius:var(--r-s); color:var(--muted); display:flex; justify-content:space-between}
.side a:hover{background:var(--hover); color:var(--ink)}
.side a.on{background:var(--hover); color:var(--ink); font-weight:600}
.side a b{background:var(--warn); color:var(--bg); border-radius:999px; padding:0 7px; font-size:12px}
.side .grow{flex:1}
.side a.quiet{font-size:13px}
main{flex:1; min-width:0; padding:28px 36px; display:flex; flex-direction:column; gap:22px}
h1{margin:0; font-size:26px}

/* the parts */
.tiles{display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:12px}
.tile{background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px; display:flex; flex-direction:column; gap:2px}
.tile:hover{border-color:var(--accent)}
.tile b{font-size:28px}
.tile span{color:var(--muted)}
.tile.bad{background:var(--bad-soft)} .tile.bad b{color:var(--bad)}
.tile.warn{background:var(--warn-soft)} .tile.warn b{color:var(--warn)}
.card{background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:18px}
.card h2{margin:0 0 10px; font-size:15px}
.muted{color:var(--muted)} .small{font-size:13px}
.head{display:flex; align-items:baseline; gap:12px; flex-wrap:wrap}
.cols{display:flex; gap:20px; flex-wrap:wrap; align-items:flex-start}
.cols .wide{flex:999 1 460px; min-width:0}
.side-col{flex:1 1 300px; min-width:260px; display:flex; flex-direction:column; gap:20px}
.row-h{display:flex; justify-content:space-between; align-items:baseline}
.row-h h2{margin:0 0 10px}

/* „Днес“: the agenda — by day, a deadline and a hearing alike */
.agenda{display:flex; flex-direction:column; gap:14px}
.day h3{margin:0 0 6px; font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted)}
.day h3.now{color:var(--bad)}
.item{display:flex; gap:12px; align-items:center; padding:10px 12px; border-radius:10px; background:var(--panel2); margin-top:6px}
.item:hover{background:var(--hover)}
.item .k{flex:none; font-size:11px; font-weight:700; letter-spacing:.04em; padding:2px 8px; border-radius:999px; background:var(--hover); color:var(--muted)}
.item .k.dl{background:var(--warn-soft); color:var(--warn)}
.item .k.hr{background:var(--accent-soft); color:var(--accent)}
.item .t{flex:1; min-width:0}
.item .t b{display:block; font-weight:600}
.item .t span{color:var(--muted); font-size:13px}
.item .x{flex:none; font-size:12px; color:var(--bad); font-weight:600}
.item.gone{opacity:.55; text-decoration:line-through}
.rows{display:flex; flex-direction:column}
.rows a{display:flex; justify-content:space-between; padding:8px 0; border-top:1px solid var(--line)}
.rows a:first-child{border-top:0}
.rows a b.hot{color:var(--warn)}
.tasks{display:flex; flex-direction:column; gap:2px}
.task{display:flex; gap:10px; align-items:flex-start; padding:7px 0}
.task input{margin-top:3px}
.task .t{flex:1; min-width:0}
.task .t span{display:block; color:var(--muted); font-size:13px}
.task .due{font-size:12px; color:var(--muted); white-space:nowrap}
.task .due.late{color:var(--bad); font-weight:600}
.task.done .t{opacity:.5; text-decoration:line-through}

/* „Дела“ (stage 3): one list, quick filters by kind and state; a table on a wide screen, cards on a phone */
.view{display:flex; flex-direction:column; gap:16px}
.view[hidden]{display:none}
.small-search{flex:0 1 320px; margin-left:auto}
.chips{display:flex; gap:6px; flex-wrap:wrap}
.chip{border:1px solid var(--line); background:transparent; color:var(--ink); border-radius:999px; padding:5px 12px; font-size:13px}
.chip span{color:var(--muted); margin-left:4px}
.chip[aria-pressed="true"]{background:var(--hover); border-color:transparent; font-weight:600}
.chips.quiet .chip{color:var(--muted)}
.chips.quiet .chip[aria-pressed="true"]{color:var(--ink)}
.table{background:var(--panel); border:1px solid var(--line); border-radius:14px; overflow:hidden}
.tr{display:grid; grid-template-columns:6px minmax(0, 1.4fr) minmax(0, 2fr) minmax(0, 1fr) 140px 90px; gap:14px; padding:11px 16px;
  align-items:center; border-top:1px solid var(--line)}
.tr.th{border-top:0; color:var(--muted); font-size:12px; letter-spacing:.04em; padding-top:10px; padding-bottom:10px}
a.tr:hover{background:var(--panel2)}
.tr .bar{width:4px; height:30px; border-radius:4px; background:var(--line)}
.tr .bar.bad{background:var(--bad)} .tr .bar.warn{background:var(--warn)} .tr .bar.ok{background:var(--accent)}
.tr b{display:block; font-weight:600}
.tr .sub{color:var(--muted); font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.tr .ttl{overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical}
.tr .nx{font-size:13px} .tr .nx.bad{color:var(--bad); font-weight:600} .tr .nx.warn{color:var(--warn); font-weight:600}
.tr .act{color:var(--muted); font-size:13px}
.tr .tag{font-size:11px; color:var(--muted); border:1px solid var(--line); border-radius:999px; padding:0 6px; margin-left:6px}
@media (max-width:900px){
  .tr{grid-template-columns:6px minmax(0, 1fr) auto; grid-template-areas:"bar case nx" "bar ttl nx"; row-gap:2px}
  .tr.th{display:none}
  .tr .bar{grid-area:bar; height:100%}
  .tr .c1{grid-area:case} .tr .c2{grid-area:ttl} .tr .c3, .tr .act{display:none} .tr .nx{grid-area:nx; text-align:right}
}

/* the matter (stage 4): the head in three lines, one main action + „⋯“; „Преглед“ — the work in front, the data aside */
.mhead{display:flex; gap:16px; align-items:flex-start; flex-wrap:wrap}
.mtitle{flex:1; min-width:260px}
.trow{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.trow h1{font-size:24px}
.badge{font-size:12px; border-radius:999px; padding:3px 10px; background:var(--hover); color:var(--muted)}
.badge.ok{background:var(--accent-soft); color:var(--accent); font-weight:600}
.badge.warn{background:var(--warn-soft); color:var(--warn); font-weight:600}
.macts{display:flex; gap:8px}
.btn.epepbtn{color:var(--epep); border-color:var(--epep)}
.menu button{all:unset; padding:9px 10px; border-radius:var(--r-s); cursor:pointer}
.menu button:hover{background:var(--hover)}
.menu .danger{color:var(--bad)}
.chain{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.chain .lbl{color:var(--muted); font-size:11px; letter-spacing:.08em; margin-right:4px}
.chain .st{background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:5px 10px; font-size:13px}
.chain .st i{font-style:normal; color:var(--muted); margin-right:6px; font-size:12px}
.chain .ar{color:var(--muted)}
.chain .more{border:1px dashed var(--line); background:transparent; border-radius:8px; padding:5px 10px; font-size:13px; color:var(--muted)}
.chain .warnpill{margin-left:auto; background:var(--warn-soft); color:var(--warn); border-radius:999px; padding:5px 12px; font-size:13px; font-weight:600}
.tabs{display:flex; gap:4px; border-bottom:1px solid var(--line); overflow-x:auto}
.tabs a{padding:10px 14px; color:var(--muted); white-space:nowrap; border-bottom:2px solid transparent}
.tabs a.on{color:var(--ink); font-weight:600; border-bottom-color:var(--accent)}
.col{display:flex; flex-direction:column; gap:20px}
.linkbtn{all:unset; cursor:pointer; color:var(--accent)}
.stepper{display:flex; overflow-x:auto; padding-bottom:4px}
.step{flex:1 0 86px; display:flex; flex-direction:column; align-items:center; gap:6px; background:none; border:0; padding:4px; color:var(--muted); font-size:12px; text-align:center}
.step .o{width:22px; height:22px; border-radius:50%; border:2px solid var(--line); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700}
.step.done .o{background:var(--accent); border-color:var(--accent); color:var(--accent-ink)}
.step.now{color:var(--ink); font-weight:600} .step.now .o{border-color:var(--accent)}
.stdesc{margin-top:12px; padding:12px; border-radius:10px; background:var(--panel2); line-height:1.55}
.dls{display:flex; flex-direction:column; gap:8px}
.dl{display:flex; align-items:center; gap:12px; padding:12px; border-radius:10px; background:var(--panel2); flex-wrap:wrap}
.dl .t{flex:1; min-width:200px}
.dl .t b{font-weight:600}
.dl .t span{display:block; color:var(--muted); font-size:13px}
.dl .pre{color:var(--bad); font-size:12px; margin-left:6px}
.dl input{background:var(--bg); border:1px solid var(--line); color:var(--ink); border-radius:8px; padding:6px 8px; font:inherit}
.dl .due{font-weight:600} .dl .due.bad{color:var(--bad)} .dl .due.warn{color:var(--warn)}
.dl.closed{opacity:.55}
.prog{height:6px; background:var(--line); border-radius:6px; margin-bottom:10px}
.prog i{display:block; height:6px; background:var(--accent); border-radius:6px; width:0}
.cks{display:flex; flex-direction:column; gap:2px}
.ck{display:flex; gap:10px; align-items:flex-start; padding:6px 0}
.ck .req{margin-left:auto; color:var(--bad); font-size:12px; white-space:nowrap}
.ck.done span{opacity:.55; text-decoration:line-through}
.addtask{display:flex; gap:6px; margin-top:8px; flex-wrap:wrap}
.addtask input{flex:1 1 140px; min-width:0; background:var(--bg); border:1px solid var(--line); color:var(--ink); border-radius:8px; padding:7px 9px; font:inherit}
.addtask input[type=date]{flex:0 0 140px}
.props{display:grid; grid-template-columns:auto minmax(0, 1fr); gap:8px 14px; font-size:13px}
.props dt{color:var(--muted)} .props dd{margin:0}

/* the matter's tabs (stage 4b): „Движение“ — a timeline by month; „Файлове“, „Страни“, „Пари“ — cards */
.pane{display:flex; flex-direction:column; gap:16px}
.pane[hidden], .cols[hidden]{display:none}
.pbar{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.pbar .small-search{margin-left:auto}
.tl{display:flex; flex-direction:column}
.tl .mo{color:var(--muted); font-size:12px; letter-spacing:.06em; text-transform:uppercase; margin:18px 0 6px}
.tl .mo:first-child{margin-top:0}
.ev{display:grid; grid-template-columns:62px 10px minmax(0, 1fr); gap:12px; padding:10px 0; border-top:1px solid var(--line)}
.ev .d{color:var(--muted); font-size:13px; text-align:right; line-height:1.3}
.ev .d b{display:block; color:var(--ink); font-size:15px}
.ev .k{width:10px; height:10px; border-radius:50%; margin-top:5px; background:var(--muted)}
.ev .k.acts{background:var(--accent)} .ev .k.docs{background:var(--ssev)} .ev .k.hear{background:var(--warn)}
.ev .k.summ{background:var(--epep)} .ev .k.mail{background:var(--ssev); border-radius:2px} .ev .k.act{background:var(--ink)}
.ev .b{min-width:0}
.ev .b .t{font-weight:600}
.ev .b .t .n{font-weight:400; color:var(--muted)}
.ev .b .s{color:var(--muted); font-size:13px}
.ev .b .gone{text-decoration:line-through}
.ev .tag{font-size:11px; color:var(--muted); border:1px solid var(--line); border-radius:999px; padding:0 6px; margin-left:6px; font-weight:400}
.fls{display:flex; gap:6px; flex-wrap:wrap; margin-top:6px}
.fl{display:inline-flex; gap:6px; align-items:center; max-width:100%; border:1px solid var(--line); background:var(--panel); border-radius:8px; padding:3px 9px; font-size:13px}
.fl:hover{border-color:var(--accent)}
.fl span{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.fl i{font-style:normal; color:var(--muted); font-size:12px; flex:none}
.form{display:flex; gap:8px; flex-wrap:wrap; align-items:flex-end; padding:14px; border-radius:12px; background:var(--panel2); border:1px solid var(--line)}
.form label{display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--muted)}
.form label.grow{flex:1 1 240px}
.form input, .form select, .form textarea{background:var(--bg); border:1px solid var(--line); color:var(--ink); border-radius:8px; padding:7px 9px; font:inherit; min-width:0}
.form textarea{width:100%; resize:vertical}
.ftab .tr{grid-template-columns:minmax(0, 1fr) 110px 80px 60px}
.ftab .tr .nm{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.ftab .tr .nm i{font-style:normal; color:var(--muted); margin-right:8px}
.grid2{display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:16px; align-items:start}
.ppl{display:flex; flex-direction:column}
.ppl .p{display:flex; gap:10px; justify-content:space-between; padding:8px 0; border-top:1px solid var(--line)}
.ppl .p:first-child{border-top:0}
.ppl .p .r{color:var(--muted); font-size:13px; text-align:right}
.ppl .p .s{color:var(--muted); font-size:13px}
.ppl .p.own{opacity:.6}
.sum{display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:12px}
.sum .tile b{font-size:22px}
.mtab .tr{grid-template-columns:90px 110px minmax(0, 1fr) 120px 28px}
.mtab .tr .am{text-align:right; font-variant-numeric:tabular-nums; font-weight:600}
.mtab .tr .am.in{color:var(--accent)}
.mtab .tr .x{all:unset; cursor:pointer; color:var(--muted); text-align:center}
.mtab .tr .x:hover{color:var(--bad)}
@media (max-width:900px){
  .ftab .tr{grid-template-columns:minmax(0, 1fr) auto; grid-template-areas:none}
  .ftab .tr .pg, .ftab .tr .sz{display:none}
  .mtab .tr{grid-template-columns:80px minmax(0, 1fr) auto 24px; grid-template-areas:none}
  .mtab .tr .kd{display:none}
}

/* „Писма“ (stage 5): one table for ССЕВ and e-mail; ticks on the unopened; the bar for the chosen on top */
.bulk{display:flex; gap:10px; align-items:center; flex-wrap:wrap; position:sticky; top:64px; z-index:10; padding:10px 14px;
  border-radius:12px; background:var(--accent-soft); border:1px solid var(--accent)}
.bulk[hidden]{display:none}
.ltab .tr{grid-template-columns:28px 92px 52px minmax(0, 1fr) minmax(0, .8fr) 110px}
.ltab .tr input{width:16px; height:16px; margin:0}
.ltab .tr.un b{font-weight:700}
.ltab .tr.picked{background:var(--accent-soft)}
.ltab .ch{font-size:11px; border-radius:999px; padding:1px 7px; text-align:center; background:var(--hover); color:var(--muted)}
.ltab .ch.s{color:var(--ssev)}
.ltab .who b{display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.ltab .who span{display:block; color:var(--muted); font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.ltab .mt{font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.ltab .mt a{color:var(--accent)}
.ltab .stt{font-size:12px; text-align:right}
.ltab .stt .unp{color:var(--warn); font-weight:600}
.ltab .stt .bad{color:var(--bad); font-weight:600}
.ltab .more{padding:12px 16px}
@media (max-width:900px){
  .ltab .tr{grid-template-columns:24px minmax(0, 1fr) auto; grid-template-areas:none}
  .ltab .tr .dt, .ltab .tr .ch, .ltab .tr .mt{display:none}
}

/* „Хора“, „Документи“, „Пари“ (stage 6): the lists across all matters */
.ptab .tr{grid-template-columns:minmax(0, 1.4fr) minmax(0, 1fr) 70px}
.ptab .tr .k{font-size:11px; color:var(--muted); border:1px solid var(--line); border-radius:999px; padding:0 6px; margin-left:6px; font-weight:400}
.ptab .tr .n{text-align:right}
.ppl .p .acts{display:flex; gap:6px; flex:none; align-items:center}
.btn.small{padding:4px 10px; font-size:13px}
.dates{display:flex; gap:6px; align-items:center; color:var(--muted); margin-left:auto}
.dates input{background:var(--panel); border:1px solid var(--line); color:var(--ink); border-radius:8px; padding:5px 8px; font:inherit}
.ev .b .s mark{background:var(--warn-soft); color:inherit; font-weight:600}
.ev .b .t a, .ev .b .s a{color:var(--accent)}
.ntab .tr{grid-template-columns:minmax(0, 1.5fr) repeat(4, 110px) 100px}
.ntab .tr .am{text-align:right; font-variant-numeric:tabular-nums}
.ntab .tr .st{font-size:12px; text-align:right}
.ntab .tr .bad{color:var(--bad); font-weight:600} .ntab .tr .warn{color:var(--warn); font-weight:600} .ntab .tr .ok{color:var(--accent)}
@media (max-width:1000px){ .ntab .tr{grid-template-columns:minmax(0, 1fr) auto; grid-template-areas:none} .ntab .tr .hide{display:none} }
@media (max-width:900px){
  .ptab .tr{grid-template-columns:minmax(0, 1fr) auto; grid-template-areas:none} .ptab .tr .c{display:none}
  .dates{margin-left:0}
}

/* the search (stage 7): Ctrl K — one window over everything; the matters, the files, the letters, the clients, the actions */
.pal-bg{position:fixed; inset:0; z-index:50; background:rgba(8,12,18,.45); display:flex; justify-content:center; align-items:flex-start; padding:10vh 16px 16px}
.pal-bg[hidden]{display:none}
.pal{width:min(680px, 100%); max-height:76vh; display:flex; flex-direction:column; background:var(--panel); border:1px solid var(--line); border-radius:16px; box-shadow:0 24px 64px rgba(0,0,0,.35); overflow:hidden}
.pal-in{display:flex; align-items:center; gap:10px; padding:14px 16px; border-bottom:1px solid var(--line); color:var(--muted)}
.pal-in svg{width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; flex:none}
.pal-in input{flex:1; min-width:0; border:0; background:transparent; color:var(--ink); font:inherit; font-size:16px; outline:none}
.pal kbd{font:11px var(--font); border:1px solid var(--line); border-radius:5px; padding:0 5px; color:var(--muted)}
.pal-x{all:unset; cursor:pointer} .pal-x span{display:none; font-size:18px; padding:0 4px; color:var(--muted)}
.pal-res{overflow-y:auto; padding:6px}
.pal-res .sec{color:var(--muted); font-size:11px; letter-spacing:.06em; text-transform:uppercase; padding:10px 10px 4px}
.pal-res .it{display:flex; gap:10px; align-items:center; padding:9px 10px; border-radius:10px; cursor:pointer}
.pal-res .it[aria-selected="true"]{background:var(--hover)}
.pal-res .it .ic{width:26px; height:26px; flex:none; border-radius:7px; background:var(--panel2); display:flex; align-items:center; justify-content:center; font-size:13px; color:var(--muted)}
.pal-res .it .tx{flex:1; min-width:0}
.pal-res .it .tx b{display:block; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.pal-res .it .tx span{display:block; color:var(--muted); font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.pal-res .it mark{background:var(--warn-soft); color:inherit}
.pal-res .it .star{all:unset; cursor:pointer; color:var(--muted); padding:0 4px}
.pal-res .it .star.on{color:var(--warn)}
.pal-res .none{padding:16px 10px; color:var(--muted)}
.pal-foot{display:flex; gap:16px; flex-wrap:wrap; padding:8px 14px; border-top:1px solid var(--line); color:var(--muted); font-size:12px}
@media (max-width:760px){ .pal-x kbd{display:none} .pal-x span{display:inline} .pal-bg{padding:0} .pal{max-height:100vh; height:100%; border-radius:0} .pal-foot{display:none} }

/* the file viewer (stage 9): over the page; the file stays where it was opened */
.vw-bg{position:fixed; inset:0; z-index:45; background:rgba(8,12,18,.5); display:flex; justify-content:center; padding:3vh 16px}
.vw-bg[hidden]{display:none}
.vw{width:min(1100px, 100%); display:flex; flex-direction:column; background:var(--panel); border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:0 24px 64px rgba(0,0,0,.35)}
.vw-top{display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--line); min-width:0}
.vw-top b{overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0}
.vw-top .grow{flex:1}
.vw-body{flex:1; min-height:0; overflow:auto; background:var(--panel2)}
.vw-body iframe{width:100%; height:100%; border:0; background:#fff; display:block}
.vw-body img{display:block; max-width:100%; margin:0 auto}
.vw-body .txt{white-space:pre-wrap; font:14px/1.6 var(--font); padding:22px 26px; max-width:860px; margin:0 auto; color:var(--ink)}
.vw-body .msg{padding:28px; color:var(--muted)}
@media (max-width:760px){ .vw-bg{padding:0} .vw{border-radius:0} .vw-top .muted{display:none} }

/* the phone */
.bottom{display:none}
@media (max-width:760px){
  .side, .status, .search kbd, .brand .word{display:none}
  .top{gap:8px; padding:8px 12px; flex-wrap:nowrap}
  .search{flex:1 1 0}
  .brand{min-width:0}
  main{padding:18px 16px 84px}
  .tiles, .sum{grid-template-columns:repeat(2, minmax(0, 1fr))}
  .bottom{display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); position:fixed; left:0; right:0; bottom:0; background:var(--panel); border-top:1px solid var(--line); z-index:20}
  .bottom a, .bottom button{text-align:center; padding:12px 0 calc(14px + env(safe-area-inset-bottom)); color:var(--muted); font-size:12px; background:none; border:0}
  .bottom a.on, .bottom button.on{color:var(--accent); font-weight:600}
  /* stage 8: the phone — „Още“ as a sheet over the bottom bar; the chips in one line that scrolls; a lower head of the
     matter; the tabs of the matter fit the width; the bigger targets for the finger */
  .menu.sheet{position:fixed; left:8px; right:8px; top:auto; bottom:calc(58px + env(safe-area-inset-bottom)); z-index:40}
  .menu.sheet a{padding:13px 12px; font-size:15px}
  .chips{flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; margin:0 -16px; padding:0 16px}
  .chips::-webkit-scrollbar{display:none}
  .chip{flex:none; padding:7px 13px}
  .head{flex-wrap:wrap}
  .head .small-search{flex:1 1 100%; margin-left:0; order:3}
  .head .btn{margin-left:auto}
  .trow h1{font-size:20px}
  .mhead{gap:10px}
  .mtitle{min-width:0; flex-basis:100%}
  .macts{width:100%} .macts .epepbtn{flex:1; text-align:center}
  .chain{flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; margin:0 -16px; padding:0 16px}
  .chain::-webkit-scrollbar{display:none}
  .chain .lbl{display:none}
  .chain .st, .chain .warnpill{flex:none; white-space:nowrap}
  .tabs a{flex:1 0 auto; padding:10px 8px; font-size:13px; text-align:center}
  .pbar .small-search{flex:1 1 100%; margin-left:0}
  .pbar .btn{flex:1}
  .ev{grid-template-columns:40px 10px minmax(0, 1fr); gap:10px}
  .form label, .form label.grow{flex:1 1 100%}
  .form .btn{flex:1}
  .dates{width:100%} .dates input{flex:1; min-width:0}
  .bulk{top:58px}
  .task, .ck{padding:9px 0}
  .ltab .tr, .ptab .tr, .ntab .tr, .ftab .tr, .mtab .tr{padding:12px 14px}
}
