/* ============================================================
   NIGHT LEDGER — Finance Analysis Tool
   Space Grotesk + Space Mono · dark #080808 · minimal
   ============================================================ */

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

:root {
  --bg:          #080808;
  --bg-1:        #0f0f0f;
  --bg-2:        #141414;
  --bg-3:        #1a1a1a;
  --border:      #222222;
  --border-soft: #1a1a1a;
  --border-focus:#444444;
  --text:        #e2e2e2;
  --text-muted:  #555555;
  --text-dim:    #2a2a2a;
  --accent:      #e2e2e2;
  --white:       #ffffff;
  --ok:          #4ade80;
  --warn:        #facc15;
  --err:         #f87171;
  --info:        #60a5fa;
  --font-sans: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --nav-h: 56px;
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 15px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ── Typography ─────────────────────────────────────────── */

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

.mono-inp {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.label-xs {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.4rem;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.5;
}

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

/* ── NAVBAR ─────────────────────────────────────────────── */

#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--white);
  flex-shrink: 0;
  text-align: left;
}

.nav-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}

/* ── BUTTONS ────────────────────────────────────────────── */

.btn-primary, .btn-secondary, .btn-danger {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.6) 0%, rgba(96, 165, 250, 0.4) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 8px 24px rgba(96, 165, 250, 0.15);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.75) 0%, rgba(96, 165, 250, 0.55) 100%);
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 12px 32px rgba(96, 165, 250, 0.25);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: var(--err);
  border-color: var(--border);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.08);
  border-color: var(--err);
}

.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-icon:hover {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border-focus);
}

.btn-filter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 6px 10px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-filter:hover {
  background: var(--bg-2);
  border-color: var(--border-focus);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.btn-close:hover {
  color: var(--err);
}

/* ── INPUTS & SELECTS ────────────────────────────────────── */

.inp, .text-input, .select-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 8px 11px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  -webkit-appearance: none;
}

.inp:focus, .text-input:focus, .select-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-3);
}

.inp::placeholder, .text-input::placeholder, .select-input::placeholder {
  color: var(--text-dim);
}

textarea.inp, textarea.text-input {
  resize: vertical;
  min-height: 72px;
  font-family: var(--font-mono);
}

select.select-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

input[type="password"] {
  font-family: monospace;
  letter-spacing: 0.2em;
}

input[type="date"] {
  font-family: var(--font-mono);
}

input[type="number"] {
  font-family: var(--font-mono);
}

/* ── LAYOUT ─────────────────────────────────────────────── */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 60px;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── DASHBOARD ──────────────────────────────────────────── */

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-focus);
  background: var(--bg-2);
}

.card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.card-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
}

.card-income {
  border-color: rgba(74, 222, 128, 0.2);
}

.card-expense {
  border-color: rgba(248, 113, 113, 0.2);
}

.card-balance {
  border-color: rgba(96, 165, 250, 0.2);
}

/* ── SECTIONS ────────────────────────────────────────────– */

.section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.link-small {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}

.link-small:hover {
  color: var(--text);
}

/* ── ACCOUNTS ────────────────────────────────────────────– */

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-row {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.account-row:hover {
  background: var(--bg-3);
  border-color: var(--border);
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.account-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.account-type {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.account-balance {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.balance-checking {
  color: var(--info);
}

.balance-savings {
  color: var(--ok);
}

.balance-credit {
  color: var(--warn);
}

/* ── CATEGORY BREAKDOWN ─────────────────────────────────── */

.category-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-emoji {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

.bar-container {
  flex: 1;
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition);
}

.category-amount {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  min-width: 80px;
  text-align: right;
}

/* ── TRANSACTIONS ────────────────────────────────────────– */

.transactions-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 8px 11px;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus {
  border-color: var(--border-focus);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.txn-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.txn-group-header {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  padding: 0.5rem 0.75rem;
}

.txn-row {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.txn-row:hover {
  background: var(--bg-3);
  border-color: var(--border);
}

.txn-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.txn-desc {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.txn-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.txn-category {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.txn-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 100px;
  text-align: right;
}

.txn-amount.positive {
  color: var(--ok);
}

.txn-amount.negative {
  color: var(--err);
}

.transactions-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── BUDGET ────────────────────────────────────────────── */

.budget-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.budget-month {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.month-label {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  min-width: 150px;
  text-align: center;
}

.btn-nav {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-family: var(--font-mono);
  font-weight: 600;
}

.btn-nav:hover {
  background: var(--bg-2);
  border-color: var(--border-focus);
}

.budget-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.budget-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--transition), background var(--transition);
}

.budget-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-2);
}

.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.budget-category {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.budget-amount {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.budget-bar {
  height: 6px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.budget-footer {
  font-size: 0.7rem;
  font-family: var(--font-mono);
}

.budget-remaining {
  color: var(--ok);
}

.budget-over {
  color: var(--err);
}

/* ── GOALS ──────────────────────────────────────────────– */

.goals-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.goals-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.goal-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color var(--transition), background var(--transition);
}

.goal-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-2);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.goal-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.goal-target {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

.progress-ring-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-bg {
  fill: none;
  stroke: var(--bg-3);
  stroke-width: 3;
}

.progress-fill {
  fill: none;
  stroke: var(--info);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition);
  stroke-dasharray: 282.7;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.goal-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.goal-info p {
  margin: 0;
}

/* ── SETTINGS ────────────────────────────────────────────– */

.settings-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 600px;
}

.settings-section {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-section h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin: 0;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.setting-row label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.status-badge {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
  margin-top: 0.25rem;
}

.status-badge.idle {
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: transparent;
}

.status-badge.testing {
  color: var(--warn);
  border: 1px solid rgba(250, 204, 21, 0.3);
  background: rgba(250, 204, 21, 0.06);
  animation: pulse 1.5s infinite;
}

.status-badge.ok {
  color: var(--ok);
  border: 1px solid rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.06);
}

.status-badge.error {
  color: var(--err);
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.06);
}

.setting-inline-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-small {
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
}

.model-meta-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
}

.model-meta-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.model-capability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.model-capability-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.08);
  color: #93c5fd;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.model-stat-line {
  font-size: 0.78rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── EMPTY STATE ────────────────────────────────────────– */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  gap: 0.75rem;
}

.empty-icon {
  font-size: 2.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  margin: 0;
}

/* ── NAVIGATION SYSTEM ──────────────────────────────────– */

.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: max-content;
}

.desktop-nav-wrap {
  flex: 1;
  min-width: 0;
}

.nav-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.nav-primary-action:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08));
}

.app-tabbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.app-tabbar-desktop {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.25rem;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  background: rgba(255,255,255,0.025);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.app-tabbar-desktop::-webkit-scrollbar,
.app-tabbar-mobile::-webkit-scrollbar {
  display: none;
}

.app-tabbar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0.72rem 0.9rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.app-tabbar-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.app-tabbar-btn.active {
  color: var(--white);
  border-color: rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 24px rgba(0, 0, 0, 0.18);
}

.app-tabbar-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.app-tabbar-label {
  white-space: nowrap;
}

.app-tabbar-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 18px;
  height: 18px;
  padding: 0 0.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--white);
  background: rgba(239, 68, 68, 0.9);
  box-shadow: 0 0 0 3px var(--bg);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(100% - 20px, 900px);
  padding: 0.45rem;
  overflow-x: auto;
  z-index: 60;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.app-tabbar-mobile {
  gap: 0.35rem;
}

.app-tabbar-mobile .app-tabbar-btn {
  min-width: 76px;
  min-height: 54px;
  padding: 0.45rem 0.6rem;
  flex-direction: column;
  gap: 0.22rem;
  font-size: 0.62rem;
}

.app-tabbar-mobile .app-tabbar-icon {
  font-size: 1rem;
}

/* ── FAB (Floating Action Button) ────────────────────────– */

.fab {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(20, 20, 20, 0.92);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.fab:hover {
  background: rgba(26, 26, 26, 0.98);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.fab:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
}

/* ── MODALS & OVERLAYS ──────────────────────────────────– */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-overlay-transaction {
  backdrop-filter: blur(8px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bottom-sheet {
  width: 100%;
  background: linear-gradient(180deg, rgba(20,20,20,0.98), rgba(8,8,8,0.98));
  border-top: 1px solid rgba(255,255,255,0.08);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  max-height: 90dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.45);
}

.transaction-shell {
  position: relative;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(15,15,15,0.98), rgba(10,10,10,0.96));
  z-index: 10;
  flex-shrink: 0;
  backdrop-filter: blur(14px);
}

.sheet-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
}

.modal-shell-kicker {
  margin-bottom: 0.3rem;
  color: #9ca3af;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mode-tabs.sheet-tabs,
.sheet-tabs {
  display: flex;
  gap: 0.45rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.018);
  padding: 0.65rem 1rem;
  flex-shrink: 0;
  overflow-x: auto;
}

.sheet-tab {
  flex: 1;
  min-width: 120px;
  padding: 0.85rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.sheet-tab.active {
  color: rgba(96, 165, 250, 1);
  border-color: rgba(96, 165, 250, 0.35);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.15) 0%, rgba(96, 165, 250, 0.06) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 16px rgba(96, 165, 250, 0.12);
}

.sheet-tab-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.sheet-content {
  padding: 1rem 1rem 5.5rem 1rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── SHEET FOOTER (Action buttons) ───────────────────────– */

.sheet-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(8, 8, 8, 0), rgba(8, 8, 8, 0.96));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.sheet-footer button {
  flex: 1;
  min-height: 44px;
}

.sheet-footer .btn-secondary {
  font-weight: 500;
}

.sheet-footer .btn-primary {
  font-weight: 600;
}

/* ── FORM SECTIONS ──────────────────────────────────────– */

.form-section {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.amount-input {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  outline: none;
  padding: 1rem 1.1rem;
  text-align: center;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.amount-input:focus {
  border-color: rgba(96,165,250,0.45);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 0 0 4px rgba(96,165,250,0.08);
}

.amount-input::placeholder {
  color: var(--text-dim);
}

/* ── CHIPS & PILLS ──────────────────────────────────────– */

.category-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.55rem;
}

.chip {
  padding: 0.75rem 0.85rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
  font-family: var(--font-sans);
  font-weight: 500;
  text-align: left;
}

.chip:hover {
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,0.12);
  color: var(--text);
  transform: translateY(-1px);
}

.chip.active {
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.08));
  border-color: rgba(255,255,255,0.18);
  color: var(--white);
}

/* ── CONTEXT MENU ────────────────────────────────────────– */

.context-menu {
  position: fixed;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 300;
  min-width: 180px;
  padding: 0;
  list-style: none;
  animation: fadeIn 0.15s ease;
}

.ctx-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition), color var(--transition);
}

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

.ctx-item:hover {
  background: var(--bg-3);
  color: var(--white);
}

.ctx-item.danger:hover {
  background: rgba(248, 113, 113, 0.15);
  color: var(--err);
}

/* ── TOAST NOTIFICATIONS ────────────────────────────────– */
.toast-viewport {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 500;
  pointer-events: none;
}

.toast-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.toast-card {
  width: min(420px, calc(100vw - 32px));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(14, 14, 18, 0.96) 0%, rgba(28, 28, 36, 0.96) 100%);
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
  overflow: hidden;
}

.toast-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
}

.toast-message {
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.toast-close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  margin-top: 1px;
  transition: color var(--transition), transform var(--transition);
}

.toast-close:hover {
  color: var(--white);
  transform: scale(1.05);
}

.toast-success {
  border-left: 3px solid rgba(74, 222, 128, 0.95);
}

.toast-warning {
  border-left: 3px solid rgba(250, 204, 21, 0.95);
}

.toast-error {
  border-left: 3px solid rgba(248, 113, 113, 0.95);
}

.toast-info {
  border-left: 3px solid rgba(96, 165, 250, 0.95);
}

.toast-list-enter-active,
.toast-list-leave-active {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-list-enter-from,
.toast-list-leave-to {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
}

.toast-list-move {
  transition: transform 0.22s ease;
}

/* ── PHASE 1: AI INSIGHTS BANNER ────────────────────────– */

.ai-insight-banner {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(168, 85, 247, 0.05) 100%);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: var(--r-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.insight-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.insight-content {
  flex: 1;
}

.insight-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.insight-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.insight-text.loading {
  color: var(--text-muted);
  font-style: italic;
}

.insight-refresh {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--r-sm);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.insight-refresh:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.insight-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── PHASE 1: CARD SPARKLINES & DELTAS ──────────────────– */

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

.delta-badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
}

.delta-badge.up {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.delta-badge.down {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.delta-badge.flat {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

.card-sparkline {
  margin-top: 0.5rem;
  height: 30px;
  width: 100%;
}

.sparkline-chart {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── PHASE 1: CATEGORY PREDICTIONS ──────────────────────– */

.category-predictions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
  animation: slideIn 0.2s ease-out;
}

.prediction-loading {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-style: italic;
}

.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.predicted-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prediction-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prediction-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.prediction-chip {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(168, 85, 247, 0.05) 100%);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: var(--r-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.prediction-chip:hover {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-color: rgba(96, 165, 250, 0.4);
  transform: translateY(-1px);
}

.prediction-chip:active {
  transform: translateY(0);
  background: rgba(96, 165, 250, 0.15);
}

.confidence {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.25rem;
}

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

@media (max-width: 768px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .goals-list {
    grid-template-columns: 1fr;
  }

  .nav-btn .nav-label {
    font-size: 0.6rem;
  }

  .btn-primary, .btn-secondary, .btn-danger {
    padding: 7px 12px;
    font-size: 0.65rem;
  }

  .tab-content {
    padding: 1rem;
  }
}

/* ==================== Phase 2: Recurring Transactions & Smart Budgets ==================== */

/* Checkbox styling */
.checkbox-input {
  margin-right: 0.5rem;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #e2e2e2;
}

.form-group label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

/* Budget suggestion banner */
.suggestion-banner {
  background: linear-gradient(135deg, rgba(147, 112, 219, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
}

.suggestion-header {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
}

.suggestion-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.suggestion-content {
  flex: 1;
}

.suggestion-label {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.suggestion-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Budget comparison in cards */
.budget-suggestion {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.85rem;
}

.budget-suggestion .suggestion-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.suggestion-comparison {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
}

.suggestion-comparison.above {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.suggestion-comparison.below {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.comparison-text {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ======================================================
   PHASE 3: Advanced Search & Filter UX
   ====================================================== */

.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  position: relative;
}

.filter-bar .search-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 0.95rem;
  transition: var(--transition);
}

.filter-bar .search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-2);
}

.btn-filter {
  position: relative;
  padding: 0.5rem 0.75rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.btn-filter:hover {
  border-color: var(--border-focus);
  background: var(--bg-2);
}

.btn-filter.active {
  background: var(--bg-3);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  margin-left: 4px;
  background: var(--err);
  color: var(--white);
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
}

.filter-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  margin-bottom: 1rem;
  animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-section {
  margin-bottom: 1rem;
}

.filter-section:last-of-type {
  margin-bottom: 0.5rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-input {
  flex: 1;
  padding: 0.5rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.9rem;
  transition: var(--transition);
}

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

.filter-separator {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.4rem 0.75rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.filter-chip:hover {
  border-color: var(--border-focus);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.filter-select {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

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

.filter-select option {
  background: var(--bg-1);
  color: var(--text);
}

.filter-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  flex: 1;
}

.results-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid var(--info);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  color: var(--info);
  margin-bottom: 1rem;
}

.clear-link {
  background: none;
  border: none;
  color: var(--info);
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.85rem;
  padding: 0;
  transition: var(--transition);
}

.clear-link:hover {
  color: var(--white);
}

.filter-panel mark {
  background: rgba(250, 204, 21, 0.3);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: var(--err);
  color: var(--white);
  border-radius: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  position: absolute;
  top: -4px;
  right: -4px;
}

/* Mobile adjustments for new elements */
@media (max-width: 640px) {
  .suggestion-banner {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .suggestion-header {
    gap: 0.5rem;
  }
  
  .suggestion-icon {
    font-size: 1rem;
  }
  
  .suggestion-label,
  .suggestion-text {
    font-size: 0.8rem;
  }
  
  .budget-suggestion {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }

  /* Phase 3: Mobile filter adjustments */
  .filter-panel {
    padding: 0.75rem;
  }

  .filter-section {
    margin-bottom: 0.75rem;
  }

  .filter-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .filter-input {
    width: 100%;
  }

  .filter-separator {
    display: none;
  }

  .filter-chips {
    gap: 0.35rem;
  }

  .filter-chip {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
  }

  .filter-footer {
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
  }

  .btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  .results-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* ========================================
   PHASE 4: QUICK WINS STYLING
   ======================================== */

/* Theme Toggle */
.theme-toggle-row {
  display: flex;
  gap: 0.5rem;
}

.theme-toggle-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.theme-toggle-btn:hover {
  border-color: var(--accent);
  background: var(--bg-1);
}

.theme-toggle-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Merchant Autocomplete */
.merchant-autocomplete {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
  padding: 0.6rem 1rem;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  transition: var(--transition);
  font-size: 0.9rem;
}

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

.autocomplete-item:hover {
  background: var(--bg-2);
  color: var(--accent);
}

/* Tags Input */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-2);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  transition: var(--transition);
}

.tag-remove:hover {
  color: var(--err);
}

/* Transaction Tags Display */
.txn-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.txn-tag {
  display: inline-block;
  background: var(--bg-2);
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Light Mode Theme Variables */
[data-theme="light"] {
  --bg:          #ffffff;
  --bg-1:        #f8f8f8;
  --bg-2:        #f0f0f0;
  --bg-3:        #e8e8e8;
  --border:      #d0d0d0;
  --border-soft: #e0e0e0;
  --border-focus:#a0a0a0;
  --text:        #1a1a1a;
  --text-muted:  #666666;
  --text-dim:    #cccccc;
  --accent:      #333333;
}

[data-theme="light"] .navbar,
[data-theme="light"] #nav {
  background: #fafafa;
  border-bottom-color: #d0d0d0;
}

[data-theme="light"] .card {
  background: #f8f8f8;
  border-color: #d0d0d0;
}

[data-theme="light"] .section {
  background: #f8f8f8;
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .bottom-sheet {
  background: #f8f8f8;
  border-color: #d0d0d0;
}

[data-theme="light"] .text-input,
[data-theme="light"] .select-input,
[data-theme="light"] .textarea-input {
  background: white;
  color: #1a1a1a;
  border-color: #d0d0d0;
}

[data-theme="light"] .text-input:focus,
[data-theme="light"] .select-input:focus,
[data-theme="light"] .textarea-input:focus {
  border-color: #666666;
  background: white;
}

[data-theme="light"] .btn-primary {
  background: #1a1a1a;
  color: white;
}

[data-theme="light"] .btn-primary:hover {
  background: #333333;
}

[data-theme="light"] .btn-secondary {
  background: #f0f0f0;
  color: #1a1a1a;
  border-color: #d0d0d0;
}

[data-theme="light"] .btn-secondary:hover {
  background: #e0e0e0;
}

[data-theme="light"] .chip.active {
  background: #1a1a1a;
  color: white;
}

[data-theme="light"] .filter-chip.active {
  background: #1a1a1a;
  color: white;
}

[data-theme="light"] .autocomplete-dropdown {
  background: #f8f8f8;
  border-color: #d0d0d0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .autocomplete-item:hover {
  background: #f0f0f0;
  color: #1a1a1a;
}

/* ==================== Phase 5 & 6: Analytics & Advanced Features ==================== */

/* Analytics Tab */
.analytics {
  padding: var(--spacing-md);
}

/* Heatmap */
.heatmap-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.heatmap-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 120px;
  gap: var(--spacing-xs);
}

.heatmap-day {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.heatmap-bar {
  width: 20px;
  background: linear-gradient(to top, #3b82f6, #10b981);
  border-radius: 2px;
  min-height: 2px;
  transition: all 0.3s ease;
}

.heatmap-bar:hover {
  box-shadow: 0 0 8px var(--accent-blue);
}

.heatmap-value {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: auto;
}

/* Merchant List */
.merchant-list,
.trend-list,
.benchmark-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.merchant-row,
.trend-row,
.benchmark-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.merchant-row:hover,
.trend-row:hover,
.benchmark-row:hover {
  background: var(--bg-2);
  border-color: var(--accent);
}

.merchant-name,
.trend-category,
.benchmark-name {
  font-weight: 500;
  color: var(--text);
}

.merchant-freq {
  background: var(--accent-muted);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Trend amounts */
.trend-amounts {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.trend-current {
  font-weight: 600;
  color: var(--text);
}

.trend-change {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-2);
  color: var(--text-muted);
}

.trend-change.positive {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.trend-change.negative {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Benchmarks */
.benchmark-info {
  display: flex;
  gap: var(--spacing-md);
  font-size: 0.9rem;
}

.benchmark-avg,
.benchmark-percentile {
  color: var(--text-muted);
}

.benchmark-percentile {
  background: var(--accent-muted);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Account Statements */
.accounts-statements {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: var(--spacing-md);
}

.account-statement {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-md);
}

.account-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.account-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.account-balance-large {
  font-size: 1.5rem;
  font-weight: 700;
}

.balance-checking {
  color: #10b981;
}

.balance-savings {
  color: #06b6d4;
}

.balance-credit {
  color: #ef4444;
}

/* Account Summary */
.account-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.summary-stat {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-sm);
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.statement-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: var(--spacing-md) 0 var(--spacing-sm) 0;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border);
}

/* Statement transactions */
.statement-txns {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  max-height: 400px;
  overflow-y: auto;
}

.statement-txn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-2);
  border-left: 3px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.statement-txn:hover {
  background: var(--bg-1);
  border-left-color: var(--accent);
}

.statement-txn.expense {
  border-left-color: #ef4444;
}

.statement-txn.income {
  border-left-color: #10b981;
}

.txn-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.txn-desc {
  font-weight: 500;
  color: var(--text);
}

.txn-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.txn-amount {
  font-weight: 600;
  font-size: 1rem;
  min-width: 80px;
  text-align: right;
}

.amount-expense {
  color: #ef4444;
}

.amount-income {
  color: #10b981;
}

/* Light mode overrides */
[data-theme="light"] .merchant-row,
[data-theme="light"] .trend-row,
[data-theme="light"] .benchmark-row {
  background: #f8f8f8;
  border-color: #d0d0d0;
}

[data-theme="light"] .merchant-row:hover,
[data-theme="light"] .trend-row:hover,
[data-theme="light"] .benchmark-row:hover {
  background: #f0f0f0;
  border-color: #333;
}

[data-theme="light"] .account-statement {
  background: #ffffff;
  border-color: #d0d0d0;
}

[data-theme="light"] .account-statement .account-header {
  border-bottom-color: #d0d0d0;
}

[data-theme="light"] .account-summary {
}

[data-theme="light"] .summary-stat {
  background: #f0f0f0;
}

[data-theme="light"] .statement-txn {
  background: #f8f8f8;
  border-left-color: #d0d0d0;
}

[data-theme="light"] .statement-subtitle {
  border-bottom-color: #d0d0d0;
}

[data-theme="light"] .heatmap-container {
  background: #f8f8f8;
  border-color: #d0d0d0;
}



/* ============================================================
   PHASE 8 — FINANCIAL INTELLIGENCE
   ============================================================ */

.summary-cards-phase8 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.card-subvalue {
  margin-top: 0.35rem;
  color: #9ca3af;
  font-size: 0.82rem;
}

.intelligence-grid,
.insight-grid,
.comparison-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.intel-card,
.trend-panel,
.budget-burndown-card,
.debt-simulator,
.comparison-summary-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem;
}

.intel-card.state-over,
.budget-burndown-card.state-over {
  border-color: rgba(248, 113, 113, 0.35);
}

.intel-card.state-under,
.intel-card.state-positive {
  border-color: rgba(74, 222, 128, 0.35);
}

.intel-card.state-negative {
  border-color: rgba(248, 113, 113, 0.35);
}

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

.intel-chip,
.insight-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.insight-badge.up,
.text-negative-soft {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.12);
}

.insight-badge.down,
.text-positive-soft {
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.12);
}

.insight-badge.flat {
  color: #d1d5db;
}

.insight-badge.warn,
.insight-badge.new {
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.28);
  background: rgba(250, 204, 21, 0.1);
}

.intel-copy {
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 0.55rem;
}

.metric-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.metric-pair,
.control-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric-label,
.burndown-label {
  font-size: 0.75rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.burn-comparison,
.debt-controls,
.debt-timeline,
.compact-list,
.comparison-list,
.trend-history {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.burn-row,
.compact-list-row,
.comparison-row,
.trend-history-row,
.category-row-top,
.category-meta,
.comparison-values,
.burndown-axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.burndown-axis {
  flex-direction: column;
  align-items: stretch;
}

.burn-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}

.burn-fill {
  height: 100%;
  border-radius: inherit;
}

.burn-fill-days {
  background: linear-gradient(90deg, rgba(96,165,250,0.95), rgba(59,130,246,0.65));
}

.burn-fill-budget {
  background: linear-gradient(90deg, rgba(248,113,113,0.95), rgba(239,68,68,0.65));
}

.category-row-intel {
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.category-name {
  font-weight: 600;
}

.category-footnote {
  margin-top: 0.45rem;
  font-size: 0.78rem;
}

.trend-panel {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 1rem;
}

.trend-chart,
.trend-chart-wrapper svg {
  width: 100%;
  height: auto;
  display: block;
}

.comparison-summary-card.emphasis {
  border-color: rgba(96, 165, 250, 0.35);
}

.comparison-delta {
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.debt-controls {
  margin-bottom: 1rem;
}

.segmented-control {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.analytics-phase8 .forecast-card {
  min-height: 160px;
}

@media (max-width: 900px) {
  .trend-panel {
    grid-template-columns: 1fr;
  }

  .metric-pair-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   PHASE 9 — Income & Bill Management
   ============================================================ */

/* Transaction Type Toggle - Premium Glassy */
.transaction-type-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0;
}

.type-btn {
  flex: 1;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.type-btn:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.type-btn.active {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(96, 165, 250, 0.08) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: rgba(96, 165, 250, 1);
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 20px rgba(96, 165, 250, 0.15);
}

/* Income Projection Card */
.projection-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  font-size: 0.9rem;
}

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

.projection-row strong {
  color: var(--text);
  font-size: 1rem;
}

/* Due Alerts */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-2);
  border-left: 4px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--transition);
}

.alert-item:hover {
  background: var(--bg-3);
  transform: translateX(4px);
}

.alert-overdue {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.alert-due-soon {
  border-left-color: #facc15;
  background: rgba(250, 204, 21, 0.08);
}

.alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.alert-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-icon-small:hover {
  background: var(--white);
  transform: scale(1.1);
}

/* Bills View */
.bills-view {
  padding: 1rem;
}

.bills-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.bills-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.bills-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.bill-card {
  padding: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition);
}

.bill-card:hover {
  background: var(--bg-3);
  border-color: var(--border-focus);
}

.bill-overdue {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

.bill-due-soon {
  border-left: 4px solid #facc15;
  background: rgba(250, 204, 21, 0.06);
}

.bill-paid {
  border-left: 4px solid #10b981;
  background: rgba(16, 185, 129, 0.06);
  opacity: 0.75;
}

.bill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.bill-title {
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.bill-amount {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
  white-space: nowrap;
}

.bill-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.overdue-badge,
.due-soon-badge,
.paid-badge {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.overdue-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.due-soon-badge {
  background: rgba(250, 204, 21, 0.2);
  color: #d97706;
}

.paid-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.bill-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-xs {
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

/* Modal adjustments for bills */
.modal-large {
  max-width: 500px;
}

.form-footer {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.form-footer .btn-primary,
.form-footer .btn-secondary {
  flex: 1;
}

/* Income sources in quick-add */
.select-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: all var(--transition);
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-3);
}

/* Alert badge */
.alert-badge {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

/* State colors */
.state-positive {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.04);
}

.state-warning {
  border-color: rgba(250, 204, 21, 0.2);
  background: rgba(250, 204, 21, 0.04);
}

.state-negative {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
}

.state-neutral {
  border-color: var(--border);
  background: var(--bg-2);
}

/* Responsive bills */
@media (max-width: 640px) {
  .bills-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .bill-actions {
    margin-top: 0.5rem;
  }

  .modal-large {
    max-width: calc(100% - 2rem);
  }
}

/* ============================================================
   PHASE 10: ADVANCED REPORTS & EXPORT
   ============================================================ */

.reports-view {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.reports-header {
  margin-bottom: 2rem;
  text-align: center;
}

.reports-header .section-title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.reports-header .text-muted {
  font-size: 0.95rem;
}

/* Report Tabs Navigation */
.report-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.report-tab {
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.report-tab:hover {
  border-color: var(--border-focus);
  color: var(--text);
}

.report-tab.active {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  color: #60a5fa;
}

/* Date Range Controls */
.report-date-range {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto auto;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  align-items: end;
}

.report-date-range .form-group {
  display: flex;
  flex-direction: column;
}

.report-date-range label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.report-date-range .text-input {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

/* Report Section */
.report-section {
  margin-bottom: 2rem;
}

.report-section-title {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.report-content {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
}

.report-subtitle {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

/* Summary Metrics Grid */
.summary-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  text-align: center;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.metric-value.positive {
  color: #10b981;
}

.metric-value.negative {
  color: #ef4444;
}

/* Tables */
.category-report-table,
.tax-category-table,
.variance-table,
.comparison-table {
  width: 100%;
  margin-bottom: 1.5rem;
}

.table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--border-focus);
  border-radius: var(--r-md) var(--r-md) 0 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.table-header.variance-table ~ .table-header,
.variance-table .table-header {
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
}

.table-header.comparison-table ~ .table-header,
.comparison-table .table-header {
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
}

.tax-category-table .table-header {
  grid-template-columns: 2fr 1fr 1fr;
}

.table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 0.95rem;
}

.table-row.over-budget {
  background: rgba(239, 68, 68, 0.05);
}

.variance-table .table-row {
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
}

.comparison-table .table-row {
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
}

.tax-category-table .table-row {
  grid-template-columns: 2fr 1fr 1fr;
}

.table-col-name {
  font-weight: 500;
}

.table-col-amount,
.table-col-percent,
.table-col-count {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.table-col-amount.positive {
  color: #10b981;
}

.table-col-amount.negative {
  color: #ef4444;
}

.table-col-percent.positive {
  color: #10b981;
}

.table-col-percent.negative {
  color: #ef4444;
}

/* Report Actions */
.report-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  justify-content: center;
}

.report-actions .btn-secondary {
  flex: 1;
  max-width: 200px;
}

/* Tax Tagging Section */
.tax-tagging-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.tax-filter {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tax-filter label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.tax-filter input[type="checkbox"] {
  cursor: pointer;
}

.transactions-for-tax {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.tax-transaction {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--transition);
}

.tax-transaction:hover {
  border-color: var(--border-focus);
}

.tax-txn-info {
  flex: 1;
}

.tax-txn-desc {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.tax-txn-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tax-txn-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  min-width: 100px;
  text-align: right;
}

.tax-txn-amount.positive {
  color: #10b981;
}

.tax-txn-amount.negative {
  color: #ef4444;
}

.tax-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.tax-checkbox:hover {
  border-color: var(--border-focus);
  background: rgba(96, 165, 250, 0.05);
}

.tax-checkbox input[type="checkbox"] {
  cursor: pointer;
}

.tax-checkbox input[type="checkbox"]:checked {
  accent-color: #60a5fa;
}

/* Comparison Report */
.comparison-type-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.comparison-btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.comparison-btn:hover {
  border-color: var(--border-focus);
  color: var(--text);
}

.comparison-btn.active {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  color: #60a5fa;
}

/* Export Options */
.export-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.export-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  text-align: center;
  transition: all var(--transition);
}

.export-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.export-card h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.export-card .text-muted {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: block;
}

.export-card .btn-primary {
  width: 100%;
}

/* Export Preview */
.export-preview {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-top: 2rem;
}

.preview-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preview-box pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Desktop dashboard refinement */
@media (min-width: 1200px) {
  .tab-content {
    width: min(1440px, calc(100vw - 40px));
    margin: 0 auto;
    padding: 1rem 1rem 6rem;
  }

  .nav-inner {
    gap: 1rem;
  }

  .desktop-nav-wrap {
    display: block;
  }

  .bottom-nav {
    display: none;
  }

  .modal-overlay-transaction {
    align-items: center;
    padding: 2rem;
  }

  .transaction-shell {
    width: min(620px, 92vw);
    max-height: min(86dvh, 980px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
    overflow: hidden;
  }

  .transaction-shell.bottom-sheet {
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
  }

  .sheet-content {
    padding: 1.1rem 1.1rem 1.2rem;
  }

  .dashboard {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
  }

  .dashboard > .ai-insight-banner,
  .dashboard > .summary-cards,
  .dashboard > .intelligence-grid {
    grid-column: 1 / -1;
  }

  .summary-cards-phase8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
  }

  .summary-cards-phase8 .card {
    min-height: 162px;
    padding: 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0.012));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 12px 28px rgba(0, 0, 0, 0.2);
  }

  .summary-cards-phase8 .card:hover,
  .dashboard > .section-panel:hover,
  .dashboard .intel-card:hover,
  .dashboard .account-row:hover,
  .dashboard .txn-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
  }

  .intelligence-grid,
  .insight-grid,
  .comparison-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
  }

  .intel-card,
  .trend-panel,
  .budget-burndown-card,
  .debt-simulator,
  .comparison-summary-card {
    min-height: 220px;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.025), 0 10px 24px rgba(0, 0, 0, 0.18);
    transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  }

  .dashboard > .section-panel {
    position: relative;
    min-height: 100%;
    padding: 1rem;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.024), rgba(255,255,255,0.01));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 14px 30px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  }

  .dashboard > .section-panel::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.16), rgba(255,255,255,0));
    opacity: 0.55;
    pointer-events: none;
  }

  .accounts-section,
  .income-projection-section {
    grid-column: 1 / span 5;
  }

  .spending-section,
  .bills-section,
  .recent-section {
    grid-column: 6 / -1;
  }

  .accounts-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
  }

  .account-row {
    min-height: 88px;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.025);
    border-color: rgba(255,255,255,0.06);
  }

  .account-balance {
    font-size: 1rem;
  }

  .category-breakdown,
  .transactions-preview,
  .alerts-list {
    gap: 0.65rem;
  }

  .category-row-intel {
    padding: 0.8rem 0.1rem;
  }

  .txn-row {
    min-height: 78px;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.024);
    border-color: rgba(255,255,255,0.055);
  }

  .txn-desc,
  .account-name,
  .category-name {
    font-size: 0.92rem;
  }

  .txn-amount,
  .projection-row strong {
    font-size: 0.98rem;
  }

  .projection-row {
    padding: 0.55rem 0;
    font-size: 0.86rem;
  }

  .section-title {
    letter-spacing: 0.09em;
  }

  .link-small {
    text-decoration: none;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
  }

  .link-small:hover {
    background: rgba(255,255,255,0.06);
  }
}

@media (min-width: 1200px) and (prefers-reduced-motion: no-preference) {
  @keyframes desktopPanelIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .summary-cards-phase8 .card,
  .dashboard .intel-card,
  .dashboard > .section-panel {
    animation: desktopPanelIn 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .summary-cards-phase8 .card:nth-child(2),
  .dashboard .intel-card:nth-child(2),
  .dashboard > .section-panel:nth-child(2) {
    animation-delay: 40ms;
  }

  .summary-cards-phase8 .card:nth-child(3),
  .dashboard .intel-card:nth-child(3),
  .dashboard > .section-panel:nth-child(3) {
    animation-delay: 80ms;
  }

  .summary-cards-phase8 .card:nth-child(4),
  .dashboard .intel-card:nth-child(4),
  .dashboard > .section-panel:nth-child(4) {
    animation-delay: 120ms;
  }
}

/* Print Styles */
@media print {
  .report-tabs,
  .report-date-range,
  .report-actions,
  .nav,
  .bottom-nav,
  .fab {
    display: none !important;
  }

  .reports-view {
    padding: 0;
    max-width: 100%;
  }

  .report-content,
  .report-section {
    page-break-inside: avoid;
    border: none;
    padding: 0;
    margin: 0 0 2rem 0;
  }

  .metric-box {
    border: 1px solid #000;
    page-break-inside: avoid;
  }

  .table-row,
  .table-header {
    page-break-inside: avoid;
  }

  body {
    background: white;
    color: black;
  }
}

/* Responsive Report Layout */
@media (max-width: 768px) {
  .report-date-range {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .report-date-range .btn-secondary {
    grid-column: 1 / -1;
  }

  .summary-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .metric-box {
    padding: 0.75rem;
  }

  .metric-value {
    font-size: 1.25rem;
  }

  .table-header,
  .table-row {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 0.5rem;
  }

  .table-col-amount,
  .table-col-percent,
  .table-col-count {
    font-size: 0.8rem;
  }

  .export-options {
    grid-template-columns: 1fr;
  }

  .report-actions {
    flex-direction: column;
  }

  .report-actions .btn-secondary {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .report-tabs {
    gap: 0.25rem;
  }

  .report-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .reports-header .section-title {
    font-size: 1.25rem;
  }

  .summary-metrics {
    grid-template-columns: 1fr;
  }

  .metric-value {
    font-size: 1.1rem;
  }

  .report-date-range {
    grid-template-columns: 1fr;
  }

  .tax-transaction {
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .tax-txn-amount {
    min-width: 80px;
  }
}

/* ============================================================
   PHASE 13: TRANSACTION ENHANCEMENTS STYLES
   ============================================================ */

/* Enhanced Edit Form Styling */
.phase13-edit-form {
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.phase13-edit-form .form-group {
  margin-bottom: var(--spacing-lg);
}

.phase13-edit-form .form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
  color: var(--text);
}

.phase13-edit-form input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
}

/* Split Items Container */
.split-items-container {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.split-item {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  align-items: center;
}

.split-item .text-input {
  padding: 0.5rem;
  font-size: 0.9rem;
}

/* Attachment Container */
.attachment-container {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.attachment-container input[type="file"] {
  display: none;
}

.attachments-preview {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.attachment-item:last-child {
  margin-bottom: 0;
}

/* OCR Correction Fields */
.ocr-fields {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.ocr-fields .form-group {
  margin-bottom: var(--spacing-md);
}

.ocr-fields .form-group:last-child {
  margin-bottom: 0;
}

/* Templates List */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--transition);
}

.template-item:hover {
  background: var(--bg-2);
  border-color: var(--border-focus);
}

.template-info {
  flex: 1;
}

.template-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.template-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.template-actions {
  display: flex;
  gap: var(--spacing-sm);
}

/* Bulk Edit Options */
.bulk-edit-options {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.bulk-edit-options .form-group {
  margin-bottom: var(--spacing-md);
}

.bulk-edit-options .form-group:last-child {
  margin-bottom: 0;
}

/* Duplicates List */
.duplicates-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.duplicate-group {
  background: var(--bg-3);
  border: 2px solid var(--warn);
  border-radius: var(--r-md);
  overflow: hidden;
}

.duplicate-group-header {
  background: var(--bg-2);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.similarity-badge {
  background: var(--warn);
  color: var(--bg);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.duplicate-items {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.duplicate-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--bg-2);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--warn);
}

.duplicate-details {
  flex: 1;
}

.duplicate-actions {
  margin-left: var(--spacing-md);
}

/* Responsive Adjustments for Phase 13 */
@media (max-width: 768px) {
  .phase13-edit-form {
    padding: var(--spacing-md);
  }

  .split-item {
    grid-template-columns: 1fr;
  }

  .split-item .btn-danger {
    justify-self: flex-start;
  }

  .template-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .template-actions {
    width: 100%;
    margin-top: var(--spacing-sm);
  }

  .template-actions .btn-primary,
  .template-actions .btn-danger {
    flex: 1;
  }

  .duplicate-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .duplicate-actions {
    width: 100%;
    margin-top: var(--spacing-sm);
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .phase13-edit-form .form-group {
    margin-bottom: var(--spacing-md);
  }

  .split-items-container,
  .ocr-fields,
  .bulk-edit-options {
    padding: var(--spacing-sm);
  }

  .attachment-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .attachment-item button {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* ============================================================
   PHASE 11: RECEIPT IMAGE GALLERY
   ============================================================ */

.receipt-gallery-view {
  padding: var(--spacing-lg);
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.gallery-stats {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.stat-item {
  background: var(--bg-2);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.gallery-search {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.gallery-search .text-input {
  flex: 1;
}

/* Progress bar for uploads */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-2);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  transition: width 0.3s ease;
  border-radius: var(--r-md);
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

/* Receipt thumbnail grid */
.receipt-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.receipt-thumbnail-card {
  background: var(--bg-2);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}

.receipt-thumbnail-card:hover {
  border-color: var(--info);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.2);
  transform: translateY(-2px);
}

.receipt-thumbnail-image {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  overflow: hidden;
  background: var(--bg-3);
}

.receipt-thumbnail-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.receipt-thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-sm);
  opacity: 0;
  transition: opacity var(--transition);
}

.receipt-thumbnail-card:hover .receipt-thumbnail-overlay {
  opacity: 1;
}

.receipt-thumbnail-overlay .btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
}

.receipt-thumbnail-overlay .btn-icon:hover {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.6);
}

.receipt-thumbnail-info {
  padding: var(--spacing-sm);
}

.receipt-merchant {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipt-amount {
  color: var(--ok);
  font-weight: 600;
  font-size: 0.8rem;
  margin: 0.25rem 0;
}

.receipt-date {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.receipt-verified {
  display: inline-block;
  color: var(--ok);
  font-size: 0.7rem;
  margin-top: 0.25rem;
  font-weight: 600;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: var(--spacing-sm);
}

/* Receipt Viewer Modal */
.receipt-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-md);
}

.receipt-viewer-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--bg-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.receipt-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  gap: var(--spacing-md);
}

.receipt-viewer-title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  color: var(--text);
}

.receipt-viewer-tools {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.receipt-viewer-tools .btn-icon,
.zoom-level {
  padding: var(--spacing-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.receipt-viewer-tools .btn-icon:hover {
  background: var(--bg-1);
  border-color: var(--info);
}

.zoom-level {
  cursor: default;
  min-width: 60px;
  text-align: center;
}

.receipt-viewer-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--spacing-lg);
}

.receipt-image-container {
  transition: transform 0.3s ease;
  transform-origin: center;
}

.receipt-placeholder {
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border-radius: var(--r-lg);
  color: var(--text-muted);
  font-size: 2rem;
}

.receipt-viewer-footer {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  justify-content: flex-end;
}

/* OCR Correction Modal */
.receipt-verified {
  background: rgba(74, 222, 128, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg) 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.pagination .btn-secondary {
  min-width: 100px;
}

.pagination .btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .receipt-gallery-view {
    padding: var(--spacing-md);
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-search {
    flex-direction: column;
  }

  .gallery-search .text-input {
    width: 100%;
  }

  .receipt-thumbnail-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-sm);
  }

  .receipt-viewer-container {
    max-width: 95vw;
    max-height: 95vh;
  }

  .receipt-viewer-tools {
    flex-wrap: wrap;
  }

  .receipt-viewer-title {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .receipt-gallery-view {
    padding: var(--spacing-sm);
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
  }

  .gallery-stats {
    width: 100%;
    font-size: 0.8rem;
  }

  .gallery-search {
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
  }

  .gallery-search .text-input {
    width: 100%;
  }

  .gallery-search button {
    width: 100%;
  }

  .receipt-thumbnail-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-sm);
  }

  .receipt-thumbnail-card {
    border-radius: var(--r-sm);
  }

  .receipt-thumbnail-info {
    padding: var(--spacing-xs);
    font-size: 0.75rem;
  }

  .receipt-merchant {
    font-size: 0.75rem;
  }

  .receipt-amount {
    font-size: 0.7rem;
  }

  .receipt-date {
    font-size: 0.65rem;
  }

  .receipt-viewer-modal {
    padding: 0;
  }

  .receipt-viewer-container {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .receipt-viewer-header {
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
  }

  .receipt-viewer-tools {
    font-size: 0.8rem;
  }

  .receipt-viewer-tools .btn-icon {
    padding: 0.4rem;
    font-size: 0.8rem;
  }

  .zoom-level {
    font-size: 0.75rem;
    min-width: 50px;
  }

  .receipt-viewer-content {
    padding: var(--spacing-sm);
  }

  .receipt-viewer-footer {
    flex-direction: column;
    padding: var(--spacing-sm);
  }

  .receipt-viewer-footer button {
    width: 100%;
  }

  .pagination {
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) 0;
  }

  .pagination-info {
    font-size: 0.8rem;
    width: 100%;
    text-align: center;
  }

  .pagination .btn-secondary {
    width: 100%;
  }
}



.onboarding-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem auto 0;
  width: min(1120px, calc(100% - 2rem));
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1rem 1.1rem;
}

.onboarding-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.demo-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem auto 0;
  width: min(1120px, calc(100% - 2rem));
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 1rem 1.1rem;
}

.demo-cta-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-empty-state {
  padding: 1.2rem;
}

.onboarding-modal {
  width: min(720px, calc(100vw - 1.5rem));
  max-height: min(90vh, 820px);
  overflow: auto;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(3, 7, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.onboarding-header {
  align-items: flex-start;
}

.onboarding-header h2 {
  margin: 0.25rem 0 0;
}

.onboarding-progress {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.25rem 0.75rem;
}

.onboarding-dot {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.onboarding-dot.active {
  background: linear-gradient(90deg, #38bdf8, #a855f7);
}

.onboarding-body {
  padding-top: 0.25rem;
}

.onboarding-panel h3 {
  margin: 0 0 0.75rem;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.onboarding-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.onboarding-highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.onboarding-highlight-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.onboarding-highlight-card span {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.onboarding-footer {
  padding: 0 1.25rem 1.25rem;
}

@media (max-width: 720px) {
  .onboarding-banner {
    width: calc(100% - 1rem);
    flex-direction: column;
    align-items: stretch;
    margin-top: 0.75rem;
  }

  .demo-cta-banner {
    width: calc(100% - 1rem);
    flex-direction: column;
    align-items: stretch;
    margin-top: 0.75rem;
  }

  .demo-cta-actions {
    justify-content: stretch;
  }

  .demo-cta-actions > * {
    width: 100%;
  }

  .onboarding-grid,
  .onboarding-highlight-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-modal {
    width: calc(100vw - 0.75rem);
    border-radius: 20px 20px 0 0;
  }
}
