/* Borya Склад — само неща, специфични за складовата програма. Общият вид (цветове, шрифтове, светла/тъмна
   тема, горна лента, меню, бутони, формуляри, таблици, съобщения, вход, телефон, печат) е в темата:
   /theme/fonts.css + /theme/borya.css (копие на темата на Borya Каса — app/theme/README.md). */

/* Допълнителни роли, изразени чрез ролите на темата (важат и за тъмната тема) */
:root {
  --sub: var(--muted);
  --sub-bg: var(--hover);
  --subtotal-bg: var(--hover);
  --total-border-strong: var(--total-border);
  --badge-lock: var(--text);
}

/* ---------- Общи ---------- */
.inline { display: inline-block; margin: 0 .5rem 0 0; }
.danger-zone { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.company-sub { margin: -.6rem 0 1.2rem; }
.h-sub { font-size: 1rem; font-weight: 400; margin-left: .4rem; }
.stat .small-num { font-size: 1.4rem; }
.badge.lock { background: var(--badge-bg); color: var(--badge-lock); }
.import-confirm { border-color: var(--accent); }
.table td.diff-ok { color: var(--ok); }
.table tr.subtotal td { background: var(--subtotal-bg); font-style: italic; }
/* Етап 8: скрити полета според основанието на изписването */
[hidden] { display: none !important; }

/* ---------- Документи ---------- */
.doc-total { text-align: right; }
.doc-total strong { font-family: var(--font-mono); font-size: 1.8rem; margin-left: .3rem; }
.doc-total .muted { display: block; font-size: .85rem; }
fieldset.table-wrap { padding: 0; margin: 0 0 .6rem; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
.doc-head { border: 1px solid var(--border); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 1rem; }
.grid .wide { grid-column: 1 / -1; }
.doc-lines { font-size: 1.02rem; }
.doc-lines th { padding: .7rem .6rem; }
.doc-lines td { padding: .35rem .5rem; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc-lines td.n, .doc-lines th.n { width: 2.5rem; color: var(--muted); text-align: right; padding-top: .9rem; }
.doc-lines td.n { font-family: var(--font-mono); font-weight: 600; }
.doc-lines td.art-cell { min-width: 22rem; }
.doc-lines input { padding: .6rem .75rem; }
.doc-lines input.qty, .doc-lines input.val { text-align: right; max-width: 10rem; margin-left: auto; display: block;
  font-family: var(--font-mono); }
.doc-lines input.art:not(:placeholder-shown) { font-weight: 600; }
.doc-lines td.stock, .doc-lines td.price { padding-top: .9rem; white-space: nowrap; }
.doc-lines tr.has-error td { background: var(--err-field); }
.doc-lines .error { text-align: left; }
.doc-lines tr.line td { transition: background-color .12s; }
.doc-lines tr.line:focus-within td { background: var(--accent-bg); }
.doc-lines tr.line:focus-within td.n { color: var(--accent-text); box-shadow: inset 3px 0 0 var(--accent); }
.doc-lines tr.line:focus-within input { border-color: var(--accent); }
/* падащият списък не се отрязва от рамката на таблицата с редовете */
fieldset.lines-wrap { overflow: visible; }
.btn-x { border: 0; background: none; color: var(--faint); font-size: 1.1rem; cursor: pointer; padding: .5rem; }
.btn-x:hover { color: var(--error); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .7rem 0; }
.sticky-actions form.inline { margin: 0; }
.btn-add-row { margin: 0 0 .8rem; font-size: 1.02rem; padding: .6rem 1.3rem; border: 1px dashed var(--accent);
  color: var(--accent-text); background: var(--surface); }
.btn-add-row:hover { background: var(--accent-bg); border-color: var(--accent); }
.btn-pdf { padding: .3rem .7rem; font-size: .85rem; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
td.pdf-cell { width: 1%; text-align: right; }
.row-buttons { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }
.row-buttons .btn { margin: 0 0 .8rem; }
.num-input { display: flex; gap: .3rem; align-items: stretch; }
.num-input input { flex: 1; }
.btn-sign { font: inherit; font-family: var(--font-mono); font-weight: 700; min-width: 2.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; }

/* Собственият списък за артикули (вместо <datalist>) */
.art-cell { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 2px 0 0; padding: .25rem; list-style: none;
  min-width: 100%; max-height: min(24rem, 55vh); overflow-y: auto; text-align: left; font-size: 1rem;
  overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-lg); box-shadow: 0 8px 24px var(--shadow); }
.ac-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; min-height: 2.6rem; border-radius: var(--radius);
  cursor: pointer; line-height: 1.3; color: var(--text); font-family: var(--font-ui); }
.ac-list li + li { margin-top: 1px; }
.ac-list li:hover { background: var(--hover); }
.ac-list li[aria-selected=true] { background: var(--primary-btn); color: var(--on-primary); }
.ac-list .code { flex: 0 0 auto; min-width: 4.5rem; padding: .1rem .45rem; border-radius: 2px; background: var(--head);
  color: var(--text); font-family: var(--font-mono); font-weight: 600; text-align: center; margin: 0; }
.ac-list li[aria-selected=true] .code { background: rgba(255, 255, 255, .18); color: inherit; }
.ac-list li.current::after { content: "✓ избран"; margin-left: auto; font-size: .82rem; opacity: .85; white-space: nowrap; }
.ac-list .empty { display: block; padding: .7rem; color: var(--muted); cursor: default; }
.ac-list li.ac-new { color: var(--accent-text); font-weight: 600; border-top: 1px solid var(--border); margin-top: .25rem; }
.ac-list li.ac-new:hover { background: var(--accent-bg); }

.tile.tile-new { border-style: dashed; border-top-style: solid; color: var(--accent-text); }

/* ---------- Ръководство ---------- */
/* „Ръководство“ в менюто — вдясно (преди „Админ“); на компютър менюто е по-сбито, за да се събере */
@media (min-width: 761px) {
  .mainnav .nav-help { margin-left: auto; }
  .mainnav .nav-help ~ .nav-admin { margin-left: 0; }
  .mainnav { gap: 0; }
  .mainnav a { padding-left: .45rem; padding-right: .45rem; gap: .35rem; }
  .nav-sep { margin: .75rem .2rem; }
}
.manual { max-width: 64rem; }
.manual-head .btn { display: inline-flex; align-items: center; gap: .45rem; }
.manual-toc ol { margin: 0 0 .4rem; padding-left: 1.3rem; }
.manual-toc li { margin: .3rem 0; }
.manual-part { margin-top: 1.2rem; line-height: 1.6; }
.manual-part .kicker { color: var(--accent-text); letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; font-weight: 600; }
.manual-part h2 { margin: .15rem 0 .9rem; padding-bottom: .4rem; border-bottom: 2px solid var(--accent); }
.manual-part h3 { margin: 1.3rem 0 .45rem; font-size: 1.12rem; }
.manual-part p, .manual-part ul, .manual-part ol { margin: 0 0 .7rem; }
.manual-part li { margin-bottom: .3rem; }
.m-row { display: flex; gap: 1.6rem; align-items: flex-start; }
.m-row .m-txt { flex: 1 1 0; min-width: 0; }
.m-row > .m-fig.phone { flex: 0 0 15rem; }
.m-row.single { justify-content: flex-start; }
.m-fig { margin: .8rem 0 1.2rem; }
.m-fig a.m-zoom { display: block; cursor: zoom-in; }
.m-fig img { display: block; max-width: 100%; height: auto; max-height: 26rem; margin: 0 auto 0 0; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 2px 10px var(--shadow-soft); background: var(--surface); }
.m-fig.phone img { max-height: 30rem; }
.m-fig figcaption { font-size: .88rem; color: var(--muted); margin-top: .35rem; }
.m-tip { background: var(--accent-bg); border-left: 3px solid var(--accent); padding: .7rem .9rem; margin: .7rem 0 1rem; border-radius: var(--radius); }
.m-table { margin: .3rem 0 .9rem; }
.m-table td:first-child { width: 30%; white-space: nowrap; }
.m-lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; }
.m-lightbox::backdrop { background: rgba(0, 0, 0, .82); }
.m-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.m-lightbox img { max-width: 96vw; max-height: 94vh; width: auto; height: auto; border-radius: var(--radius); background: #fff; cursor: zoom-out; }
.m-lb-close { position: fixed; top: max(.6rem, env(safe-area-inset-top)); right: .6rem; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 1.4rem; cursor: pointer; }

/* ---------- Справки ---------- */
.filters .field { margin-bottom: .6rem; }
.table.report th.grp { text-align: center; border-left: 1px solid var(--border); }
.table.report td, .table.report th { padding: .45rem .6rem; }
.table.report td.num { white-space: nowrap; }
.table.report .sub { color: var(--sub); font-size: .9em; background: var(--sub-bg); }
/* Сбити заглавия на колоните — да се събира всичко без страничен скрол */
.table.report th { letter-spacing: .03em; font-size: .74rem; padding: .45rem .55rem; }
.table.report thead tr + tr th { font-size: .7rem; padding-top: .3rem; padding-bottom: .3rem; }
.table.report .th-sub { text-transform: none; font-weight: 400; letter-spacing: 0; }
/* Групи колони (Начално / Доставено / …) — тънка разделителна линия отляво */
.table.report .g { border-left: 1px solid var(--line); }
.table.report thead th.g { border-left-color: var(--border); }
.table.report th.grp-end, .table.report td.end { background: var(--sub-bg); }
.table.report tr.total td.end { background: var(--head); }
.table.report td.art-name small { display: block; font-size: .82rem; line-height: 1.3; margin-top: .1rem; }
.table.report td .rev { display: block; font-size: .78rem; color: var(--muted); line-height: 1.3; }
.table.report td .badge { display: block; margin: .2rem 0 0 auto; width: max-content; }
.ledger-form { margin: 0; display: none; }
.ledger-input { max-width: 8rem; text-align: right; margin-left: auto; display: block; padding: .3rem .5rem; font-family: var(--font-mono); }
.diff-note { display: block; font-size: .78rem; margin-top: .2rem; font-family: var(--font-ui); white-space: nowrap; }
.diff-note.diff-bad { color: var(--error); font-weight: 700; }
.diff-note.diff-ok { color: var(--ok); }
.table.sales tr.group td { background: var(--head); }
.table.sales td.indent { padding-left: 1.6rem; }
/* Филтрите на справките: на компютър бутоните са на същия ред като полетата */
@media (min-width: 761px) {
  .report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 1rem; padding: .9rem 1.2rem .35rem; }
  .report-filters > .grid { flex: 999 1 32rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
  .report-filters > .actions { flex: 1 0 auto; margin: 0 0 .6rem; }
  .grid .span2 { grid-column: span 2; }
  /* заглавната част на документа: „Бележка“ не взема цял ред */
  .doc-head .grid .wide { grid-column: span 2; }
}
h2 + .table-wrap, .table-wrap + h2 { margin-top: 1.2rem; }
/* Сборен ред отгоре (на телефон) */
.m-totals { background: var(--head); border: 1px solid var(--total-border); border-radius: var(--radius-lg); padding: .7rem 1rem; margin: 0 0 .8rem; }
.m-totals strong { display: block; margin-bottom: .2rem; font-family: var(--font-ui); }
.m-totals span { margin-right: .8rem; }
.m-totals .big { font-weight: 700; font-size: 1.15rem; }
.m-totals dl { display: grid; grid-template-columns: auto 1fr; gap: .1rem .8rem; margin: 0; }
.m-totals dt { color: var(--muted); font-family: var(--font-ui); }
.m-totals dd { margin: 0; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Ревизия ---------- */
.steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
.steps li { flex: 1 1 12rem; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--muted); font-family: var(--font-ui); }
.steps li strong { display: block; color: var(--text); }
.steps li span { font-size: .88rem; }
.steps li.current { border-color: var(--accent); background: var(--accent-bg); }
.steps li.current strong { color: var(--accent-text); }
.steps li.done strong::after { content: " ✔"; color: var(--ok); }
.count-tools { align-items: center; }
.count-tools .check { display: inline-flex; gap: .4rem; align-items: center; white-space: nowrap; margin: 0; }
.count-tools .count-progress { margin-left: auto; }
.count-table td { vertical-align: middle; padding: .35rem .7rem; }
.count-table td.code { color: var(--muted); white-space: nowrap; font-family: var(--font-mono); }
.count-table td.book { white-space: nowrap; }
.count-table input.count-input { max-width: 9rem; margin-left: auto; display: block; text-align: right; font-weight: 600; font-family: var(--font-mono); }
.count-table input.count-input::placeholder { color: var(--faint); font-weight: 400; }
.count-table tr.count-row:focus-within td { background: var(--accent-bg); }
.count-table tr.count-row:focus-within td.code { box-shadow: inset 3px 0 0 var(--accent); color: var(--accent-text); }
.count-table tr.counted td.code::before { content: "✓ "; color: var(--ok); }
.count-table td.diff { font-weight: 700; white-space: nowrap; min-width: 5rem; }
.diff-stats .stat-plus { border-left: 4px solid var(--ok); }
.diff-stats .stat-minus { border-left: 4px solid var(--error); }
.diff-stats .stat-plus .num { color: var(--ok); }
.diff-stats .stat-minus .num { color: var(--error); }
.diff-table td.strong { font-weight: 700; }

@media print {
  .filters, .hint, .m-totals, .btn-add-row, .row-buttons { display: none !important; }
}

/* ---------- Телефон (до 760 px) ---------- */
@media (max-width: 760px) {
  .d-only { display: none !important; }
  .btn-x { min-width: 44px; min-height: 44px; }
  .page-head > .actions, .page-head > .btn { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
  .page-head > .btn { display: flex; }

  /* Ленти с филтри (сгъваеми) */
  .toolbar > .more { width: 100%; }
  .collapsible:not(.expanded) .more { display: none !important; }
  .filters .actions .filters-toggle { grid-column: 1 / -1; }
  .toolbar.collapsible { display: grid; grid-template-columns: 1fr auto; }
  .toolbar.collapsible > input[type=search] { grid-column: 1 / -1; }
  .toolbar.collapsible > .more { grid-column: 1 / -1; }
  .toolbar.collapsible > button[type=submit]:not(.more) { order: 0; }
  .filters .actions { display: grid; grid-template-columns: 1fr 1fr; }

  .table.cards td.card-title .m-only { font-weight: 400; font-size: .9rem; }
  .table.cards tr.total td { font-weight: 700; }

  /* Широки справки: хоризонтален скрол, закачена първа колона */
  .table.sticky-first td:first-child, .table.sticky-first th:first-child {
    position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 8.5rem; max-width: 10.5rem;
    white-space: normal; box-shadow: 2px 0 0 var(--border); }
  .table.sticky-first thead th:first-child { background: var(--head); z-index: 3; }
  .table.sticky-first thead tr + tr th:first-child { position: static; min-width: 0; max-width: none; box-shadow: none; z-index: auto; }
  .table.sticky-first tr.total td:first-child { background: var(--head); }
  .table.sticky-first tr.subtotal td:first-child { background: var(--subtotal-bg); }
  .table.sticky-first .m-name { display: block !important; font-size: .85rem; color: var(--text); line-height: 1.25;
    font-family: var(--font-ui); margin-top: .1rem; }
  .table.report td, .table.report th { padding: .45rem .5rem; }
  .table.report tfoot tr.total td { border-top: 2px solid var(--total-border-strong); font-size: 1.02rem; }

  /* Справки като карти (без страничен скрол). „qv“: редове „етикет … кол. | сума“ */
  .table.report.cards td, .table.report.cards th { padding: .2rem 0; }
  .table.report.cards td.card-title { padding-bottom: .35rem; }
  .table.report.cards .g, .table.report.cards td.end { border-left: 0; background: none; }
  .table.report.cards tr.total td { border-top: 0; background: none; }
  .table.report.cards tr.subtotal { background: var(--subtotal-bg); }
  .table.report.cards tr.subtotal td { background: none; }
  .table.report.cards tr.row-warn { border-color: var(--warn); background: var(--row-warn-bg); }
  .table.report.cards tr.row-warn td { background: none; }
  .table.report.cards td .badge { display: inline-block; margin: 0 0 0 .4rem; }
  .table.cards.qv tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(6.5rem, auto); column-gap: 1rem; }
  .table.cards.qv td { grid-column: 1 / -1; }
  .table.cards.qv td.q { grid-column: 1; }
  .table.cards.qv td.v { grid-column: 2; justify-content: flex-end; }
  .table.cards.qv td.q, .table.cards.qv td.v { flex-wrap: wrap; column-gap: .5rem; }
  .table.cards.qv td .rev { flex-basis: 100%; text-align: right; }
  .table.cards.qv td.q.end, .table.cards.qv td.v.end { font-weight: 700; border-top: 1px dashed var(--line); margin-top: .15rem; padding-top: .3rem; }
  .table.cards td.ledger { flex-wrap: wrap; }
  .table.cards td.ledger .ledger-input { flex: 0 1 9rem; }
  .table.cards td.ledger .diff-note { flex-basis: 100%; text-align: right; }
  .table.sales.cards tr.group { background: var(--head); border-color: var(--total-border); margin-top: 1rem; }
  .table.sales.cards tr.group td { background: none; }
  .table.sales.cards td.indent { padding-left: 0; }
  .table.karton.cards td.partner { display: block; text-align: left; color: var(--muted); font-size: .92rem; }
  .table.karton.cards td.partner:empty { display: none; }

  /* Документ: редовете като карти */
  .doc-total { text-align: left; }
  .doc-total strong { font-size: 1.4rem; }
  .doc-lines td.art-cell { min-width: 0; }
  .doc-lines td { border-bottom: 0; }
  fieldset.lines-wrap { background: transparent; border: 0; overflow: visible; }
  .line-cards, .line-cards tbody { display: block; }
  .line-cards thead { display: none; }
  .line-cards tr.line { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: .6rem .8rem .8rem;
    margin-bottom: .7rem; }
  .line-cards tr.line.blank-hidden { display: none; }
  .line-cards tr.line.has-error { border-color: var(--error); }
  .line-cards tr.line:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
  .line-cards tr.line:focus-within td { background: none !important; }
  .line-cards tr.line:focus-within td.n { box-shadow: none; }
  .line-cards td { display: block; padding: 0 !important; border: 0; text-align: left; background: none !important; }
  .line-cards td[data-label]::before { content: attr(data-label); display: block; font-size: .85rem; color: var(--muted);
    margin-bottom: .15rem; font-family: var(--font-ui); }
  .line-cards td.n { grid-column: 1 / -1; width: auto; text-align: left; font-weight: 600; color: var(--muted); min-height: 1.6rem; }
  .line-cards td.art-cell, .line-cards td.stock { grid-column: 1 / -1; }
  .line-cards td.stock:empty, .line-cards td.price:empty { display: none; }
  .line-cards td.stock { font-size: .95rem; color: var(--text); background: var(--hover) !important; border-radius: var(--radius);
    padding: .35rem .6rem !important; }
  .line-cards td.stock::before { display: inline !important; margin-right: .3rem; }
  .line-cards td.x-cell { position: absolute; top: .1rem; right: .1rem; }
  .line-cards input.qty, .line-cards input.val { max-width: none; text-align: right; }
  .line-cards td.num { text-align: left; }
  .btn-add-row { width: 100%; min-height: 52px; font-size: 1.1rem; }
  .row-buttons { display: grid; grid-template-columns: 1fr; gap: 0; }
  .row-buttons #new-article { width: 100%; min-height: 44px; }
  .ac-list li { min-height: 44px; }
  .m-row { flex-direction: column; gap: 0; }
  .m-row > .m-fig.phone { flex: none; width: 100%; }
  .m-fig.phone img { max-height: 70vh; margin: 0 auto; }
  .m-fig img { margin: 0 auto; }
  .m-fig figcaption { text-align: center; }
  .manual-part { padding: 1rem; }
  .m-table td:first-child { white-space: normal; }
  .btn-pdf { min-height: 44px; min-width: 56px; display: inline-flex; align-items: center; justify-content: center; }
  .table.cards td.pdf-cell { text-align: right; }

  /* Закачени долу бутони „Запиши“ / „Проведи“ */
  #doc-form { padding-bottom: calc(10rem + env(safe-area-inset-bottom)); }
  .sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; background: var(--surface);
    border-top: 1px solid var(--border); box-shadow: 0 -4px 14px var(--shadow-soft);
    padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: .5rem; }
  .sticky-actions .btn { flex: 1 1 0; min-height: 50px; font-size: 1.02rem; }
  .sticky-actions .btn-ghost { display: none; }
  .sticky-actions .sticky-total { flex-basis: 100%; text-align: right; color: var(--muted); }
  .sticky-actions .sticky-total strong { color: var(--text); font-size: 1.15rem; font-family: var(--font-mono); }
  .sticky-actions form.inline { flex: 1 1 100%; display: flex; }
  .sticky-actions form.inline .btn { flex: 1; }
  .danger-zone { flex-direction: column; align-items: stretch; }
  .danger-zone form, .danger-zone .btn { width: 100%; margin: 0; }

  /* Ревизия */
  .steps li { flex-basis: 100%; padding: .4rem .7rem; }
  .steps li span { display: none; }
  .count-tools .count-progress { margin-left: 0; }
  .count-table thead { display: none; }
  .count-table, .count-table tbody { display: block; }
  .count-table tr.count-row { display: grid; grid-template-columns: 1fr 9rem; gap: .2rem .6rem; padding: .6rem .7rem;
    border-bottom: 1px solid var(--border); }
  .count-table td { display: block; padding: 0; border: 0; }
  .count-table td.code { grid-column: 1; grid-row: 1; }
  .count-table td.name { grid-column: 1; grid-row: 2; font-weight: 600; }
  .count-table td.book { grid-column: 1; grid-row: 3; text-align: left; }
  .count-table td.book::before { content: "по програма: "; color: var(--muted); font-size: .9rem; }
  .count-table td:nth-child(4) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .count-table td.diff { grid-column: 2; grid-row: 3; text-align: right; }
  .count-table input.count-input { max-width: none; }
  #count-form { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  .diff-actions { flex-direction: column; align-items: stretch; }
  .diff-actions form.inline { display: flex; margin: 0; }
  .diff-actions form.inline .btn, .diff-actions > .btn { flex: 1; width: 100%; }
}

/* Тъмна тема по настройката на устройството: отметките и радиобутоните — в месинг (както при избрана тъмна) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) input[type=checkbox], :root:not([data-theme=light]) input[type=radio] { accent-color: var(--brass); }
}

/* ---------- Инсталиране като приложение (PWA) ---------- */
.install-block { margin-top: 1rem; text-align: center; }
.install-title { font-family: var(--font-display); font-size: 1.1rem; margin: 0 0 .3rem; }
.install-lead { margin: 0 0 .8rem; font-size: .92rem; color: var(--muted); }
.install-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.install-btns .btn { min-height: 48px; min-width: 0; width: 100%; padding: .4rem .5rem; justify-content: center; gap: .4rem;
  white-space: normal; line-height: 1.2; text-align: center; }
.install-btns .ib-ico { width: 20px; height: 20px; flex: none; }
.install-msg { margin: .8rem 0 0; padding: .6rem .75rem; border-radius: var(--radius); background: var(--info-bg); color: var(--info);
  font-family: var(--font-ui); font-size: .95rem; text-align: left; }
.install-msg b { white-space: nowrap; }
.install-ios { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .9rem; text-align: left; }
.install-ios li { display: grid; gap: .45rem; }
.install-ios .step-text { font-size: .95rem; line-height: 1.4; }
.install-ios .step-note { display: block; font-size: .85rem; color: var(--muted); }
.step-pic { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.step-pic .sp-bar { fill: var(--head); stroke: var(--border); }
.step-pic .sp-line { fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.step-pic .sp-strong { stroke: var(--link); stroke-width: 2.8; }
.step-pic .sp-hl { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 2; }
.step-pic .sp-sep { stroke: var(--line); stroke-width: 1.5; }
.step-pic .sp-t { font: 600 15px var(--font-ui); fill: var(--text); }
.step-pic .sp-small { font-size: 13px; }
.step-pic .sp-mut { fill: var(--muted); font-weight: 400; }
.step-pic .sp-strong-t { fill: var(--link); }
.emoji-ico { width: 18px; text-align: center; font-size: 1rem; line-height: 1; flex: none; }
.install-already { display: none; }
/* Отворено като инсталирано приложение — бутоните за инсталиране не трябват. */
html.pwa-app .install-block, html.pwa-app .pwa-install-link { display: none !important; }
html.pwa-app .install-already { display: block; }
@media (max-width: 760px) {
  .nav-user { flex-wrap: wrap; }
  .nav-user .nav-install { order: 10; flex: 1 0 100%; justify-content: center; }
  .nav-user .nav-new-company { order: 9; flex: 1 0 100%; justify-content: center; }
}
@media (max-width: 360px) {
  .install-btns { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .table.report.cards td.card-title .m-name { margin-left: .5rem; font-family: var(--font-ui); }
}
@media (max-width: 760px) {
  /* дълги думи/номера в картите не разпъват страницата */
  .table.cards td { overflow-wrap: anywhere; min-width: 0; }
}
