/* ============================================================
   Aurum Curo — Internal Accounting Tool
   System font, dense tables, sticky nav, monospaced numbers
   ============================================================ */

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-ui:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
  --font-mono:   "Consolas", "Menlo", "Courier New", monospace;

  --clr-bg:        #f5f5f4;
  --clr-surface:   #ffffff;
  --clr-border:    #d1d5db;
  --clr-border-lt: #e5e7eb;

  --clr-nav-bg:    #1e293b;
  --clr-nav-text:  #e2e8f0;
  --clr-nav-link:  #94a3b8;
  --clr-nav-hover: #f1f5f9;
  --clr-nav-active:#38bdf8;

  --clr-text:      #111827;
  --clr-text-muted:#6b7280;
  --clr-negative:  #b91c1c;   /* red for negative amounts */
  --clr-warning:   #92400e;   /* amber text */
  --clr-warning-bg:#fef3c7;   /* amber bg for OOB notice */
  --clr-warning-border: #f59e0b;

  --clr-section-header-bg: #f1f5f9;
  --clr-section-total-bg:  #e8edf2;
  --clr-summary-row-bg:    #dbeafe;  /* light blue highlight for GP / Net Inc */
  --clr-row-odd:   #ffffff;
  --clr-row-even:  #f9fafb;
  --clr-row-totals:#eff6ff;

  --clr-btn:       #1d4ed8;
  --clr-btn-hover: #1e40af;

  --nav-height: 48px;
  --page-pad:   1.25rem;
  --table-font: 0.8125rem;   /* 13px — dense but readable */
}

html { font-size: 14px; }

body {
  font-family: var(--font-ui);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.4;
}

/* ── Top Nav (two rows: pages, then working context) ─────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.top-nav {
  height: var(--nav-height);
  background: var(--clr-nav-bg);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 var(--page-pad);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav-session { margin-left: auto; display: flex; gap: .25rem; align-items: center; }
.context-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: .35rem var(--page-pad);
  background: #24334a;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.ctx-field {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: #94a3b8;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ctx-field a { color: #7dd3fc; }
.context-bar select {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: .25rem .5rem;
  font-size: .8125rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  min-width: 200px;
  max-width: 380px;
}
.context-bar select:focus { outline: 2px solid var(--clr-nav-active); }
.ctx-firm { margin-left: auto; }
.ctx-firm select { min-width: 170px; }

.nav-brand {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: .02em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: .25rem;
}

.nav-link {
  color: var(--clr-nav-link);
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 500;
  padding: .25rem .65rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--clr-nav-hover); background: rgba(255,255,255,.07); }
.nav-link.active { color: var(--clr-nav-active); background: rgba(56,189,248,.1); }

.nav-entity {
  margin-left: auto;
}
.nav-entity select {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: .25rem .5rem;
  font-size: .8125rem;
  cursor: pointer;
  min-width: 240px;
  max-width: 380px;
}
.nav-entity select:focus { outline: 2px solid var(--clr-nav-active); }

/* ── Page Content ──────────────────────────────────────────── */
.page-content {
  padding: var(--page-pad);
  max-width: 1600px;
}

.page-header { margin-bottom: 1rem; }
.page-header h1 { font-size: 1.2rem; font-weight: 700; margin-bottom: .3rem; }

.summary-line {
  font-size: .875rem;
  color: var(--clr-text-muted);
}

.filter-active {
  font-size: .8125rem;
  color: var(--clr-text-muted);
  margin-top: .35rem;
}
.clear-filter {
  margin-left: .4rem;
  color: var(--clr-btn);
  text-decoration: none;
  font-weight: 600;
}
.clear-filter:hover { text-decoration: underline; }

/* ── Tables ────────────────────────────────────────────────── */
.table-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  /* allow horizontal scroll on narrow viewports */
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--table-font);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  overflow: hidden;
}

.data-table thead {
  /* Non-sticky: a sticky header inside .table-scroll-wrapper (overflow-x:auto)
     pins to the wrapper, not the viewport, and floats over the rows. */
  background: var(--clr-nav-bg);
  color: #e2e8f0;
}

.data-table thead th {
  padding: .45rem .6rem;
  font-weight: 600;
  text-align: left;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--clr-border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: .35rem .6rem;
  vertical-align: top;
  border-bottom: 1px solid var(--clr-border-lt);
}

/* zebra */
.data-table .row-odd  td { background: var(--clr-row-odd); }
.data-table .row-even td { background: var(--clr-row-even); }

.data-table tr:last-child td { border-bottom: none; }

/* number cells */
.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }

/* negative amounts */
.amount-negative { color: var(--clr-negative); }

/* ── Queue Table Columns ───────────────────────────────────── */
.queue-table .col-merchant    { min-width: 160px; max-width: 220px; }
.queue-table .col-cardholder  { min-width: 80px; white-space: nowrap; }
.queue-table .col-source      { min-width: 80px; white-space: nowrap; }
.queue-table .col-n           { width: 40px; text-align: right; }
.queue-table .col-amount      { width: 110px; }
.queue-table .col-conf        { width: 60px; }
.queue-table .col-reason      { min-width: 140px; max-width: 200px; font-size: .75rem; color: var(--clr-text-muted); }
.queue-table .col-decision    { min-width: 340px; }

.merchant-name { font-weight: 600; }
.sample-memo {
  color: var(--clr-text-muted);
  font-size: .72rem;
  font-style: italic;
  display: block;
  margin-top: .1rem;
}

/* totals row */
.data-table .row-totals td {
  background: var(--clr-row-totals);
  border-top: 2px solid var(--clr-border);
  font-size: .8125rem;
}

/* ── Decision Form ─────────────────────────────────────────── */
.decision-form {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.form-select,
.form-input {
  font-size: .78rem;
  font-family: var(--font-ui);
  padding: .22rem .4rem;
  border: 1px solid var(--clr-border);
  border-radius: 3px;
  background: #fff;
  color: var(--clr-text);
  width: 100%;
}
.form-select:focus,
.form-input:focus {
  outline: 2px solid #93c5fd;
  border-color: #60a5fa;
}

/* ── Searchable account picker (combobox) ───────────────────────────────────
   A text input (.account-combo-input) + a single shared, substring-filtered
   popup (#account-combo-pop, appended to <body> by queue.js) replaces the
   native account <select> so typing any part of a name matches it. The chosen
   id lives in a sibling hidden .account-combo-value. */
.account-combo { position: relative; display: inline-flex; min-width: 100px; }
.account-combo .account-combo-input { cursor: text; }
.decision-form .account-combo { flex: 1 1 120px; }
.decision-form .account-combo .account-combo-input { width: 100%; }
.post-shown-group .account-combo { min-width: 9rem; max-width: 16rem; }
.post-shown-group .account-combo .account-combo-input { width: 100%; }

#account-combo-pop {
  position: absolute;
  z-index: 1000;
  margin: 0;
  padding: .2rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: 5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
  max-height: 16rem;
  overflow-y: auto;
  font-size: .78rem;
  font-family: var(--font-ui);
}
#account-combo-pop[hidden] { display: none; }
#account-combo-pop li {
  padding: .25rem .6rem;
  cursor: pointer;
  white-space: nowrap;
  color: var(--clr-text);
}
#account-combo-pop li.active,
#account-combo-pop li:hover { background: #eff6ff; }
#account-combo-pop li .match { background: #fde68a; border-radius: 2px; }
#account-combo-pop .combo-empty,
#account-combo-pop .combo-more {
  padding: .25rem .6rem;
  color: var(--clr-text-muted);
  font-style: italic;
  cursor: default;
}

.rule-label {
  font-size: .75rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  color: var(--clr-text-muted);
  cursor: pointer;
}

.btn-save {
  align-self: flex-start;
  padding: .25rem .8rem;
  background: var(--clr-btn);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-save:hover { background: var(--clr-btn-hover); }
.btn-save:active { transform: scale(.97); }

/* htmx loading indicator — dim the tbody while swapping */
.htmx-request #queue-body { opacity: .55; transition: opacity .2s; }

/* ── Report Tables (P&L, Balance Sheet) ────────────────────── */
.report-wrapper {
  max-width: 1000px;
}

.report-table {
  border-radius: 4px;
}

.report-table col.col-report-label  { width: auto; }
.report-table col.col-report-amount { width: 150px; }

.report-table .section-header td {
  background: var(--clr-section-header-bg);
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #374151;
  padding: .5rem .7rem .35rem;
  border-top: 1px solid var(--clr-border);
}

.report-table .account-row td { padding: .3rem .7rem; }
.report-table .account-row td.indent { padding-left: 1.75rem; }

.report-table .section-total td {
  background: var(--clr-section-total-bg);
  border-top: 1px solid var(--clr-border);
  border-bottom: 1px solid var(--clr-border);
  padding: .35rem .7rem;
}

.report-table .summary-line-row td {
  background: var(--clr-summary-row-bg);
  border-top: 2px solid #93c5fd;
  border-bottom: 2px solid #93c5fd;
  padding: .4rem .7rem;
  font-size: .875rem;
}

.report-table .net-income-row td {
  background: #1e3a5f;
  color: #f1f5f9;
  border-top: 2px solid #1d4ed8;
  padding: .45rem .7rem;
  font-size: .9rem;
}
.report-table .net-income-row .amount-negative { color: #fca5a5; }

.report-table .spacer-row td { height: .6rem; background: var(--clr-bg); border: none; }

/* bold helper used by the macro */
.bold { font-weight: 700; }

/* ── Out-of-Balance Notice ──────────────────────────────────── */
.out-of-balance-notice {
  background: var(--clr-warning-bg);
  border: 1px solid var(--clr-warning-border);
  border-left: 4px solid var(--clr-warning-border);
  border-radius: 4px;
  color: var(--clr-warning);
  padding: .65rem 1rem;
  margin-bottom: 1rem;
  font-size: .875rem;
  max-width: 640px;
}

/* ── Utility ────────────────────────────────────────────────── */
a { color: var(--clr-btn); }
a:hover { text-decoration: underline; }

/* ── Sortable column-header links ──────────────────────────── */
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { text-decoration: underline; }

/* ── Account drill-down table ──────────────────────────────── */
.account-table .col-date       { width: 92px; white-space: nowrap; font-family: var(--font-mono); }
.account-table .col-desc       { min-width: 360px; }   /* full bank detail; wraps */
.account-table .col-source     { width: 130px; white-space: nowrap; }
.account-table .col-cardholder { width: 120px; white-space: nowrap; }
.account-table .col-amount     { width: 120px; }
.account-table .col-status     { width: 72px; white-space: nowrap; }
.account-table .col-actions    { width: 84px; white-space: nowrap; }

.flag-review {
  display: inline-block;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--clr-warning); background: var(--clr-warning-bg);
  border: 1px solid var(--clr-warning-border); border-radius: 3px; padding: 0 .35rem;
}
.flag-ok { color: #16a34a; }

/* queue latest-date column */
.queue-table .col-date { width: 92px; white-space: nowrap; font-family: var(--font-mono); }

/* ── Journal Entry form ────────────────────────────────────── */
.je-form { max-width: 900px; }
.je-header-fields { display: flex; gap: 1.25rem; margin-bottom: .9rem; flex-wrap: wrap; }
.je-header-fields label { font-size: .8125rem; font-weight: 600; display: flex; flex-direction: column; gap: .2rem; }
.je-header-fields input { font-size: .85rem; padding: .3rem .45rem; border: 1px solid var(--clr-border); border-radius: 3px; }
.je-desc-field { flex: 1; min-width: 280px; }
.je-table { margin-bottom: .9rem; }
.je-table .col-je-account { width: 32%; }
.je-table .col-je-debit   { width: 15%; }
.je-table .col-je-credit  { width: 15%; }
.je-table .col-je-memo    { width: 38%; }
.je-balanced   { font-size: .78rem; font-weight: 700; color: #166534; }
.je-unbalanced { font-size: .78rem; font-weight: 700; color: var(--clr-negative); }
.btn-save:disabled { opacity: .5; cursor: not-allowed; }
.je-amount { width: 100%; text-align: right; font-family: var(--font-mono); padding: .25rem .4rem; border: 1px solid var(--clr-border); border-radius: 3px; }
.je-memo   { width: 100%; padding: .25rem .4rem; border: 1px solid var(--clr-border); border-radius: 3px; }
.je-success { color: #166534; background: #dcfce7; border: 1px solid #86efac; border-radius: 4px; padding: .5rem .8rem; margin: .4rem 0; font-size: .85rem; max-width: 640px; }
.je-error   { color: var(--clr-negative); background: #fee2e2; border: 1px solid #fca5a5; border-radius: 4px; padding: .5rem .8rem; margin: .4rem 0; font-size: .85rem; max-width: 640px; }

.btn-add {
  margin: 0 .5rem .9rem 0; padding: .25rem .7rem;
  background: #fff; color: var(--clr-btn); border: 1px solid var(--clr-btn);
  border-radius: 3px; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.btn-add:hover { background: #eff6ff; }

/* Report + JE tables are short statements/forms — header must NOT be sticky
   (sticky thead overlapped the form rows). Queue keeps its sticky header. */
.report-table thead,
.je-table thead { position: static; top: auto; }

/* ── Chart-of-accounts management ──────────────────────────── */
.acct-add-form { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.acct-add-form input[type=text], .acct-add-form select {
  font-size: .82rem; padding: .3rem .45rem; border: 1px solid var(--clr-border); border-radius: 3px;
}
.acct-add-form input[name=name] { min-width: 220px; }
.inline-form { display: flex; gap: .35rem; align-items: center; margin: 0; }
.acct-name-input { font-size: .82rem; padding: .2rem .4rem; border: 1px solid var(--clr-border-lt); border-radius: 3px; min-width: 230px; }
.acct-type-input { font-size: .82rem; padding: .2rem .4rem; border: 1px solid var(--clr-border-lt); border-radius: 3px; background: #fff; }
.acct-tax-input { font-size: .82rem; padding: .2rem .4rem; border: 1px solid var(--clr-border-lt); border-radius: 3px; min-width: 160px; }
.acct-actions-cell { display: flex; gap: .35rem; align-items: center; }
.btn-mini { font-size: .72rem; padding: .18rem .5rem; border: 1px solid var(--clr-border); background: #fff; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.btn-mini:hover { background: #f1f5f9; }
.btn-danger { color: var(--clr-negative); border-color: #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.in-use { font-size: .72rem; color: var(--clr-text-muted); font-style: italic; }

/* ── Import / ingestion ────────────────────────────────────── */
.import-form { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.import-form label { font-size: .8125rem; font-weight: 600; display: flex; flex-direction: column; gap: .25rem; }
.import-form select, .import-form input[type=file] { font-size: .82rem; padding: .3rem .45rem; border: 1px solid var(--clr-border); border-radius: 3px; }
.import-hint { font-size: .75rem; color: var(--clr-text-muted); }
.import-subhead { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .5rem; }
.import-source { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-preview-box { border: 1px solid var(--clr-border); border-radius: 6px; padding: .9rem; margin: 1rem 0; background: var(--clr-surface); }
.import-preview-rows { max-height: 360px; overflow-y: auto; margin: .6rem 0; }
.import-confirm { display: flex; gap: .75rem; align-items: center; margin-top: .6rem; }

/* ── Chat agent panel ──────────────────────────────────────── */
.chat-panel { margin-top: 1.5rem; max-width: 900px; border: 1px solid var(--clr-border); border-radius: 6px; padding: .9rem; background: var(--clr-surface); }
.chat-provider { font-size: .7rem; font-weight: 500; color: var(--clr-text-muted); }
.chat-log { display: flex; flex-direction: column; gap: .5rem; max-height: 420px; overflow-y: auto; margin-bottom: .6rem; }
.chat-msg { padding: .4rem .65rem; border-radius: 8px; font-size: .85rem; max-width: 85%; white-space: pre-wrap; }
.chat-user { align-self: flex-end; background: #dbeafe; }
.chat-assistant { align-self: flex-start; background: #f1f5f9; }
.chat-proposal { align-self: stretch; border: 1px solid var(--clr-warning-border); background: var(--clr-warning-bg); border-radius: 6px; padding: .5rem .65rem; }
.cp-head { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--clr-warning); }
.cp-body { font-size: .85rem; margin: .25rem 0 .4rem; }
.cp-actions { display: flex; gap: .5rem; align-items: center; }
.cp-lines { margin: .35rem 0 .1rem; }
.cp-lines > summary { cursor: pointer; font-size: .78rem; font-weight: 600; color: var(--clr-warning); }
.cp-lines-table { width: 100%; border-collapse: collapse; margin-top: .35rem; font-size: .78rem; }
.cp-lines-table td { padding: .12rem .4rem; border-top: 1px solid var(--clr-warning-border); vertical-align: top; }
.cp-l-date { white-space: nowrap; color: var(--clr-text-muted); width: 6rem; }
.cp-l-amt { white-space: nowrap; text-align: right; width: 7rem; }
.cp-l-src { color: var(--clr-text-muted); }
.cp-lines-more { font-size: .72rem; color: var(--clr-text-muted); margin: .3rem 0 0; font-style: italic; }
.chat-form { display: flex; gap: .5rem; align-items: center; }
.chat-form input[type=text] { flex: 1; font-size: .85rem; padding: .4rem .55rem; border: 1px solid var(--clr-border); border-radius: 4px; }
.chat-spin { font-size: .78rem; color: var(--clr-text-muted); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* ── Queue triage suggestions + opt-out ────────────────────── */
.queue-actions { margin: .5rem 0 .75rem; }
.actions-hint { font-size: .73rem; color: var(--clr-text-muted); margin-top: .4rem; }
.triage-status:not(:empty) { margin-top: .5rem; }
.triage-running { display: inline-block; font-size: .8rem; color: #1e40af; background: #dbeafe;
  border: 1px solid #93c5fd; border-radius: 4px; padding: .35rem .6rem; }
.conf-none { color: var(--clr-text-muted); }
.cp-suggest { font-size: .73rem; color: #166534; background: #dcfce7; border: 1px solid #86efac; border-radius: 4px; padding: .2rem .45rem; margin-bottom: .3rem; }
.cp-clientnote { font-size: .73rem; color: #1e40af; background: #dbeafe; border: 1px solid #93c5fd; border-radius: 4px; padding: .2rem .45rem; margin-bottom: .3rem; }
.cp-optout { font-size: .72rem; margin: .1rem 0; }
.cp-optout summary { cursor: pointer; color: var(--clr-text-muted); }
.cp-line { display: block; font-size: .72rem; padding: .12rem 0; color: var(--clr-text-muted); }

/* ── Report actions (Print / Export) ───────────────────────── */
.report-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.report-actions .btn-mini, .report-actions a.btn-mini { text-decoration: none; color: var(--clr-btn); }

/* ── Queue progress + keyboard hint ────────────────────────── */
.progress-line { font-size: .8125rem; color: var(--clr-text-muted); margin-top: .2rem; }
.progress-line strong { color: var(--clr-text); }
.kbd-hint { margin-left: .5rem; font-size: .75rem; cursor: pointer; }
.kbd-hint:hover { text-decoration: underline; }
kbd {
  font-family: var(--font-mono); font-size: .72rem;
  background: #f1f5f9; border: 1px solid var(--clr-border);
  border-bottom-width: 2px; border-radius: 3px; padding: .02rem .3rem; color: #334155;
}

/* ── Facet bar ──────────────────────────────────────────────── */
.facet-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem;
  margin: .25rem 0 .75rem; padding: .5rem .65rem;
  background: var(--clr-surface); border: 1px solid var(--clr-border-lt); border-radius: 6px;
}
.facet-group { display: inline-flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.facet-label { font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--clr-text-muted); margin-right: .15rem; }
.chip {
  font-size: .73rem; padding: .12rem .55rem; border-radius: 999px; cursor: pointer;
  background: #fff; color: #334155; border: 1px solid var(--clr-border);
}
.chip:hover { background: #f1f5f9; }
.chip.active { background: var(--clr-btn); color: #fff; border-color: var(--clr-btn); }
.facet-toggles .chip.active { background: #166534; border-color: #166534; }
.facet-count { font-size: .73rem; color: var(--clr-text-muted); margin-left: auto; font-style: italic; }
.facet-search {
  font-size: .78rem; padding: .18rem .5rem; min-width: 16rem;
  border: 1px solid var(--clr-border); border-radius: 999px; background: #fff; color: #334155;
}
.facet-search:focus { outline: none; border-color: var(--clr-btn); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.facet-search-wide { min-width: 22rem; }
.view-link {
  font-size: .73rem; padding: .12rem .55rem; border-radius: 999px; cursor: pointer;
  background: #fff; color: #334155; border: 1px solid var(--clr-border); text-decoration: none;
}
.view-link:hover { background: #f1f5f9; }
.view-link.active { background: var(--clr-btn); color: #fff; border-color: var(--clr-btn); }
#accept-shown:disabled { opacity: .5; cursor: default; }

/* ── Keyboard-active row + cleared stubs ───────────────────── */
.queue-row.kbd-active > td { box-shadow: inset 3px 0 0 0 var(--clr-nav-active); }
.queue-row.kbd-active > td:first-child { background: #eef6ff; }

.row-cleared td { background: #ecfdf5 !important; color: #166534;
  border-bottom: 1px solid var(--clr-border-lt); transition: opacity .35s, background .35s; }
.row-cleared.fading td { opacity: 0; }
.cleared-msg { font-size: .8rem; }
.btn-undo {
  padding: .18rem .6rem; font-size: .73rem; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--clr-btn); border: 1px solid var(--clr-btn); border-radius: 3px;
}
.btn-undo:hover { background: #eff6ff; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 2rem 1rem; font-size: 1rem; color: #166534; }

/* ── Client / suggestion badges + split mini-form ──────────── */
.badge-client {
  display: inline-block; font-size: .66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: #1e40af; background: #dbeafe; border: 1px solid #93c5fd;
  border-radius: 3px; padding: 0 .3rem; margin-left: .3rem; vertical-align: middle;
}
.sugg-conf { font-weight: 700; border-radius: 3px; padding: 0 .3rem; font-size: .66rem; }
.sugg-high { background: #16a34a; color: #fff; }
.sugg-medium { background: #ca8a04; color: #fff; }
.sugg-low { background: #9ca3af; color: #fff; }

.split-fields { display: flex; flex-direction: column; gap: .15rem;
  padding: .3rem .4rem; background: #fffbeb; border: 1px solid #fde68a; border-radius: 4px; }
.split-label { font-size: .73rem; display: flex; align-items: center; gap: .3rem; }
.split-input { width: 7rem !important; }
.split-note { font-size: .68rem; color: var(--clr-text-muted); }

/* ── Keyboard-shortcut cheatsheet ──────────────────────────── */
.kbd-help {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 200;
  background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: .8rem 1rem; max-width: 320px;
}
.kbd-help h3 { font-size: .85rem; margin-bottom: .5rem; }
.kbd-help ul { list-style: none; display: flex; flex-direction: column; gap: .3rem; }
.kbd-help li { font-size: .8rem; color: var(--clr-text); }

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .app-header, .top-nav, .no-print, .report-actions { display: none !important; }
  body { background: #fff; }
  .page-content { padding: 0; max-width: none; }
  .report-wrapper { max-width: none; }
  a { color: #000 !important; text-decoration: none; }
  /* keep statement rows legible on a B/W printer */
  .data-table thead th,
  .report-table .section-header td,
  .report-table .section-total td,
  .report-table .summary-line-row td,
  .report-table .net-income-row td {
    background: #f0f0f0 !important; color: #000 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .data-table { border: 1px solid #999; }
}

/* ── Queue redesign: grouped action sections + compact rows ───── */
.queue-actions { display: flex; flex-direction: column; gap: .4rem; margin: .5rem 0 .6rem; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.action-row.bulk-row { padding-top: .4rem; border-top: 1px dashed var(--clr-border); }
.action-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--clr-text-muted); font-weight: 700; min-width: 8.5rem; }
.post-shown-group { display: inline-flex; gap: .3rem; align-items: center; }
.post-shown-group .form-select { width: auto; min-width: 9rem; max-width: 16rem; }

/* Compact rows: lay the decision controls out horizontally so each row is short
   (the column layout otherwise stacks ~7 controls and wastes the left columns). */
.queue-table tbody td { padding: .2rem .45rem; vertical-align: top; }
.queue-table .col-merchant   { min-width: 145px; max-width: 185px; }
.queue-table .col-cardholder { width: 78px; }
.queue-table .col-source     { width: 84px; }
.queue-table .col-reason     { max-width: 140px; }
.queue-table .col-decision   { width: 600px; max-width: 600px; }
.queue-table .merchant-name  { font-size: .8rem; }
.queue-table .sample-memo    { font-size: .68rem; margin-top: 0; }

.decision-form { flex-direction: row; flex-wrap: wrap; gap: .25rem .4rem; align-items: center; max-width: 600px; }
.decision-form .form-select { width: auto; flex: 1 1 120px; min-width: 100px; }
.decision-form .js-note     { flex: 1 1 120px; }
.decision-form .btn-save    { align-self: center; padding: .22rem .7rem; }
.decision-form .rule-label  { flex: 0 0 auto; }
.decision-form .cp-suggest,
.decision-form .cp-clientnote,
.decision-form .split-fields,
.decision-form .cp-optout   { flex-basis: 100%; margin: 0; }
/* Split note only when Split is chosen (the [hidden] attr was overridden by display:flex). */
.split-fields[hidden] { display: none; }
/* Clamp the AI suggestion to one line (account + confidence stay visible; full text on hover). */
.decision-form .cp-suggest { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* -- 1099 module ---------------------------------------------------------- */
.ten99-payer { margin: 0 0 1.2rem; border: 1px solid var(--clr-border); border-radius: 6px; padding: .5rem .8rem; background: #fff; max-width: 980px; }
.ten99-payer summary { cursor: pointer; font-size: .9rem; }
.je-form fieldset { border: 1px solid var(--clr-border); border-radius: 6px; margin: 0 0 .9rem; padding: .6rem .9rem; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; }
.je-form fieldset legend { font-size: .8rem; font-weight: 600; padding: 0 .3rem; }
.je-form fieldset label { display: flex; flex-direction: column; font-size: .78rem; gap: .15rem; }
.je-form fieldset input[type=text], .je-form fieldset input[type=date],
.je-form fieldset input[type=number], .je-form fieldset select, .je-form fieldset textarea {
  font-size: .85rem; padding: .25rem .4rem; border: 1px solid var(--clr-border); border-radius: 3px; }
.je-form fieldset textarea { min-width: 420px; }
