
:root{--bg:#f4f3f0;--panel:#fff;--ink:#242722;--muted:#61665e;--line:#dfE1da;--soft:#eceee8;--accent:#384b40;--accent-soft:#edf2ed;--bad:#a3312e;--warn:#81540a;--radius:14px;color-scheme:light}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}a{color:inherit}button,input,select,textarea{font:inherit}button,a,input,select,textarea{touch-action:manipulation}button,.button{display:inline-flex;justify-content:center;align-items:center;gap:8px;min-height:44px;padding:10px 15px;border:1px solid #858c81;border-radius:8px;background:var(--panel);color:var(--ink);cursor:pointer;text-decoration:none;font-weight:600}button:hover,.button:hover{background:var(--soft)}button.primary,.button.primary{background:var(--accent);border-color:var(--accent);color:#fff}button.primary:hover{background:#263a2d}button[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:#fff}button:disabled{cursor:not-allowed;opacity:.55}:focus-visible{outline:3px solid #81540a;outline-offset:3px}input,select,textarea{min-height:44px;padding:10px 12px;border:1px solid #858c81;border-radius:7px;background:var(--panel);color:var(--ink);max-width:100%}input[type=checkbox]{min-height:24px;width:24px;height:24px;accent-color:var(--accent)}label{display:grid;gap:6px;font-size:13px;font-weight:600}label.check{display:flex;align-items:center;gap:10px}.skip{position:absolute;left:10px;top:-100px;z-index:20;background:white;padding:12px}.skip:focus{top:10px}.shell{display:grid;grid-template-columns:232px minmax(0,1fr);min-height:100vh}aside{background:#eeefe9;border-right:1px solid var(--line);padding:27px 18px}.brand{display:flex;gap:10px;align-items:center;text-decoration:none;margin:0 8px 30px}.mark{width:34px;height:34px;border:1px solid #515c4c;border-radius:10px;display:grid;place-items:center;font-family:Georgia,serif;font-size:24px}.brand strong{font-size:19px;letter-spacing:-.5px}.brand small{display:block;color:var(--muted);font-size:11px;letter-spacing:1.4px}.nav-label{color:var(--muted);font-size:10px;letter-spacing:1.5px;margin:24px 12px 8px}nav a{display:flex;align-items:center;gap:11px;padding:11px 12px;text-decoration:none;border-radius:8px;font-size:13px;margin:2px 0}nav a[aria-current=page]{background:#fff;box-shadow:0 1px 4px #0000000a;font-weight:700}nav a:hover{background:#fff}nav svg{width:17px;height:17px;flex-shrink:0}.aside-foot{font-size:12px;color:var(--muted);margin:28px 12px}.workspace{min-width:0}header{min-height:76px;padding:16px 36px;display:flex;align-items:center;justify-content:space-between;gap:14px;border-bottom:1px solid var(--line);background:#fafaf7}header .crumb{font-size:13px;color:var(--muted)}header .crumb b{color:var(--ink);font-weight:500}.header-actions{display:flex;gap:12px;align-items:center}.avatar{width:33px;height:33px;border-radius:50%;background:#e0e5da;display:grid;place-items:center;font-size:11px;font-weight:700}.demo{font-size:11px;text-transform:uppercase;letter-spacing:1px;color:var(--muted)}main{padding:32px 36px;max-width:1660px;margin:auto}.eyebrow{font-size:11px;letter-spacing:1.7px;color:var(--muted);text-transform:uppercase;margin-bottom:7px}h1{font-size:30px;line-height:1.2;letter-spacing:-1px;margin:0 0 10px;font-weight:650}h2{font-size:17px;letter-spacing:-.3px;margin:0}h3{font-size:15px;margin:0}p{margin:5px 0}.sub{color:var(--muted);font-size:13px}.pagehead{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:26px;flex-wrap:wrap}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:20px 0 24px}.metric{padding:20px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);text-decoration:none}.metric small{color:var(--muted);font-size:12px}.metric strong{display:block;font-size:27px;line-height:1.4;letter-spacing:-.8px;margin:8px 0;font-weight:600;font-variant-numeric:tabular-nums}.metric .hint{font-size:12px;color:var(--muted)}.metric.feature{background:#e8ece3}.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);margin-bottom:20px;overflow:hidden}.panelhead{padding:20px 22px;display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;border-bottom:1px solid var(--line)}.panelbody{padding:22px}.toolbar{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin:20px 0}.toolbar label{flex:1;min-width:160px}.toolbar label.search{flex:2}.toolbar input,.toolbar select{width:100%}.tablewrap{overflow:auto}table{border-collapse:collapse;width:100%;font-size:13px}caption{text-align:left;padding:12px 22px;color:var(--muted)}th{background:#f8f9f5;color:var(--muted);font-size:11px;font-weight:600;text-align:left;white-space:nowrap}th,td{padding:15px 20px;border-bottom:1px solid var(--line);vertical-align:middle}tbody tr:last-child td{border-bottom:0}tbody tr:hover{background:#fafbf8}td small{display:block;color:var(--muted);font-size:11px;margin-top:4px}.num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.badge{display:inline-block;padding:4px 9px;border-radius:5px;font-size:11px;font-weight:600;background:#eff0eb;color:#52584e;white-space:nowrap}.badge.good{background:#eaf1e8;color:#345837}.badge.warn{background:#fbf0d8;color:#80500b}.badge.bad{background:#f9e9e7;color:#9c2d27}.bad-text{color:var(--bad)}.link{border:0;background:none;padding:6px 0;min-height:44px;text-decoration:underline;text-underline-offset:4px;color:var(--accent);text-align:left;justify-content:flex-start}.task{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:18px 22px;border-bottom:1px solid var(--line)}.task:last-child{border:0}.task small{display:block;color:var(--muted);font-size:12px;margin-top:4px}.task strong{font-size:13px}.dot{width:9px;height:9px;border-radius:50%;background:#697e61;display:inline-block;margin-right:7px}.note{padding:13px 16px;background:#f0f2eb;border:1px solid var(--line);border-radius:8px;color:#4c5747;font-size:13px;margin:14px 0}.warning{background:#fcf4e3;color:#775213;border-color:#e7d9b8}.empty{padding:42px 22px;text-align:center;color:var(--muted)}.empty strong{display:block;color:var(--ink);font-size:17px;margin-bottom:10px}.tabs{display:flex;gap:6px;flex-wrap:wrap}.tabs button{font-size:13px}.barrow{display:grid;grid-template-columns:90px 1fr 100px;gap:12px;align-items:center;margin:16px 0;font-size:12px}.bartrack{background:#f1f2ed;height:12px;border-radius:3px;overflow:hidden}.barfill{height:100%;background:#687e62}.barrow button{padding:0;border:0;justify-content:start;background:none;font-size:12px}.barchart{display:flex;gap:12px;align-items:end;height:190px;margin:20px 0 12px}.barcol{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;height:100%;justify-content:end;gap:8px}.barcol button{padding:0;min-height:4px;background:#889b7d;border:0;border-radius:5px 5px 0 0;width:75%;max-width:54px}.barcol button:hover{background:#435d39}.barcol small{font-size:11px}.chart-value{font-size:11px;color:var(--muted)}.legend{display:flex;gap:16px;font-size:12px;color:var(--muted);flex-wrap:wrap}.footnote{font-size:12px;color:var(--muted);margin-top:20px}.split{display:grid;grid-template-columns:1.3fr 1fr;gap:20px}.steps{display:flex;gap:8px;flex-wrap:wrap;margin:20px 0}.step{background:#e9ece3;color:#495540;padding:8px 12px;border-radius:7px;font-size:12px}.step.active{background:#384b40;color:#fff}dialog{border:1px solid var(--line);border-radius:16px;padding:0;width:min(680px,calc(100% - 32px));max-height:90vh;box-shadow:0 22px 100px #0003;color:var(--ink);background:var(--panel)}dialog::backdrop{background:#17201877}dialog .body{padding:24px}dialog h2{font-size:22px}dialog form{display:grid;gap:16px}dialog .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px;flex-wrap:wrap}.fieldgrid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.fieldgrid input,.fieldgrid select{width:100%}.detailgrid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin:20px 0}.detailgrid dt{font-size:12px;color:var(--muted)}.detailgrid dd{margin:4px 0 0;font-weight:600}.timeline{list-style:none;padding:0;margin:22px 0}.timeline li{padding:12px 0 12px 22px;border-left:2px solid #dce3d5;margin-left:5px}.timeline li strong{display:block}.timeline li small{color:var(--muted)}.toast{position:fixed;bottom:24px;right:24px;background:#28372c;color:white;padding:14px 22px;border-radius:9px;max-width:calc(100vw - 48px);z-index:100;box-shadow:0 6px 30px #0002}.formstack{display:grid;gap:16px}.uploadzone{padding:32px;border:1px dashed #858c81;border-radius:12px;background:#fafbf7}.uploadzone input{width:100%;margin-top:12px;background:#fff}.mobile-menu{display:none}footer{color:var(--muted);font-size:11px;padding:20px 36px;border-top:1px solid var(--line)}[hidden]{display:none!important}@media(min-width:1500px){main{padding:40px 48px}.metrics{gap:20px}}@media(max-width:1100px){.shell{grid-template-columns:205px minmax(0,1fr)}main{padding:26px 22px}header{padding:16px 22px}.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.split{grid-template-columns:1fr}.grid{gap:14px}}@media(max-width:760px){.shell{display:block}aside{display:none}aside.open{display:block}.mobile-menu{display:inline-flex}header{padding:12px 16px}.crumb{display:none}.header-actions{gap:8px}.demo{font-size:9px}main{padding:24px 16px}.grid,.fieldgrid,.detailgrid{grid-template-columns:1fr}h1{font-size:26px}.metric{padding:15px}.metric strong{font-size:23px}.barrow{grid-template-columns:70px 1fr 80px}.task{flex-wrap:wrap}.panelbody{padding:18px}.toolbar label{min-width:130px}.pagehead{gap:12px}.barchart{gap:5px}footer{padding:20px 16px}}@media(max-width:390px){.metrics{grid-template-columns:1fr}.header-actions .avatar{display:none}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}@media print{aside,header,.toolbar,button,footer,.demo{display:none!important}.shell{display:block}main{padding:0}.panel{break-inside:avoid}.metrics{grid-template-columns:repeat(4,1fr)}}


/* ============================================================================
   ДОБАВКИ КЪМ ДИЗАЙН-СИСТЕМАТА – за екраните, които прототипът не покрива
   (банка, преглед на фактура, партиди/QR, сканиране, архив, БН, логове).
   Ползват същите променливи и същия речник от класове.
   ============================================================================ */

/* --- съвместимост със старите имена на класове в шаблоните --- */
.cards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin:20px 0 24px; }
.card { padding:20px; border:1px solid var(--line); border-radius:var(--radius); background:var(--panel); }
.card .k { color:var(--muted); font-size:12px; }
.card .v { display:block; font-size:27px; line-height:1.4; letter-spacing:-.8px; margin:8px 0;
           font-weight:600; font-variant-numeric:tabular-nums; }
.card.warn .v { color:var(--warn); } .card.bad .v { color:var(--bad); } .card.ok .v { color:#345837; }
.card .v a { text-decoration:none; }
.wrap { overflow:auto; background:var(--panel); border:1px solid var(--line);
        border-radius:var(--radius); margin-bottom:20px; }
.wrap > table { border:0; }
.panel .wrap, .panelbody .wrap { border:0; border-radius:0; margin-bottom:0; }
/* заглавие точно преди таблица – става шапка на панела */
h2 + .wrap, h3 + .wrap { margin-top:10px; }
.tag { display:inline-block; padding:4px 9px; border-radius:5px; font-size:11px; font-weight:600;
       background:#eff0eb; color:#52584e; white-space:nowrap; }
.tag.ok { background:#eaf1e8; color:#345837; }
.tag.warn { background:#fbf0d8; color:#80500b; }
.tag.bad { background:#f9e9e7; color:#9c2d27; }
.small { color:var(--muted); font-size:12px; }
.msg { padding:13px 16px; background:var(--accent-soft); border:1px solid #cfdccf; border-radius:8px;
       color:#31452f; font-size:13px; margin-bottom:18px; }
.alert { padding:13px 16px; border:1px solid var(--line); border-radius:8px; font-size:13px; margin-bottom:10px;
         background:#f0f2eb; color:#4c5747; }
.alert.warning { background:#fcf4e3; color:#775213; border-color:#e7d9b8; }
.alert.danger  { background:#f9e9e7; color:#9c2d27; border-color:#efcdc9; }
.alert.info    { background:var(--accent-soft); color:#31452f; border-color:#cfdccf; }
.btn { display:inline-flex; justify-content:center; align-items:center; gap:8px; min-height:44px;
       padding:10px 15px; border:1px solid #858c81; border-radius:8px; background:var(--panel);
       color:var(--ink); cursor:pointer; text-decoration:none; font-weight:600; font-size:13px; }
.btn:hover { background:var(--soft); }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:hover { background:#263a2d; }
form.inline { display:inline-flex; gap:8px; align-items:center; }

/* Прототипът очаква полетата в .toolbar да са увити в <label>. Нашите шаблони ги слагат директно,
   затова голите контроли пазят естествената си ширина, вместо да станат на цял ред. */
.toolbar > input, .toolbar > select, .toolbar > button, .toolbar > .btn, .toolbar > a,
.toolbar > form, .toolbar > span, .toolbar > b, .toolbar > details {
  flex:0 0 auto; width:auto; }
.toolbar > input { min-width:160px; }
.toolbar > select { min-width:150px; }
.toolbar > input.grow { flex:1 1 220px; }
.toolbar form.inline > input, .toolbar form.inline > select { width:auto; }
.toolbar { align-items:center; }

/* плътни таблици: по-малко въздух, за да се събират много колони */
table.dense th, table.dense td { padding:10px 12px; }
.wrap table th, .wrap table td { padding:12px 14px; }
td.date, th.date { white-space:nowrap; }
details summary { cursor:pointer; color:var(--accent); font-weight:600; }
details > summary + * { margin-top:12px; }

/* по-компактни бутони и полета вътре в таблици – иначе редовете стават огромни */
table button, table .btn { min-height:34px; padding:6px 10px; font-size:12px; font-weight:600; }
table input, table select { min-height:34px; padding:6px 8px; font-size:13px; }
.toolbar.compact button, .toolbar.compact .btn { min-height:36px; padding:7px 12px; }

/* --- падащо меню в страничната лента (групи с подраздели) --- */
nav details.grp > summary { display:flex; align-items:center; gap:11px; padding:11px 12px; border-radius:8px;
                            font-size:13px; margin:2px 0; list-style:none; color:var(--ink); font-weight:400; }
nav details.grp > summary::-webkit-details-marker { display:none; }
nav details.grp > summary:hover { background:#fff; }
nav details.grp[open] > summary { font-weight:700; }
nav details.grp .sub-links a { padding-left:40px; font-size:13px; }

/* --- екран „Преглед на фактура“: документ вляво, данни вдясно --- */
.rev { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); gap:20px; align-items:start; }
.rev > * { min-width:0; }
.doc { position:sticky; top:16px; background:var(--panel); border:1px solid var(--line);
       border-radius:var(--radius); overflow:hidden; }
.doc iframe { width:100%; height:78vh; border:0; display:block; background:var(--soft); }
.doc .nofile { padding:20px; }
.doc pre { white-space:pre-wrap; word-break:break-word; font-size:12px; }
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 16px; }
.f { display:grid; gap:6px; min-width:0; }
.f.full { grid-column:1 / -1; }
.f > span.lbl { font-size:12px; font-weight:600; color:var(--muted); }
.f input, .f select, .f textarea { width:100%; }
.src { font-size:11px; font-weight:600; }
.src.auto { color:#345837; } .src.ocr { color:var(--warn); } .src.none { color:var(--bad); }
.miss { background:#f9e9e7 !important; border-color:#c98b85 !important; }
.bar { position:sticky; bottom:0; z-index:5; background:var(--panel); border:1px solid var(--line);
       border-radius:var(--radius); padding:12px 14px; display:flex; gap:10px; flex-wrap:wrap;
       align-items:center; margin-top:16px; box-shadow:0 -6px 22px #0000000f; }

/* --- партида с QR --- */
.lotgrid { display:grid; grid-template-columns:250px minmax(0,1fr); gap:20px; align-items:start; }
.lotgrid > * { min-width:0; }
.qrbox { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
         padding:18px; text-align:center; }
.qrbox img { width:100%; max-width:210px; image-rendering:pixelated; }
.qrbox .code { font-size:20px; font-weight:700; letter-spacing:.05em; margin-top:10px; }
.qrbox .small { word-break:break-all; }
.big { font-size:28px; font-weight:600; letter-spacing:-.8px; font-variant-numeric:tabular-nums; }

/* --- сканиране --- */
video#cam { width:100%; max-height:60vh; border-radius:var(--radius); background:#17201a; display:none; }

@media (max-width:1100px) { .rev, .lotgrid { grid-template-columns:1fr; }
                            .doc { position:static; } .doc iframe { height:55vh; } }
@media (max-width:760px) {
  .cards { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .card { padding:15px; } .card .v { font-size:23px; }
  .fields { grid-template-columns:1fr; }
  th, td { padding:11px 12px; }
  table { font-size:12px; }
  .sm-hide { display:none; }
}
@media (max-width:390px) { .cards { grid-template-columns:1fr; } }

/* панел с вътрешно поле – за картите с формуляри (партида, преглед на фактура) */
.panel.padded { padding:18px 20px; margin-bottom:14px; }
.panel.padded > h3 { margin:0 0 12px; font-size:15px; }
.panel.padded .toolbar { margin:0; }
.panel.padded .wrap { margin:0; }
details.panel.padded > summary { margin:0; }

/* --- дребни поправки за тесен екран: дълъг текст и бутони не бутат страницата настрани --- */
.toolbar > span, .toolbar > b, .toolbar > .small { min-width:0; overflow-wrap:anywhere; }
.toolbar > .small { flex:1 1 100%; }
form.inline { flex-wrap:wrap; }
button, .button, .btn { max-width:100%; overflow-wrap:anywhere; }
.metric, .card { min-width:0; overflow-wrap:anywhere; }
h1, h2, h3, p, td, th { overflow-wrap:anywhere; }
/* таблица без изричен .wrap – пак да се плъзга, вместо да разтяга страницата */
.panel.padded > table { display:block; overflow:auto; }
@media (max-width:760px) {
  .toolbar > input, .toolbar > select { flex:1 1 100%; min-width:0; }
  .toolbar > button, .toolbar > .btn, .toolbar > a.button { flex:1 1 auto; }
}

/* файловите полета имат голяма собствена ширина – ограничаваме ги, иначе бутат страницата */
input[type=file] { max-width:100%; min-width:0; }
form.inline > *, .toolbar > form > * { min-width:0; }
.toolbar form.toolbar, .toolbar > form.inline { flex:1 1 100%; min-width:0; margin:0; }
@media (max-width:900px) {
  form.inline > input[type=file] { flex:1 1 100%; }
  form.inline > button, form.inline > .btn { flex:1 1 auto; }
}

/* етикетите на полетата са едноредови (прототипът ги прави grid – тук текстът и бележката са на един ред) */
.f > label { display:block; font-size:12px; font-weight:600; color:var(--muted); margin-bottom:6px; }
.f > label .src { display:inline; font-weight:600; }
.f > label + input, .f > label + select, .f > label + textarea { margin-top:0; }
.fields .f { gap:0; }
.entry input { width:110px; }

/* --- бутон-икона за действие в ред на таблица ---------------------------------
   Текстов бутон в тясна колона се пренасяше буква под буква (вертикално „п-р-е-г-л-е-д“).
   Иконата е с фиксирана ширина и не се пренася; действието се чете от title/aria-label. */
.icon-btn { width:34px; min-width:34px; height:34px; min-height:34px; padding:0; flex:0 0 auto;
            overflow-wrap:normal; white-space:nowrap; color:var(--muted); }
.icon-btn:hover { color:var(--accent); border-color:var(--accent); background:var(--accent-soft); }
.icon-btn svg { width:18px; height:18px; display:block; }
table .icon-btn { min-height:34px; padding:0; }
td.act, th.act { width:1%; white-space:nowrap; text-align:right; }
td.act > .icon-btn + .icon-btn { margin-left:6px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
           clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* ===========================================================================
   ТАБЛО: плочки с икони и графики
   Графиките са инлайн SVG, смятан на сървъра – без външен скрипт, защото
   системата работи локално и нищо не бива да се тегли от интернет.
   Цветовете на сериите са проверена категорийна палитра (контраст и
   далтонизъм); UI-ят си остава в зелено-пясъчната гама на системата.
   =========================================================================== */
.viz { --s1:#2a78d6; --s2:#eb6834; --s3:#1baf7a; }

/* --- плочки --- */
.kpi-row { display:grid; gap:12px; grid-template-columns:repeat(auto-fit, minmax(210px, 1fr)); margin:16px 0; }
.kpi { display:flex; gap:12px; align-items:flex-start; background:var(--panel); border:1px solid var(--line);
       border-radius:var(--radius); padding:14px 16px; text-decoration:none; color:inherit; min-width:0; }
.kpi:hover { border-color:#c8ccc2; }
.kpi .ic { flex:0 0 auto; width:38px; height:38px; border-radius:11px; display:grid; place-items:center;
           background:var(--accent-soft); color:var(--accent); }
.kpi .ic svg { width:20px; height:20px; }
.kpi .ic.blue { background:#e8f1fc; color:#1b5fae; }
.kpi .ic.amber{ background:#fdf0e8; color:#b44c1c; }
.kpi .ic.teal { background:#e6f6f0; color:#0f7a55; }
.kpi .bd { min-width:0; }
.kpi .k { font-size:12px; color:var(--muted); display:block; }
.kpi .v { font-size:25px; font-weight:650; line-height:1.15; display:block; margin-top:2px;
          overflow-wrap:anywhere; }
.kpi .d { font-size:12px; margin-top:3px; display:block; color:var(--muted); }
.kpi .d.up   { color:#0f7a55; }
.kpi .d.down { color:var(--bad); }

/* --- лента с дребни броячи --- */
.chips { display:flex; flex-wrap:wrap; gap:8px; margin:-4px 0 16px; }
.chips a { display:inline-flex; gap:7px; align-items:baseline; background:var(--panel);
           border:1px solid var(--line); border-radius:999px; padding:6px 13px; font-size:13px;
           text-decoration:none; color:var(--muted); }
.chips a:hover { border-color:#c8ccc2; }
.chips b { color:var(--ink); font-weight:650; }

/* --- графики --- */
.charts { display:grid; gap:14px; grid-template-columns:1.55fr 1fr; margin-bottom:16px;
          align-items:start; }   /* иначе празен панел се разтяга до съседа и зее */
@media (max-width:900px) { .charts { grid-template-columns:1fr; } }
.chart svg { display:block; width:100%; height:auto; }
.chart .ax { font-size:11px; fill:var(--muted); }
.chart .gl { stroke:var(--line); stroke-width:1; }
.chart .ln { fill:none; stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.chart .ar { stroke:none; opacity:.10; }
.chart .dt { stroke:var(--panel); stroke-width:2; }
.chart .el { font-size:11px; font-weight:650; fill:var(--ink); }

/* сегментна лента – една цялост, разделена на части (чете се по-точно от поничка) */
.segbar { display:flex; height:28px; gap:2px; margin:4px 0 12px; }   /* 2px = разделителят */
.segbar span { position:relative; border-radius:4px; display:grid; place-items:center;
               font-size:11px; font-weight:650; color:#fff; min-width:0; overflow:visible; }
.legend { display:grid; gap:7px; margin:0; padding:0; list-style:none; }
.legend li { display:flex; align-items:baseline; gap:9px; font-size:13px; }
.legend .sw { flex:0 0 auto; width:10px; height:10px; border-radius:3px; transform:translateY(1px); }
.legend .nm { flex:1 1 auto; min-width:0; overflow-wrap:anywhere; }
.legend .vl { font-variant-numeric:tabular-nums; color:var(--muted); }
.legend .vl b { color:var(--ink); font-weight:650; }

.chart-empty { display:grid; place-items:center; text-align:center; min-height:150px;
               border:1px dashed var(--line); border-radius:10px; padding:18px; color:var(--muted);
               font-size:13px; }
.chart-empty b { display:block; color:var(--ink); margin-bottom:4px; font-size:14px; }

@media print { .chart .ar { opacity:.18; } }

/* --- меню на потребителя в заглавната лента -------------------------------- */
.usermenu { position:relative; }
.usermenu > summary { list-style:none; cursor:pointer; }
.usermenu > summary::-webkit-details-marker { display:none; }
.usermenu-pop { position:absolute; right:0; top:calc(100% + 8px); z-index:40; min-width:210px;
  background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:12px;
  box-shadow:0 10px 30px rgba(0,0,0,.10); display:grid; gap:8px; }
.usermenu-pop a { color:var(--ink); text-decoration:none; font-size:13px; padding:6px 8px;
  border-radius:7px; }
.usermenu-pop a:hover { background:var(--soft); }
.usermenu-pop form { margin:0; }
.usermenu-pop .btn { width:100%; min-height:36px; }

/* --- вход и първоначална настройка ---------------------------------------- */
.authwrap { min-height:100vh; display:grid; place-items:center; padding:24px; background:var(--bg); }
.authcard { width:100%; max-width:400px; background:var(--panel); border:1px solid var(--line);
  border-radius:var(--radius); padding:28px; }
.authcard h1 { font-size:21px; margin:0 0 4px; }
.authcard .sub { font-size:13px; color:var(--muted); margin:0 0 18px; }
.authcard label { display:block; font-size:12px; color:var(--muted); margin:12px 0 4px; }
.authcard input { width:100%; min-height:42px; padding:9px 12px; border:1px solid #858c81;
  border-radius:8px; font-size:15px; background:var(--panel); color:var(--ink); }
.authcard .btn { width:100%; margin-top:18px; }
.authcard .brand { display:flex; gap:10px; align-items:center; margin-bottom:18px; }
.authcard .mark { width:34px; height:34px; border-radius:10px; background:var(--accent); color:#fff;
  display:grid; place-items:center; font-weight:700; }

/* --- страница с настройки -------------------------------------------------- */
.setgrid { display:grid; gap:14px; margin-top:10px; }
.setrow { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr); gap:16px;
          align-items:start; padding-bottom:14px; border-bottom:1px solid var(--line); }
.setrow:last-child { border-bottom:0; padding-bottom:0; }
@media (max-width:760px) { .setrow { grid-template-columns:1fr; gap:6px; } }
.setrow label > b { display:block; font-size:14px; }
.setrow label > code { display:inline-block; color:var(--muted); background:var(--soft);
                       padding:1px 6px; border-radius:5px; margin:3px 0; font-size:11px; }
.setrow label > span.small { display:block; color:var(--muted); line-height:1.45; }
.setrow input[type=text], .setrow input:not([type]), .setrow textarea {
  width:100%; min-height:40px; padding:9px 11px; border:1px solid #858c81; border-radius:8px;
  font-size:14px; background:var(--panel); color:var(--ink); font-family:inherit; }
.setrow textarea { min-height:84px; resize:vertical; }
.switch { display:inline-flex; gap:8px; align-items:center; font-size:14px; }
.switch input { width:18px; height:18px; }
