/* =============================================================
   BeanCounter — "Greed Is Good" · LIGHT edition
   White marble · gold + money-green Wall Street accents
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,900&family=Oswald:wght@400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,700&family=Instrument+Sans:wght@400;500;600&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* surfaces (white marble) */
  --bg:      #FFFFFF;
  --bg2:     #F7F4EA;
  --card:    #FFFFFF;
  --card2:   #FCFAF2;
  --inset:   #F4F1E6;

  /* metals & money */
  --gold:    #B8901E;
  --gold-lt: #D9B53D;
  --gold-dk: #806413;
  --green:   #1FA97A;
  --green-lt:#17A06B;
  --green-dk:#0E5C3F;
  --green-soft: #E2F4EC;

  /* text */
  --ink:     #1E2A22;
  --muted:   #7C8473;
  --line:    #E5DDC8;
  --red:     #C8462F;

  --font-head: 'Fraunces', Georgia, serif;
  --font-body: 'Instrument Sans', -apple-system, sans-serif;
  --font-cond: 'Oswald', 'Arial Narrow', sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 72px;
  --shadow: 0 2px 12px rgba(30,42,34,.07);
  --shadow-lg: 0 8px 26px rgba(30,42,34,.12);
}

html { height: 100%; font-size: 16px; }

body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(700px 460px at 50% -10%, rgba(31,169,122,.07) 0%, transparent 60%),
    radial-gradient(700px 520px at 100% 108%, rgba(184,144,30,.06) 0%, transparent 60%),
    var(--bg);
}

/* faint gold pinstripes */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(184,144,30,.045) 0px,
    rgba(184,144,30,.045) 1px,
    transparent 1px,
    transparent 12px
  );
}

/* ── APP SHELL ── */
#app {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

/* ── SCREENS ── */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.screen.hidden { display: none !important; }

.screen-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 100px;
}

/* ── HEADER ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
  background: var(--bg2);
  border-bottom: 2px solid var(--gold);
  gap: 8px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 18px;
  color: var(--gold-dk);
  flex: 1;
  text-align: center;
  letter-spacing: .5px;
  font-variant: small-caps;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-mark-img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 8px rgba(184,144,30,.3);
  object-fit: cover;
  flex-shrink: 0;
}

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

.brand-name {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 21px;
  color: var(--gold-dk);
  font-variant: small-caps;
  letter-spacing: .5px;
}

/* ── BUTTONS ── */
.btn-back {
  background: none;
  border: none;
  color: var(--gold-dk);
  font-size: 24px;
  cursor: pointer;
  padding: 2px 0;
  min-width: 40px;
  font-weight: 600;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 19px;
  cursor: pointer;
  padding: 4px;
  min-width: 36px;
  text-align: right;
  color: var(--gold-dk);
}

.btn {
  display: block;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-cond);
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  cursor: pointer;
  padding: 13px 18px;
  text-align: center;
  transition: transform 0.1s, filter 0.1s;
}
.btn:active { transform: translateY(1px); filter: brightness(0.97); }

.btn-primary {
  background: linear-gradient(180deg, #E6C65A, var(--gold));
  color: #2a2106;
  border-color: var(--gold-dk);
  box-shadow: 0 2px 10px rgba(184,144,30,.28);
}
.btn-mint {
  background: linear-gradient(180deg, #28C28E, var(--green));
  color: #fff;
  border-color: var(--green-dk);
  box-shadow: 0 2px 12px rgba(31,169,122,.3);
}
.btn-ghost {
  background: #fff;
  color: var(--gold-dk);
  border-color: var(--gold);
}
.btn-danger {
  background: #fff;
  color: var(--red);
  border-color: var(--red);
}
.btn-full { width: 100%; margin-top: 12px; }
.btn-sm   { padding: 8px 14px; font-size: 13px; margin-top: 8px; width: 100%; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg2);
  border-top: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}
.bottom-nav.hidden { display: none; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-cond);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  padding: 8px 16px;
  flex: 1;
}
.nav-item .nav-glyph { font-size: 20px; line-height: 1; }
.nav-item.active { color: var(--gold-dk); }
.nav-item:disabled, .nav-item.dimmed { opacity: 0.35; cursor: default; }

.nav-fab {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: linear-gradient(180deg, #E6C65A, var(--gold));
  border: 1.5px solid var(--gold-dk);
  box-shadow: 0 0 14px rgba(184,144,30,.45);
  color: #2a2106;
  font-size: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: translateY(-6px);
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.1s, filter 0.1s;
}
.nav-fab:active { transform: translateY(-4px); filter: brightness(0.97); }

/* ══════════════════════════════════════
   AUTH SCREEN
   ══════════════════════════════════════ */
.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 28px;
  gap: 34px;
}

.auth-logo { text-align: center; }

.auth-logo-img {
  width: 132px;
  height: 132px;
  border-radius: 22px;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(184,144,30,.1), 0 8px 30px rgba(30,42,34,.18);
  object-fit: cover;
  margin: 0 auto 18px;
  display: block;
}

.auth-logo h1 {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 44px;
  letter-spacing: .5px;
  line-height: 1;
  color: var(--gold-dk);
  font-variant: small-caps;
}

.auth-logo p {
  font-family: var(--font-cond);
  font-size: 12px;
  color: var(--green-dk);
  margin-top: 6px;
  letter-spacing: .35em;
  text-transform: uppercase;
}

.auth-form { width: 100%; display: flex; flex-direction: column; gap: 10px; }

.auth-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 2px; }

.auth-link {
  background: none;
  border: none;
  color: var(--green-dk);
  font-family: var(--font-cond);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  cursor: pointer;
  padding: 8px;
  width: 100%;
}
.auth-link:active { opacity: 0.7; }

.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

/* ══════════════════════════════════════
   SECTION LABEL
   ══════════════════════════════════════ */
.seclab {
  font-family: var(--font-cond);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dk);
  margin: 16px 0 8px;
  border-bottom: 1.5px solid var(--line);
  padding-bottom: 5px;
}

/* ══════════════════════════════════════
   TRIP CARDS
   ══════════════════════════════════════ */
.card-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.trip-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
}
.trip-card:active { transform: translateY(1px); box-shadow: var(--shadow-lg); border-left-color: var(--green); }

.trip-card-icon { font-size: 30px; flex-shrink: 0; }
.trip-card-body { flex: 1; min-width: 0; }

.trip-card-name {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
  font-variant: small-caps;
  letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trip-card-loc, .trip-card-dates {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.trip-card-meta { text-align: right; flex-shrink: 0; }
.trip-card-total {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--green-dk);
}
.trip-card-count { font-family: var(--font-cond); font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .08em; }

/* ══════════════════════════════════════
   TRIPBAND (dark money feature card on white)
   ══════════════════════════════════════ */
.tripband {
  background:
    radial-gradient(120% 120% at 80% 0%, rgba(217,181,61,.22), transparent 55%),
    linear-gradient(165deg, #14694A, #0A3A28);
  color: #EAF6EF;
  border: 1px solid var(--green-dk);
  border-radius: 14px;
  padding: 18px 18px 16px;
  margin: 4px 0 6px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.tripband-dice {
  position: absolute; right: -6px; top: -10px;
  font-size: 58px; opacity: .16; transform: rotate(12deg); pointer-events: none;
}
.tripband-name {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 23px;
  line-height: 1.1;
  color: var(--gold-lt);
  font-variant: small-caps;
  letter-spacing: .5px;
}
.tripband-loc {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(234,246,239,.7);
  letter-spacing: .05em;
  margin-top: 3px;
}
.tripband-amt {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 34px;
  margin-top: 12px;
  letter-spacing: -.02em;
  color: #8FF0C2;
}
.tripband-amt small { font-size: 16px; opacity: .7; }
.tripband-sub { font-family: var(--font-mono); font-size: 12px; color: var(--gold-lt); margin-top: 3px; }

/* ══════════════════════════════════════
   EXPENSE ROWS
   ══════════════════════════════════════ */
.expense-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.expense-row:last-child { border-bottom: none; }
.expense-row:active { background: rgba(184,144,30,.05); }

.expense-ic {
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0;
}
.expense-body { flex: 1; min-width: 0; }
.expense-name {
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.expense-sub-text { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 1px; }
.expense-amt {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--green-dk);
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   FORMS
   ══════════════════════════════════════ */
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 22px;
  box-shadow: var(--shadow);
}

.field-label {
  display: block;
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-dk);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-top: 20px;
  margin-bottom: 7px;
}
.field-label:first-child { margin-top: 0; }
.optional { font-family: var(--font-body); font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }

.field-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font-size: 16px;
  color: var(--ink);
  background: var(--inset);
  outline: none;
  font-family: var(--font-body);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input::placeholder { color: #a8a995; }
.field-input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,144,30,.15); }
.field-textarea { resize: none; min-height: 72px; }

.date-row { display: flex; gap: 10px; }
.date-field { flex: 1; }
.date-field .field-label { margin-top: 20px; }

/* conditional flight / meal blocks */
.cond-fields { margin-top: 4px; }

/* client / team toggle */
.toggle-row { display: flex; gap: 10px; }
.toggle-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--inset);
  border-radius: var(--radius-sm);
  padding: 11px;
  font-family: var(--font-cond);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.toggle-btn.active {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-dk);
  font-weight: 600;
}

/* ── AMOUNT ── */
.amount-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.amount-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 2px rgba(31,169,122,.16); }
.amount-symbol {
  font-family: var(--font-mono);
  font-size: 26px; font-weight: 700;
  padding: 0 2px 0 13px;
  color: var(--green-dk);
  flex-shrink: 0;
}
.amount-input {
  border: none; background: transparent;
  font-family: var(--font-mono);
  font-size: 34px; font-weight: 700;
  padding: 10px 14px 10px 2px;
  flex: 1; min-width: 0;
  color: var(--green-dk);
}
.amount-input:focus { outline: none; }
.amount-input::-webkit-inner-spin-button,
.amount-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── CATEGORY LIST ── */
.cat-group-label {
  font-family: var(--font-cond);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 5px;
}
.cat-list { display: flex; flex-direction: column; gap: 6px; }

.cat-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: border-color 0.1s, background 0.1s;
}
.cat-chip:active:not(.disabled) { border-color: var(--gold); }
.cat-chip.selected {
  background: var(--green-soft);
  border-color: var(--green);
}
.cat-chip.selected .cat-name { color: var(--green-dk); }
.cat-chip.selected .cat-tag { background: #fff; color: var(--green-dk); border-color: var(--green); }
.cat-chip.disabled { opacity: .5; cursor: default; }
.cat-chip.disabled .cat-tag { color: var(--red); border-color: var(--red); }

.cat-emoji { font-size: 17px; flex-shrink: 0; }
.cat-name {
  font-family: var(--font-cond);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: .02em;
  color: var(--ink);
  flex: 1;
}
.cat-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--gold-dk);
  background: rgba(184,144,30,.08);
  border: 1px solid var(--gold);
  border-radius: 5px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── RECEIPT AREA ── */
.receipt-area {
  border: 1.5px dashed var(--gold);
  border-radius: var(--radius-sm);
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: var(--inset);
  transition: border-color 0.15s;
}
.receipt-area:active { border-color: var(--gold-dk); }
.receipt-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--muted); font-size: 14px; padding: 20px; text-align: center;
}
.receipt-ph-icon { font-size: 38px; }
.receipt-preview { width: 100%; max-height: 240px; object-fit: contain; display: block; }

/* ══════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 52px 24px; gap: 8px;
}
.empty-icon { font-size: 56px; margin-bottom: 8px; }
.empty-state h2 {
  font-family: var(--font-head); font-weight: 900; font-size: 22px;
  color: var(--gold-dk); font-variant: small-caps; letter-spacing: .5px;
}
.empty-state p { color: var(--muted); font-size: 15px; max-width: 260px; }

/* ══════════════════════════════════════
   MODAL
   ══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30,42,34,.45);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal-sheet {
  background: var(--card);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--line);
  border-bottom: none;
  width: 100%; max-width: 480px;
  padding: 12px 20px 0;
  max-height: 88dvh; overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(30,42,34,.18);
}
.modal-handle { width: 42px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 16px; }

.modal-header { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 14px; }
.modal-ic {
  width: 46px; height: 46px;
  border-radius: 11px;
  border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
}
.modal-info { flex: 1; min-width: 0; }
.modal-category {
  font-family: var(--font-head); font-weight: 900; font-size: 19px;
  color: var(--gold-dk); font-variant: small-caps; letter-spacing: .4px;
}
.modal-merchant { font-size: 13px; color: var(--muted); margin-top: 2px; }
.modal-amount {
  font-family: var(--font-mono); font-weight: 700; font-size: 22px;
  color: var(--green-dk); flex-shrink: 0;
}
.modal-receipt {
  width: 100%; border-radius: var(--radius-sm); max-height: 260px;
  object-fit: contain; background: var(--inset);
  border: 1px solid var(--line); margin-bottom: 12px;
}
.modal-note {
  background: var(--inset); border-radius: var(--radius-sm);
  padding: 9px 13px; font-size: 14px; color: var(--muted);
  font-style: italic; margin-bottom: 10px;
}
.modal-ded-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--green-soft);
  color: var(--green-dk);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 700;
  margin-bottom: 16px;
}
.modal-actions { display: flex; gap: 10px; padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)); }
.modal-actions .btn { flex: 1; margin-top: 0; }

/* ══════════════════════════════════════
   TOAST  (dark chip pops on white)
   ══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + max(12px, env(safe-area-inset-bottom, 12px)) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1E2A22;
  color: var(--gold-lt);
  border: 1px solid var(--gold);
  padding: 11px 22px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.35s;
  letter-spacing: .04em;
  box-shadow: var(--shadow-lg);
}
.toast.hidden { opacity: 0; }

/* ══════════════════════════════════════
   SPINNER
   ══════════════════════════════════════ */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ══════════════════════════════════════
   SUMMARY: HERO + STAT CARDS
   ══════════════════════════════════════ */
.hero {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(184,144,30,.1), var(--shadow-lg);
  margin: 4px 0 8px;
  aspect-ratio: 1 / 1;
  max-height: 300px;
}
.hero-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  animation: kenburns 14s ease-in-out infinite alternate;
}
.hero-scan {
  position: absolute; left: 0; right: 0; height: 28px;
  background: linear-gradient(180deg, transparent, rgba(63,216,155,.35), transparent);
  box-shadow: 0 0 22px 6px rgba(31,169,122,.4);
  pointer-events: none;
  animation: heroScan 3.2s ease-in-out infinite;
}
.hero-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(0deg, rgba(8,10,7,.92), transparent);
  color: var(--gold-lt);
  font-family: var(--font-head);
  font-weight: 900;
  font-variant: small-caps;
  letter-spacing: .5px;
  font-size: 17px;
  text-align: center;
  padding: 28px 12px 12px;
}

@keyframes kenburns {
  0%   { transform: scale(1)    translate(0, 0); }
  100% { transform: scale(1.12) translate(-2%, -2%); }
}
@keyframes heroScan {
  0%   { top: -30px; opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { top: 100%;  opacity: 0; }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat-card.gold { border-top-color: var(--gold); }
.stat-card.wide { grid-column: 1 / -1; }
.stat-icon { font-size: 22px; }
.stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 26px;
  color: var(--green-dk);
  margin-top: 6px;
  letter-spacing: -.01em;
}
.stat-card.gold .stat-value { color: var(--gold-dk); }
.stat-label {
  font-family: var(--font-cond);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-top: 2px;
}
.stat-sub { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ══════════════════════════════════════
   LASER EXPORT OVERLAY (stays dark — it's a moment)
   ══════════════════════════════════════ */
.laser-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: radial-gradient(circle at 50% 42%, #0f2a1e 0%, #000 72%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  animation: fadeIn 0.25s ease;
}
.laser-overlay.hidden { display: none; }

.laser-stage { position: relative; display: grid; place-items: center; }
.laser-stage-wide { width: 240px; height: 240px; }

.laser-hero {
  width: 220px; height: 220px;
  border-radius: 24px; object-fit: cover;
  border: 2px solid var(--gold-lt);
  box-shadow: 0 0 0 4px rgba(217,181,61,.25), 0 0 50px rgba(31,169,122,.55);
  animation: laserPulse 0.9s ease-in-out infinite;
  z-index: 2;
}
.laser-scan {
  position: absolute; left: 18px; right: 18px; height: 6px;
  background: linear-gradient(90deg, transparent, var(--green), #6ef0bd, var(--green), transparent);
  box-shadow: 0 0 16px 3px rgba(31,169,122,.8);
  border-radius: 4px; z-index: 4;
  animation: laserScan 1.4s ease-in-out infinite;
}
.laser-text {
  font-family: var(--font-head); font-weight: 900; font-size: 28px;
  color: var(--gold-lt); font-variant: small-caps; letter-spacing: .06em;
  text-shadow: 0 0 18px rgba(31,169,122,.9);
  text-align: center; padding: 0 24px;
}
.laser-sub {
  font-family: var(--font-mono); font-size: 13px;
  color: #6ef0bd; letter-spacing: .05em; text-align: center; padding: 0 30px;
}

@keyframes laserPulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(217,181,61,.25), 0 0 30px rgba(31,169,122,.4); }
  50%     { box-shadow: 0 0 0 6px rgba(255,40,40,.4), 0 0 55px rgba(255,40,40,.55); }
}
@keyframes laserScan {
  0%   { top: 22px;  opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { top: 200px; opacity: 0; }
}
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Map panel is desktop-only; hidden on phones */
.trips-map-col { display: none; }
#trips-map {
  width: 100%;
  height: 60vh;
  border-radius: 14px;
  background: #BFE3F5; /* light blue oceans */
}
/* Black city labels on the green map */
.city-label {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.city-label span {
  font-family: var(--font-cond);
  font-size: 8.5px;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
}

/* ══════════════════════════════════════
   DESKTOP / LAPTOP LAYOUT (fills the screen)
   ══════════════════════════════════════ */
@media (min-width: 820px) {
  /* App fills the viewport; leave room on the left for the nav rail */
  #app { max-width: 100%; padding-left: 92px; }

  .screen-body {
    padding: 30px clamp(28px, 4vw, 80px) 60px;
    width: 100%;
    margin: 0 auto;
  }

  /* ── Bottom nav becomes a left-hand vertical rail ── */
  .bottom-nav {
    flex-direction: column;
    justify-content: flex-start;
    gap: 14px;
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    transform: none;
    width: 92px;
    height: 100dvh;
    max-width: 92px;
    padding: 28px 0 24px;
    border-top: none;
    border-right: 2px solid var(--gold);
  }
  .nav-item { flex: none; padding: 10px 8px; }
  .nav-fab { transform: none; }
  .nav-fab:active { transform: translate(0, 1px); }

  /* ── Trips screen: list left, map right ── */
  #screen-trips .screen-body { max-width: 1600px; }
  .trips-layout {
    display: flex;
    gap: 26px;
    align-items: flex-start;
  }
  .trips-list-col { flex: 1 1 44%; min-width: 0; }
  .trips-map-col {
    display: block;
    flex: 1 1 56%;
    position: sticky;
    top: 92px;
  }
  #trips-map {
    height: calc(100dvh - 180px);
    min-height: 420px;
    border: 1.5px solid var(--gold);
    box-shadow: var(--shadow-lg);
  }

  /* Cards: within the left column, comfortable auto-fill */
  .card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }

  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .stat-card.wide { grid-column: span 2; }
  .hero { max-width: 560px; margin: 4px auto 14px; }

  /* Detail + form screens stay a comfortable centered reading column */
  #screen-trip .screen-body,
  #screen-new-trip .screen-body,
  #screen-new-expense .screen-body { max-width: 720px; }

  .cat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
  }
  .cat-group-label { grid-column: 1 / -1; }
}

/* Map popup buttons */
.map-pop b { font-family: var(--font-head); font-variant: small-caps; font-size: 15px; }
.map-pop-city { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.map-pop-list { max-height: 200px; overflow-y: auto; }
.map-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px;
  border-top: 1px solid #eee;
  cursor: pointer;
}
.map-pop-row:hover { background: #f3f6f2; }
.map-pop-row .mp-name { font-weight: 600; font-size: 13px; }
.map-pop-row .mp-meta { font-family: var(--font-mono); font-size: 11px; color: #777; }
.map-pop-btn {
  margin-top: 6px;
  display: inline-block;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  cursor: pointer;
}

/* Flying-money pins (city with an expense) */
.money-pin {
  position: relative;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.45));
}
.money-pin img {
  width: 36px;
  height: 36px;
  display: block;
}
.tp-flag-img { width: 28px; height: 28px; display: block; }

/* (legacy emoji flag pin, kept for safety) */
.flag-pin {
  position: relative;
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.4));
  text-align: center;
}
.flag-count {
  position: absolute;
  top: -7px; right: -11px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1.5px solid #fff;
  padding: 0 3px;
}

/* ── Designed map popup (city report dropdown) ── */
.trip-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(30,42,34,.28);
}
.trip-popup .leaflet-popup-content { margin: 0; width: auto !important; }
.trip-popup .leaflet-popup-tip { background: var(--card); }

.tp { font-family: var(--font-body); background: var(--card); }
.tp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(160deg, #14694A, #0A3A28);
  color: #EAF6EF;
}
.tp-flag { font-size: 24px; line-height: 1; }
.tp-head-text { display: flex; flex-direction: column; min-width: 0; }
.tp-city {
  font-family: var(--font-head);
  font-weight: 900;
  font-variant: small-caps;
  letter-spacing: .4px;
  font-size: 16px;
  color: var(--gold-lt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tp-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(234,246,239,.75);
  letter-spacing: .04em;
}

.tp-list { max-height: 210px; overflow-y: auto; }
.tp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  background: var(--card);
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s;
}
.tp-row:last-child { border-bottom: none; }
.tp-row:hover { background: var(--green-soft); }
.tp-row-main { display: flex; flex-direction: column; min-width: 0; }
.tp-row-name {
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tp-row-meta { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 1px; }
.tp-row-amt {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--green-dk);
  flex-shrink: 0;
}

/* Trip detail action buttons (Add line item + Export) */
.trip-actions { display: flex; gap: 10px; margin-top: 6px; }
.trip-actions .btn { flex: 1; margin-top: 0; }

/* ── Floating "Add line item" button (trip screen) ── */
.fab-add {
  position: fixed;
  right: 18px;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #E6C65A, var(--gold));
  color: #2a2106;
  border: 2px solid var(--gold-dk);
  border-radius: 999px;
  padding: 13px 20px 13px 16px;
  box-shadow: 0 6px 20px rgba(184,144,30,.5);
  cursor: pointer;
  font-family: var(--font-cond);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: transform 0.1s, filter 0.1s;
}
.fab-add:active { transform: translateY(1px); filter: brightness(0.97); }
.fab-plus { font-size: 24px; line-height: 1; font-weight: 700; }

/* On desktop the nav is a left rail, so float bottom-right clear of it */
@media (min-width: 820px) {
  .fab-add { right: 28px; bottom: 28px; }
}

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