/* ============================================================
   Business tools — till close-out + quote & invoice builder
   (experiments.html, Demo 02 and 03; behaviour in scripts/main.js)
   Built only on the site tokens, so both themes and every accent
   colour carry through without overrides.
   ============================================================ */

.biz-tool {
  --bt-warn: #f2b84b;
  --bt-r: 8px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 30px 70px -40px #000;
  color: var(--text);
  font-size: 0.9rem;
  overflow: hidden;
}
[data-theme="light"] .biz-tool { --bt-warn: #8a5a00; box-shadow: 0 24px 60px -40px rgba(20, 24, 11, 0.45); }

/* copy above a full-width tool */
.biz-demo .biz-copy { max-width: none; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px 60px; align-items: end; }
.biz-demo .biz-copy > div > p:last-child { margin-bottom: 0; }
.biz-demo .src-btn { margin-top: 1.2rem; }
@media (max-width: 900px) { .biz-demo .biz-copy { grid-template-columns: 1fr; } }

/* ---------- shared form controls ---------- */
.biz-tool input[type="text"], .biz-tool input[type="email"], .biz-tool input[type="number"],
.biz-tool input[type="date"], .biz-tool select, .biz-tool textarea {
  width: 100%; min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-2); border-radius: 6px;
  background: var(--bg); color: var(--text);
  font: 500 0.88rem var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.biz-tool input[type="date"] { color-scheme: inherit; }
.biz-tool textarea { resize: vertical; line-height: 1.45; }
.biz-tool select { cursor: pointer; }
.biz-tool input::placeholder, .biz-tool textarea::placeholder { color: var(--text-dim); opacity: 1; }
.biz-tool input:focus, .biz-tool select:focus, .biz-tool textarea:focus { outline: none; border-color: var(--accent-border, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.biz-tool [aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent) !important; }
.biz-tool button { font-family: var(--font); cursor: pointer; }
.biz-tool button:focus-visible, .biz-tool summary:focus-visible { outline: 2px solid var(--accent-border, var(--accent)); outline-offset: 2px; }
.biz-tool kbd { font: 500 0.7rem var(--mono); padding: 0.05rem 0.32rem; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--text-mid); margin-right: 2px; }

.bt-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.bt-field > span:first-child { font-size: 0.78rem; font-weight: 600; color: var(--text-mid); }
.bt-field small { font-weight: 400; color: var(--text-dim); }
.bt-wide { grid-column: 1 / -1; }
.bt-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 16px; }
.bt-money { display: flex; align-items: center; border: 1px solid var(--border-2); border-radius: 6px; background: var(--bg); transition: border-color 0.2s, box-shadow 0.2s; }
.bt-money:focus-within { border-color: var(--accent-border, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.bt-money .bt-pre { white-space: nowrap; padding-left: 0.65rem; color: var(--text-dim); font: 500 0.86rem var(--mono); }
.biz-tool .bt-money input { border: 0; background: transparent; box-shadow: none !important; font-family: var(--mono); font-feature-settings: "tnum"; padding-left: 0.3rem; }
.bt-money:has([aria-invalid="true"]) { border-color: var(--danger); }

.bt-hint { color: var(--text-dim); font-size: 0.78rem; line-height: 1.5; margin: 0; }
.bt-lede { color: var(--text-mid); font-size: 0.86rem; margin: 0 0 14px; }

.bt-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.95rem; border-radius: 6px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font: 600 0.84rem var(--font); white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.bt-btn:hover { border-color: var(--accent-border, var(--accent)); }
.bt-btn:active { transform: translateY(1px); }
.bt-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bt-btn.primary:hover { filter: brightness(1.06); }
.bt-btn[hidden] { display: none; }
.bt-link { background: none; border: 0; padding: 0.3rem 0.1rem; color: var(--text-mid); font-size: 0.82rem; font-weight: 600; text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }
.bt-link:hover { color: var(--text); text-decoration-color: currentColor; }
.bt-link + .bt-link { margin-left: 0.8rem; }
.bt-chip { padding: 0.32rem 0.7rem; border-radius: 99px; border: 1px dashed var(--border-2); background: transparent; color: var(--text-mid); font-size: 0.78rem; font-weight: 600; }
.bt-chip:hover { border-style: solid; border-color: var(--accent-border, var(--accent)); color: var(--text); }
.bt-x { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--text-dim); font-size: 1.1rem; line-height: 1; }
.bt-x:hover:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.bt-x:disabled { opacity: 0.3; cursor: not-allowed; }

/* segmented radio control */
.bt-seg { display: inline-flex; padding: 3px; margin: 0; border: 1px solid var(--border-2); border-radius: 8px; background: var(--bg); gap: 2px; }
.bt-seg label { position: relative; }
.bt-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bt-seg span { display: block; padding: 0.32rem 0.85rem; border-radius: 5px; font-size: 0.8rem; font-weight: 600; color: var(--text-mid); transition: background 0.2s, color 0.2s; }
.bt-seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.bt-seg input:focus-visible + span { outline: 2px solid var(--accent-border, var(--accent)); outline-offset: 1px; }
.bt-seg-sm span { padding: 0.3rem 0.6rem; }

/* switch */
.bt-switch { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; font-weight: 600; color: var(--text-mid); cursor: pointer; position: relative; }
.bt-switch input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.bt-switch-ui { width: 36px; height: 20px; border-radius: 99px; background: var(--border-2); position: relative; transition: background 0.2s; flex: none; }
.bt-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform 0.2s var(--ease, ease); }
.bt-switch input:checked + .bt-switch-ui { background: var(--accent); }
.bt-switch input:checked + .bt-switch-ui::after { transform: translateX(16px); background: var(--accent-ink); }
.bt-switch input:focus-visible + .bt-switch-ui { outline: 2px solid var(--accent-border, var(--accent)); outline-offset: 2px; }

/* ---------- frame: bar, KPIs, tabs, panels, footer ---------- */
.bt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.bt-title { display: inline-flex; align-items: center; gap: 0.55rem; margin: 0; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.1em; }
.bt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.bt-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.bt-mini { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.76rem; color: var(--text-dim); }
.biz-tool .bt-mini select, .biz-tool .bt-mini input { width: auto; max-width: 150px; padding: 0.3rem 0.5rem; font-size: 0.8rem; }
.bt-bar-actions { margin-left: auto; display: flex; align-items: center; }

.bt-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.kpi { padding: 16px 20px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi p { margin: 0; }
.kpi-label { font: 500 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); }
.kpi-value { font: 600 clamp(1.25rem, 2.2vw, 1.65rem) var(--mono); font-feature-settings: "tnum"; letter-spacing: -0.02em; margin: 0.3rem 0 0.2rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 0.74rem; color: var(--text-dim); line-height: 1.35; }
.kpi-hi { background: var(--accent); }
.kpi-hi .kpi-label, .kpi-hi .kpi-sub, .kpi-hi .kpi-value { color: var(--accent-ink); }
.kpi-hi .kpi-label, .kpi-hi .kpi-sub { opacity: 0.72; }
.kpi-var .kpi-sub::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--text-dim); }
.kpi-var[data-state="ok"] .kpi-value { color: var(--good); }
.kpi-var[data-state="ok"] .kpi-sub::before { background: var(--good); }
.kpi-var[data-state="over"] .kpi-value { color: var(--bt-warn); }
.kpi-var[data-state="over"] .kpi-sub::before { background: var(--bt-warn); }
.kpi-var[data-state="short"] .kpi-value { color: var(--danger); }
.kpi-var[data-state="short"] .kpi-sub::before { background: var(--danger); }

.bt-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.bt-tabs::-webkit-scrollbar { display: none; }
.bt-tabs [role="tab"] { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.85rem 0.75rem 0.75rem; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-dim); font-size: 0.86rem; font-weight: 600; white-space: nowrap; transition: color 0.2s, border-color 0.2s; }
.bt-tabs [role="tab"]:hover { color: var(--text); }
.bt-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.bt-tabs [role="tab"] > .mono:not(.bt-count) { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 1px solid var(--border-2); font-size: 0.68rem; }
.bt-tabs [role="tab"][aria-selected="true"] > .mono:not(.bt-count) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bt-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.bt-count:empty { display: none; }
.bt-count { font-size: 0.68rem; padding: 0.05rem 0.4rem; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border-2); }

.bt-panel { padding: 18px 20px 20px; }
.bt-panel[hidden] { display: none; }
.bt-panel-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }

.bt-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 18px; background: var(--surface-2); border-top: 1px solid var(--border); }
.bt-status { margin: 0; min-height: 1.3em; font-size: 0.82rem; color: var(--text-mid); flex: 1 1 220px; }
.bt-foot-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* lists: till history and saved documents */
.bt-list { list-style: none; margin: 0; padding: 0; }
.bt-empty { color: var(--text-dim); font-size: 0.86rem; padding: 18px 0; text-align: center; }
.hist-summary { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 10px 12px; margin-bottom: 6px; border-radius: 6px; background: var(--surface-2); font-size: 0.8rem; color: var(--text-dim); }
.hist-summary b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.hist-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 10px 4px 10px 12px; border-bottom: 1px solid var(--border); }
.hist-main, .hist-open { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hist-open { background: none; border: 0; padding: 0; text-align: left; color: inherit; }
.hist-open:hover b { text-decoration: underline; text-underline-offset: 3px; }
.hist-main b, .hist-open b { font-size: 0.88rem; }
.hist-main span, .hist-open span { font-size: 0.76rem; color: var(--text-dim); }
.hist-main em { font-size: 0.78rem; color: var(--text-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-nums { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font: 600 0.86rem var(--mono); font-feature-settings: "tnum"; }
.hist-var { font-size: 0.7rem; padding: 0.08rem 0.45rem; border-radius: 99px; border: 1px solid currentColor; color: var(--text-dim); }
.hist-var[data-state="ok"] { color: var(--good); }
.hist-var[data-state="over"] { color: var(--bt-warn); }
.hist-var[data-state="short"] { color: var(--danger); }

/* ---------- till: count ---------- */
.till-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 16px; }
.till-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 36px; }
.till-col h4 { margin: 0 0 4px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.till-row { display: grid; grid-template-columns: 2.9rem auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.till-den { font: 600 0.9rem var(--mono); color: var(--text-mid); }
.till-row.has-value .till-den { color: var(--text); }
.till-step { display: inline-flex; align-items: stretch; border: 1px solid var(--border-2); border-radius: 6px; background: var(--bg); overflow: hidden; }
.till-step:focus-within { border-color: var(--accent-border, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.till-pm { width: 32px; border: 0; background: transparent; color: var(--text-mid); font-size: 1rem; font-weight: 600; transition: background 0.15s, color 0.15s; }
.till-pm:hover { background: var(--surface-2); color: var(--text); }
.till-pm:focus-visible { outline-offset: -2px !important; }
.biz-tool .till-step input { width: 4.2rem; border: 0; border-inline: 1px solid var(--border); border-radius: 0; background: transparent; text-align: center; font: 600 0.92rem var(--mono); font-feature-settings: "tnum"; box-shadow: none !important; padding: 0.42rem 0.2rem; }
.till-roll { display: none; align-items: center; gap: 6px; font: 500 0.7rem var(--mono); color: var(--text-dim); white-space: nowrap; }
.show-rolls .till-roll:not(.is-blank) { display: inline-flex; }
.biz-tool .till-roll input { width: 2.8rem; padding: 0.32rem 0.3rem; text-align: center; font: 600 0.82rem var(--mono); }
.till-sub { grid-column: 4; font: 500 0.86rem var(--mono); font-feature-settings: "tnum"; color: var(--text-dim); text-align: right; min-width: 5.5rem; }
.till-row.has-value .till-sub { color: var(--text); }

.till-mix { margin-top: 18px; }
.mix-bar { display: flex; gap: 2px; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin-bottom: 8px; }
.mix-bar i { display: block; min-width: 3px; transition: flex-grow 0.4s var(--ease, ease); }
.mix-bill { background: color-mix(in srgb, var(--accent) calc(100% - var(--i) * 15%), var(--surface-2)); }
.mix-coin { background: color-mix(in srgb, var(--text-mid) calc(100% - (var(--i) - 5) * 15%), var(--surface-2)); }

/* ---------- till: reconcile ---------- */
.till-eq { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.eq-term { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 6px; background: var(--surface-2); font: 600 0.9rem var(--mono); font-feature-settings: "tnum"; min-width: 0; }
.eq-term b { color: var(--text-dim); font-weight: 500; margin-right: 4px; display: inline; }
.eq-term small { font: 500 0.68rem var(--font); color: var(--text-dim); margin-top: 2px; }
.eq-term.is-zero { opacity: 0.5; }
.eq-total { background: var(--accent-soft); outline: 1px solid var(--accent-border, var(--accent)); }
.eq-var[data-state="ok"] { color: var(--good); }
.eq-var[data-state="over"] { color: var(--bt-warn); }
.eq-var[data-state="short"] { color: var(--danger); }

/* ---------- till: float & deposit ---------- */
.till-dep-head { display: grid; grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); gap: 16px 24px; align-items: end; margin-bottom: 14px; }
.till-dep-head .bt-lede { margin: 0 0 0.55rem; }
.bt-table-wrap { overflow-x: auto; }
.bt-table { width: 100%; border-collapse: collapse; font: 500 0.86rem var(--mono); font-feature-settings: "tnum"; }
.bt-table th, .bt-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bt-table th:first-child, .bt-table td:first-child { text-align: left; }
.bt-table thead th { font: 600 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.bt-table thead th:nth-child(4), .bt-table thead th:nth-child(5), .bt-table td:nth-child(4), .bt-table td:nth-child(5) { background: var(--accent-soft); }
.bt-table tfoot th, .bt-table tfoot td { font-weight: 700; border-top: 2px solid var(--border-2); border-bottom: 0; }

/* ---------- invoice ---------- */
.inv-body { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.inv-editor { border-right: 1px solid var(--border); min-width: 0; }
.inv-head { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; }
.inv-group { border: 1px solid var(--border); border-radius: var(--bt-r); margin-bottom: 12px; }
.inv-group summary { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; font-weight: 700; font-size: 0.88rem; cursor: pointer; list-style: none; }
.inv-group summary::-webkit-details-marker { display: none; }
.inv-group summary::after { content: "+"; margin-left: auto; color: var(--text-dim); font-weight: 500; }
.inv-group[open] summary::after { content: "−"; }
.inv-group .bt-form { padding: 2px 14px 14px; }

.inv-lines { margin: 18px 0; }
.inv-lines-head, .inv-item { display: grid; grid-template-columns: minmax(0, 1fr) 4.2rem 7.2rem 6.6rem 28px; gap: 8px; align-items: center; }
.inv-lines-head { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.inv-lines-head span:nth-child(4) { text-align: right; }
.inv-item { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.inv-item label { min-width: 0; }
.biz-tool .inv-qty input { text-align: center; font-family: var(--mono); }
.inv-rate { display: flex; align-items: center; border: 1px solid var(--border-2); border-radius: 6px; background: var(--bg); }
.inv-rate:focus-within { border-color: var(--accent-border, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.inv-rate .bt-pre { padding-left: 0.55rem; color: var(--text-dim); font: 500 0.84rem var(--mono); }
.biz-tool .inv-rate input { border: 0; background: transparent; box-shadow: none !important; font-family: var(--mono); padding-left: 0.25rem; }
.inv-rate:has([aria-invalid="true"]) { border-color: var(--danger); }
.inv-amt { font: 600 0.86rem var(--mono); font-feature-settings: "tnum"; text-align: right; white-space: nowrap; }
.inv-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.inv-add .bt-hint { margin-left: 6px; }
.inv-money { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inv-disc { display: flex; gap: 6px; align-items: center; }
.inv-disc .bt-seg { flex: none; }
.inv-taxnote { margin-top: 12px; }
.inv-taxnote b { color: var(--text-mid); }

.inv-preview { background: color-mix(in srgb, var(--bg) 70%, var(--surface)); padding: 14px 18px 20px; min-width: 0; }
.inv-preview-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; color: var(--text-dim); }
.inv-total { font-size: 0.8rem; }
.inv-total b { color: var(--text); font-size: 1rem; margin-left: 4px; }
.inv-paper { position: sticky; top: 100px; background: #fff; color: #16181d; border-radius: 4px; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05), 0 22px 50px -26px rgba(0, 0, 0, 0.6); font: 400 0.74rem/1.5 var(--font); }
.inv-paper:focus-visible { outline: 2px solid var(--accent-border, var(--accent)); outline-offset: 3px; }
.inv-paper .doc { padding: 26px 26px 20px; }
.inv-paper p { margin: 0; }
.doc-top { display: flex; justify-content: space-between; gap: 18px; padding-bottom: 14px; border-bottom: 2px solid #16181d; }
.doc-biz { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 3px !important; overflow-wrap: anywhere; }
.doc-from p:not(.doc-biz) { color: #5b5f66; overflow-wrap: anywhere; }
.doc-kind { text-align: right; flex: none; }
.doc-type { font-size: 1.25rem; font-weight: 300; letter-spacing: 0.14em; text-transform: uppercase; }
.doc-kind dl { display: grid; grid-template-columns: auto auto; gap: 1px 10px; margin: 6px 0 0; justify-content: end; }
.doc-kind dt { color: #6a6e75; }
.doc-kind dd { margin: 0; font-weight: 600; }
.doc-paid { display: inline-block; margin-top: 8px !important; border: 2px solid #216c42; color: #216c42; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; padding: 1px 9px; transform: rotate(-4deg); }
.doc-to { margin: 14px 0; overflow-wrap: anywhere; }
.doc-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: #7a7e85; margin-bottom: 3px !important; }
.doc-items { width: 100%; border-collapse: collapse; font-feature-settings: "tnum"; }
.doc-items th { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #6a6e75; text-align: right; padding: 6px 5px; border-bottom: 1px solid #16181d; }
.doc-items td { padding: 7px 5px; border-bottom: 1px solid #e6e6e2; text-align: right; vertical-align: top; white-space: nowrap; }
.doc-items th:first-child, .doc-items td:first-child { text-align: left; white-space: normal; width: 55%; overflow-wrap: anywhere; }
.doc-empty { color: #8a8e95; text-align: center !important; padding: 16px 0 !important; }
.doc-sum { display: grid; grid-template-columns: 1fr auto; gap: 3px 18px; margin: 12px 0 0 auto; max-width: 260px; font-feature-settings: "tnum"; }
.doc-sum dt { color: #5b5f66; }
.doc-sum dd { margin: 0; text-align: right; }
.doc-sum .doc-total { font-size: 0.92rem; font-weight: 700; color: #16181d; border-top: 2px solid #16181d; padding-top: 5px; margin-top: 3px; }
.doc-notes { margin-top: 16px; padding: 10px 12px; background: #f4f4f1; border-radius: 4px; overflow-wrap: anywhere; }
.doc-foot { margin-top: 18px !important; color: #8a8e95; font-size: 0.66rem; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .inv-body { grid-template-columns: 1fr; }
  .inv-editor { border-right: 0; border-bottom: 1px solid var(--border); }
  .inv-paper { position: static; }
}
@media (max-width: 820px) {
  .bt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .till-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .bt-bar, .bt-foot { padding-inline: 14px; }
  .bt-panel { padding: 16px 14px 18px; }
  .kpi { padding: 12px 14px; }
  .bt-bar-actions { margin-left: 0; }
  .bt-foot-actions { width: 100%; }
  .bt-foot-actions .bt-btn { flex: 1 1 auto; justify-content: center; }
  .till-row { grid-template-columns: 2.6rem auto minmax(0, 1fr); }
  .till-sub { grid-column: 3; }
  .show-rolls .till-row:has(.till-roll:not(.is-blank)) { grid-template-columns: 2.6rem auto minmax(0, 1fr); }
  .show-rolls .till-roll:not(.is-blank) { grid-column: 2 / 4; grid-row: 2; padding-bottom: 2px; }
  .till-roll.is-blank { display: none; }
  .till-dep-head { grid-template-columns: 1fr; }
  .inv-head, .inv-money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-head > :first-child { grid-column: 1 / -1; }
  .inv-lines-head { display: none; }
  .inv-item { grid-template-columns: 4rem minmax(0, 1fr) auto 28px; row-gap: 6px; }
  .inv-item .inv-desc { grid-column: 1 / -1; }
  .inv-preview { padding: 12px 10px 16px; }
  .inv-paper .doc { padding: 18px 16px; }
  .doc-top { flex-direction: column; }
  .doc-kind { text-align: left; }
  .doc-kind dl { justify-content: start; }
}
@media (prefers-reduced-motion: reduce) {
  .mix-bar i, .bt-switch-ui::after { transition: none; }
}
html[data-motion="reduced"] .mix-bar i, html[data-motion="reduced"] .bt-switch-ui::after { transition: none; }
