@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;600&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-subtle: #f0f4f2;
  --border: #dfe5e2;
  --border-strong: #c8d2ce;
  --text: #0f1f1c;
  --text-muted: #5a6b66;
  --text-soft: #7b8c87;

  --primary: #0f766e;
  --primary-hover: #0d625b;
  --primary-soft: #e6f4f1;
  --primary-contrast: #ffffff;

  --income: #059669;
  --income-soft: #ecfdf5;
  --expense: #e11d48;
  --expense-soft: #fff1f2;
  --transfer: #d97706;
  --transfer-soft: #fffbeb;
  --info: #0284c7;
  --info-soft: #f0f9ff;

  --shadow-xs: 0 1px 2px rgba(15, 31, 28, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 31, 28, 0.05);
  --shadow-md: 0 10px 28px rgba(15, 31, 28, 0.09);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #0c1211;
  --surface: #131c1a;
  --surface-subtle: #1a2523;
  --border: #253330;
  --border-strong: #324440;
  --text: #eef4f2;
  --text-muted: #98aba5;
  --text-soft: #71857f;

  --primary: #14b8a6;
  --primary-hover: #0d9488;
  --primary-soft: rgba(20, 184, 166, 0.14);
  --primary-contrast: #071917;

  --income: #34d399;
  --income-soft: rgba(52, 211, 153, 0.12);
  --expense: #fb7185;
  --expense-soft: rgba(251, 113, 133, 0.13);
  --transfer: #fbbf24;
  --transfer-soft: rgba(251, 191, 36, 0.13);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.12);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.num,
.money-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

/* =========================================================
   AUTH SCREEN (index.html)
   ========================================================= */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(1.5rem + var(--safe-top)) 1rem calc(1.5rem + var(--safe-bottom));
  background: var(--bg);
}

.auth-shell {
  width: 100%;
  max-width: 430px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.auth-logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--primary);
  color: var(--primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.auth-brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-brand p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.auth-card {
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
  background: var(--surface-subtle);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 1.15rem;
}

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.6rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.seg-btn.active[data-type="income"] {
  color: var(--income);
}

.seg-btn.active[data-type="expense"] {
  color: var(--expense);
}

.seg-btn.active[data-type="transfer"] {
  color: var(--transfer);
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */
.form-group {
  margin-bottom: 0.95rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-textarea {
  min-height: 76px;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-prefix .form-input {
  padding-left: 2.65rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.chip-btn {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* =========================================================
   BUTTONS & ALERTS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.6rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}

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

.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.78rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--expense);
  border-color: var(--border);
}

.btn-danger-outline:hover {
  background: var(--expense-soft);
  border-color: var(--expense);
}

.alert-box {
  padding: 0.72rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--expense-soft);
  color: var(--expense);
  border-color: rgba(225, 29, 72, 0.25);
}

.alert-success {
  background: var(--income-soft);
  color: var(--income);
  border-color: rgba(5, 150, 105, 0.25);
}

.alert-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(2, 132, 199, 0.22);
}

.alert-warning {
  background: var(--transfer-soft);
  color: var(--transfer);
  border-color: rgba(217, 119, 6, 0.25);
}

/* =========================================================
   APP SHELL (app.html)
   ========================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(0.65rem + var(--safe-top)) 1rem 0.65rem;
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  padding: 0.48rem 0.82rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-link:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--income);
}

.status-dot.offline {
  background: var(--transfer);
}

.status-dot.local {
  background: var(--info);
}

.app-main {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: 1.1rem 1rem calc(5.8rem + var(--safe-bottom));
}

.desktop-only {
  display: none;
}

/* =========================================================
   HERO BALANCE & KPI GRID
   ========================================================= */
.balance-hero {
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 1.35rem 1.35rem 1.25rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1rem;
  position: relative;
}

[data-theme="dark"] .balance-hero {
  background: #0d4f49;
  border: 1px solid #1b6b63;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.hero-label {
  font-size: 0.8rem;
  opacity: 0.9;
  font-weight: 500;
  white-space: nowrap;
}

.icon-ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.hero-amount {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.quick-act-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.58rem 0.5rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background-color 0.15s ease;
}

.quick-act-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-xs);
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kpi-val {
  font-size: 1.18rem;
  font-weight: 700;
}

.text-income {
  color: var(--income);
}

.text-expense {
  color: var(--expense);
}

.text-transfer {
  color: var(--transfer);
}

.text-muted {
  color: var(--text-muted);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* =========================================================
   WALLET STRIP & LISTS
   ========================================================= */
.wallet-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.wallet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wallet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.wallet-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.wallet-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.wallet-bal {
  font-size: 1.12rem;
  font-weight: 700;
}

/* =========================================================
   CHARTS & BUDGET PROGRESS
   ========================================================= */
.chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.chart-tooltip {
  margin-top: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.donut-layout {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1rem;
  align-items: center;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.budget-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.budget-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.progress-track {
  height: 8px;
  width: 100%;
  background: var(--surface-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.25s ease;
}

.progress-fill.warn {
  background: var(--transfer);
}

.progress-fill.over {
  background: var(--expense);
}

/* =========================================================
   TRANSACTION LIST
   ========================================================= */
.tx-date-group {
  margin-bottom: 1rem;
}

.tx-date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.15rem;
}

.tx-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.82rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.tx-row:last-child {
  border-bottom: none;
}

.tx-row:hover {
  background: var(--surface-subtle);
}

.tx-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.tx-type-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.tx-type-badge.income {
  background: var(--income-soft);
  color: var(--income);
}

.tx-type-badge.expense {
  background: var(--expense-soft);
  color: var(--expense);
}

.tx-type-badge.transfer {
  background: var(--transfer-soft);
  color: var(--transfer);
}

.tx-meta {
  min-width: 0;
}

.tx-title {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.tx-amount {
  font-weight: 700;
  font-size: 0.95rem;
}

.tx-time {
  font-size: 0.74rem;
  color: var(--text-soft);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

/* =========================================================
   MOBILE BOTTOM NAVIGATION
   ========================================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 0.35rem 0.25rem calc(0.35rem + var(--safe-bottom));
  box-shadow: 0 -4px 16px rgba(15, 31, 28, 0.06);
}

.bnav-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.32rem 0.2rem;
  cursor: pointer;
}

.bnav-btn.active {
  color: var(--primary);
}

.bnav-add {
  width: 48px;
  height: 48px;
  margin: -18px auto 0;
  border-radius: 15px;
  background: var(--primary);
  color: var(--primary-contrast);
  border: 3px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* =========================================================
   MODALS & PIN OVERLAY
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12, 18, 17, 0.56);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-panel {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  padding: 1.25rem 1.25rem calc(1.35rem + var(--safe-bottom));
  box-shadow: var(--shadow-md);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-close {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 1.1rem;
  cursor: pointer;
}

.receipt-preview {
  margin-top: 0.5rem;
  position: relative;
  display: inline-block;
}

.receipt-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
}

.toast {
  position: fixed;
  top: auto;
  bottom: calc(5.2rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  background: var(--text);
  color: var(--surface);
  padding: 0.52rem 0.95rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.report-table th,
.report-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.report-table th {
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.report-table td.right,
.report-table th.right {
  text-align: right;
}

/* =========================================================
   OCR SCANNER & MANUAL VERIFICATION CHECK MODE
   ========================================================= */
.ocr-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.ocr-toolbar .btn-ocr {
  flex: 1 1 200px;
}

.btn-ocr {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(15, 118, 110, 0.28);
}

.btn-ocr:hover {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: var(--primary);
}

.ocr-panel {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.78rem 0.9rem;
  margin-bottom: 0.9rem;
}

.ocr-raw-details {
  margin-bottom: 0.6rem;
  font-size: 0.78rem;
}

.ocr-raw-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  user-select: none;
}

.ocr-raw-pre {
  margin-top: 0.45rem;
  padding: 0.55rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 135px;
  overflow-y: auto;
  color: var(--text);
}

.ocr-autofilled {
  border-color: var(--primary) !important;
  background-color: var(--primary-soft) !important;
}

.verif-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.verif-choice-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.42rem 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.verif-choice-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.verif-choice-btn.active[data-verif-choice="unverified"] {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.verif-choice-btn.active[data-verif-choice="needs_review"] {
  background: var(--transfer-soft);
  color: var(--transfer);
  border-color: var(--transfer);
}

.verif-choice-btn.active[data-verif-choice="verified"] {
  background: var(--income-soft);
  color: var(--income);
  border-color: var(--income);
}

.verif-choice-btn.active[data-verif-choice="mismatch"] {
  background: var(--expense-soft);
  color: var(--expense);
  border-color: var(--expense);
}

.verif-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--transfer-soft);
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: var(--radius-lg);
  padding: 0.78rem 1rem;
  margin-bottom: 1rem;
}

.verif-banner-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.verif-banner-text {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.verif-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.verif-badge-pill.verified,
.verif-badge-pill.ok {
  background: var(--income-soft);
  color: var(--income);
}

.verif-badge-pill.needs_review,
.verif-badge-pill.warn {
  background: var(--transfer-soft);
  color: var(--transfer);
}

.verif-badge-pill.mismatch,
.verif-badge-pill.bad {
  background: var(--expense-soft);
  color: var(--expense);
}

.verif-badge-pill.unverified,
.verif-badge-pill.neutral {
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.count-pill {
  background: var(--transfer);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
}

.btn-verify-toggle-active {
  background: var(--primary) !important;
  color: var(--primary-contrast) !important;
  border-color: var(--primary) !important;
}

.verify-mode-bar {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.verify-only-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.verify-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.verify-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-xs);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.verify-card.status-verified {
  border-left: 4px solid var(--income);
}

.verify-card.status-needs_review {
  border-left: 4px solid var(--transfer);
}

.verify-card.status-mismatch {
  border-left: 4px solid var(--expense);
}

.verify-evidence-col {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.verify-thumb-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: zoom-in;
}

.verify-thumb-wrap img {
  width: 100%;
  max-height: 185px;
  object-fit: cover;
  display: block;
}

.verify-thumb-caption {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  padding: 0.25rem;
  color: var(--primary);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.verify-no-receipt {
  padding: 1.15rem 0.65rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.verify-data-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.verify-actions-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.verify-ok-btn {
  background: var(--income-soft);
  color: var(--income);
  border-color: rgba(5, 150, 105, 0.3);
}

.verify-ok-btn:hover {
  background: var(--income);
  color: #ffffff;
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .donut-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .verif-choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-bar {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }
  #filterSearch,
  #filterMonth,
  #filterVerification,
  #view-reports .filter-bar .form-group {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
  }
  .desktop-only {
    display: inline-flex;
  }
  .bottom-nav {
    display: none;
  }
  .app-main {
    padding: 1.5rem 1.25rem 2.5rem;
  }
  .dashboard-grid {
    grid-template-columns: 1.35fr 1fr;
  }
  .modal-backdrop {
    align-items: center;
    padding: 1rem;
  }
  .modal-panel {
    border-radius: var(--radius-xl);
    padding: 1.5rem;
  }
  .verify-card {
    grid-template-columns: 240px 1fr;
  }
  .toast {
    bottom: 1.35rem;
  }
}

@media (min-width: 900px) {
  #view-transactions .filter-bar {
    grid-template-columns: 1.6fr 1fr 0.85fr 0.95fr 1.15fr;
  }
}

@media print {
  .app-header,
  .bottom-nav,
  .no-print {
    display: none !important;
  }
  .app-main {
    padding: 0;
    max-width: 100%;
  }
  body {
    background: #ffffff;
    color: #000000;
  }
}
