:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --text: #16181d;
  --muted: #6a7180;
  --accent: #2f6fed;
  --accent-soft: #e8efff;
  --ok: #138a4c;
  --ok-soft: #e4f5ec;
  --warn: #b25e00;
  --warn-soft: #fff1df;
  --bad: #c62f2f;
  --bad-soft: #fde9e9;
  --yandex: #2a78d6;
  --glovo: #eb6834;
  --buyam: #1baf7a;
  --seq: #2a78d6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1d2128;
    --border: #2a2f38;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --accent: #6b9bff;
    --accent-soft: #1d2a44;
    --ok: #4cc38a;
    --ok-soft: #15301f;
    --warn: #f0a845;
    --warn-soft: #34260f;
    --bad: #ff7b7b;
    --bad-soft: #3a1818;
    --yandex: #3987e5;
    --glovo: #d95926;
    --buyam: #199e70;
    --seq: #5b9cf0;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Inter", "Noto Sans Armenian", system-ui, sans-serif;
}
main { max-width: 1600px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.hidden { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo { font-size: 26px; color: var(--accent); }
h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.sub { margin: 0; color: var(--muted); font-size: 12px; }

.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.pill.idle { background: var(--surface-2); color: var(--muted); }
.pill.running { background: var(--accent-soft); color: var(--accent); }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.error { background: var(--bad-soft); color: var(--bad); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.controls { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; padding: 16px 20px; align-items: start; }
@media (max-width: 1000px) { .controls { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.field .check { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text); font-size: 13px; display: flex; gap: 8px; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.dates { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: var(--muted); }
input[type=date], input[type=search], select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
input:focus, select:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.actions .buttons { display: flex; gap: 8px; margin-top: 12px; }
.btn {
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 8px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { padding: 7px 12px; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; max-width: 340px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }

.progress { padding: 12px 20px; }
.progress-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.log {
  margin: 10px 0 0; max-height: 220px; overflow: auto; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 12px; white-space: pre-wrap;
}
.spinner {
  display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 20px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 11px; color: var(--muted); margin-top: 2px; }

.grid-card { padding: 0; overflow: hidden; }
.grid-toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 9px; border: 1px solid var(--border); }
.tab { border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search] { width: 240px; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; margin: 0; }

/* Tabulator theming */
#grid { border: 0; }
.tabulator { background: var(--surface); border: 0; font-size: 13px; color: var(--text); }
.tabulator .tabulator-header { background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--muted); }
.tabulator .tabulator-header .tabulator-col { background: var(--surface-2); border-right: 1px solid var(--border); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-weight: 600; font-size: 12px; }
.tabulator .tabulator-header .tabulator-col input,
.tabulator .tabulator-header .tabulator-col select { padding: 4px 6px; font-size: 12px; border-radius: 6px; width: 100%; }
.tabulator .tabulator-tableholder .tabulator-table { background: var(--surface); color: var(--text); }
.tabulator-row { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabulator-row.tabulator-row-even { background: var(--surface-2); }
.tabulator-row.tabulator-selectable:hover { background: var(--accent-soft); }
.tabulator-row .tabulator-cell { border-right: 0; padding: 7px 10px; }
.tabulator .tabulator-footer { background: var(--surface-2); border-top: 1px solid var(--border); color: var(--text); }
.tabulator .tabulator-footer .tabulator-calcs-holder { background: var(--surface-2); border-top: 0; }
.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row { background: var(--surface-2); font-weight: 700; }
.tabulator-placeholder span { color: var(--muted) !important; font-weight: 500 !important; font-size: 14px !important; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tag.yandex, .tag.glovo, .tag.buyam { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.tag.yandex::before, .tag.glovo::before, .tag.buyam::before { content: ""; display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.tag.yandex::before { background: var(--yandex); }
.tag.glovo::before { background: var(--glovo); }
.tag.buyam::before { background: var(--buyam); }
.tag.Completed { background: var(--ok-soft); color: var(--ok); }
.tag.Cancelled { background: var(--bad-soft); color: var(--bad); }
.tag.progress { background: var(--accent-soft); color: var(--accent); }
.warn-text { color: var(--warn); font-weight: 600; }

/* ---------- navigation & views ---------- */
.topbar { gap: 16px; flex-wrap: wrap; }
.mainnav { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; border: 1px solid var(--border); }
.navbtn { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); }
.navbtn:hover { color: var(--text); }
.navbtn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.view { max-width: 1600px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.muted { color: var(--muted); font-weight: 400; }
.hint.wide { max-width: none; margin: 0 4px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 16px; }
.toolbar-left { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input[type=search] { width: 240px; }
.toolbar input:not([type=search]):not([type=date]):not([type=checkbox]) {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
label.inline { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.section-title { font-size: 14px; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border); }

.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.iconbtn { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }

.fc-good { color: var(--ok); font-weight: 600; }
.fc-mid { color: var(--warn); font-weight: 600; }
.fc-bad { color: var(--bad); font-weight: 600; }
.thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; vertical-align: middle; }

/* ---------- editor drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 16, .35); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(860px, 100vw); z-index: 21;
  background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, .12);
}
.drawer-head, .drawer-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.drawer-foot { border-bottom: 0; border-top: 1px solid var(--border); }
.drawer-head h2 { flex: 1; margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px 24px; }
.drawer-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 8px; }
.spacer { flex: 1; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid label, .drawer-body > label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.span2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.drawer input:not([type=radio]):not([type=file]), .drawer select, .drawer textarea {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; width: 100%;
}
.drawer textarea { resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text); }
.seg label { display: flex; gap: 6px; align-items: center; font-weight: 500; color: var(--text); flex-direction: row; }
.pair { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.form-grid .pair { margin-top: 0; }
.pair select { width: auto !important; }

table.lines { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
table.lines th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 4px; border-bottom: 1px solid var(--border); }
table.lines td { padding: 4px; vertical-align: middle; }
table.lines td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.lines input { padding: 6px 7px !important; }
table.lines .c-comp { width: 40%; }
table.lines .c-qty { width: 10%; }
table.lines .c-sec select { min-width: 128px; }
table.lines .c-unit select { min-width: 68px; }

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 14px; }
.totals .kpi { box-shadow: none; padding: 10px 12px; }
.totals .kpi .v { font-size: 17px; }
.warnings { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.warnings li { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 500; }
.chip .x { margin-left: 6px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 13px; }
.photo-row { display: flex; gap: 14px; align-items: flex-start; }
.photo { width: 160px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- modal window ---------- */
dialog.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
}
dialog.modal::backdrop { background: rgba(10, 12, 16, .4); }
dialog.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
dialog.modal .form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
dialog.modal input, dialog.modal select, dialog.modal textarea {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
dialog.modal input:disabled, dialog.modal select:disabled, dialog.modal textarea:disabled { background: var(--surface-2); color: var(--text); opacity: 1; }
.used-list { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.used-list li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.row-actions { display: flex; gap: 4px; }
.row-actions button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.row-actions button:hover { border-color: var(--accent); color: var(--accent); }
.row-actions button.del:hover { border-color: var(--bad); color: var(--bad); }
.no-price { color: var(--muted); font-size: 12px; }
dialog.modal { width: min(760px, calc(100vw - 32px)); }
table.goods td input { padding: 6px 8px !important; }
table.goods .g-name { width: 44%; } table.goods .g-sup { width: 24%; } table.goods .g-unit { width: 14%; } table.goods .g-qty { width: 14%; }

.modal-body .hint { max-width: none; }

dialog.modal.wide { width: min(1000px, calc(100vw - 32px)); }
.price-now { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.price-now b { font-size: 18px; }
details.history { margin-top: 10px; }
details.history summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
details.history table { margin-top: 8px; }
label.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; font-weight: 500 !important; }
label.check input { width: auto !important; }

.mtabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 18px 0; border-bottom: 1px solid var(--border); }
.mtab { border: 0; background: none; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.mtab .dot-count { font-weight: 500; color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.checks label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); font-weight: 500; }
.checks input { width: auto !important; }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .form-grid.four { grid-template-columns: 1fr 1fr; } }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.log-list li { border-left: 3px solid var(--border); padding: 4px 10px; }
.log-list .when { color: var(--muted); margin-right: 8px; }
input.narrow { width: 70px !important; }
.tabulator-row.archived .tabulator-cell { color: var(--muted); }
.allergen { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; margin: 1px 2px 1px 0;
  background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.label-chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; margin: 1px 2px 1px 0;
  background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.stock-out { color: var(--bad); font-weight: 600; } .stock-low { color: var(--warn); font-weight: 600; } .stock-ok { color: var(--ok); }

.chips-line { margin-bottom: 8px; }

a.btn { text-decoration: none; display: inline-block; }

:root { --chart: #2f6fed; }
@media (prefers-color-scheme: dark) { :root { --chart: #5b8ef5; } }
.chart-wrap { position: relative; margin-top: 12px; }
.price-chart { width: 100%; height: auto; display: block; }
.price-chart .grid { stroke: var(--border); stroke-width: 1; }
.price-chart .axis { fill: var(--muted); font-size: 11px; }
.price-chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.price-chart .area { fill: var(--chart); opacity: .1; }
.price-chart .dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.price-chart .dot.active { r: 6; }
.price-chart .cross { stroke: var(--muted); stroke-width: 1; }
.price-chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; width: 180px; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; font-size: 12px; box-shadow: var(--shadow); }

/* ---- Sales */
.subtabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 9px; border: 1px solid var(--border); }
.subtab { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); }
.subtab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.sub { display: flex; flex-direction: column; gap: 12px; }
.sub.hidden { display: none; }
.notice { margin: 0; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--text); font-size: 13px; border: 1px solid var(--border); }
.chart-card { padding-bottom: 10px; }
.chart-card .chart-wrap { margin: 6px 14px 0; }
.legend { display: flex; gap: 14px; padding: 10px 14px 0; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.table-view { margin: 6px 14px 0; font-size: 12px; overflow-x: auto; }
.table-view summary { cursor: pointer; color: var(--muted); }
.table-view table { border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 3px 10px; border-bottom: 1px solid var(--border); text-align: right; }
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.svg-chart { width: 100%; height: auto; display: block; overflow: visible; }
.svg-chart .grid { stroke: var(--border); stroke-width: 1; }
.svg-chart .axis { fill: var(--muted); font-size: 11px; }
.svg-chart .seg { stroke: var(--surface); stroke-width: 2; }
.svg-chart .hit { fill: transparent; }
.svg-chart .hit:hover { fill: var(--text); fill-opacity: .05; }
.svg-chart .qline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.svg-chart .qlabel { fill: var(--muted); font-size: 12px; font-weight: 600; }
.svg-chart .dot { fill: var(--seq); stroke: var(--surface); stroke-width: 2; fill-opacity: .85; cursor: default; }
.svg-chart .dot:hover { stroke: var(--text); }
.svg-chart .dlabel { fill: var(--text); font-size: 11px; }
.heat { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 10px; color: var(--muted); }
.heat .cell { aspect-ratio: 1.6; border-radius: 3px; background: var(--surface-2); }
.heat .cell:hover { outline: 2px solid var(--text); }
.heat .hl { text-align: center; }
.heat .wl { align-self: center; }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.heat-scale .r { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--seq) 10%, var(--surface)), var(--seq)); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.pad { padding: 10px 14px; }
.report-text { margin: 0 14px 14px; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  white-space: pre-wrap; font: 13px/1.45 ui-monospace, Consolas, monospace; }
.up { color: var(--ok); } .down { color: var(--bad); }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } .heat { grid-template-columns: 28px repeat(24, minmax(0, 1fr)); font-size: 8px; } }
.chart-tip .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.svg-chart .dlabel { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
@media (max-width: 760px) {
  .mainnav, .subtabs { max-width: 100%; overflow-x: auto; }
  .mainnav .navbtn, .subtab { white-space: nowrap; flex: 0 0 auto; }
  #view-sales .toolbar-left > * { max-width: 100%; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .view > *, .sub > * { min-width: 0; }
}

/* ---- tax portal run */
.tax-run { padding: 12px 14px; }
.tax-run-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tax-run .run-log { max-height: 180px; overflow: auto; margin: 8px 0 0; padding: 8px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; font: 12px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; }

/* ---- invoice details */
.inv-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
.inv-meta dt { color: var(--muted); }
.inv-meta dd { margin: 0; }
.atg-box { font-size: 13px; }
.atg-box .chips { margin-top: 6px; }

/* ---- invoices: selection actions, suggestions */
.grid-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.grid-actions .spacer { flex: 1; }
.grid-actions select { margin: 0 4px; }
#aSuggest, #bSuggest { align-items: center; }
#bRows input.narrow { width: 110px; }
/* tables never widen their section (a wide Tabulator scrolls inside its card instead of the whole page) */
.view > *, .sub > *, .two-col > * { min-width: 0; }
.grid-card { max-width: 100%; }

/* ---- waste log, other costs */
.view-tabs { align-self: start; }
.waste-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; padding: 12px 14px 4px; align-items: end; }
.waste-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.waste-grid label.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; }
.waste-grid .wide { grid-column: span 2; }
.waste-grid input, .waste-grid select { width: 100%; }
.waste-actions { display: flex; gap: 8px; justify-content: flex-end; padding-bottom: 2px; }
@media (max-width: 640px) { .waste-grid .wide { grid-column: auto; } }

/* ---- usage calculation window */
.usage-calc .dish-row td { border-top: 2px solid var(--border); padding-top: 8px; }
.usage-calc .calc-row td { padding: 2px 8px 10px 22px; font-size: 12px; color: var(--muted); }
.usage-calc .calc-row b { color: var(--text); font-weight: 600; }
.usage-calc .calc-step { margin: 2px 0; }
.usage-calc tfoot td { border-top: 2px solid var(--border); padding-top: 8px; }

/* ---- orders: grouping */
.groupbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.groupbar .spacer { flex: 1; }
.groupbar select { max-width: 200px; }
#grid .tabulator-group { background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 400; }
#grid .tabulator-group .group-sum { margin-left: 10px; font-variant-numeric: tabular-nums; }
#grid .tabulator-row.tabulator-calcs { background: var(--surface-2); font-weight: 600; }

/* ---- linked products: unsaved corrections */
#linkedGrid .tabulator-row.row-pending { background: var(--warn-soft); }

/* ---- supplier orders */
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.po-head { display: flex; align-items: center; gap: 10px; padding-right: 14px; }
.po-head .section-title { flex: 1; border-bottom: 0; }
.pad-x { margin: 0 14px; }
.po-add { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 6px 14px 0; }
.po-add label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.po-add .grow { flex: 1 1 220px; }
.po-add .qty { flex: 0 0 170px; }
.po-add input, .po-add select { width: 100%; }
.qty-row { display: flex; gap: 6px; align-items: center; }
.qty-row input { width: 90px; }
.po-lines { margin: 10px 14px; width: calc(100% - 28px); }
.po-lines .sup-row td { background: var(--surface-2); font-weight: 600; }
.po-lines input.narrow { width: 90px; }
.po-lines tr.removed td { text-decoration: line-through; color: var(--muted); }
.po-lines tr.removed td:last-child { text-decoration: none; }
.po-lines tr.changed td, .po-lines tr.added td { background: var(--warn-soft); }
.po-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px 14px; }
.po-actions .spacer { flex: 1; }
.waste-grid .full { grid-column: 1 / -1; }
.waste-grid textarea { width: 100%; font: inherit; }
.msg-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.msg-label textarea { width: 100%; font: 13px/1.45 ui-monospace, Consolas, monospace; }
#poOrderDialog .po-actions { padding: 10px 0; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---- supplier orders: kitchen link, pictures */
.kitchen-link { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 14px 16px; }
.cat-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; padding: 12px 14px 16px; }
.cat-pic { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12px; }
.cat-pic-img { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; border: 1px dashed var(--border); background: var(--surface-2); font-size: 44px; overflow: hidden; cursor: pointer; padding: 0; }
.cat-pic-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-pic-name { font-weight: 600; }

/* ---- orders: columns menu, order window */
.col-menu-wrap { position: relative; }
.col-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 240px; max-height: 60vh; overflow: auto; padding: 8px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); }
.col-menu-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.col-menu .link { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.col-item { display: flex; align-items: center; gap: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.col-item:hover { background: var(--surface-2); }
#grid.rows-open .tabulator-row:not(.tabulator-group):not(.tabulator-calcs) { cursor: pointer; }
.od-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 14px; }
.od-money dd { text-align: right; font-variant-numeric: tabular-nums; }
#odItems th.num, #odItems td.num { text-align: right; }
#odItems tfoot td { border-top: 2px solid var(--border); }
#odTitle .tag { vertical-align: 3px; }
@media (max-width: 700px) { .od-top { grid-template-columns: 1fr; } }

/* ---- dish mapping */
#mapDishGrid .tabulator-cell.map-actions { white-space: normal; }
#mapDishGrid .map-btns { display: flex; flex-wrap: wrap; gap: 4px; }
#mapCardGrid .tabulator-cell { white-space: normal; }

/* ---- logged-in user, roles */
.me { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.me-name { font-weight: 600; }
.me-role { color: var(--muted); }
.role-name { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 12px; max-width: 360px; }
.role-matrix td, .role-matrix th { text-align: center; }
.role-matrix td:first-child, .role-matrix th:first-child { text-align: left; }
.role-matrix input { width: 18px; height: 18px; }
/* supplier orders: what a role without these rights doesn't need */
body:not(.can-approve) #poApprove, body:not(.can-approve) #poReject { display: none !important; }
body:not(.purch-full) #poTabs .subtab[data-sub=sending], body:not(.purch-full) #poTabs .subtab[data-sub=suppliers],
body:not(.purch-full) #poTabs .subtab[data-sub=items], body:not(.purch-full) #poTabs .subtab[data-sub=settings],
body:not(.purch-full) #poTabs .subtab[data-sub=calendar], body:not(.purch-full) #poTabs .subtab[data-sub=standing],
body:not(.purch-full) #poTabs .subtab[data-sub=returns], body:not(.purch-full) #poTabs .subtab[data-sub=prices] { display: none; }

/* ---- supplier orders: calendar, invoice check, flags */
.po-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.po-day { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px; min-height: 110px; min-width: 0; }
.po-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.po-day.past { opacity: .7; }
.po-day h4 { margin: 0 0 6px; font-size: 13px; display: flex; justify-content: space-between; gap: 6px; }
.po-cal-order { display: block; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2, var(--bg));
  padding: 4px 6px; margin-bottom: 4px; font-size: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.po-cal-order:hover { border-color: var(--accent); }
.po-cal-order .tag { float: right; margin-left: 4px; }
.po-cal-free { font-size: 12px; color: var(--muted); padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .po-cal { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.flag { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 6px; border-radius: 6px; font-size: 12px;
  background: var(--warn-soft, #fff4e0); color: var(--warn, #b45309); }
.flag.ok { background: var(--ok-soft, #dcfce7); color: var(--ok, #15803d); }
.cheapest { color: var(--ok, #15803d); font-weight: 600; }
body.no-money .money-only { display: none !important; }

/* ---- Data page */
.dp-checks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.dp-checks li.ok { color: var(--ok); }
.dp-checks li.bad { color: var(--bad); font-weight: 600; }
.dp-days-wrap { max-height: 460px; overflow: auto; }
.dp-days td, .dp-days th { text-align: center; }
.dp-days td:first-child, .dp-days th:first-child { text-align: left; white-space: nowrap; }
.dp-day { border-radius: 6px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.dp-day.settled { background: var(--ok-soft); color: var(--ok); }
.dp-day.fetched { background: var(--warn-soft); color: var(--warn); }
.dp-day.missing { background: var(--surface-2); color: var(--muted); }

/* Settings (company details) */
#view-settings .card { display: grid; gap: 14px; padding: 16px 18px; }
#view-settings input:not([type=checkbox]):not([type=radio]), #view-settings select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
#view-settings input:disabled, #view-settings select:disabled { background: var(--surface-2); color: var(--text); opacity: 1; }
#view-settings .form-grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
#view-settings .hint { max-width: none; }
.st-table label.check { display: inline-flex; gap: 4px; align-items: center; margin-right: 8px; font-size: 13px; }
.set-actions { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; }
.st-table { width: 100%; border-collapse: collapse; }
.st-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; }
.st-table td { padding: 4px 6px; vertical-align: middle; border-top: 1px solid var(--border); }
.st-table input:not([type=checkbox]):not([type=radio]) { width: 100%; min-width: 0; }
.st-table .st-short { width: 64px; }
.st-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.st-logo { display: flex; gap: 10px; align-items: center; }
.st-logo img { height: 40px; max-width: 120px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; background: #fff; padding: 2px; }
.st-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
@media (max-width: 720px) { .st-table thead { display: none; } .st-table tr { display: grid; gap: 4px; padding: 6px 0; } .st-table td { border: 0; } }
#view-settings .st-table input.st-short { width: 80px; display: inline-block; }
.st-table td:has(> input.st-short) { white-space: nowrap; }

/* Reporting */
.rp-bar { display: grid; gap: 10px; padding: 12px 14px; }
.rp-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; font-size: 13px; }
.rp-controls label:not(.check) { display: flex; gap: 6px; align-items: center; color: var(--muted); font-weight: 600; font-size: 12px; }
.rp-controls input[type=date], .rp-controls select { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.notice-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rp-scroll { overflow-x: auto; }
.rp-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.rp-table th, .rp-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rp-table th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; position: sticky; top: 0; background: var(--surface); }
.rp-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rp-table .rp-line { position: sticky; left: 0; background: var(--surface); min-width: 260px; white-space: normal; }
.rp-table tr.rp-header td { background: var(--surface-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.rp-table tr.rp-total td { font-weight: 700; border-top: 1px solid var(--text); }
.rp-table tr.rp-sub td.rp-line, .rp-table tr.rp-info td.rp-line { padding-left: 28px; color: var(--muted); }
.rp-table tr.rp-info td { color: var(--muted); font-style: italic; }
/* better / worse markers (reconciliation differences, report changes) - always with ▲▼ or +/− as well as colour */
span.good { color: var(--ok); font-weight: 600; }
span.bad { color: var(--bad); font-weight: 600; }

/* Settings -> Data collection: one row per source, grouped; details open per row */
.dc-intro { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dc-intro .hint { margin: 0; max-width: 760px; }
.dc-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.dc-group { margin-top: 18px; }
.dc-group-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.dc-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.dc-src { --src: var(--muted); border-top: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--src); }
.dc-src:first-child { border-top: 0; }
.dc-src[data-src=yandex] { --src: var(--yandex); } .dc-src[data-src=glovo] { --src: var(--glovo); }
.dc-src[data-src=buyam] { --src: var(--buyam); } .dc-src[data-src=tax] { --src: var(--muted); } .dc-src[data-src=bank] { --src: var(--accent); }
.dc-src.dc-report { --src: transparent; }
.dc-head { display: grid; grid-template-columns: minmax(220px, 1.6fr) 140px minmax(150px, 1fr) minmax(160px, 1.1fr) minmax(110px, .8fr) 250px;
  gap: 12px 18px; align-items: center; padding: 12px 14px 12px 18px; }
.dc-report .dc-head { grid-template-columns: minmax(220px, 1.6fr) 1fr 250px; }
.dc-name { display: flex; gap: 12px; align-items: center; min-width: 0; }
.dc-name b { display: block; font-size: 15px; }
.dc-name small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.dc-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); position: relative; }
.dc-ico::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--src); border: 2px solid var(--surface); }
.dc-report .dc-ico::after { display: none; }
.dc-cell { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.dc-cell small { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
#view-settings .dc-cell select { width: auto; display: inline-block; margin-left: 4px; }
.dc-status { justify-items: start; }
.dc-end { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.dc-more { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; font-size: 14px; }
.dc-more:hover, .dc-src.open .dc-more { color: var(--accent); border-color: var(--accent); }
.dc-alert { margin: -4px 14px 12px 18px; padding: 7px 10px; border-radius: 8px; font-size: 13px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.dc-alert.bad { background: var(--bad-soft); color: var(--bad); } .dc-alert.warn { background: var(--warn-soft); color: var(--warn); }
.dc-body { display: none; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; padding: 0 14px 14px 18px; }
.dc-src.open .dc-body { display: grid; }
.dc-panel { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
.dc-panel h4 { margin: 0; font-size: 13px; }
.dc-panel .hint { margin: 0; }
.dc-fields { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 13px; }
.dc-fields label { display: grid; gap: 4px; color: var(--muted); font-weight: 600; font-size: 12px; }
.dc-fields label > span { display: flex; gap: 6px; align-items: center; color: var(--text); font-weight: 400; }
#view-settings .dc-fields input[type=time], #view-settings .dc-fields input[type=date], #view-settings .dc-fields select { width: auto; }
.dc-pill { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.dc-ok { background: var(--ok-soft); color: var(--ok); } .dc-warn { background: var(--warn-soft); color: var(--warn); }
.dc-bad { background: var(--bad-soft); color: var(--bad); } .dc-run { background: var(--accent-soft); color: var(--accent); }
.dc-off { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.dc-job { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); margin-top: 12px; }
.dc-job.ok { border-color: var(--ok); background: var(--ok-soft); } .dc-job.bad { border-color: var(--bad); background: var(--bad-soft); }
.dc-job .log { max-height: 180px; overflow: auto; margin: 6px 0 0; }
.dc-runs-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.dc-runs { margin: 0; }
.dc-nowrap { white-space: nowrap; }
.dc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--muted); }
.dc-dot[data-src=yandex] { background: var(--yandex); } .dc-dot[data-src=glovo] { background: var(--glovo); }
.dc-dot[data-src=buyam] { background: var(--buyam); } .dc-dot[data-src=bank] { background: var(--accent); }
.dc-savebar { position: sticky; bottom: 12px; z-index: 5; margin-top: 16px; display: flex; gap: 10px; align-items: center; justify-content: flex-end;
  padding: 10px 14px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface); box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.dc-savebar span { margin-right: auto; font-weight: 600; }
@media (max-width: 1100px) {
  .dc-head { grid-template-columns: 1fr auto; }
  .dc-head .dc-cell { grid-column: 1 / -1; grid-template-columns: 110px 1fr; align-items: baseline; }
  .dc-head .dc-status { grid-column: 2; grid-row: 1; justify-self: end; display: block; }
  .dc-head .dc-end { grid-column: 1 / -1; justify-content: flex-start; }
  .dc-report .dc-head { grid-template-columns: 1fr auto; }
  .dc-report .dc-head .dc-end { grid-column: 2; grid-row: 1; }
}

/* Data collection: on/off switch + schedule choice */
.dc-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; width: fit-content; position: relative; }
.dc-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dc-toggle-text { min-width: 30px; color: var(--muted); }
.dc-toggle input:checked ~ .dc-toggle-text { color: var(--ok); }
.dc-slider { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--border); transition: background .15s; flex: none; }
.dc-slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.dc-toggle input:checked + .dc-slider { background: var(--ok); }
.dc-toggle input:checked + .dc-slider::after { transform: translateX(18px); }
.dc-toggle input:focus-visible + .dc-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.dc-toggle input:disabled + .dc-slider { opacity: .5; }
.dc-sched { display: grid; gap: 8px; font-size: 13px; }
.dc-sched label.check { display: flex; gap: 8px; align-items: center; }
#view-settings .dc-sched input[type=time], #view-settings .dc-sched select { width: auto; }

/* tech card editor: restaurants as on/off chips */
.cstores { display: grid; gap: 6px; }
.cstores-label { font-size: 12px; font-weight: 600; color: var(--muted); }

/* Settings -> Categories: three lists side by side */
.st-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items: start; }
#view-settings .st-cats .st-cat { margin: 0; display: block; }
.st-cats h3 { margin-top: 0; }
.st-cat-add { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.st-cat-add input { flex: 1; min-width: 0; }

/* Invoices -> Attach: first "what is it?" (ingredient / packaging / non-ingredient) */
.kind-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kind-pick .kind-q { grid-column: 1 / -1; font-weight: 600; }
.kind-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface, transparent); color: var(--text); font: inherit; }
.kind-btn small { color: var(--muted); font-size: 12px; }
.kind-btn:hover { border-color: var(--accent); }
.kind-btn[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kind-btn .kind-guess { font-size: 11px; color: var(--accent); }
.attach-part > .form-grid { margin: 0; }
@media (max-width: 560px) { .kind-pick { grid-template-columns: 1fr; } }

/* Supplier orders -> New order: three steps (details, add items, check and send) */
.po-editor { padding: 18px 20px 16px; display: grid; gap: 12px; }
.po-ed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.po-ed-title { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.po-ed-sub { margin: 4px 0 0; font-size: 13px; }
.po-editor .notice { margin: 0; }
.po-step { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-top: 6px; }
.po-step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 700; }
.po-step-btn { margin-left: auto; }
.po-step-note { font-weight: 400; font-size: 13px; }
.po-editor :is(.po-details, .po-add, .po-lines) :is(input:not([type=checkbox]):not([type=radio]), select) {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
.po-editor :is(.po-details, .po-add, .po-lines) :is(input, select):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.po-editor :is(.po-details, .po-add, .po-lines) :is(input, select):disabled { background: var(--surface-2); }
.po-editor :is(.po-details, .po-add) label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.po-details { display: grid; grid-template-columns: 180px 220px minmax(0, 1fr); gap: 12px; }
.po-add-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.po-editor .po-add { padding: 0; }
.po-editor .po-add .po-sup { flex: 0 1 220px; }
.po-editor .po-add .qty { flex: 0 0 180px; }
.po-editor .qty-row { display: flex; align-items: center; gap: 6px; }
.po-unit { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 24px; }
.po-editor .po-add > .btn { height: 36px; padding: 0 18px; }
.po-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); min-height: 1em; }
.po-hint:empty { display: none; }
.po-suggest h3 { font-size: 14px; margin: 0 0 8px; }
.po-lines-wrap { border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.po-editor .po-lines { margin: 0; width: 100%; border-collapse: collapse; }
.po-editor .po-lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; background: var(--surface); }
.po-editor .po-lines td { padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: middle; }
.po-editor .po-lines .sup-row td { background: var(--surface-2); font-weight: 600; padding: 9px 10px; }
.po-editor .po-lines .sup-row .sup-sum { float: right; font-weight: 600; }
.po-editor .po-lines input.narrow { width: 90px; }
.po-editor .po-lines td.po-empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.po-item-name { font-weight: 500; }
.po-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 12px; }
.po-total { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.po-total b { font-size: 20px; }
.po-budget { font-size: 12px; color: var(--muted); }
.po-editor .po-actions { padding: 0; }
@media (max-width: 900px) { .po-details { grid-template-columns: 1fr 1fr; } .po-details .po-note { grid-column: 1 / -1; } }
@media (max-width: 560px) { .po-details { grid-template-columns: 1fr; } .po-ed-head { flex-direction: column; } }

/* Ingredient usage -> where it went (one ingredient): tiles, one row per dish with a share bar, calculation steps */
#usageDialog .uc-kpis { margin: 0 0 10px; }
.uc-split { font-size: 13px; margin: 0 0 12px; }
.uc-h { font-size: 14px; margin: 6px 0 8px; }
.uc-list { display: grid; gap: 6px; }
.uc-row { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.uc-row[open] { border-color: var(--accent); }
.uc-row > summary { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) 190px; gap: 14px; align-items: center;
  padding: 10px 12px; cursor: pointer; list-style: none; }
.uc-row > summary::-webkit-details-marker { display: none; }
.uc-row > summary:hover { background: var(--surface-2); border-radius: 10px; }
.uc-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.uc-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-plats { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; }
.uc-bar { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.uc-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.uc-amt { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: 12px; }
.uc-amt b { font-size: 15px; }
.uc-detail { padding: 2px 12px 12px; border-top: 1px dashed var(--border); }
.uc-detail p { margin: 8px 0 0; font-size: 12px; }
.uc-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin-top: 10px; }
.uc-box { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 10px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); max-width: 230px; }
.uc-box b { font-size: 14px; }
.uc-box span { font-size: 11px; color: var(--muted); line-height: 1.3; }
.uc-box.result { background: var(--accent-soft); border-color: var(--accent); }
.uc-box.bad { background: var(--warn-soft); }
.uc-arrow { align-self: center; color: var(--muted); }
.uc-how { margin-top: 14px; font-size: 13px; }
.uc-how summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.uc-how ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
@media (max-width: 700px) { .uc-row > summary { grid-template-columns: 1fr; gap: 6px; } .uc-amt { align-items: flex-start; text-align: left; } }

/* Invoices -> by supplier and period: the clicked supplier and its products below */
#invPeriodGrid .tabulator-row { cursor: pointer; }
#invPeriodGrid .tabulator-row.row-open, #invPeriodGrid .tabulator-row.row-open .tabulator-cell { background: var(--accent-soft); }
.period-detail { border-top: 2px solid var(--accent); margin-top: 10px; }
.period-detail h3.section-title { font-size: 15px; }
.link-kind { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); margin-right: 4px; }

/* =====================================================================  panel-wide polish (2026-10-21)  */
/* header: brand + user on one row, the grouped menu below; stays on top while scrolling */
.topbar { position: sticky; top: 0; z-index: 50; display: block; padding: 10px 20px 0; box-shadow: 0 1px 0 var(--border); }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar .brand h1 { font-size: 16px; }
.topbar .logo { font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.me-avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; font-size: 12px; }
.me-avatar:empty { display: none; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; }
.me-role { font-size: 11px; }
.mainnav { display: flex; align-items: stretch; gap: 0; background: none; border: 0; border-radius: 0; padding: 8px 0 0; overflow-x: auto;
  scrollbar-width: thin; }
.navgroup { display: flex; align-items: flex-end; gap: 2px; padding: 0 10px; position: relative; }
.navgroup:first-child { padding-left: 0; }
.navgroup + .navgroup { border-left: 1px solid var(--border); }
.navgroup:not(:has(.navbtn:not(.hidden))) { display: none; }
.navgroup::before { content: attr(data-group); position: absolute; top: -1px; left: 10px; font-size: 9.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted); opacity: .75; }
.navgroup:first-child::before { left: 0; }
.navbtn { padding: 16px 10px 9px; border-radius: 0; border-bottom: 2px solid transparent; white-space: nowrap; flex: 0 0 auto; }
.navbtn:hover { color: var(--text); background: none; }
.navbtn.active { background: none; box-shadow: none; color: var(--accent); border-bottom-color: var(--accent); }

/* tables */
.tabulator .tabulator-header .tabulator-col input, .tabulator .tabulator-header .tabulator-col select {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 4px 7px; }
.tabulator .tabulator-header .tabulator-col input:focus { outline: none; border-color: var(--accent); }
.tabulator .tabulator-row .tabulator-cell .btn.small { padding: 3px 10px; font-size: 12px; font-weight: 600; }
.tabulator .tabulator-row .tabulator-cell .row-actions button { padding: 3px 8px; }
.tabulator .tabulator-row.tabulator-group { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  color: var(--text); font-weight: 600; padding: 7px 10px; }
.tabulator .tabulator-row.tabulator-group:hover { background: var(--accent-soft); }
.tabulator .tabulator-row.tabulator-group span { color: var(--muted); font-weight: 400; }
.tabulator .tabulator-row.tabulator-group .tabulator-arrow { border-left-color: var(--muted); }
.tabulator .tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow { border-top-color: var(--muted); border-left-color: transparent; }
.tabulator-row .tabulator-frozen { background: inherit; }
.tabulator .tabulator-header .tabulator-frozen { background: var(--surface-2); }
.tabulator-placeholder span { font-size: 13px !important; padding: 18px 0; display: inline-block; }

/* section titles and notices */
.section-title { font-size: 14px; font-weight: 600; padding: 12px 16px; }
.section-title .muted { font-size: 13px; }
.notice { padding: 8px 12px 8px 34px; border-radius: 10px; border-color: color-mix(in srgb, var(--warn) 25%, var(--border));
  position: relative; line-height: 1.4; }
.notice::before { content: "!"; position: absolute; left: 11px; top: 8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--warn); color: var(--surface); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.view > .notice + .notice { margin-top: -8px; }

/* settings forms: readable line length */
#view-settings #setBody > .form-grid { max-width: 980px; }
.topbar .brand .sub { white-space: nowrap; }
.dp-checks { padding: 0 16px 14px; }
#dpDaysSummary { max-width: none; padding: 0 16px; margin: 0 0 10px; line-height: 2; }
#dpDaysSummary .dp-day { white-space: nowrap; margin-right: 4px; }
.dp-days { border-collapse: separate; border-spacing: 3px 2px; padding: 0 12px 12px; }
.dp-days th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; position: sticky; top: 0; background: var(--surface); }
.dp-days td:first-child { width: 150px; }
.dp-days td.dp-day { border-radius: 5px; }
.brand-sub { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tag.neutral { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.tag { background: var(--surface-2); }
.pill.idle { display: none; }   /* the status pill only shows while a fetch runs */

/* every text field / dropdown in cards and windows gets the panel look (low specificity: page rules still win);
   table header filters keep their own compact style */
:where(.card, dialog, .view) :where(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]):not([type=range]), select, textarea):not(.tabulator *) {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0; }
:where(.card, dialog, .view) :where(input, select, textarea):not(.tabulator *):focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:where(.card, dialog, .view) :where(input, select, textarea):not(.tabulator *):disabled { background: var(--surface-2); }
:where(.card, dialog, .view) textarea:not(.tabulator *) { line-height: 1.45; }
.waste-grid label { gap: 5px; }
.section-title { color: var(--text); }
.tabulator-placeholder .tabulator-placeholder-contents { color: var(--muted) !important; font-size: 13px !important; font-weight: 500 !important; padding: 22px 10px !important; }
.tabulator .tabulator-calcs-holder, .tabulator .tabulator-calcs-holder .tabulator-row { background: var(--surface-2) !important; border-color: var(--border) !important; }
.tabulator .tabulator-row.tabulator-calcs { background: var(--surface-2); font-weight: 600; }
@media (max-width: 560px) { .me-text { display: none; } .topbar { padding: 8px 12px 0; } }

/* Ingredients -> bought and used per period */
.ip-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px 0 0;
  border-bottom: 1px solid var(--border); }
.ip-head .section-title { border-bottom: 0; }
.ip-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; }
.ip-sub { font-size: 13px; font-weight: 600; margin: 0; padding: 12px 16px 8px; }
#ipUsedBox { border-top: 1px solid var(--border); margin-top: 6px; }

/* Non-ingredient products: invoice names per product, mapping window */
.nf-name { display: inline-block; font-size: 12px; padding: 1px 7px; margin: 1px 2px 1px 0; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
#nfProductsGrid .tabulator-row { cursor: pointer; }
.nfp-h { font-size: 13px; margin: 16px 0 6px; }
.nfp-mapped { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.nfp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent); }
.nfp-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 12px; padding: 0 4px; }
.nfp-chip button:hover { color: var(--bad); }
.nfp-search { width: 100%; margin-bottom: 8px; }
.nfp-pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; padding: 2px; }
.nfp-free { border: 1px dashed var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 10px;
  font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.nfp-free:hover { border-color: var(--accent); border-style: solid; }

/* per-period tables: a clicked row opens "By supplier" below */
.rows-click .tabulator-row { cursor: pointer; }
.rows-click .tabulator-row.row-open, .rows-click .tabulator-row.row-open .tabulator-cell { background: var(--accent-soft); }

/* non-ingredient product window */
#nfViewDialog .kpis { margin-bottom: 12px; }
.nfv-meta dd { margin-bottom: 6px; }
#nfViewDialog h3 { font-size: 13px; margin: 14px 0 6px; }
#nfViewDialog .mpane { min-height: 260px; }

/* Sales dashboard: chart type switch and line / area marks */
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-right: 14px;
  border-bottom: 1px solid var(--border); }
.chart-head .section-title { border-bottom: 0; }
.chart-types .subtab { font-size: 12px; padding: 4px 10px; }
.svg-chart .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.svg-chart .series-dot { stroke: var(--surface); stroke-width: 2; }
.svg-chart .area-seg { fill-opacity: .85; stroke: var(--surface); stroke-width: 2; }
.svg-chart .area-soft { fill-opacity: .12; }
.svg-chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

/* Bank */
.bk-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.bk-filters input[type=search] { width: 280px; }
.bk-filters .spacer { flex: 1; }
.bk-acc .k { display: flex; justify-content: space-between; gap: 6px; }
.bk-acc .k button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 12px; }
.bk-acc .k button:hover { color: var(--accent); }
.bk-src { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 0 5px; border-radius: 4px; margin-left: 4px; }
.bk-src.auto { background: var(--ok-soft); color: var(--ok); }
.bk-src.rule { background: var(--accent-soft); color: var(--accent); }
.bk-src.manual { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.bk-unsorted { color: var(--warn); font-weight: 600; }
.bk-in { color: var(--ok); }
#bkuTable td.bad { color: var(--bad); }
#bkuTable td.good { color: var(--ok); }

/* Counterparties */
#cpGrid .tabulator-row { cursor: pointer; }
.cp-owe { color: var(--text); font-weight: 600; }
.cp-owed { color: var(--ok); font-weight: 600; }
.cp-code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
#cpvStatement table td.num, #cpvStatement table th.num { text-align: right; white-space: nowrap; }
#cpvStatement .cp-open td { background: var(--surface-2); font-weight: 600; }

/* opening balances import */
.cpo-options { display: grid; gap: 4px; margin: 6px 0 10px; font-size: 13px; }
.cpo-table select { max-width: 330px; }
.cpo-table tr.cpo-check td { background: var(--warn-soft); }
.cpo-how { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.cpo-how.ok { background: var(--ok-soft); color: var(--ok); }
.cpo-how.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.cpo-how.bad { background: var(--bad-soft); color: var(--bad); }

/* counterparties: several unlinked bank names at once */
.cp-bulk { justify-content: flex-start; gap: 8px; padding: 8px 16px; }
.cp-bulk #cpBulkCount { margin-right: 8px; }

/* Bank → Platform payouts / Cash forecast, Counterparties → Unpaid invoices, reconciliation statement */
.bk-pay { margin-bottom: 14px; }
.bk-pay .section-title { padding: 12px 16px 0; }
.bk-periods { padding: 6px 16px 12px; }
.bk-periods summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
#bkFcMin { width: 120px; }
.cp-act-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.cp-act h3 { text-align: center; margin: 0 0 6px; }
.cp-act p { margin: 4px 0; }
.cp-act table { margin: 10px 0; }
.cp-act-sign { display: flex; justify-content: space-between; gap: 32px; margin-top: 18px; line-height: 1.9; flex-wrap: wrap; }
#rpbTable select { min-width: 260px; }

/* Counterparties → merge window */
.cpm-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 10px 0; }
.cpm-pick label { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.cpm-cards { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.cpm-card { flex: 1 1 260px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.cpm-arrow { align-self: center; font-size: 22px; color: var(--muted); }
.cpm-dups { margin: 4px 0 10px; padding-left: 18px; }

/* filter / group bar above tables (tabletools.js) */
.tt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.tt-bar .tt-filters.on { background: var(--accent-soft, #e8efff); border-color: var(--accent, #2f6fed); }
.tt-hide-filters .tabulator-header-filter { display: none !important; }
.tabulator-header-filter input { width: 100%; font-size: 12px; padding: 3px 6px; }

/* Finance → Month close */
.cl-checks { list-style: none; margin: 0; padding: 4px 16px 12px; }
.cl-check { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cl-icon { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; color: #fff; }
.cl-check.ok .cl-icon { background: #1f9d55; }
.cl-check.warn .cl-icon { background: #d98a00; }
.cl-check.bad .cl-icon { background: #d64545; }
.cl-label { font-weight: 600; }
.cl-alerts { padding: 0 16px; }
.cl-alert-actions { display: flex; gap: 8px; padding: 10px 16px 14px; align-items: center; }
.cl-preview { margin: 0 16px 16px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; white-space: pre-wrap; font: 13px/1.5 inherit; }
.cp-match-amt { width: 120px; text-align: right; }

/* Reporting → Budget, Bank → forecast chart */
.rp-budget .rpb-cell { vertical-align: top; }
.rpb-in { width: 92px; text-align: right; font-size: 12px; padding: 2px 4px; }
.bk-chart { width: 100%; max-width: 820px; height: auto; display: block; margin: 4px 16px 8px; }
.bk-chart .grid { stroke: var(--border); stroke-width: 1; }
.bk-chart .axis { fill: var(--muted); font-size: 11px; }
.bk-chart .line { fill: none; stroke: #2f6fed; stroke-width: 2; }
.bk-chart .dot { fill: #2f6fed; stroke: var(--surface); stroke-width: 2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-chart .line { stroke: #5b8ef5; } :root:not([data-theme="light"]) .bk-chart .dot { fill: #5b8ef5; } }
:root[data-theme="dark"] .bk-chart .line { stroke: #5b8ef5; }
:root[data-theme="dark"] .bk-chart .dot { fill: #5b8ef5; }

/* Sales -> Prices: cheapest / dearest platform in a row */
.price-low { color: var(--ok); font-weight: 600; }
.price-high { color: var(--warn); font-weight: 600; }

/* Finance → Payroll → Work calendar (shifts.js): planned = outlined, actual (paid) = filled */
.sh-wrap { overflow-x: auto; }
.sh-table { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.sh-table th, .sh-table td { border-bottom: 1px solid var(--border); padding: 6px; vertical-align: top; text-align: left; }
.sh-table thead th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.sh-table thead th small, .sh-table tbody th small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; white-space: normal; }
.sh-table thead th:first-child { width: 170px; }
.sh-table thead th:last-child { width: 110px; }
.sh-table tbody th { font-weight: 400; }
.sh-table .sh-today { background: var(--accent-soft); }
.sh-table .sh-hol { box-shadow: inset 0 3px 0 var(--warn); }
.sh-table td { position: relative; min-height: 46px; }
.sh-chip { display: block; width: 100%; margin: 0 0 4px; padding: 3px 6px; border-radius: 6px; font-size: 12px; text-align: left; cursor: pointer;
  border: 1.5px dashed var(--accent); background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums; }
.sh-chip.actual { border: 1.5px solid var(--ok); background: var(--ok-soft); }
.sh-chip small { float: right; color: var(--muted); }
.sh-chip sup { font-size: 9px; color: var(--muted); }
.sh-chip:disabled { cursor: default; }
.sh-legend .sh-chip { display: inline-block; width: auto; margin: 0 2px; cursor: default; }
.sh-flag { display: inline-block; margin: 0 3px 3px 0; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.sh-flag.missing { background: var(--bad-soft); color: var(--bad); }
.sh-flag.late, .sh-flag.overtime { background: var(--warn-soft); color: var(--warn); }
.sh-flag.unplanned { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.sh-add { display: block; width: 100%; border: 1px dashed var(--border); background: transparent; color: var(--muted); border-radius: 6px;
  cursor: pointer; font-size: 14px; line-height: 20px; opacity: .55; }
.sh-add:hover, .sh-add:focus-visible { opacity: 1; color: var(--accent); border-color: var(--accent); }
.sh-total { font-size: 12px; font-variant-numeric: tabular-nums; }
.sh-kind { display: flex; gap: 18px; }
/* employee window: hourly rate rules */
.pr-rules { display: grid; gap: 8px; }
.pr-rule { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.pr-rule .pr-days { display: flex; flex-wrap: wrap; gap: 3px; }
.pr-rule .chip { padding: 2px 7px; font-size: 12px; }
#prDialog .pr-rule input[type=time] { width: auto; }
#prDialog .pr-rule input[data-f=rate] { width: 90px; }
#prDialog .pr-rule input[data-f=label] { flex: 1 1 90px; min-width: 90px; width: auto; }
#prDialog .pr-rule [data-remove] { margin-left: auto; }
.sh-legend { max-width: none; line-height: 2; }

/* Work calendar: time clock records waiting for the manager */
.sh-chip.sh-clockrec { border: 1.5px solid var(--warn); background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* Kitchen → Where used: the ingredient whose details are open */
.tabulator-row.selected-row, .tabulator-row.selected-row .tabulator-cell { background: var(--accent-soft); }
#wuDetailHint, #view-whereused .hint { max-width: none; }

/* Counterparties → Payments ↔ invoices: the reason wraps instead of being cut */
#cpMatchGrid .cp-wrap { white-space: normal; }
#cpMatchGrid .tabulator-cell { white-space: normal; }

/* header link to the owner phone view (/m) */
.me .phone-link { text-decoration: none; }

/* Sales → Entered checks: a check whose total or brand differs from the platform's order */
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* Settings → Fiscal receipts (fiscal.js) */
#view-settings .fs-ready li.ok { color: var(--ok); } #view-settings .fs-ready li.bad { color: var(--bad); }
#view-settings .fs-dishes { max-height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
#view-settings .fs-dishes thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
#view-settings input.fs-missing::placeholder { color: var(--bad); }
#view-settings .fs-json { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; max-height: 360px;
  overflow: auto; font-size: 12.5px; white-space: pre; }
#view-settings h3 { margin: 22px 0 8px; }

/* Settings → Network & server (sysinfo.js) */
#view-settings .sy-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#view-settings .sy-tiles { margin: 6px 0 4px; }
#view-settings .sy-tile.ok { box-shadow: inset 3px 0 0 var(--ok); } #view-settings .sy-tile.warn { box-shadow: inset 3px 0 0 var(--warn); }
#view-settings .sy-tile.bad { box-shadow: inset 3px 0 0 var(--bad); }
.sy-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--muted); }
.sy-dot.ok { background: var(--ok); } .sy-dot.warn { background: var(--warn); } .sy-dot.bad { background: var(--bad); } .sy-dot.off { background: var(--border); }
#view-settings .sy-scroll { overflow-x: auto; }
#view-settings .sy-table td { vertical-align: top; }
#view-settings .sy-table td.num { text-align: right; white-space: nowrap; }
#view-settings .sy-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
#view-settings .sy-chip.warn { background: var(--warn-soft); color: var(--warn); } #view-settings .sy-chip.bad { background: var(--bad-soft); color: var(--bad); }
#view-settings .sy-chart svg { display: block; width: 100%; max-width: 900px; height: auto; }
#view-settings .sy-bar { fill: var(--seq); }
#view-settings .sy-chart .lbl { fill: var(--muted); font-size: 10px; }
#view-settings .sy-errlbl { fill: var(--bad); font-size: 10px; font-weight: 700; }
#view-settings .sy-bot { margin-top: 8px; }
#view-settings h4 { margin: 14px 0 6px; }
/* Network & server, round 2: sections, trend charts, logs */
#view-settings .sy-head .sy-secs { flex: 1; }
#view-settings .sy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
#view-settings .sy-mini { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); min-width: 0; }
#view-settings .sy-mini-h { font-size: 13px; margin-bottom: 4px; }
#view-settings .sy-mini svg { display: block; width: 100%; height: auto; }
#view-settings .sy-path { fill: none; stroke: var(--seq); stroke-width: 2; stroke-linejoin: round; }
#view-settings .sy-hit { fill: transparent; }
#view-settings .sy-hit:hover { fill: var(--seq); }
#view-settings .sy-mini .lbl { fill: var(--muted); font-size: 10px; }
#view-settings .sy-logs { max-height: 560px; overflow: auto; }
#view-settings .sy-msg { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; }
#view-settings .sy-nowrap { white-space: nowrap; }

/* two-factor login window (twofa.js) */
.tfa-dialog { width: min(560px, 96vw); }
.tfa-setup { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.tfa-qr svg { display: block; width: 210px; height: auto; border-radius: 8px; }
.tfa-key { font: 600 15px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .04em; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.tfa-codes { font: 600 16px/1.7 ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 12px 16px; border-radius: 10px; columns: 2; }
.tfa-steps { padding-left: 20px; }
@media (max-width: 560px) { .tfa-setup { grid-template-columns: 1fr; } }
