/* === Design tokens ============================================== */
:root {
  --bg: #f7f7f5;
  --bg-elev: #ffffff;
  --ink: #0f1115;
  --ink-soft: #4a5160;
  --ink-mute: #8a8f9a;
  --line: #e6e6e2;
  --line-strong: #d4d4cf;
  --accent: #1d4ed8;
  --accent-soft: #eef2ff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --shadow-sm: 0 1px 2px rgba(15, 17, 21, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 17, 21, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --space: 16px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Apple Color Emoji";
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* === Reset / base =============================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
code { font-family: var(--font-mono); font-size: 0.92em; }

/* === Login page ================================================== */
.page--login {
  max-width: 440px;
  margin-top: 60px;
}
.login__card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-md);
}
.login__head { display: flex; flex-direction: column; gap: 4px; }
.login__title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.login__sub {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.login__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login__submit {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
}
.login__hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-mute);
}
.login__hint a {
  color: var(--ink-soft);
  text-underline-offset: 3px;
}
.login__hint a:hover { color: var(--ink); }

/* OTP code input — large, monospace, center-aligned */
.field__input--code {
  font-size: 26px;
  letter-spacing: 0.35em;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--bg);
  padding: 14px 12px;
  color: var(--ink);
}
.field__input--code::placeholder {
  letter-spacing: 0.25em;
  color: var(--line-strong);
  font-weight: 400;
  font-size: 24px;
}

/* === Form fields ================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}
.field__input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* === Buttons ==================================================== */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.btn--primary {
  background: var(--ink);
  color: white;
}
.btn--primary:hover { background: #1e2128; }
.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn--ghost:hover {
  background: var(--bg-elev);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 6px;
}
.btn--danger-ghost {
  color: var(--danger);
  border-color: transparent;
}
.btn--danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.btn--danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn--danger:hover {
  background: #991b1b;
  color: white;
  border-color: #991b1b;
}
.btn--accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn--accent:hover {
  background: #1e3aa8;
  border-color: #1e3aa8;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-weight: 550;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover { color: #1e3aa8; }

/* === Alert ====================================================== */
.alert {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.alert--error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* === Topbar ===================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__logo { font-size: 22px; }
.topbar__name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.topbar__status {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* === Chip (status pill) ========================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--bg-elev);
}
.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-mute);
}
.chip--ok { color: var(--ok); border-color: #b8e3c5; background: var(--ok-soft); }
.chip--ok .chip__dot { background: var(--ok); }
.chip--warn { color: var(--warn); border-color: #f4d290; background: var(--warn-soft); }
.chip--warn .chip__dot { background: var(--warn); }
.chip--muted { color: var(--ink-mute); }

/* === Page layout ================================================ */
.page {
  max-width: 980px;
  margin: 28px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-head__count {
  font-size: 12px;
  color: var(--ink-mute);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 1px 8px;
  border-radius: 999px;
}

/* === Dropzone =================================================== */
.dropzone {
  position: relative;
  display: block;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 36px 24px;
  text-align: center;
  transition: border-color 120ms, background 120ms;
}
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.dropzone__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
}
.dropzone__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.dropzone__sub {
  font-size: 13px;
  color: var(--ink-soft);
}
.dropzone__progress {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--ink-soft);
  border-radius: inherit;
  pointer-events: none;
}
.htmx-indicator { opacity: 0; transition: opacity 120ms; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

/* Push CTA + spinner. Spinner replaces the button label while in flight. */
.push-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.push-button__spinner {
  font-size: 12px;
  color: var(--ink-mute);
  display: none;
}
.push-button__spinner.htmx-request,
.htmx-request.push-button__spinner {
  display: inline;
}

/* === Push summary (after bulk push) ============================ */
.push-summary {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 13.5px;
  border: 1px solid var(--line);
}
.push-summary--ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #b8e3c5;
}
.push-summary--err {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f5c4c4;
}
.push-summary__errors {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12px;
}

/* === Receipts list ============================================== */
.receipts__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === Card (receipt) ============================================= */
.card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card--extracted { cursor: pointer; }
.card--extracted:hover { border-color: var(--accent); }
.card--extracted[data-edit="true"] { cursor: default; }
.card--extracted[data-edit="true"]:hover { border-color: var(--line); }
.card--failed { border-color: #e9bcbc; background: #fffafa; }
.card--verified {
  border-color: #b8e3c5;
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--ok);
}
.card__side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.card__thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.card__side-delete {
  width: 64px;
  font-size: 11.5px;
  padding: 5px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--ink-mute);
  cursor: pointer;
  font-family: inherit;
}
.card__side-delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-soft);
}
.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card__thumb-icon {
  font-size: 26px;
}
.card__body { min-width: 0; }
.card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.card__vendor {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.card__vendor-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.card__amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  font-feature-settings: "tnum";
}
.card__amount--neg { color: var(--ok); }
.card__currency {
  margin-left: 4px;
  color: var(--ink-mute);
  font-weight: 500;
  font-size: 12px;
}
.card__meta {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
  align-items: center;
}
.meta-dot { color: var(--ink-mute); }
.muted { color: var(--ink-mute); }
.card__notes {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--warn);
  background: var(--warn-soft);
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-block;
}
.card__error {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 6px 8px;
  border-radius: 6px;
}

/* === Status pills inside card =================================== */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status--pending {
  color: var(--ink-soft);
  background: var(--bg);
  border-color: var(--line);
}
.status--pending .status__dot { background: var(--ink-mute); }
.status--extracting {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #c7d2fe;
}
.status--extracting .status__dot {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.status--extracted {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #b8e3c5;
}
.status--extracted .status__dot { background: var(--ok); }
.status--failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f5b8b8;
}
.status--failed .status__dot { background: var(--danger); }
.status--verified {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #98d4ad;
  font-weight: 600;
}
.status--pushed {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.status--pushed .status__check { color: white; }
.status--matched {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #c7d2fe;
  font-weight: 600;
}
.status__check {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* In-app confirmation modal — replaces native window.confirm(). */
.confirm-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 460px;
  width: calc(100% - 32px);
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: 0 32px 64px rgba(15, 17, 21, 0.18);
}
.confirm-modal::backdrop {
  background: rgba(15, 17, 21, 0.45);
  backdrop-filter: blur(2px);
}
.confirm-modal__form {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
}
.confirm-modal__message {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-line;
}
.confirm-modal__actions {
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Tab nav (Active / Submitted) */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.tab__count {
  font-size: 11.5px;
  color: var(--ink-mute);
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 7px;
}
.tab.is-active .tab__count {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Card actions row (Edit / Confirm) */
.card__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Card display/edit mode toggle.
   The summary line shows resolved values; the inline-edit form is hidden
   until the user clicks Edit. JS flips data-edit on the .card. */
.card__summary {
  margin-top: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.card__summary-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30ch;
}
.card__summary-sep {
  color: var(--ink-mute);
}
.card__edit-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  margin-left: auto;
}
.card__edit-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.card__edit-done {
  margin-left: auto;
}
.card[data-edit="true"] .card__summary { display: none; }
.card__edit { display: none; }
.card[data-edit="true"] .card__edit { display: block; }

/* Inline edit row on each extracted card. Compact, light styling so a
   stack of cards still scans easily. */
.inline-edit {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.inline-edit__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.inline-edit__field--grow {
  flex: 1 1 140px;
}
.inline-edit__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  font-weight: 600;
}
.inline-edit__input {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
  font-size: 13px;
  color: inherit;
  min-width: 0;
  width: 100%;
}
.inline-edit__input:focus {
  outline: none;
  border-color: var(--accent);
}
.inline-edit__input--num { width: 90px; }
.inline-edit__input--curr { width: 56px; text-transform: uppercase; }
.inline-edit__input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}

.badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.badge--refund { background: var(--ok-soft); color: var(--ok); }

/* === Empty state ================================================ */
.empty {
  text-align: center;
  padding: 36px 16px;
  background: var(--bg-elev);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
.empty__icon { font-size: 28px; margin-bottom: 6px; }
.empty__title { font-weight: 600; color: var(--ink); }
.empty__sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* === Section head action button ================================ */
.section-head__action {
  margin-left: auto;
}

/* === Drawer (review panel) ====================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 50;
  animation: drawer-fade-in 140ms ease-out;
}
@keyframes drawer-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(1100px, 92vw);
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 60px rgba(15, 17, 21, 0.18);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  animation: drawer-slide-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
@media (max-width: 640px) {
  .drawer { width: 100vw; border-right: 0; }
}
@keyframes drawer-slide-in {
  from { transform: translateX(-30px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.drawer__head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.drawer__head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.drawer__head-right {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}
.drawer__close {
  appearance: none;
  background: transparent;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
}
.drawer__close:hover {
  background: var(--bg);
  color: var(--ink);
}
.drawer__head-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drawer__title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.drawer__counter {
  font-size: 12px;
  color: var(--ink-mute);
}
.drawer__nav {
  display: flex;
  gap: 6px;
  /* Sits in the center column of the header grid; no margin needed. */
}
.drawer__nav-btn {
  appearance: none;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.drawer__nav-btn:hover:not(:disabled) {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line-strong);
}
.drawer__nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.drawer__open-orig {
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.drawer__open-orig:hover {
  background: var(--accent-soft);
  border-color: #c7d2fe;
}

.drawer__body {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(360px, 1fr);
  overflow: hidden;
  min-height: 0;
}
@media (max-width: 900px) {
  .drawer__body { grid-template-columns: 1fr; grid-template-rows: 320px 1fr; }
}

.drawer__preview {
  background: #f1f1ec;
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
  min-height: 0;
}
@media (max-width: 900px) {
  .drawer__preview { border-right: 0; border-bottom: 1px solid var(--line); }
}
.drawer__preview-link {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(15, 17, 21, 0.10);
  background: white;
}
.drawer__preview-link img {
  display: block;
  width: 100%;
  height: auto;
}

.drawer__form {
  padding: 20px 24px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.drawer__section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer__section-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field--narrow { max-width: 130px; }
.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
}
.field--inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.field__hint {
  font-weight: 400;
  color: var(--ink-mute);
  font-size: 12px;
}

.line-items {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.line-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.line-item:first-child { border-top: 0; }
.line-item__desc {
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-item__meta {
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.line-item__amount {
  color: var(--ink);
  font-weight: 500;
  margin-left: 8px;
}

.drawer__notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  border: 1px solid #f4d290;
}
.drawer__notes--error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f5c4c4;
}
.drawer__notes--ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #b8e3c5;
}
.drawer__notes-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}
.drawer__foot-meta {
  font-size: 12.5px;
  color: var(--ink-mute);
  align-self: center;
  padding-right: 4px;
}

.drawer__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-mute);
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.drawer__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}
.drawer__foot-right {
  display: flex;
  gap: 8px;
}

/* === Settings / Xero status page ================================ */
.page--narrow {
  max-width: 720px;
}
.topbar__back {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 18px;
  margin-right: 4px;
  padding: 4px 8px;
  border-radius: 6px;
}
.topbar__back:hover {
  background: var(--bg);
  color: var(--ink);
}
.settings__title {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.settings__card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings__card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.settings__subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.settings__card-body {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.settings__meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-mute);
}
.settings__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.settings__divider {
  height: 1px;
  background: var(--line);
  margin: 4px -22px;
}
.settings__code {
  display: inline-block;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  user-select: all;
  word-break: break-all;
}
.settings__code-inline {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  user-select: all;
}
.settings__row--actions {
  justify-content: flex-end;
  gap: 8px;
}
.settings__card--quiet {
  background: transparent;
  border: 1px dashed var(--line);
  box-shadow: none;
}
.drawer__section--tenant {
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 4px;
}

/* === Match banner (auto-match suggestion) ===================== */
.match-banner {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.match-banner--high {
  background: var(--accent-soft);
  border-color: #c7d2fe;
}
.match-banner--maybe {
  background: var(--warn-soft);
  border-color: #f4d290;
}
.match-banner--info {
  background: #f4f6fb;
  border-color: #d1d9e8;
}
.match-banner--info .match-banner__title { color: var(--ink); }
.match-banner__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.match-banner__hint + .match-banner__hint {
  margin-top: 6px;
}
.match-banner__hint code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-elev);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.match-banner__hint strong {
  color: var(--ink);
  font-weight: 600;
}
.match-banner__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.match-banner__title {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
}
.match-banner--high .match-banner__title { color: var(--accent); }
.match-banner--maybe .match-banner__title { color: var(--warn); }
.match-banner__conf {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
}
.match-banner__line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--ink);
}
.match-banner__amount {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.match-banner__sep {
  color: var(--ink-mute);
}
.match-banner__bank {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.match-banner__reconciled {
  margin-left: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ok);
  background: var(--ok-soft);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #b8e3c5;
}
.match-banner__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* === Combobox (typeahead) ======================================= */
.combobox {
  position: relative;
}
.combobox__input {
  width: 100%;
}
/* Inline-edit variant: field is narrow, but labels like "5200 — General
   Expenses" need room to be legible. Let the dropdown overflow the field. */
.combobox--inline .combobox__list {
  min-width: 320px;
  right: auto;
}
.combobox__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(15, 17, 21, 0.12);
  max-height: 280px;
  overflow-y: auto;
}
.combobox__option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.combobox__option:hover,
.combobox__option.is-highlighted {
  background: var(--accent-soft);
  color: var(--accent);
}
.combobox__option[hidden] {
  display: none;
}
.combobox__option-label {
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combobox__option:hover .combobox__option-label,
.combobox__option.is-highlighted .combobox__option-label {
  color: var(--accent);
}
.combobox__option-meta {
  color: var(--ink-mute);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* === Account list (settings page) =============================== */
.account-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}
.account-row:first-child { border-top: 0; }
.account-row.is-hidden {
  opacity: 0.55;
  background: var(--bg);
}
.account-row__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-row__label {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-row__meta {
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.settings__checklist {
  list-style: none;
  margin: 4px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings__checklist li {
  display: grid;
  grid-template-columns: 18px auto 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 13px;
}
.settings__checklist li.is-ok {
  border-color: #b8e3c5;
  background: var(--ok-soft);
}
.settings__checklist li.is-missing {
  border-color: #f5c4c4;
  background: var(--danger-soft);
}
.settings__check {
  font-weight: 700;
  text-align: center;
}
.is-ok .settings__check { color: var(--ok); }
.is-missing .settings__check { color: var(--danger); }
.settings__check-state {
  color: var(--ink-soft);
  font-size: 12.5px;
}

/* Linkable chip variant — for the Xero chip in the topbar. */
.chip--link {
  text-decoration: none;
  cursor: pointer;
}
.chip--link:hover {
  filter: brightness(0.97);
}

/* ── Upload notices (duplicate / error banners) ──────────────────
   Lives outside #receipts-list so polling swaps don't clear it.
   Auto-dismisses after ~8 s via CSS animation. */
@keyframes notice-dismiss {
  0%, 75% { opacity: 1; max-height: 80px; margin-bottom: 8px; }
  100%     { opacity: 0; max-height: 0;   margin-bottom: 0; padding: 0; }
}
.upload-notice {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  animation: notice-dismiss 8s ease forwards;
  overflow: hidden;
}
.upload-notice--dup {
  background: #fef9ec;
  border: 1px solid #f6d860;
  color: #7a5c00;
}
.upload-notice--dup a {
  color: inherit;
  font-weight: 600;
}

/* === Split panel ================================================ */
.badge--split { background: var(--warn-soft); color: var(--warn); }

.field--grow { flex: 1 1 auto; min-width: 0; }

.split-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.split-row:last-child { border-bottom: none; }
.split-row .field { margin: 0; }

.split-row__remove {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
  padding: 8px 6px;
  cursor: pointer;
  border-radius: 4px;
}
.split-row__remove:hover { background: var(--warn-soft); color: var(--warn); }

.split-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.split-total { font-size: 13px; color: var(--ink-soft); }
.split-total--warn { color: var(--warn); }
