/* =========================================================================
   Reconcilio — single-page stylesheet (no build step, no CDN)
   Status colors mirror the canonical legend (ARGB without the alpha byte):
     matched      FFC6EFCE -> #C6EFCE (green)
     timing       FFFFEB9C -> #FFEB9C (yellow)
     review       FFFFD8A8 -> #FFD8A8 (orange)
     discrepancy  FFFFC7CE -> #FFC7CE (red)
     fee          FFBDD7EE -> #BDD7EE (blue)
     outstanding  FFE4DFEC -> #E4DFEC (purple)
   ========================================================================= */

:root {
  --green:  #2f7d5b;
  --green-d:#256348;
  --accent: #2f7d5b;
  --ink:    #1d2530;
  --ink-2:  #4a5666;
  --muted:  #7a8696;
  --line:   #e3e8ee;
  --bg:     #f4f6f9;
  --card:   #ffffff;
  --shadow: 0 1px 2px rgba(20,30,45,.06), 0 6px 18px rgba(20,30,45,.06);

  /* status fills */
  --st-matched:     #C6EFCE;
  --st-timing:      #FFEB9C;
  --st-review:      #FFD8A8;
  --st-discrepancy: #FFC7CE;
  --st-fee:         #BDD7EE;
  --st-payment:     #B2DFDB;
  --st-awaiting_proof: #FFEB9C;
  --st-outstanding: #E4DFEC;

  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark { display: inline-flex; }
.brand__name { font-size: 20px; font-weight: 750; letter-spacing: -.2px; }
.brand__tag { color: var(--muted); font-size: 12px; margin-left: 4px; }

.topbar__right { display: flex; align-items: center; gap: 12px; }
.period-picker { display: flex; align-items: center; gap: 8px; }
.period-picker label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.period-picker select {
  min-width: 200px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px;
}

/* ---------- Stepper ---------- */
.stepper { background: var(--card); border-bottom: 1px solid var(--line); }
.stepper ol {
  /* Span full width so the stepper's left edge lines up with the steps column. */
  display: flex; gap: 6px; list-style: none; margin: 0;
  padding: 8px 24px;
}
.step {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 4px 14px 4px 4px; border-radius: 999px;
}
.step__num {
  width: 22px; height: 22px; border-radius: 50%;
  background: #eef1f5; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.step.active { color: var(--green-d); }
.step.active .step__num { background: var(--green); color: #fff; }
.step.done .step__num { background: var(--st-matched); color: var(--green-d); }

/* ---------- Layout ---------- */
.layout {
  /* Full window width: steps 1-4 pinned LEFT, summary + transactions take the
     wider RIGHT side (no centered max-width band). */
  display: grid; grid-template-columns: minmax(360px, 1fr) minmax(520px, 1.6fr);
  gap: 20px; margin: 20px 0; padding: 0 24px 60px;
}
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.workflow, .results { display: flex; flex-direction: column; gap: 20px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card__head h2 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card__step {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.card__body { padding: 18px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  font-size: 14px; font-weight: 650; cursor: pointer; text-decoration: none;
  transition: background .12s, box-shadow .12s, opacity .12s; line-height: 1;
}
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:not(:disabled):hover { background: var(--green-d); }
.btn--accent { background: #1f6f4d; color: #fff; }
.btn--accent:not(:disabled):hover { background: #18583d; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:not(.disabled):hover { background: #f2f5f8; }
.btn--danger { background: #fff; color: #b42318; border-color: #f1c4bf; }
.btn--danger:not(:disabled):hover { background: #fdeceb; border-color: #e3a39c; }
.btn--lg { padding: 12px 22px; font-size: 15px; }

.filebtn {
  display: inline-block; padding: 8px 14px; border-radius: 9px;
  border: 1px dashed var(--green); color: var(--green-d); background: #f1f8f4;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.filebtn:hover { background: #e6f2ec; }
.filename { display: block; font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.append-opt { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin: 0 0 10px; cursor: pointer; }
.append-opt input { margin: 0; }

.iconbtn {
  border: none; background: transparent; font-size: 24px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.iconbtn:hover { color: var(--ink); }

/* ---------- Period meta ---------- */
.period-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.period-meta div { display: flex; flex-direction: column; }
.period-meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.period-meta dd { margin: 2px 0 0; font-weight: 600; }

/* ---------- Uploaders ---------- */
.uploader h3 { font-size: 14px; margin-bottom: 2px; }
.import-result { font-size: 13px; margin: 8px 0 0; min-height: 18px; }
.import-result.ok { color: var(--green-d); }
.import-result.err { color: #b3261e; }

/* ---------- Document upload / OCR ---------- */
.doc-upload__controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px;
}
.kind-pick { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kind-pick select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.doc-upload__controls .filename { margin: 0; }

.ocr-result {
  border: 1px solid var(--line); border-radius: 10px; background: #fafcfe; padding: 14px;
}
.ocr-result__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ocr-result__head h4 { font-size: 14px; }
.ocr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.ocr-fields dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ocr-fields dd { margin: 2px 0 0; font-weight: 600; }

.badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  letter-spacing: .03em;
}
.badge.needs-review { background: var(--st-review); color: #8a4b00; }

.conf-bar {
  display: inline-block; width: 110px; height: 8px; border-radius: 999px;
  background: #e6ebf1; vertical-align: middle; overflow: hidden;
}
.conf-bar__fill { display: block; height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .3s; }
.conf-text { font-size: 12px; margin-left: 8px; }

.doc-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.doc-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 13px; background: #fff;
}
.doc-list .doc-thumb {
  width: 34px; height: 34px; border-radius: 6px; object-fit: cover;
  background: #eef1f5; flex: 0 0 auto;
}
.doc-list .doc-name { font-weight: 600; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-list .doc-amt { color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* Document body wraps the name + the "Loaded <when> · <accuracy>" meta line. */
.doc-list .doc-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-list .doc-body .doc-name { flex: 0 0 auto; }
.doc-list .doc-meta { font-size: 11px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-list .doc-acc { font-weight: 700; padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.doc-list .acc-high { background: #eaf6ef; color: #1f8f4d; }
.doc-list .acc-mid  { background: #fbf3e2; color: #9a6a00; }
.doc-list .acc-low  { background: #fdecec; color: #c0392b; }
/* Clickable proof items + bidirectional cross-link highlight. */
.doc-list .doc-item { cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s; }
.doc-list .doc-item:hover { background: #f7faf8; }
.doc-list .doc-check { color: #1f8f4d; font-weight: 800; flex: 0 0 auto; }
/* Per-row delete button: always visible (clearly), brightens on hover/focus. */
.doc-list .doc-del {
  flex: 0 0 auto; border: 0; background: transparent; cursor: pointer;
  font-size: 19px; line-height: 1; padding: 5px 8px; border-radius: 6px;
  opacity: .65; transition: opacity .12s, background .12s; color: #b42318;
}
.doc-list .doc-item:hover .doc-del,
.doc-list .doc-del:focus-visible { opacity: .9; }
.doc-list .doc-del:hover { opacity: 1; background: #fdeceb; }
.doc-list .doc-item.proof-active {
  border-color: var(--green, #1f8f4d); background: #eaf6ef;
  box-shadow: 0 0 0 2px rgba(31,143,77,.25);
}
.txn-grid tbody tr.proof-highlight {
  outline: 2px solid #1f8f4d; outline-offset: -2px;
}

/* ---------- Transaction search ---------- */
.grid-search {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line, #d7dde5); border-radius: 7px;
  padding: 3px 8px; margin-left: 10px; min-width: 210px;
}
.grid-search:focus-within { border-color: #1f8f4d; box-shadow: 0 0 0 2px rgba(31,143,77,.18); }
.grid-search__icon { font-size: 12px; opacity: .6; }
.grid-search input[type="search"] {
  border: 0; outline: 0; background: transparent; flex: 1 1 auto;
  font-size: 13px; min-width: 0; padding: 2px 0;
}
.grid-search__count { font-size: 11px; white-space: nowrap; }
/* Matched name/amount text inside a cell. */
mark.search-mark { background: #ffe9a8; color: inherit; padding: 0 1px; border-radius: 2px; }
/* A search that resolves to a single row reads as "selected". */
.txn-grid tbody tr.search-solo {
  outline: 2px solid #d98a00; outline-offset: -2px; background: #fff7e6;
}

/* ---------- Reconcile actions ---------- */
.reconcile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.reconcile-hint { width: 100%; margin: 4px 0 0; }

/* ---------- Summary card ---------- */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 560px) { .summary-grid { grid-template-columns: 1fr 1fr; } }
.sum-item { background: #f7f9fb; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.sum-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sum-val { display: block; font-size: 17px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }

.balance-pill {
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: #eef1f5; color: var(--ink-2);
}
.balance-pill.balanced { background: var(--st-matched); color: var(--green-d); }
.balance-pill.unbalanced { background: var(--st-discrepancy); color: #9b1c13; }

.legend-title { font-size: 13px; margin-bottom: 8px; color: var(--ink-2); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend .swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,.12); flex: 0 0 auto; }
.legend .leg-label { flex: 1 1 auto; text-transform: capitalize; }
.legend .leg-count { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Transaction grid ---------- */
.grid-card .card__body { padding: 0; }
.grid-scroll { max-height: 560px; overflow: auto; }

/* Drag-to-resize column handles (sit on each header cell's right edge). */
.col-resizer {
  position: absolute; top: 0; right: 0; width: 7px; height: 100%;
  cursor: col-resize; user-select: none; touch-action: none; z-index: 2;
}
.col-resizer:hover { background: rgba(40, 90, 160, .25); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none; }

/* Full-screen overlay for the transactions table. */
body.grid-fullscreen-open { overflow: hidden; }
.grid-card.grid-fullscreen {
  position: fixed; inset: 0; z-index: 1000; margin: 0; border-radius: 0;
  background: #fff; box-shadow: none;
  display: flex; flex-direction: column;
}
.grid-card.grid-fullscreen .card__body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.grid-card.grid-fullscreen .grid-scroll { flex: 1; min-height: 0; max-height: none; }
/* Company/Account/Month picker bar — only shown in full-screen. */
.grid-fsnav { display: none; }
.grid-card.grid-fullscreen .grid-fsnav {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--line); background: #fafbfc;
}
.grid-fsnav label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.grid-fsnav select { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--ink); }
.txn-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.txn-grid thead th {
  position: sticky; top: 0; z-index: 2; background: #f7f9fb;
  text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Keep transient overlays above the full-screen grid (z-index:1000). */
body.grid-fullscreen-open .toast { z-index: 1100; }
.txn-grid th.num, .txn-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.txn-grid tbody td { padding: 9px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.txn-grid tbody tr { cursor: pointer; transition: filter .1s; }
.txn-grid tbody tr:hover { filter: brightness(.97); }
.txn-grid .empty-row td { text-align: center; color: var(--muted); cursor: default; padding: 24px; }
.txn-grid .empty-row:hover { filter: none; }

.txn-grid .col-src { text-transform: capitalize; color: var(--ink-2); }
.txn-grid .col-desc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-grid .col-cat, .txn-grid .col-type { padding-top: 4px; padding-bottom: 4px; }
.txn-grid .cat-select, .txn-grid .type-select {
  font: inherit; font-size: .9em; padding: 3px 5px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
  cursor: pointer;
}
.txn-grid .cat-select { min-width: 130px; }
.txn-grid .type-select { min-width: 78px; }

/* Side-panel Category + Type selectors */
.sp-classify { display: flex; gap: 12px; margin: 12px 0 4px; }
.sp-classify > div { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sp-classify label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sp-classify select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; }

/* Manage-categories modal */
.modal__box--wide { max-width: 760px; width: 92vw; }
.cat-manager { display: grid; grid-template-columns: 1fr 1.2fr; gap: 22px; }
.cat-manager__col h4 { margin: 0 0 10px; }
.cat-add { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cat-add input, .cat-add select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.cat-add > input { flex: 1; min-width: 120px; }
.cat-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.cat-row, .rule-row { display: flex; align-items: center; gap: 6px; }
.cat-name-input { flex: 1; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.cat-code-input { width: 78px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.cat-kind-select { width: 92px; padding: 5px 4px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.rule-row { justify-content: space-between; padding: 5px 8px; border: 1px solid #eef1f5; border-radius: 6px; }
.rule-text { font-size: 13px; }
.cat-del { color: #9b1c13; }
@media (max-width: 680px) { .cat-manager { grid-template-columns: 1fr; } }

/* Accounting-package export row */
.acct-export { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.acct-export select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }

/* Feedback board (floating bug/idea buttons + board modal) */
.feedback-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 90;
  display: flex; gap: 8px;
}
.feedback-fab .btn { box-shadow: var(--shadow); background: #fff; }
.report-add { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.report-add label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.report-add input, .report-add select, .report-add textarea {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
.report-list-title { margin: 6px 0 8px; }
.report-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto;
  display: flex; flex-direction: column; gap: 8px; }
.report-row { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between;
  padding: 8px 10px; border: 1px solid #eef1f5; border-radius: 8px; }
.report-meta { flex: 1; min-width: 0; }
.report-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-right: 8px; white-space: nowrap; }
.report-bug { background: #fde8e6; color: #9b1c13; }
.report-feature { background: #e6f0fd; color: #1d4ed8; }
.report-title { font-weight: 600; }
.report-title.report-done { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.report-detail { font-size: 12.5px; margin-top: 4px; white-space: pre-wrap; }
.report-actions { display: flex; gap: 4px; }
.report-empty { padding: 14px; text-align: center; }
.txn-grid .amt-neg { color: #9b1c13; }
.txn-grid .amt-pos { color: var(--green-d); }

.status-tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: capitalize; color: #2a2a2a;
  border: 1px solid rgba(0,0,0,.08);
}
.matchnum { font-weight: 700; font-variant-numeric: tabular-nums; }
.proof-dot { font-size: 15px; }
.proof-yes { color: var(--green); }
.proof-no { color: #cdd4dd; }

/* row tints by status (exact legend hex) */
tr.st-matched     { background: var(--st-matched); }
tr.st-timing      { background: var(--st-timing); }
tr.st-review      { background: var(--st-review); }
tr.st-discrepancy { background: var(--st-discrepancy); }
tr.st-fee         { background: var(--st-fee); }
tr.st-payment     { background: var(--st-payment); }
tr.st-awaiting_proof { background: var(--st-awaiting_proof); }
tr.st-outstanding { background: var(--st-outstanding); }

/* ---------- Side panel ---------- */
.sidepanel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 92vw;
  background: var(--card); box-shadow: -8px 0 28px rgba(20,30,45,.18);
  transform: translateX(100%); transition: transform .22s ease; z-index: 50;
  display: flex; flex-direction: column;
}
.sidepanel.open { transform: translateX(0); }
.sidepanel__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sidepanel__head h3 { font-size: 16px; }
.sidepanel__body { padding: 18px; overflow: auto; }
.sp-fields { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0 0 18px; }
.sp-fields div { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.sp-fields dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.sp-fields dd { margin: 0; font-weight: 600; text-align: right; }
.sp-proof h4 { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.sp-proof__view img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.sp-proof__view embed, .sp-proof__view iframe { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; }

.scrim { position: fixed; inset: 0; background: rgba(15,22,33,.32); z-index: 40; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,22,33,.42); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal__box { background: #fff; border-radius: 14px; width: 460px; max-width: 100%; box-shadow: 0 18px 60px rgba(15,22,33,.3); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal__body label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.modal__body input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- App footer ---------- */
.app-footer {
  text-align: center; color: #8a97a0; font-size: 12px;
  padding: 22px 12px 30px;
}

/* ---------- Sample-data banner ---------- */
.demo-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 12px 22px 0; padding: 11px 16px; border-radius: 12px;
  background: #fdf6e3; border: 1px solid #efe0b0; color: #7a5d12;
  font-size: 13.5px;
}
.demo-banner__text { flex: 1; min-width: 220px; }
.demo-banner__btn {
  background: #b07d1e; color: #fff; border: none;
}
.demo-banner__btn:hover { background: #946717; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 80;
  max-width: 90vw;
}
.toast.err { background: #b3261e; }
.toast.ok { background: var(--green-d); }

/* ---------- Reconciliation coverage bar (Feature 1) ---------- */
.coverage { margin: 0 0 18px; }
.coverage__headline { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.coverage__bar {
  display: flex; width: 100%; height: 14px; border-radius: 999px;
  overflow: hidden; background: #eef1f5; border: 1px solid var(--line);
}
.coverage__bar.is-empty { background: #eef1f5; }
.coverage__seg { height: 100%; min-width: 2px; }
.coverage__seg:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.coverage__seg:last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }

/* ---------- Clickable status filters (Feature 2) ---------- */
.legend-hint { font-weight: 400; font-size: 11px; }
.legend .leg-item {
  cursor: pointer; padding: 3px 8px; border-radius: 999px;
  border: 1px solid transparent; transition: background .1s, box-shadow .1s;
  user-select: none;
}
.legend .leg-item:hover { background: #f2f5f8; }
.legend .leg-item:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.legend .leg-item.active {
  background: #eef5f1; border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(47,125,91,.15); font-weight: 700;
}
/* A deselected (hidden) status chip in the multi-select filter is dimmed. */
.legend .leg-item.leg-off { opacity: .4; }
.legend .leg-item.leg-off .leg-label { text-decoration: line-through; }
.legend .leg-all .leg-label { text-transform: none; font-weight: 700; }

/* ---------- Matched-pair highlighting + reconciled affordance (Feature 3) ---------- */
.txn-grid tbody tr.match-highlight {
  box-shadow: inset 4px 0 0 0 var(--green);
  background-image: linear-gradient(rgba(47,125,91,.10), rgba(47,125,91,.10));
}
.recon-check {
  display: inline-block; margin-right: 5px; color: var(--green-d);
  font-weight: 700; font-size: 12px; vertical-align: middle;
}

/* Proof viewer (side panel) + lightbox */
.proof-wrap { display: flex; flex-direction: column; gap: 8px; }
.proof-img {
  max-width: 100%; display: block; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; cursor: zoom-in;
}
.proof-frame {
  width: 100%; height: 440px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
.proof-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.btn--sm { padding: 5px 10px; font-size: 12px; line-height: 1.2; }

/* Statement-load progress bar (advances as each file is read). */
.ingest-progress { margin-top: 12px; }
.ingest-progress__bar {
  height: 9px; background: #eef1f5; border-radius: 999px; overflow: hidden;
}
.ingest-progress__fill {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--green, #1f8f4d); transition: width .25s ease;
}
/* Animated stripes while a file is actively being read/OCR'd. */
.ingest-progress.is-working .ingest-progress__fill {
  background-image: linear-gradient(45deg,
    rgba(255,255,255,.28) 25%, transparent 25%, transparent 50%,
    rgba(255,255,255,.28) 50%, rgba(255,255,255,.28) 75%, transparent 75%, transparent);
  background-size: 1rem 1rem;
  animation: ingest-stripes .8s linear infinite;
}
@keyframes ingest-stripes { from { background-position: 0 0; } to { background-position: 1rem 0; } }
.ingest-progress__label { font-size: 12px; color: var(--ink-2); margin-top: 6px; }

/* Smart-inbox statement load report (per-file outcome). */
.ingest-report { margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #fafbfc; }
.ingest-report__title { font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.ingest-report__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ingest-report__item { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.ingest-report__item .ingest-file { font-weight: 600; }
.ingest-report__item .ingest-msg { flex: 1 1 auto; }
.ingest-report__item.ingest-failed .ingest-file { color: #b42318; }

/* Manual link/unlink controls under the proof view. */
.sp-link-actions { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); align-items: center; }
.sp-manual-note { font-size: 12px; }
/* The link-a-receipt picker is a scrollable list inside the modal. */
.link-doc-list { margin-top: 0; max-height: 50vh; overflow-y: auto; }
.link-doc-list .link-empty { border: none; background: none; padding: 8px 2px; }
/* A receipt whose amount matches this line — the system's suggested match. */
.link-doc-list .doc-suggest { border-color: var(--green, #1f8f4d); background: #f0f9f4; }
.link-doc-list .doc-suggest-badge {
  color: #1f8f4d; font-weight: 700; font-size: 12px; flex: 0 0 auto;
  background: #d8f0e2; border-radius: 999px; padding: 1px 8px;
}
/* A receipt already attached to a DIFFERENT line — dimmed, with where it's used.
   Still clickable: clicking MOVES it to the current line. */
.link-doc-list .doc-used { opacity: .55; }
.link-doc-list .doc-used:hover { opacity: 1; background: #fff7f2; }
.link-doc-list .doc-usedby { font-size: 11px; flex: 0 0 auto; white-space: nowrap; }

.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 56px 24px 24px;
  background: rgba(15, 23, 32, .85);
}
.lightbox__stage {
  position: relative; max-width: 95vw; max-height: 86vh;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.lightbox__img {
  max-width: 95vw; max-height: 86vh; border-radius: 8px; background: #fff;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
  transform-origin: center center; cursor: zoom-in; user-select: none;
  -webkit-user-drag: none; transition: transform .04s linear;
}
.lightbox__img.is-pannable { cursor: grab; }
.lightbox__img.is-panning { cursor: grabbing; transition: none; }
.lightbox__frame {
  width: 92vw; height: 86vh; border: 0; border-radius: 8px; background: #fff;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
}
.lightbox__bar {
  position: absolute; top: 14px; right: 18px; left: 18px;
  display: flex; gap: 10px; align-items: center; justify-content: flex-end;
}
.lightbox__bar .lb-zoom { margin-right: auto; }
.lb-zoom { display: inline-flex; gap: 4px; align-items: center; }
.lightbox__bar .iconbtn { background: #fff; }

/* Batch invoice upload: progress + per-file results */
.doc-progress { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.doc-progress__track {
  flex: 1; height: 8px; border-radius: 6px; background: #e6ebf2; overflow: hidden;
}
.doc-progress__fill {
  display: block; height: 100%; width: 0; background: var(--accent, #3b82f6);
  transition: width .2s ease;
}
.doc-progress__label { font-size: 12px; color: var(--muted, #6b7280); }
.doc-results {
  list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px;
  max-height: 184px; overflow: auto;
}
.doc-result { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.doc-result__icon { flex: 0 0 auto; }
.doc-result.is-dup { color: #8a6d3b; }
.doc-result.is-err { color: #b4232c; }
.doc-result.is-review { color: #8a5a00; }

.doc-readmethod { font-weight: 600; }
.doc-readmethod.rm-ocr { color: #1a7f37; }
.doc-readmethod.rm-text { color: #8a6d3b; }

/* "Improve accuracy" re-read: progress + stop + before -> after */
.lb-reread {
  position: absolute; left: 18px; right: 18px; bottom: 16px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: rgba(255, 255, 255, .97); border-radius: 8px; padding: 8px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35); font-size: 13px; color: #222;
}
.lb-reread__track {
  flex: 0 0 130px; height: 8px; border-radius: 6px; background: #e6ebf2; overflow: hidden;
}
.lb-reread__fill {
  display: block; height: 100%; width: 35%; border-radius: 6px;
  background: var(--accent, #3b82f6); animation: lbReread 1.1s ease-in-out infinite;
}
@keyframes lbReread { 0% { transform: translateX(-120%); } 100% { transform: translateX(380%); } }
.lb-reread__time { color: #555; white-space: nowrap; }
.lb-reread__result { display: inline-flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.rr-pair .rr-label { color: #888; }
.rr-pair .rr-arrow { color: #aaa; }
.rr-pair .rr-after { font-weight: 700; }

/* Manual edit of a document's fields */
.lb-edit {
  position: absolute; left: 18px; right: 18px; bottom: 16px;
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: rgba(255, 255, 255, .97); border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35); color: #222;
}
.lb-edit__f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #555; }
.lb-edit__f input { padding: 5px 8px; border: 1px solid #cdd4dd; border-radius: 6px; font-size: 13px; }
.lb-edit__f input[type=number] { width: 110px; }
.lb-edit__f input[type=text] { width: 180px; }
.doc-readmethod.rm-manual { color: #5b3bbf; }

/* utility */
[hidden] { display: none !important; }

/* ================= App navigation + views (Dashboard / Reconciliation / Reports) */
.appnav {
  display: flex; gap: 6px; padding: 8px 22px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.appnav__btn {
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  font: inherit; font-weight: 600; padding: 7px 16px; border-radius: 999px;
  cursor: pointer;
}
.appnav__btn:hover { background: var(--bg); }
.appnav__btn[aria-pressed="true"] { background: var(--green); color: #fff; }
.appview { min-height: calc(100vh - 110px); }
.appview--reports { display: flex; }
.appview--reports iframe {
  border: 0; width: 100%; min-height: calc(100vh - 110px); flex: 1;
}

/* ================= Dashboard */
.dash { max-width: 1180px; margin: 18px auto 60px; padding: 0 22px; }
.dash__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.dash__head h2 { margin: 0; color: var(--green-d); }
.dash__head .btn { margin-left: auto; }
.dash-co { margin-bottom: 18px; }
.dash-co__grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.1fr); gap: 22px; }
@media (max-width: 900px) { .dash-co__grid { grid-template-columns: 1fr; } }
.dash-co__meta { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 10px; }

.dash-accounts { display: flex; flex-direction: column; gap: 8px; }
.dash-acct {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.dash-acct__type {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 999px; background: #e9f3ee; color: var(--green-d);
  white-space: nowrap;
}
.dash-acct__type--card { background: #fdeeee; color: #9b1c13; }
.dash-acct__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-acct__label .detail { display: block; font-size: 12px; color: var(--muted); }
.dash-acct__bal { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.dash-acct__bal.neg { color: #9b1c13; }
.dash-acct__eye { border: 0; background: none; cursor: pointer; font-size: 15px; opacity: .55; }
.dash-acct__eye:hover { opacity: 1; }
.dash-acct--hidden { opacity: .45; background: var(--bg); }
.dash-acct--hidden .dash-acct__bal { visibility: hidden; }

.dash-chart h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.dash-chart + .dash-chart { margin-top: 16px; }
.dash-bars { display: flex; flex-direction: column; gap: 6px; }
.dash-bar { display: grid; grid-template-columns: 150px 1fr 90px; gap: 8px; align-items: center; font-size: 13px; }
.dash-bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar__track { background: var(--bg); border-radius: 5px; height: 14px; overflow: hidden; }
.dash-bar__fill { height: 100%; background: var(--green); border-radius: 5px; min-width: 2px; }
.dash-bar__val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.dash-cols { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding-top: 6px; }
.dash-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.dash-col__bar { width: 70%; max-width: 46px; background: var(--green); border-radius: 4px 4px 0 0; min-height: 2px; }
.dash-col__cap { font-size: 11px; color: var(--muted); white-space: nowrap; }
.dash-col__amt { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-empty { color: var(--muted); padding: 8px 0; }

/* ================= Invoice / Payroll libraries */
.lib-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lib-toolbar label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.lib-toolbar select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.lib-spacer { flex: 1; }
.lib-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(380px, 1.6fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .lib-grid { grid-template-columns: 1fr; } }
.lib-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.lib-table th { text-align: left; font-size: 12px; color: var(--ink-2); border-bottom: 2px solid var(--line); padding: 6px 8px; }
.lib-table th.num, .lib-table td.num { text-align: right; white-space: nowrap; }
.lib-table td { padding: 6px 8px; border-bottom: 1px solid #eef1f5; }
.lib-table tbody tr:hover td { background: #f7faf8; }
.lib-table .detail { display: block; font-size: 12px; color: var(--muted); }
.lib-table a { color: var(--green-d); text-decoration: none; }
.lib-table a:hover { text-decoration: underline; }
.lib-total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.lib-undated td { color: #7a5b13; background: #fff9ea; }
.lib-actions { white-space: nowrap; text-align: right; }
.lib-actions .btn { padding: 2px 8px; }
.lib-editrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lib-editrow input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }
.lib-editrow input[type=number] { width: 110px; }

/* ================= Sales (AR) */
.inv-form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.inv-form-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.inv-form-row select, .inv-form-row input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; min-width: 140px; }
#invLinesTable input, #invLinesTable select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }
#invLinesTable .inv-qty { max-width: 70px; }
#invLinesTable .inv-price { max-width: 110px; }
#invLinesTable td { vertical-align: middle; }
.inv-totals { display: flex; gap: 22px; justify-content: flex-end; align-items: baseline; padding: 10px 4px 0; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.inv-totals .inv-grand { font-size: 16px; color: var(--ink); }
.inv-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.inv-chip--draft { background: #eef1f5; color: var(--ink-2); }
.inv-chip--sent { background: #e3edfb; color: #1e5799; }
.inv-chip--paid { background: var(--st-matched); color: var(--green-d); }
.inv-chip--void { background: #fdecea; color: #9b1c13; text-decoration: line-through; }
.cust-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px; border: 1px dashed var(--green); border-radius: 10px; margin-bottom: 10px; background: #f6faf8; }
.cust-form input, .cust-form select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }

/* Customer editor modal — a roomy window so all fields breathe. */
.modal__box--xl { max-width: 980px; width: 94vw; }
.modal__box--xl .modal__body { max-height: 74vh; overflow-y: auto; }
.cust-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; margin-bottom: 12px; }
.cust-grid .span2 { grid-column: span 2; }
@media (max-width: 720px) { .cust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cust-grid .span2 { grid-column: span 2; } }
@media (max-width: 480px) { .cust-grid { grid-template-columns: 1fr; } .cust-grid .span2 { grid-column: auto; } }
/* min-width:0 lets a cell shrink below the input's intrinsic width, and
   width:100% keeps every field inside its own column — otherwise the email/
   BN/tax fields spill past the modal's right edge. */
.cust-grid label, .cust-block { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; color: var(--ink-2); min-width: 0; }
.cust-grid label .muted { font-weight: 400; }
.cust-grid input, .cust-grid select, .cust-block textarea {
  width: 100%; min-width: 0; box-sizing: border-box;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff;
}
/* Pin every control to the bottom of its grid cell so fields in the same
   row line up even when one label wraps to two lines (Terms vs Credit limit). */
.cust-grid label > input, .cust-grid label > select { margin-top: auto; }
.cust-section {
  font-weight: 700; font-size: 13px; color: var(--green-d);
  border-bottom: 1px solid var(--line); padding-bottom: 4px; margin: 14px 0 10px;
}
.cust-block { margin-top: 10px; }
.cust-block textarea { resize: vertical; width: 100%; box-sizing: border-box; }

/* Invoice item picker */
#invLinesTable .inv-item { max-width: 140px; }

/* Postal-code mini map (offline tile map of Canada) */
.cust-addr-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.cust-map {
  flex: 0 0 240px; padding: 10px 10px 8px; border: 1px solid var(--line);
  border-radius: 10px; background: #fafcfd; text-align: center;
}
.cust-map__cap { font-size: 12px; color: var(--ink-2); margin-top: 6px; font-weight: 600; }
@media (max-width: 720px) { .cust-map { flex: 1 1 100%; } }

/* Invoice editor styled like the document it produces */
.inv-paper .modal__body { max-height: 76vh; overflow-y: auto; }
.inv-head { display: flex; gap: 26px; justify-content: space-between; flex-wrap: wrap;
  border-bottom: 3px solid var(--green); padding-bottom: 14px; margin-bottom: 6px; }
.inv-head__left { flex: 1 1 320px; display: flex; flex-direction: column; gap: 8px; }
.inv-head__left > label, .inv-head__right > label { display: flex; flex-direction: column; gap: 4px;
  font-weight: 600; font-size: 13px; color: var(--ink-2); }
.inv-head__left select, .inv-head__right input, .inv-head__right select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.inv-billto { font-size: 13.5px; color: var(--ink-2); line-height: 1.45;
  padding: 10px 12px; background: #f7faf8; border-radius: 8px; min-height: 40px; }
.inv-billto__name { font-weight: 700; color: var(--ink); }
.inv-head__right { flex: 0 0 240px; display: flex; flex-direction: column; gap: 8px; text-align: right; }
.inv-head__right > label { text-align: left; }
.inv-doc-title { font-size: 26px; font-weight: 800; color: var(--green-d); letter-spacing: 1px; line-height: 1; }
.inv-doc-number { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.inv-date-echo { font-weight: 600; color: var(--green-d); }

.dash-prov { padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 12.5px; color: var(--ink-2); background: #fff; }

/* Sales view on big (24-34in) screens: use the width — wider container,
   roomier two-column split, larger cards so nothing looks lost in the middle. */
.dash--sales { max-width: 1620px; }
.dash--sales .lib-grid {
  grid-template-columns: minmax(430px, 5fr) minmax(560px, 7fr);
  gap: 24px;
}
.dash--sales .card__body { padding: 20px; }
.dash--sales .lib-table th, .dash--sales .lib-table td { padding: 8px 10px; font-size: 14.5px; }
.dash--sales .dash-acct { padding: 12px 14px; }
@media (min-width: 1700px) {
  .dash--sales { max-width: 1860px; }
  .dash--sales .lib-grid { grid-template-columns: minmax(500px, 2fr) minmax(700px, 3fr); }
}

.inv-deliv { display: block; margin-top: 4px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; color: var(--ink-2); background: #fff; }

/* dd-mm-yyyy date fields (visible text input + hidden native picker) */
.dmy-wrap { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.dmy-wrap input[type="text"] { width: 120px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.dmy-pick { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 7px; cursor: pointer; font-size: 14px; line-height: 1; }
.dmy-pick:hover { background: #f2f6f3; }
.dmy-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* Clickable library totals rows + drill-down */
.lib-bucket-row { cursor: pointer; }
.lib-bucket-row:hover td { background: #eef6f1 !important; }
.lib-open-row { cursor: pointer; }

/* Wide tables inside cards scroll sideways instead of clipping at the
   card border (.card has overflow:hidden) — AR aging especially: 7 numeric
   nowrap columns in the narrow left column of the Sales grid. */
#salesAging, #salesTaxReport, #salesInvoices, #salesCustomers, #salesProducts,
#custTableBox, #dashCompanies,
#viewInvoices [data-lib="summary"], #viewInvoices [data-lib="list"],
#viewPayroll [data-lib="summary"], #viewPayroll [data-lib="list"],
#libDocsModal .modal__body { overflow-x: auto; }
#salesAging .lib-table { font-size: 12.5px; }
#salesAging .lib-table th, #salesAging .lib-table td { padding: 6px 6px; }

/* User chip (top bar) */
.user-chip { display: flex; align-items: center; gap: 8px; padding-right: 12px; border-right: 1px solid var(--line); }
.user-chip__name { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
