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

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

:root {
  --teal: #1D9E75;
  --teal-light: #E1F5EE;
  --teal-mid: #9FE1CB;
  --teal-dark: #0F6E56;
  --amber: #EF9F27;
  --amber-light: #FAEEDA;
  --red: #E24B4A;
  --red-light: #FCEBEB;
  --blue: #378ADD;
  --blue-light: #E6F1FB;
  --purple: #7F77DD;
  --purple-light: #EEEDFE;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.14);
  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  --text-hint: #9CA3AF;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --font: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text-primary); min-height: 100vh; max-width: 430px; margin: 0 auto; position: relative; }

/* App Shell */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.screen { flex: 1; overflow-y: auto; padding-bottom: 80px; }
.screen.no-tabs { padding-bottom: 0; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 20px 12px; position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; }
.topbar p { font-size: 13px; color: var(--text-secondary); margin-top: 1px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; }

/* Bottom tabs */
.bottom-tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; height: 72px; background: var(--surface); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom, 8px); z-index: 20; }
.tab-item { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; padding: 6px 4px; cursor: pointer; text-decoration: none; }
.tab-item svg { width: 22px; height: 22px; stroke: var(--text-hint); fill: none; stroke-width: 1.8; transition: stroke 0.15s; }
.tab-item span { font-size: 10px; font-weight: 500; color: var(--text-hint); transition: color 0.15s; }
.tab-item.active svg { stroke: var(--teal); }
.tab-item.active span { color: var(--teal); }
.tab-cam { flex: 1; display: flex; justify-content: center; align-items: center; }
.cam-fab { width: 54px; height: 54px; border-radius: 50%; background: var(--teal); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(29,158,117,0.4); position: relative; bottom: 10px; cursor: pointer; border: none; text-decoration: none; }
.cam-fab svg { width: 24px; height: 24px; stroke: white; fill: none; stroke-width: 1.8; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 16px; }
.card + .card { margin-top: 10px; }

/* Metric grid */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric-card { background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 14px; }
.metric-card .lbl { font-size: 11px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.metric-card .val { font-size: 26px; font-weight: 600; letter-spacing: -1px; color: var(--text-primary); }
.metric-card .sub { font-size: 11px; color: var(--teal); margin-top: 3px; font-weight: 500; }
.metric-card .sub.warn { color: var(--amber); }

/* Badges */
.badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.badge-travel { background: var(--teal-light); color: var(--teal-dark); }
.badge-food { background: var(--amber-light); color: #854F0B; }
.badge-supplies { background: var(--blue-light); color: #185FA5; }
.badge-software { background: var(--purple-light); color: #534AB7; }
.badge-other { background: #F1EFE8; color: #5F5E5A; }
.badge-warn { background: var(--amber-light); color: #854F0B; }
.badge-review { background: var(--red-light); color: #A32D2D; }

/* Receipt row */
.receipt-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; text-decoration: none; color: inherit; }
.receipt-row:last-child { border-bottom: none; }
.receipt-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.receipt-icon svg { width: 18px; height: 18px; stroke: var(--text-secondary); fill: none; stroke-width: 1.8; }
.receipt-info { flex: 1; min-width: 0; }
.receipt-vendor { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt-date { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.receipt-right { text-align: right; flex-shrink: 0; }
.receipt-amount { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; }

/* Bars */
.bar-item { margin-bottom: 12px; }
.bar-item:last-child { margin-bottom: 0; }
.bar-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.bar-meta .name { color: var(--text-secondary); font-weight: 500; }
.bar-meta .amount { color: var(--text-primary); font-weight: 600; }
.bar-track { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--teal); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 20px; border-radius: var(--radius-md); font-family: var(--font); font-size: 15px; font-weight: 600; border: none; cursor: pointer; transition: opacity 0.15s, transform 0.1s; text-decoration: none; }
.btn:active { transform: scale(0.98); opacity: 0.85; }
.btn-primary { background: var(--teal); color: white; }
.btn-secondary { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border-strong); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-full { width: 100%; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.form-input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); font-family: var(--font); font-size: 15px; color: var(--text-primary); background: var(--surface); outline: none; transition: border-color 0.15s; }
.form-input:focus { border-color: var(--teal); }
.form-input.highlight { border-color: var(--teal); background: var(--teal-light); }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }

/* Search */
.search-bar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; margin: 12px 16px 0; }
.search-bar svg { width: 16px; height: 16px; stroke: var(--text-hint); fill: none; stroke-width: 2; flex-shrink: 0; }
.search-bar input { border: none; outline: none; font-family: var(--font); font-size: 14px; color: var(--text-primary); background: transparent; flex: 1; }
.search-bar input::placeholder { color: var(--text-hint); }

/* Filter chips */
.filter-row { display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.chip { padding: 6px 14px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; border: 1.5px solid var(--border-strong); color: var(--text-secondary); background: var(--surface); transition: all 0.15s; }
.chip.active { background: var(--teal); color: white; border-color: var(--teal); }

/* Section header */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-header h2 { font-size: 15px; font-weight: 600; }
.section-header a { font-size: 13px; color: var(--teal); font-weight: 500; text-decoration: none; }

/* Settings rows */
.settings-group { background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; margin-bottom: 8px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; text-decoration: none; color: inherit; }
.settings-row:last-child { border-bottom: none; }
.settings-row-left { display: flex; align-items: center; gap: 12px; }
.settings-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.settings-icon svg { width: 16px; height: 16px; stroke: white; fill: none; stroke-width: 2; }
.settings-text .title { font-size: 14px; font-weight: 500; }
.settings-text .sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.chevron { width: 16px; height: 16px; stroke: var(--text-hint); fill: none; stroke-width: 2; }

/* Profile header */
.profile-header { display: flex; flex-direction: column; align-items: center; padding: 24px 20px 20px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--teal-mid); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: var(--teal-dark); margin-bottom: 12px; }
.profile-name { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.profile-role { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.profile-company { font-size: 13px; color: var(--teal); font-weight: 600; margin-top: 2px; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; background: var(--surface); }
.auth-logo { margin-bottom: 32px; text-align: center; }
.auth-logo .logo-mark { width: 56px; height: 56px; background: var(--teal); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.auth-logo .logo-mark svg { width: 28px; height: 28px; stroke: white; fill: none; stroke-width: 1.8; }
.auth-logo h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.auth-logo p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }
.auth-footer a { color: var(--teal); font-weight: 600; text-decoration: none; }

/* OCR confirm */
.ocr-preview { height: 220px; background: #1a1a1a; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.ocr-preview svg { width: 48px; height: 48px; stroke: rgba(255,255,255,0.3); fill: none; stroke-width: 1.5; }
.ocr-badge { position: absolute; bottom: 12px; right: 12px; background: var(--teal); color: white; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 99px; display: flex; align-items: center; gap: 5px; }
.ocr-dot { width: 6px; height: 6px; border-radius: 50%; background: white; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* Toast */
.toast { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); background: #1A1A1A; color: white; padding: 10px 20px; border-radius: 99px; font-size: 13px; font-weight: 500; z-index: 100; opacity: 0; transition: opacity 0.2s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; }

/* Scroll container */
.scroll-pad { padding: 16px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty-state svg { width: 48px; height: 48px; stroke: var(--text-hint); fill: none; stroke-width: 1.5; margin: 0 auto 12px; display: block; }
.empty-state p { font-size: 15px; font-weight: 500; }
.empty-state small { font-size: 13px; margin-top: 4px; display: block; }

/* Section label */
.section-lbl { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 16px 4px; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* Spinner */
.spinner { width: 24px; height: 24px; border: 3px solid var(--teal-light); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading overlay */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 200; font-size: 14px; color: var(--text-secondary); font-weight: 500; }

/* Landing page */
.landing { min-height: 100vh; background: var(--bg); }
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.landing-nav-brand { display: flex; align-items: center; gap: 10px; }
.landing-nav-brand span { font-size: 17px; font-weight: 700; letter-spacing: -0.4px; }
.landing-nav-actions { display: flex; gap: 8px; }
.landing-link { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-decoration: none; padding: 8px 14px; border-radius: var(--radius-md); }
.landing-link-primary { font-size: 13px; font-weight: 600; color: #fff; background: var(--teal); text-decoration: none; padding: 8px 14px; border-radius: var(--radius-md); }
.landing-hero { background: var(--surface); padding: 52px 24px 44px; text-align: center; border-bottom: 1px solid var(--border); }
.landing-hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -1.2px; line-height: 1.12; margin-bottom: 14px; }
.landing-hero h1 .accent { color: var(--teal); }
.landing-hero p { font-size: 15px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 28px; }
.landing-ctas { display: flex; gap: 10px; justify-content: center; }
.landing-preview { margin-top: 32px; background: var(--bg); border-radius: var(--radius-xl); border: 1px solid var(--border); padding: 16px; text-align: left; }
.lp-topbar { margin-bottom: 14px; }
.lp-topbar-title { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.lp-topbar-sub { font-size: 11px; color: var(--text-secondary); }
.lp-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.lp-metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.lp-metric-lbl { font-size: 9px; font-weight: 600; color: var(--text-hint); text-transform: uppercase; letter-spacing: 0.05em; }
.lp-metric-val { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; margin-top: 2px; }
.lp-receipt { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.lp-receipt-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lp-receipt-icon svg { width: 14px; height: 14px; }
.lp-receipt-info { flex: 1; }
.lp-vendor { font-size: 13px; font-weight: 500; }
.lp-date { font-size: 10px; color: var(--text-hint); }
.lp-amount { font-size: 14px; font-weight: 700; letter-spacing: -0.3px; }
.landing-features { padding: 32px 20px; }
.landing-features h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 16px; }
.lf-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin-bottom: 8px; display: flex; gap: 14px; align-items: flex-start; }
.lf-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lf-icon svg { width: 18px; height: 18px; }
.lf-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.lf-card p { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.landing-cta { margin: 24px 20px 8px; background: var(--teal); border-radius: var(--radius-lg); padding: 28px 24px; text-align: center; color: #fff; }
.landing-cta h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 6px; }
.landing-cta p { font-size: 13px; opacity: 0.85; margin-bottom: 18px; }
.btn-white { background: #fff; color: var(--teal-dark); padding: 13px 28px; border-radius: var(--radius-md); font-family: var(--font); font-size: 15px; font-weight: 600; border: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-white svg { width: 16px; height: 16px; }
.landing-footer { padding: 24px 20px 32px; text-align: center; }
.landing-footer-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.logo-mark-sm { width: 22px; height: 22px; background: var(--teal); border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.logo-mark-sm svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 1.8; }
.landing-footer-brand span { font-size: 13px; font-weight: 600; }
.landing-footer p { font-size: 11px; color: var(--text-hint); }
.landing-footer-links { display: flex; gap: 16px; justify-content: center; margin-top: 10px; }
.landing-footer-links a { font-size: 12px; color: var(--text-secondary); text-decoration: none; font-weight: 500; }
