/* Bonnio App Shell — Mobile-first CSS for all logged-in pages
   Dashboard, invoices, settings, trusted senders, blacklist.
   Viewport: 375px (iPhone SE) → 430px (iPhone 15 Pro Max) → desktop.
   Touch targets: 44×44px minimum. Card-based layout throughout. */

@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500&display=swap');

@font-face {
  font-family: 'Geist Sans';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.0/dist/fonts/geist-sans/Geist-Variable.woff2') format('woff2');
}

/* ─── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  --color-bone:         #F2F4EF;
  --color-bone-dark:    #E4E8DE;
  --color-surface:      #FFFFFF;
  --color-forest-900:   #0E3B2E;
  --color-forest-800:   #164D3C;
  --color-forest-700:   #1E6048;
  --color-forest-500:   #2D8A62;
  --color-mint-300:     #6EE7B7;
  --color-mint-200:     #A7F3D0;
  --color-mint-100:     #D1FAE5;
  --color-emerald-500:  #10B981;
  --color-emerald-600:  #059669;

  --color-success:      #16A34A;
  --color-success-bg:   #DCFCE7;
  --color-warning:      #D97706;
  --color-warning-bg:   #FEF3C7;
  --color-danger:       #DC2626;
  --color-danger-bg:    #FEE2E2;
  --color-info:         #2563EB;
  --color-info-bg:      #DBEAFE;

  --color-ink:          #0F1912;
  --color-ink-secondary:#3D4A3E;
  --color-ink-muted:    #6B7C6D;
  --color-ink-ghost:    #9CAD9E;
  --color-divider:      #D4DACE;
  --color-divider-light:#E8EDE4;

  --font-sans:  'Geist Sans', system-ui, sans-serif;
  --font-mono:  'Geist Mono', 'SF Mono', monospace;

  --text-xs:    0.75rem;
  --text-sm:    0.8125rem;
  --text-base:  0.9375rem;
  --text-md:    1.0625rem;
  --text-lg:    1.25rem;
  --text-xl:    1.5rem;
  --text-2xl:   2rem;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full:9999px;

  --shadow-sm:  0 1px 3px rgba(14,59,46,0.06), 0 1px 2px rgba(14,59,46,0.03);
  --shadow-md:  0 4px 12px rgba(14,59,46,0.08), 0 2px 4px rgba(14,59,46,0.04);
  --shadow-lg:  0 8px 24px rgba(14,59,46,0.10), 0 4px 8px rgba(14,59,46,0.05);
  --shadow-xl:  0 16px 40px rgba(14,59,46,0.12), 0 6px 16px rgba(14,59,46,0.06);
  --shadow-focus: 0 0 0 3px rgba(110,231,183,0.4);

  --motion-fast:    100ms ease;
  --motion-default: 180ms ease;

  /* Safe area for bottom bars */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--color-bone);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  /* Reserve space for sticky bottom bar */
  padding-bottom: 0;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-forest-900);
  letter-spacing: -0.02em;
}

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── APP NAV (HEADER) ───────────────────────────────────────── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--color-forest-900);
  height: 56px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 8px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.app-logo-icon {
  width: 30px;
  height: 30px;
  background: var(--color-mint-300);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--color-forest-900);
  font-family: var(--font-mono);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.app-logo-img {
  height: 28px;
  width: auto;
  display: block;
}

.app-logo-text {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-mint-200);
  letter-spacing: -0.02em;
  display: none;
}

.app-nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.app-nav-right::-webkit-scrollbar { display: none; }

.nav-user-label {
  font-size: var(--text-xs);
  color: rgba(167,243,208,0.5);
  display: none;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 11px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  min-height: 36px;
  min-width: 36px;
  white-space: nowrap;
  transition: all var(--motion-fast);
  user-select: none;
  flex-shrink: 0;
}

.btn:active { transform: scale(0.97); }

.btn-forest {
  background: rgba(255,255,255,0.08);
  color: var(--color-mint-200);
  border-color: rgba(255,255,255,0.10);
  font-size: 11px;
  padding: 6px 10px;
}

.btn-forest:hover { background: rgba(255,255,255,0.16); }

.btn-primary {
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border-color: var(--color-forest-900);
}

.btn-primary:hover {
  background: var(--color-forest-800);
  border-color: var(--color-forest-800);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-forest-900);
  border-color: var(--color-divider);
}

.btn-secondary:hover { border-color: var(--color-forest-900); }

.btn-ghost {
  background: transparent;
  color: var(--color-ink-muted);
  border-color: var(--color-divider-light);
  min-height: 44px;
  min-width: 44px;
}

.btn-ghost:hover {
  color: var(--color-danger);
  border-color: rgba(220,38,38,0.3);
  background: var(--color-danger-bg);
}

/* ─── PAGE LAYOUT ────────────────────────────────────────────── */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 14px 80px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.signup-confirmation {
  width: calc(100% - 28px);
  max-width: 1080px;
  margin: 12px auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
  background: var(--color-success-bg);
  color: var(--color-forest-900);
  border: 1px solid rgba(22,163,74,0.24);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.signup-confirmation-copy {
  flex: 1 1 300px;
  min-width: 0;
}

.signup-confirmation-copy p {
  overflow-wrap: anywhere;
}

.signup-confirmation-title {
  margin-bottom: 2px;
  color: var(--color-forest-900);
  font-size: var(--text-base);
  font-weight: 700;
}

.signup-confirmation-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
}

.signup-confirmation-action:focus-visible {
  outline: 3px solid var(--color-forest-500);
  outline-offset: 2px;
}

.trial-week-plan {
  width: calc(100% - 28px);
  max-width: 1080px;
  margin: 12px auto 16px;
  padding: 16px;
  background: var(--color-surface);
  color: var(--color-ink-secondary);
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.trial-week-plan h2 {
  margin-bottom: 6px;
  font-size: var(--text-base);
}

.trial-week-plan-intro {
  margin-bottom: 10px;
}

.trial-week-plan-note {
  margin-bottom: 12px;
  padding: 9px 11px;
  background: var(--color-bone);
  border-left: 3px solid var(--color-forest-700);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

.trial-week-plan-days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
}

.trial-week-plan-days li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-sm);
}

.trial-week-plan-days h3 {
  padding-top: 1px;
  font-size: var(--text-xs);
}

.trial-week-plan-days p {
  min-width: 0;
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.trial-week-plan a {
  color: var(--color-forest-700);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.trial-week-plan a:focus-visible {
  outline: 3px solid var(--color-forest-500);
  outline-offset: 2px;
  border-radius: 2px;
}

.page-header h1 {
  font-size: var(--text-lg);
  color: var(--color-forest-900);
}

.page-header .subtitle {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.active-bundle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.active-bundle-copy {
  min-width: 0;
}

.active-bundle-eyebrow {
  margin-bottom: 3px;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

.active-bundle-card h2 {
  color: var(--color-forest-900);
  font-size: var(--text-md);
}

.active-bundle-link {
  flex-shrink: 0;
  color: var(--color-forest-500);
  font-size: var(--text-xs);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.active-bundle-link:focus-visible {
  outline: 3px solid var(--color-forest-500);
  outline-offset: 3px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  margin-bottom: 20px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: color var(--motion-fast);
  min-height: 44px;
  min-width: 44px;
}

.back-link:hover {
  color: var(--color-forest-900);
  background: var(--color-bone-dark);
}

.page-title {
  font-size: var(--text-lg);
  margin-bottom: 6px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  margin-bottom: 20px;
  line-height: 1.55;
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-divider-light);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-header {
  padding: 14px 14px;
  border-bottom: 1px solid var(--color-divider-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-header-left {
  flex: 1;
  min-width: 0;
}

.card-header h2 {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: 2px;
}

.card-header p {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  line-height: 1.5;
}

.card-count {
  font-size: 11px;
  color: var(--color-ink-ghost);
  background: var(--color-bone);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-body {
  padding: 14px 14px;
}

/* ─── STATS ROW ──────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-divider-light);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-fast);
}

.stat-card:last-child {
  /* If odd number, span full width */
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-ghost);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-forest-900);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 10px;
  color: var(--color-ink-ghost);
  letter-spacing: 0.01em;
}

/* 5th stat card spans full width on mobile 2-col grid */
.stats-row .stat-card:nth-child(5) {
  grid-column: 1 / -1;
}

/* ─── TWO-COLUMN LAYOUT ──────────────────────────────────────── */
.two-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */
.sidebar-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-divider-light);
  overflow: hidden;
}

.sidebar-section {
  padding: 16px 14px;
  border-bottom: 1px solid var(--color-divider-light);
}

.sidebar-section:last-child { border-bottom: none; }

.sidebar-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-forest-900);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

/* ─── EMAIL ACCOUNT ITEMS ────────────────────────────────────── */
.account-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-divider-light);
}

.account-item:last-child { border-bottom: none; }

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-label {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-forest-900);
}

.account-email-small {
  font-size: 11px;
  color: var(--color-ink-muted);
  font-family: var(--font-mono);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.account-status-line {
  font-size: 11px;
  margin-top: 2px;
}

.status-idle    { color: var(--color-ink-ghost); }
.status-scanning{ color: var(--color-emerald-500); }
.status-error   { color: var(--color-danger); }

.account-actions { display: flex; gap: 6px; flex-shrink: 0; }

.account-error {
  padding: 10px 12px;
  background: var(--color-danger-bg);
  border: 1px solid rgba(220,38,38,0.15);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--color-danger);
  line-height: 1.55;
}

.account-error a { color: var(--color-info); text-decoration: underline; }

/* ─── DATE RANGE PILLS ───────────────────────────────────────── */
.date-range-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.date-range-btn {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  background: var(--color-bone);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-full);
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: all var(--motion-fast);
  min-height: 32px;
}

.date-range-btn:hover {
  border-color: var(--color-forest-500);
  color: var(--color-forest-900);
}

.date-range-btn.active {
  background: var(--color-forest-900);
  border-color: var(--color-forest-900);
  color: var(--color-mint-300);
}

/* ─── HEALTH BADGES ──────────────────────────────────────────── */
.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.health-badge-green  { background: var(--color-success-bg); color: var(--color-success); }
.health-badge-orange { background: var(--color-warning-bg); color: var(--color-warning); }
.health-badge-red    { background: var(--color-danger-bg); color: var(--color-danger); }
.health-badge-grey   { background: var(--color-bone-dark); color: var(--color-ink-ghost); }

.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.health-dot-green  { background: var(--color-success); }
.health-dot-orange { background: var(--color-warning); }
.health-dot-red    { background: var(--color-danger); }
.health-dot-grey   { background: var(--color-ink-ghost); }

/* ─── SCAN BUTTONS ───────────────────────────────────────────── */
.btn-scan {
  padding: 6px 14px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--motion-fast);
  min-height: 34px;
  font-family: var(--font-sans);
}

.btn-scan:hover { background: var(--color-forest-800); }
.btn-scan:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-delete-acct {
  background: transparent;
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-sm);
  color: var(--color-ink-ghost);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 13px;
  min-height: 34px;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--motion-fast);
}

.btn-delete-acct:hover {
  color: var(--color-danger);
  border-color: rgba(220,38,38,0.3);
  background: var(--color-danger-bg);
}

.btn-add {
  width: 100%;
  padding: 12px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: background var(--motion-fast);
  min-height: 44px;
  font-family: var(--font-sans);
}

.btn-add:hover { background: var(--color-forest-800); }
.btn-add:disabled { opacity: 0.5; cursor: not-allowed; }

.toggle-form-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--color-forest-900);
  border: 1.5px dashed var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--motion-fast), background var(--motion-fast);
  min-height: 44px;
  font-family: var(--font-sans);
}

.toggle-form-btn:hover {
  border-color: var(--color-forest-500);
  background: var(--color-bone);
}

/* ─── ADD ACCOUNT FORM ───────────────────────────────────────── */
.add-form .input { margin-bottom: 10px; width: 100%; }
.add-form select.input { cursor: pointer; }

/* ─── SCAN FEEDBACK ──────────────────────────────────────────── */
.scan-summary {
  padding: 10px 12px;
  background: var(--color-bone);
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--color-ink-muted);
  line-height: 1.7;
}

.scan-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.scan-stat-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-forest-900);
}

.scan-summary-zero { border-color: rgba(217,119,6,0.2); }

.scanning-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.15);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--color-emerald-600);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

.scanning-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-emerald-500);
  animation: pulse-dot 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

/* ─── SCAN OVERVIEW (sidebar) ────────────────────────────────── */
.scan-overview-time {
  font-size: 11px;
  color: var(--color-ink-muted);
  margin-bottom: 10px;
}

.scan-overview-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-ink-secondary);
  margin-bottom: 4px;
}

.scan-overview-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-forest-900);
}

/* ─── HOW-IT-WORKS SIDEBAR ───────────────────────────────────── */
.how-steps {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  line-height: 1.7;
}

.how-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.how-step:last-child { margin-bottom: 0; }

.how-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  margin-top: 1px;
}

/* ─── SETUP GUIDE ────────────────────────────────────────────── */
.setup-guide {
  padding: 12px;
  background: rgba(16,185,129,0.05);
  border: 1px solid rgba(16,185,129,0.12);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--color-ink-secondary);
  line-height: 1.7;
  margin-top: 8px;
}

.setup-guide strong { color: var(--color-ink); }
.setup-guide a { color: var(--color-forest-500); text-decoration: underline; }
.setup-guide ol { padding-left: 18px; margin: 6px 0 0; }

.setup-guide-title {
  font-weight: 700;
  font-size: 11px;
  color: var(--color-forest-900);
  margin-bottom: 6px;
}

/* ─── INVOICE TABLE HEADER ───────────────────────────────────── */
.invoice-table-head {
  display: none; /* Hide complex table header on mobile — use card layout */
}

.sort-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ink-ghost);
  padding: 0;
  transition: color var(--motion-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.sort-btn.active { color: var(--color-forest-900); }
.sort-btn:hover { color: var(--color-forest-700); }

.sort-indicator {
  font-size: 10px;
  display: inline;
}

/* ─── INVOICE ROWS (card-style on mobile) ────────────────────── */
.invoice-list {
  /* Scrollable list container */
}

.invoice-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px 14px;
  border-bottom: 1px solid var(--color-divider-light);
  cursor: pointer;
  transition: background var(--motion-fast);
}

.invoice-row:last-child { border-bottom: none; }
.invoice-row:active { background: var(--color-bone); }

.invoice-row-check-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.invoice-row-check {
  width: 18px;
  height: 18px;
  accent-color: var(--color-forest-700);
  cursor: pointer;
}

.invoice-sender {
  min-width: 0;
  overflow: hidden;
}

.invoice-sender-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-forest-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.invoice-sender-email {
  font-size: 11px;
  color: var(--color-ink-ghost);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.invoice-subject {
  font-size: 11px;
  color: var(--color-ink-ghost);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  display: none; /* Hide on mobile to save space */
}

.invoice-amount {
  text-align: right;
  flex-shrink: 0;
}

.invoice-amount-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-forest-900);
  letter-spacing: -0.02em;
}

.invoice-currency {
  font-size: 10px;
  color: var(--color-ink-ghost);
  text-align: right;
}

.invoice-meta {
  display: none; /* Hide date column on mobile — shown in detail modal */
}

.invoice-date {
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}

.invoice-due {
  font-size: 10px;
  color: var(--color-warning);
  margin-top: 2px;
}

/* ─── INVOICE BADGES ─────────────────────────────────────────── */
.badge-forwarded {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-success);
  background: var(--color-success-bg);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-workflow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-auto-sent {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-awaiting {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-failed {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-manually-sent {
  background: rgba(45,138,98,0.1);
  color: var(--color-forest-700);
}

/* Status select (dropdown badge) */
.status-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: inherit;
  font-family: var(--font-sans);
  padding: 3px 6px;
  border-radius: var(--radius-full);
  min-height: 28px;
}

.badge { padding: 3px 8px; border-radius: var(--radius-full); font-size: 10px; font-weight: 600; }
.badge-detected  { background: var(--color-info-bg); color: var(--color-info); }
.badge-reviewed  { background: var(--color-bone-dark); color: var(--color-ink-secondary); }
.badge-paid      { background: var(--color-success-bg); color: var(--color-success); }
.badge-ignored   { background: var(--color-bone); color: var(--color-ink-ghost); }

/* ─── ORGANIZER TOOLBAR (replaces old filter-bar) ────────────── */
.filter-bar,
.organizer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-divider-light);
  background: var(--color-bone);
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.filter-group-search {
  flex: 2;
  min-width: 180px;
}

.filter-group-toggles {
  flex: 0 0 auto;
  gap: 6px;
}

.filter-group-dates {
  flex: 0 0 auto;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink-ghost);
  flex-shrink: 0;
}

.filter-sep {
  font-size: 11px;
  color: var(--color-ink-ghost);
}

.filter-input {
  height: 34px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--color-ink);
  transition: border-color var(--motion-fast);
  min-width: 0;
  flex: 1;
}

.filter-input:focus {
  outline: none;
  border-color: var(--color-forest-500);
}

.filter-input::placeholder { color: var(--color-ink-ghost); }

.filter-input-vendor { min-width: 100%; }
.filter-input-amount { max-width: 70px; flex: 0 1 70px; }
.filter-input-date   { max-width: 130px; flex: 0 1 130px; }

.filter-select {
  height: 34px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--color-ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  min-width: 0;
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-forest-500);
}

.filter-clear-btn {
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  color: var(--color-ink-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--motion-fast);
  min-height: 34px;
  font-family: var(--font-sans);
}

.filter-clear-btn:hover {
  border-color: var(--color-forest-500);
  color: var(--color-forest-900);
}

/* Attachment toggle + view mode buttons */
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-ink-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.filter-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--color-forest-700);
  cursor: pointer;
  flex-shrink: 0;
}

.filter-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: all var(--motion-fast);
  flex-shrink: 0;
}

.filter-view-btn:hover {
  border-color: var(--color-forest-500);
  color: var(--color-forest-700);
}

.filter-view-btn.active {
  background: var(--color-forest-900);
  border-color: var(--color-forest-900);
  color: var(--color-mint-300);
}

.filter-empty-state {
  padding: 32px 16px;
  text-align: center;
}

/* ─── MONTH ORGANIZER VIEW ───────────────────────────────────── */
#month-view {
  padding: 4px 0;
}

.month-group {
  border-bottom: 1px solid var(--color-divider-light);
}

.month-group:last-child { border-bottom: none; }

.month-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--color-bone);
  transition: background var(--motion-fast);
  user-select: none;
}

.month-group-header:hover { background: var(--color-bone-dark); }

.month-group-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-forest-900);
  flex: 1;
  text-transform: capitalize;
}

.month-group-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-group-count {
  font-size: 11px;
  color: var(--color-ink-muted);
}

.month-group-total {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-forest-900);
}

.month-group-chevron {
  color: var(--color-ink-ghost);
  transition: transform var(--motion-fast);
  flex-shrink: 0;
}

.month-group-header.collapsed .month-group-chevron {
  transform: rotate(-90deg);
}

.month-group-body {
  overflow: hidden;
  max-height: 9999px;
  transition: max-height 0.25s ease;
}

.month-group-body.collapsed {
  max-height: 0;
}

.month-invoice-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-divider-light);
  transition: background var(--motion-fast);
}

.month-invoice-row:last-child { border-bottom: none; }
.month-invoice-row:hover { background: var(--color-bone); }

.month-vendor {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-amount {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-forest-900);
  white-space: nowrap;
}

.month-badge {
  flex-shrink: 0;
}

/* Inline bankexport button — hidden on desktop, shown on mobile */
.bankexport-inline-btn {
  display: none;
}

@media (max-width: 640px) {
  .filter-group-dates { min-width: 100%; }
  .filter-group-search { min-width: 100%; }
  .month-group-header { padding: 10px 12px; }
  .month-invoice-row  { padding: 10px 12px; }
  .month-group-count  { display: none; }

  /* Show inline Bankexport button in toolbar, hide floating FAB */
  .bankexport-inline-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--color-forest-900);
    color: var(--color-mint-300);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 34px;
  }
  .bankexport-inline-btn:active { background: var(--color-forest-700); }
  #bonnio-chat-bubble { display: none !important; }
}

.filter-empty-state .empty-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.5; }
.filter-empty-state p { font-size: var(--text-xs); color: var(--color-ink-muted); }
.filter-empty-state a { color: var(--color-forest-500); text-decoration: underline; cursor: pointer; }

/* ─── BULK ACTION BAR (inline) ───────────────────────────────── */
.bulk-bar {
  display: none;
  padding: 10px 14px;
  background: var(--color-forest-900);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.bulk-bar.visible {
  display: flex;
}

.bulk-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.bulk-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-mint-200);
}

.bulk-bar-right {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-bulk {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: var(--color-mint-200);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--motion-fast);
  min-height: 32px;
  font-family: var(--font-sans);
}

.btn-bulk:hover { background: rgba(255,255,255,0.15); }

.btn-bulk-deselect {
  background: transparent;
  border-color: rgba(255,255,255,0.12);
  color: rgba(167,243,208,0.6);
}

.btn-bulk-send {
  background: var(--color-mint-300) !important;
  color: var(--color-forest-900) !important;
  border-color: transparent !important;
  font-weight: 700;
}

/* ─── STICKY FORWARD TOOLBAR (bottom) ────────────────────────── */
.bulk-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--color-forest-900);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -4px 20px rgba(14,59,46,0.2);
}

.bulk-toolbar.visible {
  transform: translateY(0);
}

.bulk-toolbar-count {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-mint-300);
  flex-shrink: 0;
  min-width: 24px;
  text-align: center;
}

.bulk-toolbar-label {
  font-size: 12px;
  color: rgba(167,243,208,0.6);
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-deselect {
  font-size: 11px;
  color: rgba(167,243,208,0.5);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  min-height: 36px;
  font-family: var(--font-sans);
}

.btn-deselect:hover { color: var(--color-mint-200); }

.btn-forward {
  margin-left: auto;
  background: var(--color-mint-300);
  color: var(--color-forest-900);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--motion-fast);
  min-height: 44px;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.btn-forward:hover { background: var(--color-mint-200); }
.btn-forward:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-irrelevant {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--motion-fast);
  min-height: 44px;
  font-family: var(--font-sans);
  white-space: nowrap;
}
.btn-irrelevant:hover {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
}
.btn-irrelevant:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── CATEGORY TABS ───────────────────────────────────────────── */
.category-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-divider);
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-sans);
  transition: color var(--motion-fast), border-color var(--motion-fast);
  text-decoration: none;
  min-height: 44px;
}
.category-tab:hover { color: var(--color-ink); }

.category-tab.active {
  color: var(--color-forest-900);
  border-bottom-color: var(--color-forest-800);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-forest-900);
  color: #fff;
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.tab-badge-warn {
  background: var(--color-warning);
}

.tab-badge-muted {
  background: var(--color-ink-ghost);
}

/* ─── ARCHIVE PAGE ────────────────────────────────────────────── */
.archive-tabs {
  display: flex;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 12px;
}
.archive-tab {
  flex: 1;
  padding: 10px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink-muted);
  text-align: center;
  text-decoration: none;
  border-right: 1px solid var(--color-divider);
  transition: all var(--motion-fast);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.archive-tab:last-child { border-right: none; }
.archive-tab:hover { background: var(--color-bone); color: var(--color-ink); }
.archive-tab.active { background: var(--color-forest-900); color: var(--color-mint-300); }

.archive-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.archive-count-label {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.archive-row { opacity: 1; transition: opacity 300ms ease; }

.archive-restore-cell {
  display: flex;
  align-items: center;
}

.btn-restore {
  background: var(--color-surface);
  color: var(--color-ink-secondary);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--motion-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.btn-restore:hover {
  background: var(--color-forest-800);
  color: var(--color-mint-300);
  border-color: var(--color-forest-800);
}

/* Per-invoice row action buttons (detected rows) */
.btn-row-forward,
.btn-row-irrelevant {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  flex-shrink: 0;
}
.btn-row-forward:hover {
  background: var(--color-forest-900);
  border-color: var(--color-forest-900);
  color: var(--color-mint-300);
}
.btn-row-forward:active { opacity: 0.75; }
.btn-row-irrelevant:hover {
  background: var(--color-warning-bg);
  border-color: rgba(217,119,6,0.3);
  color: var(--color-warning);
}
.btn-row-irrelevant:active { opacity: 0.75; }

/* Resend button (failed invoice row → bookkeeper) */
.btn-row-resend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 10px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid var(--color-forest-900);
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.btn-row-resend:hover {
  background: var(--color-forest-800);
  border-color: var(--color-forest-800);
  color: var(--color-mint-300);
}
.btn-row-resend:active { opacity: 0.75; }
.btn-row-resend:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Preview bookkeeper-email button (per-row, all statuses) */
.btn-row-preview-email {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 10px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.btn-row-preview-email:hover {
  background: var(--color-bone);
  border-color: var(--color-forest-500);
  color: var(--color-forest-900);
}
.btn-row-preview-email:active { opacity: 0.75; }
.btn-row-preview-email:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Two-line bookkeeper-delivery label under each row badge */
.delivery-line {
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-ink-muted);
  margin-top: 2px;
  max-width: 180px;
  word-break: break-word;
}
.delivery-line-success { color: var(--color-success); }
.delivery-line-danger  { color: var(--color-danger); }
.delivery-line-link {
  display: inline-block;
  font-size: 11px;
  color: var(--color-warning);
  text-decoration: none;
  margin-top: 2px;
}
.delivery-line-link:hover { text-decoration: underline; }

.back-link { transition: color var(--motion-fast); }
.back-link:hover { color: var(--color-forest-800) !important; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--color-divider-light);
}
.pagination-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  color: var(--color-forest-800);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 8px 16px;
  text-decoration: none;
  transition: all var(--motion-fast);
  display: inline-flex;
  align-items: center;
  min-height: 36px;
}
.pagination-btn:hover {
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border-color: var(--color-forest-900);
}
.pagination-info {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  font-family: var(--font-mono);
}

/* Toast */
.toast-visible { transform: translateY(0) !important; opacity: 1 !important; }

/* ─── TABLE (trusted senders) ────────────────────────────────── */
.sender-table {
  width: 100%;
  border-collapse: collapse;
}

.sender-thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ink-ghost);
  border-bottom: 1px solid var(--color-divider-light);
  background: var(--color-bone);
  white-space: nowrap;
}

.sender-thead th:last-child { text-align: right; }

.sender-row {
  border-bottom: 1px solid var(--color-divider-light);
  transition: background var(--motion-fast);
}

.sender-row:last-child { border-bottom: none; }
.sender-row:hover { background: var(--color-bone); }

.sender-row td {
  padding: 14px 12px;
  vertical-align: middle;
}

.sender-row td:last-child { text-align: right; }

.sender-domain-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sender-domain-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(45,138,98,0.08);
  border: 1px solid rgba(45,138,98,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-forest-700);
}

.sender-domain {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-forest-900);
}

.sender-display-name {
  font-size: 11px;
  color: var(--color-ink-muted);
  margin-top: 1px;
}

/* Status toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-label {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  white-space: nowrap;
}

.toggle {
  position: relative;
  width: 40px;
  height: 24px;
  background: var(--color-divider);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--motion-fast);
  border: none;
  outline: none;
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
}

.toggle.on { background: var(--color-forest-700); }

.toggle::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--motion-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle.on::after { transform: translateX(16px); }
.toggle:focus-visible { box-shadow: var(--shadow-focus); }

/* Badges */
.badge-active {
  background: var(--color-success-bg);
  color: var(--color-success);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-paused {
  background: var(--color-bone-dark);
  color: var(--color-ink-muted);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* Stats cells */
.stat-cell {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-forest-900);
}

.stat-cell-sub {
  font-size: 10px;
  color: var(--color-ink-ghost);
  margin-top: 1px;
}

/* Actions */
.action-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.btn-remove {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--color-ink-ghost);
  cursor: pointer;
  transition: all var(--motion-fast);
  display: flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
}

.btn-remove:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  padding: 40px 16px;
  text-align: center;
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.45;
}

.empty-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(45,138,98,0.07);
  border: 1px solid rgba(45,138,98,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--color-forest-700);
}

.empty-state h3 {
  font-size: var(--text-base);
  color: var(--color-forest-900);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.65;
}

.empty-inbox-steps {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 10px;
  padding-left: 20px;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  line-height: 1.65;
  text-align: left;
}

.empty-inbox-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.empty-inbox-actions .btn {
  justify-content: center;
  min-height: 44px;
  text-align: center;
}

@media (max-width: 640px) {
  .empty-inbox-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ─── FORMS ──────────────────────────────────────────────────── */
.add-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
  margin-bottom: 14px;
}

.field:last-child { margin-bottom: 0; }

.field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-ghost);
}

.input {
  height: 44px;
  background: var(--color-bone);
  border: 1.5px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
  appearance: none;
  -webkit-appearance: none;
}

.input:focus {
  outline: none;
  border-color: var(--color-forest-500);
  box-shadow: var(--shadow-focus);
  background: var(--color-surface);
}

.input::placeholder { color: var(--color-ink-ghost); }

/* ─── INFO BOX ───────────────────────────────────────────────── */
.info-box {
  background: rgba(45,138,98,0.05);
  border: 1px solid rgba(45,138,98,0.12);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 11px;
  color: var(--color-ink-secondary);
  line-height: 1.7;
}

.info-box strong { color: var(--color-forest-900); }

/* ─── MODAL (Invoice detail) ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(14,59,46,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 40px rgba(14,59,46,0.15);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--color-divider-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}

.modal-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-forest-900);
}

.modal-subtitle {
  font-size: 11px;
  color: var(--color-ink-muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.modal-close {
  background: var(--color-bone);
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--color-ink-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--motion-fast);
}

.modal-close:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.modal-body {
  padding: 16px;
}

.modal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-field-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-ghost);
  margin-bottom: 4px;
}

.modal-field-value {
  font-size: var(--text-sm);
  color: var(--color-ink);
  font-weight: 500;
}

.modal-field-value.mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

.modal-export-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-export {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  background: var(--color-bone);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  color: var(--color-ink-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--motion-fast);
}

.btn-export:hover {
  border-color: var(--color-forest-500);
  color: var(--color-forest-900);
}

.btn-ignore-sender {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  color: var(--color-ink-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--motion-fast);
  font-family: var(--font-sans);
}

.btn-ignore-sender:hover {
  border-color: rgba(220,38,38,0.3);
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

.btn-ignore-sender:disabled { opacity: 0.4; cursor: not-allowed; }

.modal-raw-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-ghost);
  margin: 20px 0 8px;
}

.modal-raw-text {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--color-bone);
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--color-ink-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}

/* ─── CONFIRM DIALOG ─────────────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(14,59,46,0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.confirm-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.confirm-box {
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -8px 40px rgba(14,59,46,0.15);
  width: 100%;
  max-width: 440px;
  padding: 24px 20px calc(20px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1);
}

.confirm-overlay.open .confirm-box {
  transform: translateY(0);
}

.confirm-box h3 {
  font-size: var(--text-base);
  margin-bottom: 10px;
  color: var(--color-forest-900);
}

.confirm-box p {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  flex-direction: column-reverse;
}

.confirm-actions .btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}

/* ─── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--color-forest-900);
  color: var(--color-mint-200);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}

/* Support both class names used across pages */
.toast.visible,
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--color-danger);
  color: #fff;
}

/* ─── UTILITY ───────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── TRUST PROMPT ───────────────────────────────────────────── */
.trust-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 250;
  background: var(--color-surface);
  border-top: 2px solid var(--color-forest-500);
  padding: 16px 16px calc(16px + var(--safe-bottom));
  box-shadow: 0 -4px 20px rgba(14,59,46,0.12);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.trust-prompt.visible {
  transform: translateY(0);
}

.trust-prompt-icon {
  width: 36px;
  height: 36px;
  background: rgba(45,138,98,0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-forest-700);
  flex-shrink: 0;
}

.trust-prompt-body { flex: 1; min-width: 0; }

.trust-prompt-text {
  font-size: var(--text-sm);
  color: var(--color-ink);
  margin-bottom: 10px;
  line-height: 1.5;
}

.trust-prompt-actions {
  display: flex;
  gap: 8px;
}

.btn-trust-yes {
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 36px;
  font-family: var(--font-sans);
  transition: background var(--motion-fast);
}

.btn-trust-yes:hover { background: var(--color-forest-800); }

.btn-trust-no {
  background: transparent;
  color: var(--color-ink-muted);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  min-height: 36px;
  font-family: var(--font-sans);
  transition: all var(--motion-fast);
}

.btn-trust-no:hover {
  border-color: var(--color-ink-muted);
  color: var(--color-ink);
}

/* ─── ONBOARDING OVERLAY ─────────────────────────────────────── */
.aha-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(14,59,46,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.aha-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.aha-inner {
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.aha-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-mint-300);
  margin-bottom: 20px;
}

.aha-headline {
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  color: var(--color-surface);
  margin-bottom: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.aha-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
}

.aha-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aha-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-mint-300);
  line-height: 1;
  letter-spacing: -0.03em;
}

.aha-stat-value.counting {
  animation: counter-pop 0.3s ease;
}

@keyframes counter-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.aha-stat-label {
  font-size: 11px;
  color: rgba(167,243,208,0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.aha-cta {
  background: var(--color-mint-300);
  color: var(--color-forest-900);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--motion-fast);
  min-height: 48px;
  font-family: var(--font-sans);
}

.aha-cta:hover { background: var(--color-mint-200); }

.aha-cta-arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform var(--motion-fast);
}

.aha-cta:hover .aha-cta-arrow { transform: translateX(3px); }

/* Zero-result state */
.aha-zero { display: none; }

.aha-inner.aha-zero-active .aha-headline,
.aha-inner.aha-zero-active .aha-stats,
.aha-inner.aha-zero-active .aha-cta {
  display: none;
}

.aha-inner.aha-zero-active .aha-zero {
  display: block;
}

.aha-zero-headline {
  font-size: var(--text-lg);
  color: var(--color-surface);
  margin-bottom: 12px;
}

.aha-zero-body {
  font-size: var(--text-sm);
  color: rgba(167,243,208,0.6);
  line-height: 1.7;
  margin-bottom: 24px;
}

.aha-zero-cta {
  background: rgba(255,255,255,0.12);
  color: var(--color-mint-200);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--motion-fast);
  min-height: 44px;
  font-family: var(--font-sans);
}

.aha-zero-cta:hover {
  background: rgba(255,255,255,0.18);
}

/* ── AHA OVERLAY — time-saving message ─────────────────────── */
.aha-timesave {
  font-size: var(--text-sm);
  color: rgba(167,243,208,0.6);
  line-height: 1.6;
  margin-bottom: 28px;
  margin-top: -12px;
}

/* ── FIRST-FORWARD CONFETTI OVERLAY ─────────────────────────── */
.first-forward-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(14,59,46,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.first-forward-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.first-forward-inner {
  text-align: center;
  max-width: 320px;
  width: 100%;
}
.first-forward-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: emoji-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}
@keyframes emoji-pop {
  0% { transform: scale(0.2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.first-forward-headline {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-surface);
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}
.first-forward-body {
  font-size: var(--text-sm);
  color: rgba(167,243,208,0.65);
  line-height: 1.7;
  margin-bottom: 28px;
}
.first-forward-close {
  background: var(--color-mint-300);
  color: var(--color-forest-900);
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 32px;
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--motion-fast);
}
.first-forward-close:hover { background: var(--color-mint-200); }

/* ─── UTILITIES ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── RESPONSIVE ─────────────────────────────────────────────── */

/* Small phones — tighter spacing */
@media (max-width: 375px) {
  .page {
    padding: 12px 10px 80px;
  }

  .app-nav {
    padding: 0 10px;
    height: 52px;
  }

  .stats-row {
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: var(--text-lg);
  }

  .card {
    border-radius: var(--radius-md);
  }

  .card-header {
    padding: 12px;
  }

  .card-body {
    padding: 12px;
  }

  .invoice-row {
    padding: 12px 10px;
    gap: 8px;
  }

  .modal-fields {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .page-title {
    font-size: var(--text-base);
  }

  .back-link {
    font-size: var(--text-xs);
    margin-bottom: 16px;
  }
}

/* Mid-size phones (376–430px) — standard mobile */
@media (min-width: 376px) and (max-width: 640px) {
  .page {
    padding: 16px 14px 80px;
  }
}

/* Hide columns on mobile */
@media (max-width: 640px) {
  .sender-thead th.hide-mobile { display: none; }
  .sender-row td.hide-mobile { display: none; }

  .signup-confirmation {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .signup-confirmation-action {
    width: 100%;
  }

  .trial-week-plan {
    padding: 12px;
  }

  .trial-week-plan-days {
    grid-template-columns: 1fr;
  }

  .active-bundle-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
  }

  .active-bundle-link {
    align-self: stretch;
  }

  .add-form {
    flex-direction: column;
  }

  .field {
    min-width: unset;
    width: 100%;
  }

  .input { width: 100%; }

  .filter-bar {
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
  }

  .filter-group {
    width: 100%;
  }

  .filter-input-vendor {
    min-width: unset;
    width: 100%;
  }

  .filter-input-amount { max-width: none; flex: 1; }
  .filter-input-date { max-width: none; flex: 1; }
  .filter-select { width: 100%; }

  .bulk-bar-right {
    width: 100%;
  }

  .btn-bulk {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  /* Sticky bottom toolbar — mobile adjustments */
  .bulk-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px calc(10px + var(--safe-bottom));
    align-items: flex-end;
  }
  .bulk-toolbar-count {
    font-size: var(--text-base);
    flex-shrink: 0;
  }
  .bulk-toolbar-label {
    font-size: 11px;
    white-space: normal;
    min-width: 30px;
    flex-shrink: 1;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.2;
    align-self: flex-end;
    padding-bottom: 1px;
  }
  .btn-forward {
    font-size: 12px;
    padding: 9px 14px;
    flex-shrink: 0;
    margin-left: 0;
    order: 1;
  }

  /* Toast — centered and wider on mobile */
  .toast {
    left: 16px;
    right: 16px;
    transform: translateY(80px);
    max-width: none;
  }

  .toast.visible,
  .toast.show {
    transform: translateY(0);
  }
}

/* Tablet and up — switch to desktop layout */
@media (min-width: 768px) {
  .page {
    padding: 28px 24px 72px;
  }

  .app-nav {
    height: 60px;
    padding: 0 20px;
    gap: 12px;
  }

  .app-logo-text { display: block; }
  .nav-user-label { display: block; }

  .btn {
    font-size: var(--text-xs);
    padding: 8px 16px;
    min-height: 40px;
  }

  .btn-forest {
    font-size: var(--text-xs);
    padding: 7px 14px;
  }

  .page-title { font-size: var(--text-xl); }
  .page-subtitle { font-size: var(--text-sm); margin-bottom: 28px; }

  .card { margin-bottom: 20px; }
  .card-header { padding: 18px 20px; }
  .card-header h2 { font-size: var(--text-base); }
  .card-body { padding: 20px; }

  .stats-row {
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
  }

  .stats-row .stat-card:nth-child(5) {
    grid-column: auto;
  }

  .stat-card { padding: 16px; }

  .two-col {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
  }

  .sidebar-section { padding: 18px 16px; }

  .invoice-table-head {
    display: grid;
    grid-template-columns: 36px 1fr auto auto auto;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--color-divider-light);
    background: var(--color-bone);
    align-items: center;
  }

  .invoice-row {
    grid-template-columns: 36px 1fr auto auto auto;
    padding: 14px 20px;
    gap: 12px;
  }

  .invoice-meta { display: block; text-align: right; }
  .invoice-subject { display: block; }

  .sender-row td { padding: 14px 14px; }
  .sender-thead th { padding: 10px 14px; }

  .confirm-overlay {
    align-items: center;
    padding: 20px;
  }

  .confirm-box {
    border-radius: var(--radius-lg);
    max-width: 420px;
    padding: 28px 24px 24px;
  }

  .confirm-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .confirm-actions .btn {
    width: auto;
  }

  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: var(--radius-xl);
    max-height: 80vh;
  }

  .modal-fields {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .modal-subtitle {
    max-width: none;
  }

  .toast {
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(80px);
    max-width: 320px;
  }

  .toast.visible,
  .toast.show {
    transform: translateX(-50%) translateY(0);
  }
}

/* Large desktop */
@media (min-width: 1024px) {
  .app-nav {
    padding: 0 24px;
  }

  .app-nav-right { gap: 10px; }

  .stats-row { gap: 14px; }
  .stat-card { padding: 18px 16px; }
  .stat-value { font-size: var(--text-xl); }
}

/* ─── ONBOARDING TOUR ─────────────────────────────────────────── */
/* Dimmed overlay that covers the entire viewport */
.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  /* The cutout is applied via clip-path on the highlight element */
}

/* Dark overlay — four rectangles masking everything outside the spotlight */
.tour-mask-top,
.tour-mask-bottom,
.tour-mask-left,
.tour-mask-right {
  position: fixed;
  z-index: 9000;
  background: rgba(14, 59, 46, 0.72);
  pointer-events: all;
  transition: all 240ms ease;
}

/* Spotlight border ring */
.tour-highlight-ring {
  position: fixed;
  z-index: 9001;
  border: 2px solid var(--color-mint-300);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.18);
  pointer-events: none;
  transition: all 240ms ease;
}

/* Tooltip bubble */
.tour-tooltip {
  position: fixed;
  z-index: 9100;
  background: var(--color-forest-900);
  color: #fff;
  border-radius: 12px;
  padding: 18px 20px 16px;
  max-width: min(340px, calc(100vw - 32px));
  box-shadow: var(--shadow-xl);
  font-family: var(--font-sans);
  transition: all 240ms ease;
  pointer-events: all;
}

.tour-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.tour-step-indicator {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-mint-300);
  opacity: 0.8;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.tour-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--motion-fast), background var(--motion-fast);
}
.tour-close-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.tour-tooltip-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  line-height: 1.35;
}

.tour-tooltip-body {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 14px;
}

.tour-tooltip-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-btn-next {
  background: var(--color-mint-300);
  color: var(--color-forest-900);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition: background var(--motion-fast), transform var(--motion-fast);
  white-space: nowrap;
}
.tour-btn-next:hover { background: var(--color-mint-200); transform: translateY(-1px); }
.tour-btn-next:active { transform: none; }

.tour-btn-skip {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 8px 4px;
  min-height: 44px;
  transition: color var(--motion-fast);
}
.tour-btn-skip:hover { color: rgba(255,255,255,0.7); }

/* Step dots */
.tour-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: background var(--motion-fast), width var(--motion-fast);
}
.tour-dot.active {
  background: var(--color-mint-300);
  width: 16px;
  border-radius: 3px;
}

/* Welcome modal (step 1) — centered, mascot style */
.tour-welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tour-welcome-box {
  background: var(--color-forest-900);
  border-radius: 20px;
  padding: 32px 28px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: tour-welcome-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tour-welcome-in {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.tour-welcome-mascot {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  background: var(--color-forest-800);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  /* If mascot image available, it's set via inline style */
}

.tour-welcome-mascot img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.tour-welcome-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.25;
}

.tour-welcome-sub {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.72);
  line-height: 1.65;
  margin-bottom: 24px;
}

.tour-welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tour-welcome-start {
  background: var(--color-mint-300);
  color: var(--color-forest-900);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  min-height: 52px;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.tour-welcome-start:hover { background: var(--color-mint-200); transform: translateY(-1px); }

.tour-welcome-skip {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 8px;
  min-height: 44px;
  transition: color var(--motion-fast);
}
.tour-welcome-skip:hover { color: rgba(255,255,255,0.65); }

/* Finish step */
.tour-finish-modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tour-finish-box {
  background: var(--color-forest-900);
  border-radius: 20px;
  padding: 32px 28px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: tour-welcome-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tour-finish-emoji {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.tour-finish-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
}

.tour-finish-sub {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.72);
  line-height: 1.65;
  margin-bottom: 24px;
}

.tour-finish-cta {
  display: block;
  background: var(--color-mint-300);
  color: var(--color-forest-900);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  min-height: 52px;
  width: 100%;
  text-decoration: none;
  text-align: center;
  transition: background var(--motion-fast);
  margin-bottom: 10px;
}
.tour-finish-cta:hover { background: var(--color-mint-200); }

.tour-finish-later {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 8px;
  min-height: 44px;
  transition: color var(--motion-fast);
}
.tour-finish-later:hover { color: rgba(255,255,255,0.65); }

/* Arrow caret on tooltips */
.tour-tooltip::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--color-forest-900);
  transform: rotate(45deg);
}
.tour-tooltip.arrow-top::before    { top: -5px; left: 20px; }
.tour-tooltip.arrow-bottom::before { bottom: -5px; left: 20px; }
.tour-tooltip.arrow-left::before   { left: -5px; top: 20px; }
.tour-tooltip.arrow-right::before  { right: -5px; top: 20px; }

/* Mobile overrides */
@media (max-width: 640px) {
  .tour-tooltip {
    max-width: calc(100vw - 24px);
    padding: 16px 16px 14px;
  }
  .tour-welcome-box,
  .tour-finish-box {
    padding: 28px 20px 22px;
  }
  .tour-welcome-title,
  .tour-finish-title { font-size: var(--text-lg); }
}

/* ====================================================
   MULTI-INBOX: TABS + BADGE
   ==================================================== */

/* Inbox filter dropdown — compact replacement for old tab strip */
.inbox-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-divider);
}
.inbox-filter-label {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.inbox-select {
  flex: 1;
  max-width: 320px;
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-ink);
  background: var(--color-bone);
  border: 1px solid var(--color-divider);
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
  transition: border-color 120ms;
}
.inbox-select:hover { border-color: var(--color-forest-700); }
.inbox-select:focus {
  outline: none;
  border-color: var(--color-forest-700);
  box-shadow: 0 0 0 2px rgba(22,101,52,0.12);
}

/* Inbox source badge on each invoice row */
.inbox-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-bone);
  color: var(--color-ink-muted);
  border: 1px solid var(--color-divider);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Ingestion-source pill on each FetchBill invoice row (Gmail / Exact Online) */
.row-source-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--color-bone-dark);
  color: var(--color-ink-muted);
  margin-bottom: 4px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  vertical-align: middle;
}
.row-source-tag.row-source-exact {
  background: var(--color-info-bg);
  color: var(--color-info);
}

@media (max-width: 640px) {
  .inbox-select { font-size: 12px; max-width: 100%; }
  .inbox-badge { max-width: 100px; }
}

/* ====================================================
   TRUST TOGGLE BUTTON (per-invoice shield icon)
   ==================================================== */

.btn-trust-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--color-divider);
  background: transparent;
  color: var(--color-ink-ghost);
  cursor: pointer;
  padding: 0;
  transition: color 120ms, background 120ms, border-color 120ms, transform 120ms;
  flex-shrink: 0;
  vertical-align: middle;
}

.btn-trust-toggle:hover {
  color: var(--color-forest-700);
  border-color: var(--color-forest-400);
  background: var(--color-bone);
  transform: scale(1.1);
}

/* Trusted (filled) state */
.btn-trust-toggle.trusted {
  color: var(--color-forest-700);
  background: var(--color-success-bg);
  border-color: var(--color-forest-400);
}

.btn-trust-toggle.trusted:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border-color: rgba(220,38,38,0.3);
  transform: scale(1.1);
}

.btn-trust-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 640px) {
  .btn-trust-toggle {
    width: 28px;
    height: 28px;
  }
}

/* ====================================================
   SETTINGS: TRUSTED SENDER ENTRIES
   ==================================================== */

.trusted-sender-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider-light);
}
.trusted-sender-entry:last-child { border-bottom: none; }

.trusted-sender-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.trusted-sender-domain {
  font-size: var(--text-xs);
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-weight: 600;
}

.trusted-sender-name {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  font-style: italic;
}

.trusted-sender-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.trusted-sender-badge.badge-active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.trusted-sender-badge.badge-paused {
  background: var(--color-bone);
  color: var(--color-ink-muted);
}

.btn-trusted-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-ink-ghost);
  font-size: 16px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--motion-fast);
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-trusted-remove:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* ─── CHAT BUBBLE ──────────────────────────────────────────────────────────── */

/* Floating action button */
#bonnio-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 12px 14px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(14,59,46,0.35);
  transition: background var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
  min-height: 48px;
  white-space: nowrap;
}
#bonnio-chat-bubble:hover {
  background: var(--color-forest-700);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14,59,46,0.45);
}
#bonnio-chat-bubble.active {
  background: var(--color-forest-700);
}
.chat-bubble-label {
  letter-spacing: 0.01em;
}

/* Chat panel */
#bonnio-chat-panel {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 999;
  width: 400px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(14,59,46,0.18), 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}
#bonnio-chat-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}
#bonnio-chat-panel.chat-drag-over {
  border-color: var(--color-forest-500);
  box-shadow: 0 8px 32px rgba(14,59,46,0.25), 0 0 0 3px rgba(45,138,98,0.2);
}

/* Panel header */
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 12px 16px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-shrink: 0;
}
.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.chat-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-mint-200);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: background var(--motion-fast), color var(--motion-fast);
  min-width: 28px;
  min-height: 28px;
  justify-content: center;
}
.chat-close-btn:hover {
  background: rgba(110,231,183,0.15);
  color: #fff;
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  max-height: 480px;
}
.chat-msg {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.55;
  max-width: 100%;
  word-break: break-word;
}
.chat-msg-bot {
  background: var(--color-bone);
  color: var(--color-ink);
  border-bottom-left-radius: var(--radius-sm);
  align-self: flex-start;
}
.chat-msg-user {
  background: var(--color-forest-900);
  color: var(--color-mint-200);
  border-bottom-right-radius: var(--radius-sm);
  align-self: flex-end;
  font-size: var(--text-xs);
}
.chat-loading {
  color: var(--color-ink-muted);
  font-style: italic;
}

/* Input area */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--color-divider-light);
  background: var(--color-bone);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-shrink: 0;
}
.chat-file-label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--motion-fast);
  white-space: nowrap;
  min-height: 36px;
  flex-shrink: 0;
}
.chat-file-label:hover {
  background: var(--color-forest-700);
}
.chat-input-hint {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  line-height: 1.4;
}

/* Transaction list */
.tx-list-header {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.tx-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.tx-row {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  font-size: 11px;
  border-bottom: 1px solid var(--color-divider-light);
  line-height: 1.3;
}
.tx-row:last-child { border-bottom: none; }
.tx-date {
  color: var(--color-ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 10px;
}
.tx-desc {
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
  font-size: 11px;
}
.tx-credit { color: var(--color-success); }
.tx-debet  { color: var(--color-danger); }
.tx-truncated {
  padding: 5px 8px;
  font-size: 10px;
  color: var(--color-ink-ghost);
  text-align: center;
  font-style: italic;
}
.chat-match-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-ink-muted);
  line-height: 1.45;
}

/* Inbox selector */
.chat-inbox-selector p {
  margin: 0 0 8px;
  font-size: var(--text-xs);
  color: var(--color-ink-secondary);
}
.chat-inbox-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-inbox-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: var(--text-xs);
  color: var(--color-ink);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--motion-fast), background var(--motion-fast);
  min-height: 40px;
}
.chat-inbox-btn:hover {
  border-color: var(--color-forest-500);
  background: var(--color-bone);
}

/* Match button */
.chat-match-actions {
  margin-top: 10px;
}
.chat-match-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: background var(--motion-fast);
  min-height: 40px;
}
.chat-match-btn:hover:not(:disabled) { background: var(--color-forest-700); }
.chat-match-btn:disabled { opacity: 0.6; cursor: wait; }

/* Match results summary bar */
.match-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.match-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 99px;
}
.match-found    { background: var(--color-success-bg);  color: var(--color-success); }
.match-possible { background: var(--color-warning-bg);  color: var(--color-warning); }
.match-notfound { background: var(--color-danger-bg);   color: var(--color-danger); }

/* Match cards section header */
.match-cards-header {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 10px 0 5px;
}
.match-notfound-header { color: var(--color-ink-ghost); }

/* Individual match card */
.match-cards {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.match-card {
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
}
.match-card-found   { border-left: 3px solid var(--color-success); }
.match-card-possible { border-left: 3px solid var(--color-warning); }

.match-card-tx {
  display: grid;
  grid-template-columns: 18px 75px 1fr auto;
  gap: 5px;
  align-items: center;
  padding: 6px 8px;
  font-size: 11px;
  background: var(--color-bone);
  border-bottom: 1px solid var(--color-divider-light);
}
.match-status-icon { font-size: 12px; line-height: 1; }

.match-card-inv {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 5px;
  align-items: center;
  padding: 6px 8px;
  font-size: 11px;
}
.match-inv-sender {
  color: var(--color-ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-inv-num {
  color: var(--color-ink-muted);
  white-space: nowrap;
  font-size: 10px;
}
.match-inv-date {
  color: var(--color-ink-muted);
  white-space: nowrap;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.match-inv-amount {
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

/* Checkbox for confirmed matches */
.match-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--color-ink-muted);
  cursor: pointer;
  white-space: nowrap;
}
.match-checkbox-label[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.match-checkbox {
  accent-color: var(--color-forest-500);
  cursor: pointer;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Candidate selection for possible matches */
.match-card-candidates {
  padding: 8px;
}
.match-candidates-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-warning);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.match-candidate-row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto auto auto;
  gap: 5px;
  align-items: center;
  padding: 5px 6px;
  border-radius: var(--radius-xs, 3px);
  font-size: 11px;
  cursor: pointer;
  transition: background var(--motion-fast);
  margin-bottom: 3px;
  border: 1px solid var(--color-divider-light);
  background: var(--color-surface);
}
.match-candidate-row:hover { background: var(--color-bone); }
.match-candidate-radio {
  accent-color: var(--color-warning);
  cursor: pointer;
  flex-shrink: 0;
}
.match-has-pdf {
  font-size: 9px;
  font-weight: 700;
  background: var(--color-info-bg);
  color: var(--color-info);
  padding: 1px 5px;
  border-radius: 99px;
}

/* Not found list */
.match-notfound-list {
  border: 1px solid var(--color-divider-light);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  overflow: hidden;
}
.match-notfound-row {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  font-size: 11px;
  border-bottom: 1px solid var(--color-divider-light);
  opacity: 0.7;
}
.match-notfound-row:last-child { border-bottom: none; }

/* Download bar */
.match-download-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: var(--color-bone);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.match-download-hint {
  flex: 1;
  font-size: 11px;
  color: var(--color-ink-muted);
  min-width: 120px;
}
.chat-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: var(--color-forest-900);
  color: var(--color-mint-300);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--motion-fast);
  white-space: nowrap;
  min-height: 38px;
}
.chat-download-btn:hover:not(:disabled) { background: var(--color-forest-700); }
.chat-download-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mobile: full-screen panel */
@media (max-width: 640px) {
  #bonnio-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  .match-card-inv {
    grid-template-columns: 1fr auto auto;
    flex-wrap: wrap;
  }
  .match-inv-num, .match-inv-date { display: none; }
}
