/* =========================================================================
   IFMS — Inward Fund Management System
   Design language: Paybase-inspired (purple/lavender), 8-point grid,
   clean modern flat with soft shadows and large rounded cards.

   Palette:
     primary        #6C63FF   (action purple)
     primary-d      #4d44d6
     primary-l      #e7e4ff
     bg             #f5f4fc   (page background, lavender wash)
     surface        #ffffff
     ink            #1b1b2f   (primary text)
     muted          #6b7393
     line           #e8e7f3   (borders)
     success        #2ec39c
     danger         #ef4d5e
     warning        #f5a623
   ========================================================================= */

:root {
  --primary: #6C63FF;
  --primary-d: #4d44d6;
  --primary-l: #e7e4ff;
  --primary-soft: #f0eefe;
  --bg: #f5f4fc;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --ink: #1b1b2f;
  --ink-soft: #303049;
  --muted: #6b7393;
  --line: #e8e7f3;
  --line-strong: #d6d3eb;
  --success: #2ec39c;
  --success-l: #d8f4ea;
  --danger: #ef4d5e;
  --danger-l: #fde0e3;
  --warning: #f5a623;
  --warning-l: #ffeacb;
  --shadow-sm: 0 1px 3px rgba(28,18,80,.06), 0 1px 2px rgba(28,18,80,.04);
  --shadow-md: 0 6px 24px rgba(28,18,80,.08), 0 2px 6px rgba(28,18,80,.04);
  --shadow-lg: 0 16px 48px rgba(28,18,80,.12), 0 4px 12px rgba(28,18,80,.06);
  --radius: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-d); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================================================================
   App shell
   ========================================================================= */
#app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
#sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8f7ff 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
  text-decoration: none; color: inherit;
}
.brand:hover { text-decoration: none; }
.brand-logo svg { width: 44px; height: 44px; display: block; }
.brand-title { font-size: 20px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; }

.sidebar-footer {
  margin-top: auto;
  font-size: 11px; color: var(--muted); text-align: center;
  padding-top: 16px; border-top: 1px solid var(--line);
}

/* Company switcher */
.company-switcher { margin-bottom: 18px; }
.company-switcher.hidden { display: none; }
.company-switcher-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  text-align: left; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); transition: all .15s;
}
.company-switcher-btn:hover {
  border-color: var(--primary); box-shadow: var(--shadow-sm);
}
.cs-logo {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 8px;
  /* 'contain' so the entire logo image is visible without cropping */
  background: var(--primary-l) center center / contain no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--primary-d); font-size: 13px;
}
.cs-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chev { color: var(--muted); font-size: 11px; }

.company-switcher-menu {
  margin-top: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 6px; max-height: 320px; overflow: auto;
}
.company-switcher-menu.hidden { display: none; }
.company-switcher-menu .cs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; cursor: pointer;
  font-size: 13px;
}
.company-switcher-menu .cs-item:hover { background: var(--primary-soft); }
.company-switcher-menu .cs-item.active { background: var(--primary-l); font-weight: 600; }
.company-switcher-menu .cs-divider { height: 1px; background: var(--line); margin: 4px 0; }
.company-switcher-menu .cs-add {
  color: var(--primary-d); font-weight: 600;
}

/* Nav module list */
#nav-modules { display: flex; flex-direction: column; gap: 2px; }
#nav-modules .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .12s;
  text-decoration: none;
}
#nav-modules .nav-item:hover {
  background: var(--primary-soft); color: var(--primary-d);
}
#nav-modules .nav-item.active {
  background: var(--primary); color: white;
  box-shadow: 0 4px 12px rgba(108,99,255,.28);
}
#nav-modules .nav-item.active svg { color: white; }
#nav-modules .nav-item.disabled {
  opacity: .42; cursor: not-allowed; pointer-events: none;
}
#nav-modules .nav-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 8px; background: var(--primary-l);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-d);
}
#nav-modules .nav-item.active .nav-icon { background: rgba(255,255,255,.22); color: white; }
#nav-modules .section-header {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  font-weight: 700; color: var(--muted);
  margin: 16px 12px 6px;
}

/* =========================================================================
   Main
   ========================================================================= */
#main { display: flex; flex-direction: column; min-width: 0; }
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); cursor: pointer; transition: all .12s;
}
.icon-btn:hover {
  background: var(--primary-soft); border-color: var(--primary);
  color: var(--primary-d);
}

#breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  margin-left: 8px;
}
.crumb { color: var(--muted); }
.crumb-current { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--line-strong); }
#breadcrumb a { color: var(--muted); }
#breadcrumb a:hover { color: var(--primary-d); }

#topbar-actions { display: flex; align-items: center; gap: 8px; }

/* 20260907 (P3.5) — signed-in user, far right of the top bar. */
.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: 12px; }
.topbar-user .tu-name {
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-user .tu-signout {
  font: inherit; font-size: 12px; color: var(--muted);
  background: transparent; border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 5px 10px; cursor: pointer;
}
.topbar-user .tu-signout:hover { color: var(--ink); border-color: var(--muted); }

#page {
  padding: 32px;
  flex: 1;
  min-width: 0;
}

/* =========================================================================
   Components
   ========================================================================= */
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.6px; margin: 0 0 6px; color: var(--ink); }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
h3 { font-size: 14px; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.page-subtitle { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}
.card-tight { padding: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid transparent; background: var(--surface);
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); cursor: pointer; transition: all .12s;
  line-height: 1;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(108,99,255,.24); }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--primary-soft); color: var(--primary-d); }
.btn-secondary:hover { background: var(--primary-l); }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-d); background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-d); }
.btn-danger { background: var(--danger-l); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Inputs */
.field { margin-bottom: 14px; }
.field label, label.field-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 6px;
}
input[type=text], input[type=number], input[type=date], input[type=email],
input[type=password], textarea, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 13px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,.16);
}
textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.field-error { color: var(--danger); font-size: 11px; margin-top: 4px; }

/* Tags pills (read-only display + multi-select chips) */
.tag-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary-d);
}
.tag-pill.lvl2 { background: var(--success-l); color: #1c8e6f; }
.tag-pill.lvl3 { background: #fff2d8; color: #af6c00; }
.tag-pill.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Chips multi-select */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-soft); transition: all .12s;
  user-select: none;
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.chip.active.lvl2 { background: var(--success); border-color: var(--success); color: white; }
.chip.active.lvl3 { background: #d6a02a; border-color: #d6a02a; color: white; }

/* Status pills */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.status-pill.success { background: var(--success-l); color: #1c8e6f; }
.status-pill.warning { background: var(--warning-l); color: #b96e00; }
.status-pill.danger { background: var(--danger-l); color: #c4344a; }
.status-pill.info { background: var(--primary-soft); color: var(--primary-d); }
.status-pill.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Tables */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
/* mod 6: sentence case for table headers — no auto-uppercasing.
   Acronyms (VAT, IBAN, …) render as typed in the JS template. */
.data-table th {
  text-align: left; font-size: 12px;
  color: var(--muted); font-weight: 700;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 12px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft); vertical-align: middle;
}
.data-table tr:hover td { background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .amount { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.data-table .amount.credit { color: var(--success); }
.data-table .amount.debit  { color: var(--danger); }
.data-table .row-action { text-align: right; white-space: nowrap; }
.data-table th.right, .data-table td.right { text-align: right; }

/* Empty states */
.empty-state {
  padding: 64px 32px; text-align: center; color: var(--muted);
}
.empty-state .empty-icon {
  font-size: 56px; margin-bottom: 12px;
  filter: grayscale(.2);
}
.empty-state h2 { color: var(--ink); margin-bottom: 8px; }

/* Toast */
#toast-host {
  position: fixed; top: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 16px; border-radius: 10px;
  background: var(--ink); color: white;
  font-size: 13px; box-shadow: var(--shadow-lg);
  min-width: 280px; opacity: 1; transition: opacity .2s;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--primary); }

/* Modal — supports stacking (20260526_Prompt1 fixes #2 / #5).
   Each .modal positions itself absolutely on the host so multiple modals
   layer on top of each other. The host paints the shared backdrop. */
#modal-host:not(:empty) {
  position: fixed; inset: 0; background: rgba(18,15,55,.45);
  z-index: 100;
}
.modal {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: calc(100% - 48px); max-width: 540px;
  max-height: 88vh; display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-wide  { max-width: 760px; }
.modal-xwide { max-width: 1100px; }

/* Horizontally scrollable wrapper used by tables that may overflow on
   narrower modals (e.g. Invoice lines, which packs 9 columns). */
.table-scroll { width: 100%; overflow-x: auto; }
.table-scroll .data-table { min-width: 880px; }

/* Bookkeeping row highlight for debits whose review failed (mod 3).
   Visually distinct from passed (success-l) — uses warning tint + left
   stripe so users notice missing supporting files. */
.data-table tr.review-failed {
  background: var(--danger-l);
  position: relative;
}
.data-table tr.review-failed td:first-child {
  border-left: 4px solid var(--danger);
}
.review-failed-flag {
  display: inline-block; margin-left: 6px;
  font-size: 10px; padding: 2px 6px; border-radius: 999px;
  background: var(--danger); color: white; font-weight: 700;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { margin: 0; }
.modal-body { padding: 20px 24px; overflow: auto; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}

/* =========================================================================
   Home (company picker)
   ========================================================================= */
.home-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #8c84f7 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 32px;
  box-shadow: 0 12px 36px rgba(108,99,255,.28);
  position: relative; overflow: hidden;
}
.home-hero::after {
  content: ''; position: absolute; right: -50px; top: -50px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.home-hero::before {
  content: ''; position: absolute; right: 60px; bottom: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.home-hero h1 { color: white; font-size: 32px; margin-bottom: 8px; }
.home-hero p { font-size: 15px; opacity: .92; max-width: 480px; }

.company-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.company-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.company-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.company-tile .tile-logo {
  width: 72px; height: 72px; border-radius: 18px;
  /* 'contain' so the entire logo is shown even when its aspect ratio differs */
  background: var(--primary-l) center center / contain no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: var(--primary-d);
}
.company-tile .tile-name {
  font-weight: 700; font-size: 14px; color: var(--ink);
}
.company-tile.add-tile {
  border: 2px dashed var(--line-strong); background: transparent;
  color: var(--muted);
}
.company-tile.add-tile:hover {
  border-color: var(--primary); color: var(--primary-d);
  background: var(--primary-soft);
}
.company-tile .tile-action {
  position: absolute; top: 8px; right: 8px;
  opacity: 0; transition: opacity .15s;
}
.company-tile:hover .tile-action { opacity: 1; }

/* =========================================================================
   Company info (Still to do / How IFMS works)
   ========================================================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  /* 20260531_Prompt2 fix #1: stretch so "Still to do" and "Financial snapshot"
     are exactly the same height. */
  align-items: stretch;
}
@media (max-width: 920px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* 20260531_Prompt1 fix #6 — Funding Summary incoming/outgoing cards (equal). */
.funds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
@media (max-width: 920px) { .funds-grid { grid-template-columns: 1fr; } }

/* 20260531_Prompt1 fix #7 — dashboard quick-action tiles. */
.quick-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.quick-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  text-decoration: none; color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.quick-tile:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quick-tile-icon {
  font-size: 22px; width: 44px; height: 44px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); border-radius: 10px;
}
.quick-tile-label { font-weight: 700; font-size: 14px; color: var(--ink); }
.quick-tile-desc { font-size: 12px; color: var(--muted); }

.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: all .15s;
}
.todo-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.todo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-l); color: var(--primary-d);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.todo-icon.success { background: var(--success-l); color: #1c8e6f; }
.todo-icon.warning { background: var(--warning-l); color: #b96e00; }
.todo-icon.danger  { background: var(--danger-l); color: #c4344a; }
.todo-body { flex: 1; }
.todo-title { font-weight: 600; font-size: 13px; color: var(--ink); }
.todo-desc  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.todo-count {
  background: var(--primary); color: white;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}

/* Flow diagram */
.flow-diagram {
  display: flex; flex-direction: column; gap: 14px;
}
.flow-row {
  display: flex; align-items: center; gap: 8px;
}
.flow-step {
  flex: 1; padding: 10px 12px;
  background: var(--primary-soft); border: 1px solid var(--primary-l);
  border-radius: 10px;
  font-size: 12px; font-weight: 600; color: var(--primary-d);
  text-align: center;
}
.flow-step.input  { background: var(--success-l); border-color: var(--success-l); color: #1c8e6f; }
.flow-step.output { background: var(--warning-l); border-color: var(--warning-l); color: #b96e00; }
.flow-arrow { color: var(--muted); font-size: 14px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
/* mod 5: sentence case, no auto-uppercasing — acronyms render as-typed */
.stat-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--ink); margin-top: 4px; }
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }

/* =========================================================================
   Bank statement tabs (Credit / Debit) + transaction rows
   ========================================================================= */
.tabbar {
  display: flex; gap: 6px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line); padding-bottom: 0;
  overflow-x: auto;
}
.tab-btn {
  padding: 8px 16px; border: 0; background: transparent;
  font-family: inherit; font-weight: 600; font-size: 13px;
  color: var(--muted); cursor: pointer; position: relative;
  border-radius: 8px 8px 0 0;
  transition: color .12s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary-d); }
.tab-btn.active {
  color: var(--primary-d);
}
.tab-btn.active::after {
  content: ''; position: absolute; bottom: -1px; left: 12px; right: 12px;
  height: 3px; background: var(--primary); border-radius: 3px;
}
.tab-btn .pill {
  display: inline-block; margin-left: 6px;
  background: var(--primary-l); color: var(--primary-d);
  font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 700;
}
.tab-btn.active .pill { background: var(--primary); color: white; }

/* file upload */
.upload-zone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-d);
}

/* details two-column layout */
.kv-grid {
  display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px;
  margin-top: 8px;
}
.kv-grid .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kv-grid .v { font-size: 13px; color: var(--ink); }
.kv-grid .v.editable { display: flex; align-items: center; gap: 6px; }

/* split layout */
.split-2col {
  display: grid; grid-template-columns: 2fr 1fr; gap: 20px;
}
@media (max-width: 1100px) { .split-2col { grid-template-columns: 1fr; } }

.hidden { display: none !important; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-grow { flex: 1; }
.gap-12 { gap: 12px; }
.spacer { flex: 1; }
.text-muted { color: var(--muted); font-size: 12px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }

/* Bookkeeping totals row */
.totals-row {
  background: var(--primary-soft) !important;
  font-weight: 700;
}
.totals-row td { color: var(--primary-d); }

/* 20260601_Prompt2 待修改4 — brief flash when a row is reached via a
   "matched item" click on another page. The highlight fades on its own.
   20260601_Prompt3 待修改2: use the brand's primary tint (not the glaring
   yellow) so it is easy on the eyes. */
@keyframes rowflash {
  0%   { background-color: var(--primary-l, #e7e4ff); }
  35%  { background-color: var(--primary-l, #e7e4ff); }
  100% { background-color: transparent; }
}
.data-table tbody tr.row-flash > td,
tr.row-flash > td {
  animation: rowflash 2.1s ease-out;
}

/* Match status visual */
.match-info {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--success-l); color: #1c8e6f;
  font-size: 12px; font-weight: 600;
}
.match-info.unmatched { background: var(--warning-l); color: #b96e00; }

/* PDF preview / link */
.file-preview {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary-d);
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--primary-l);
}
.file-preview:hover { background: var(--primary-l); }

/* Receipt image preview */
.receipt-preview {
  max-width: 100%; max-height: 380px;
  border-radius: var(--radius); border: 1px solid var(--line);
}

