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

/* ── Variables — Light mode (default) ──────────────────── */
:root {
  --bg:              #f4f5f7;
  --card:            #ffffff;
  --card-2:          #f0f1f5;
  --surface-2:       #e8eaf0;
  --border:          rgba(0,0,0,0.08);
  --border-solid:    #dddde8;
  --text:            rgba(0,0,0,0.87);
  --text-2:          rgba(0,0,0,0.45);
  --text-3:          rgba(0,0,0,0.60);
  --primary:         #2563EB;
  --primary-dark:    #1d4ed8;
  --accent:          #d96a1a;
  --success:         #16a34a;
  --danger:          #dc2626;
  --chart-revenue:   #3B82F6;
  --chart-expense:   #d96a1a;
  --nav-color:       rgba(0,0,0,0.35);
  --handle-color:    rgba(0,0,0,0.12);
  --scrollbar-color: rgba(0,0,0,0.15);
  --period-bg:       rgba(0,0,0,0.05);
  --period-color:    rgba(0,0,0,0.38);
  --surface-overlay: rgba(0,0,0,0.05);
  --hover-overlay:   rgba(0,0,0,0.07);
  --icon-muted:      rgba(0,0,0,0.18);
  --header-h:        58px;
  --nav-h:           68px;
  --radius:          14px;
  --shadow:          0 2px 8px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
}

/* ── Variables — Dark mode ─────────────────────────────── */
[data-theme="dark"] {
  --bg:              #13151e;
  --card:            #1c1f2e;
  --card-2:          #222638;
  --surface-2:       #2a2d3e;
  --border:          rgba(255,255,255,0.07);
  --border-solid:    #2a2d3e;
  --text:            rgba(255,255,255,0.92);
  --text-2:          rgba(255,255,255,0.4);
  --text-3:          rgba(255,255,255,0.6);
  --success:         #4ADE80;
  --danger:          #F87171;
  --chart-expense:   #F5A623;
  --nav-color:       rgba(255,255,255,0.58);
  --handle-color:    rgba(255,255,255,0.12);
  --scrollbar-color: rgba(255,255,255,0.12);
  --period-bg:       rgba(255,255,255,0.05);
  --period-color:    rgba(255,255,255,0.38);
  --surface-overlay: rgba(255,255,255,0.06);
  --hover-overlay:   rgba(255,255,255,0.10);
  --icon-muted:      rgba(255,255,255,0.20);
  --shadow:          0 2px 8px rgba(0,0,0,.30), 0 8px 24px rgba(0,0,0,.20);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
}

/* ── App Shell ─────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
}

/* ── Header ────────────────────────────────────────────── */
.header {
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 18px;
  padding-right: 18px;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon { width: 28px; height: 20px; flex-shrink: 0; }

.header-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.header-title .hl-haul  { color: var(--text); }
.header-title .hl-ledger { color: var(--chart-expense); }

.lang-toggle {
  background: var(--surface-overlay);
  border: 1.5px solid var(--border-solid);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  letter-spacing: .5px;
  font-family: 'DM Sans', sans-serif;
  transition: background .2s;
}
.lang-toggle:hover { background: var(--hover-overlay); }

/* ── Main Scroll Area ──────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* ── Pages ─────────────────────────────────────────────── */
.page { display: none; padding: 16px 18px 24px; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ── Dashboard heading ─────────────────────────────────── */
.dash-heading {
  padding: 16px 18px 0;
}
.dash-heading-sub {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.dash-heading-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-top: 2px;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s, transform .1s;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}
.btn-primary:active { transform: scale(.97); background: var(--primary-dark); }

.btn-secondary {
  background: var(--card-2);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-secondary:active { background: var(--border-solid); }

/* ── List Items ────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; }

.list-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.list-item-main { flex: 1; min-width: 0; }

.list-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.list-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-amount {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.revenue-color { color: var(--success); }
.expense-color { color: var(--danger); }

.list-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.list-item-sub {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-date {
  font-size: 11px;
  color: var(--text-2);
  flex-shrink: 0;
}

.list-item-notes {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-2);
  font-style: italic;
  line-height: 1.4;
}

.list-item-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid var(--border-solid);
  align-self: center;
}
.item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.edit-btn, .delete-btn {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: color .2s, background .2s;
}
.edit-btn   { color: var(--icon-muted); }
.delete-btn { color: var(--icon-muted); }
.edit-btn:hover   { color: var(--accent); background: rgba(249,115,22,0.12); }
.delete-btn:hover { color: var(--danger); background: rgba(248,113,113,0.1); }

/* ── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
  padding: 40px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Bottom Navigation ─────────────────────────────────── */
.bottom-nav {
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--nav-color);
  transition: color .2s;
  padding: 8px 4px;
  font-family: 'DM Sans', sans-serif;
}

.nav-btn svg { width: 22px; height: 22px; flex-shrink: 0; }

.nav-btn span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav-btn.active { color: var(--chart-expense); }
.nav-btn.active svg { stroke: var(--chart-expense); }

/* ── Modal Overlay ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

/* ── Modal ─────────────────────────────────────────────── */
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  padding: 20px 20px 32px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp .22s ease-out;
}
.modal.hidden { display: none; }

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--handle-color);
  border-radius: 2px;
  margin: 0 auto 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.btn-close {
  background: var(--surface-overlay);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.btn-close:hover { background: var(--hover-overlay); }

/* ── Forms ─────────────────────────────────────────────── */
.modal-form { display: flex; flex-direction: column; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
  background: var(--card-2);
}

.form-group textarea { resize: none; line-height: 1.5; }

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  justify-content: center;
  width: 100%;
  padding: 13px;
  font-size: 15px;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-color); border-radius: 4px; }

/* ── Period Toggle ─────────────────────────────────────── */
.period-toggle {
  display: flex;
  background: var(--period-bg);
  border-radius: 12px;
  padding: 4px;
  gap: 3px;
  margin-bottom: 20px;
}

.period-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 9px;
  padding: 8px 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--period-color);
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}

.period-btn.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(0,0,0,0.25);
}

/* ── Donut Chart ───────────────────────────────────────── */
.chart-wrapper {
  position: relative;
  width: min(220px, 72vw);
  height: min(220px, 72vw);
  margin: 0 auto 20px;
}

.chart-wrapper svg { width: 100%; height: 100%; }

.chart-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  width: 120px;
}

.chart-center-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-2);
  margin-bottom: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.chart-center-amount {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  color: var(--success);
  line-height: 1.1;
  letter-spacing: -0.02em;
  transition: color .15s;
}

/* ── Stats Row ─────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.stat-card-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.stat-icon-rev { background: rgba(59,130,246,0.15); color: var(--chart-revenue); }
.stat-icon-exp { background: rgba(245,166,35,0.15);  color: var(--chart-expense); }

.stat-card-label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.stat-card-value {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Custom Date Range ─────────────────────────────────── */
.custom-range {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.custom-range.hidden { display: none; }

.custom-range-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 14px;
}

.custom-range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.custom-range .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 12px;
}

/* ── Recent Activity ───────────────────────────────────── */
.recent-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 6px;
}

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

.recent-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.activity-row-border {
  border-bottom: 1px solid var(--border);
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon-revenue { background: rgba(59,130,246,0.15); color: var(--chart-revenue); }
.activity-icon-expense { background: rgba(245,166,35,0.15);  color: var(--chart-expense); }

.activity-info { flex: 1; min-width: 0; }

.activity-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-sub {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 1px;
}

.activity-amount {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

.activity-amount-rev { color: var(--success); }
.activity-amount-exp { color: var(--danger); }

/* ── Photo Capture ─────────────────────────────────────── */
.photo-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.btn-photo {
  flex: 1;
  background: var(--bg);
  border: 1.5px dashed var(--border-solid);
  border-radius: 10px;
  padding: 11px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--chart-revenue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .2s, border-color .2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-photo:hover { background: rgba(37,99,235,0.08); border-color: var(--chart-revenue); }

.photo-preview-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border-solid);
  margin-bottom: 4px;
}
.photo-preview-wrap img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  display: block;
}
.photo-clear-btn {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.scan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.btn-scan {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-scan:hover { background: #c05e16; }
.btn-scan:disabled { background: var(--border-solid); color: var(--text-2); cursor: not-allowed; }

.scan-status {
  font-size: 12px;
  color: var(--text-2);
  flex: 1;
}

.scan-progress-bar {
  height: 4px;
  background: var(--border-solid);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.scan-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .2s;
  width: 0%;
}

.photo-tip {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ── Page action row ───────────────────────────────────── */
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 380px) {
  .page-actions .btn-primary { flex: 1 0 100%; }
}

.btn-outline {
  background: none;
  border: 1px solid var(--border-solid);
  color: var(--text-3);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background .2s, border-color .2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-outline:hover { background: var(--hover-overlay); border-color: var(--border-solid); }

/* ── Ticket tags ───────────────────────────────────────── */
.list-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.tag {
  background: var(--surface-overlay);
  border: 1px solid var(--border-solid);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10px;
  color: var(--text-2);
  white-space: nowrap;
}

.tag-tons {
  border-color: rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.1);
  color: var(--chart-revenue);
}

/* ── PDF modals ────────────────────────────────────────── */
.pdf-section {
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}
.pdf-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
  margin-bottom: 10px;
}

/* ── Settings page ─────────────────────────────────────── */
.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
  margin-bottom: 14px;
}
.settings-save-btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  margin-top: 4px;
}
.btn-danger-outline {
  background: none;
  border: 1px solid rgba(248,113,113,0.3);
  color: var(--danger);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background .2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-danger-outline:hover { background: rgba(248,113,113,0.08); }

/* ── Invoice verification badges ──────────────────────── */
.badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(74,222,128,0.12);
  color: var(--success);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-pending {
  display: inline-flex;
  align-items: center;
  background: rgba(245,166,35,0.15);
  color: var(--chart-expense);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Invoice match results ─────────────────────────────── */
.match-results {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid var(--border-solid);
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow-y: auto;
}
.match-results.hidden { display: none; }
.match-results-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0 7px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  gap: 6px;
}
.match-row:last-child { border-bottom: none; }
.match-row-ok   { border-left: 3px solid var(--success); }
.match-row-fill { border-left: 3px solid var(--primary); }
.match-row-fill .match-icon { color: var(--primary); }
.match-row-diff { border-left: 3px solid var(--chart-expense); }
.match-row-diff .match-amount { font-size: 11px; color: var(--chart-expense); }
.match-row-warn { border-left: 3px solid var(--chart-expense); }
.match-row-miss { border-left: 3px solid var(--border-solid); color: var(--text-2); font-style: italic; }
.match-icon     { font-size: 13px; flex-shrink: 0; }
.match-ticket   { font-weight: 600; flex: 1; }
.match-amount   { font-family: 'DM Mono', monospace; font-weight: 500; color: var(--success); flex-shrink: 0; }
.match-note     { color: var(--text-2); font-size: 11px; flex-shrink: 0; }

.invoice-summary {
  background: var(--card-2);
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border-solid);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.invoice-summary.hidden { display: none; }
.invoice-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.invoice-summary-row .inv-label { color: var(--text-2); }
.invoice-summary-row .inv-value { font-family: 'DM Mono', monospace; font-weight: 500; }
.invoice-summary-total {
  border-top: 1px solid var(--border-solid);
  padding-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--chart-revenue);
}

/* ── Account icon (header) ─────────────────────────────── */
.account-icon-btn { background: none; border: none; padding: 4px; cursor: pointer; display: flex; align-items: center; }
.account-avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface-overlay); color: var(--text); }
.account-avatar-img { width: 100%; height: 100%; object-fit: cover; }

/* ── Profile photo (settings) ──────────────────────────── */
.profile-photo-circle { width: 80px; height: 80px; border-radius: 50%; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; border: 2px solid var(--border); color: var(--text-2); }
.profile-photo-img { width: 100%; height: 100%; object-fit: cover; }

/* ── Plants list ───────────────────────────────────────── */
.plants-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 4px; }
.plant-tag { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px 4px 12px; font-size: 13px; color: var(--text-1); }
.plant-remove { background: none; border: none; color: var(--text-2); font-size: 18px; cursor: pointer; padding: 0; line-height: 1; }
.plant-remove:hover { color: var(--text-1); }

/* ── PDF upload badge ──────────────────────────────────── */
.pdf-badge { font-size: 13px; padding: 10px; color: var(--text-2); text-align: center; width: 100%; }
/* ── Toast notification ──────────────────────────────────── */
#toast { position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 24px; font-size: 14px; font-weight: 500; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; white-space: nowrap; }
#toast.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.field-warn { font-size: 12px; color: var(--chart-expense); margin-top: 4px; }
.btn-use-invoice, .btn-add-to-app { margin-top: 6px; padding: 4px 10px; font-size: 12px; border-radius: 6px; border: 1px solid var(--chart-expense); color: var(--chart-expense); background: transparent; cursor: pointer; width: 100%; }
.match-row-diff-accepted { border-left-color: var(--primary); }
.match-row-diff-accepted .btn-use-invoice { border-color: var(--primary); color: var(--primary); }
.match-row-added { border-left-color: var(--success); }
.match-row-added .btn-add-to-app { border-color: var(--success); color: var(--success); }

/* ── AI chat answer box ────────────────────────────────── */
.ai-answer-box {
  background: var(--bg);
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
}

/* ── AI alerts on dashboard ────────────────────────────── */
.ai-alert-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-alert-row {
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 0;
}
.ai-alert-warn { color: var(--danger); }
.ai-alert-tip  { color: var(--text-3); }

/* ── Auth Screen ─────────────────────────────────────────── */
#auth-screen { position: fixed; inset: 0; background: #E9EBEF; display: flex; align-items: flex-start; justify-content: center; z-index: 10000; padding: 24px; overflow-y: auto; }
#auth-screen.hidden { display: none; }
.auth-card { background: #F5F6F8; border-radius: 28px; padding: 32px 28px 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.12); margin-top: auto; margin-bottom: auto; }
/* Brand */
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth-logo-box { width: 64px; height: 64px; border-radius: 18px; background: #F5A623; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(245,166,35,0.45); }
.auth-brand-name { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; text-align: center; }
.auth-haul   { color: #1A1D29; }
.auth-ledger { color: #B47200; }
.auth-subtitle { font-size: 13px; color: rgba(26,29,41,0.5); text-align: center; margin-top: 3px; }
/* Error + title */
.auth-error { font-size: 13px; color: #dc2626; background: rgba(220,38,38,0.08); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; text-align: center; }
.auth-card h2 { font-size: 19px; font-weight: 700; color: #1A1D29; letter-spacing: -0.02em; margin-bottom: 20px; }
/* Field labels */
.auth-field-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(26,29,41,0.38); margin-bottom: 7px; }
/* Input wrapper (reveal button) */
.auth-field-wrap { position: relative; }
.auth-field-wrap input { padding-right: 44px !important; }
/* Inputs */
#auth-screen input[type="text"], #auth-screen input[type="email"], #auth-screen input[type="password"] { width: 100%; height: 48px; background: #F7F8FA; border: 1.5px solid rgba(26,29,41,0.10); border-radius: 12px; padding: 0 16px; font-family: 'DM Sans', sans-serif; font-size: 15px; color: #1A1D29; outline: none; transition: border-color 0.18s, box-shadow 0.18s, background 0.18s; }
#auth-screen input:focus { background: #fff; border-color: #F5A623; box-shadow: 0 0 0 3px rgba(245,166,35,0.18); }
#auth-screen input::placeholder { color: rgba(26,29,41,0.3); }
/* Reveal button */
.auth-reveal-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
/* Terms */
.auth-terms-group { margin: 4px 0 20px; }
.auth-terms-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.auth-checkbox-box { width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0; margin-top: 1px; background: #F7F8FA; border: 1.5px solid rgba(26,29,41,0.10); display: flex; align-items: center; justify-content: center; transition: all 0.15s ease; }
.auth-checkbox-box.checked { background: #F5A623; border-color: #F5A623; }
.auth-checkbox-box.checked::after { content: ''; display: block; width: 10px; height: 10px; background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' stroke='%231A1D29' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; }
.auth-terms-text { font-size: 13px; color: rgba(26,29,41,0.5); line-height: 1.45; }
.auth-terms-text strong { color: #B47200; }
/* Forgot row */
.auth-forgot-row { text-align: right; margin-top: -4px; margin-bottom: 20px; }
.auth-link-inline { background: none; border: none; font-size: 13px; font-weight: 600; color: #B47200; cursor: pointer; padding: 0; }
/* Submit button */
.auth-submit-btn { width: 100%; height: 50px; border: none; cursor: pointer; border-radius: 13px; background: #F5A623; color: #1A1D29; font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 700; letter-spacing: 0.01em; box-shadow: 0 6px 18px rgba(245,166,35,0.45); transition: transform 0.1s ease; margin-top: 4px; }
.auth-submit-btn:active { transform: scale(0.98); }
/* Footer */
.auth-footer { display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.auth-link { background: none; border: none; font-size: 13px; font-weight: 600; color: #B47200; cursor: pointer; padding: 8px 0 4px; text-align: center; }
.auth-lang-btn { opacity: 0.5; font-weight: 400; }

/* ── List groups (collapsible) ─────────────────────────── */
.list-group { display: flex; flex-direction: column; margin-bottom: 10px; }

.group-header {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; width: 100%;
  padding: 8px 2px; cursor: pointer;
  color: var(--text-2); font-family: 'DM Sans', sans-serif;
}
.group-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  flex: 1; text-align: left;
}
.group-count {
  font-size: 11px;
  background: var(--surface-overlay);
  border-radius: 10px; padding: 1px 7px;
}
.group-chevron { width: 14px; height: 14px; flex-shrink: 0; transition: transform .18s; }
.group-header[data-open="true"] .group-chevron { transform: rotate(180deg); }

.group-body { display: flex; flex-direction: column; gap: 8px; }
.group-body.collapsed { display: none; }

/* ── FAB action menu ───────────────────────────────────── */
.fab-wrap {
  position: sticky; bottom: 16px;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 10px; pointer-events: none;
  padding-right: 4px; margin-top: 16px;
  z-index: 10;
}
.fab-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,99,235,.5);
  transition: transform .18s, background .15s;
  pointer-events: all;
}
.fab-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.fab-btn.open { transform: rotate(45deg); background: var(--primary-dark); }

.fab-menu {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px; pointer-events: all;
}
.fab-menu.hidden { display: none; }

.fab-menu-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-2); border: 1px solid var(--border-solid);
  border-radius: 22px; padding: 9px 16px 9px 12px;
  font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
  font-family: 'DM Sans', sans-serif;
  transition: background .15s;
}
.fab-menu-item svg { width: 14px; height: 14px; flex-shrink: 0; stroke: currentColor; }
.fab-menu-item--primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.fab-menu-item:active { opacity: .8; }

/* ── Tutorial ──────────────────────────────────────────── */
.tut-body-wrap { text-align: center; padding-top: 8px; }
.tut-icon      { font-size: 52px; text-align: center; margin-bottom: 12px; }
.tut-body      { font-size: 15px; line-height: 1.65; color: var(--text-2); text-align: center; margin: 0; }
.tut-dots      { display: flex; justify-content: center; gap: 7px; margin-top: 22px; }
.tut-dot       { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background 0.2s; }
.tut-dot.active { background: var(--primary); }

/* ── Upgrade to Pro modal ──────────────────────────────── */
.upgrade-body-wrap   { text-align: center; padding-top: 4px; }
.upgrade-badge       { font-size: 2.2rem; margin-bottom: 6px; }
.upgrade-sub         { font-size: 15px; color: var(--text-2); margin: 0 0 18px; }
.upgrade-features    { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; }
.upgrade-features li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.upgrade-features li:last-child { border-bottom: none; }
.upgrade-promo-code  { font-size: 13px; font-weight: 700; color: var(--primary); letter-spacing: 0.02em; margin: 0; }

/* ── Desktop wrapper ───────────────────────────────────── */
@media (min-width: 480px) {
  body { background: #0a0c12; }
  #app { box-shadow: 0 0 60px rgba(0,0,0,.5); }
}
