/* ── Auth screen ── */
.auth-screen {
  min-height: 100dvh;
  background: linear-gradient(135deg, #1D4ED8 0%, #1e40af 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  background: white;
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-logo  { font-size: 48px; text-align: center; display: block; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 24px; font-weight: 800; color: #1E293B; margin-bottom: 2px; }
.auth-sub   { text-align: center; font-size: 13px; color: #94A3B8; margin-bottom: 24px; }
.auth-form  { display: flex; flex-direction: column; gap: 14px; }
.auth-error {
  background: #FEE2E2; color: #DC2626;
  border-radius: 8px; padding: 10px 12px;
  font-size: 13px;
}
.auth-toggle { text-align: center; margin-top: 18px; font-size: 13px; color: #64748B; }
.auth-toggle a { color: #1D4ED8; font-weight: 600; text-decoration: none; }

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      #1D4ED8;
  --blue-lt:   #DBEAFE;
  --blue-mid:  #3B82F6;
  --green:     #16A34A;
  --green-lt:  #DCFCE7;
  --amber:     #D97706;
  --amber-lt:  #FEF3C7;
  --purple:    #7C3AED;
  --purple-lt: #EDE9FE;
  --red:       #DC2626;
  --red-lt:    #FEE2E2;
  --gray-50:   #F8FAFC;
  --gray-100:  #F1F5F9;
  --gray-200:  #E2E8F0;
  --gray-400:  #94A3B8;
  --gray-600:  #475569;
  --gray-800:  #1E293B;
  --radius:    12px;
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --tab-h:     64px;
  --header-h:  56px;
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

body {
  background: var(--gray-100);
  color: var(--gray-800);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--gray-50);
  position: relative;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-h);
  padding: 0 16px;
  background: var(--blue);
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.header-logo  { font-size: 22px; }
.header-title { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.header-right { display: flex; align-items: center; gap: 6px; }
.header-user  { font-size: 12px; opacity: .8; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; }

/* ── Main scrollable area ── */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

/* ── Tab panes ── */
.tab-pane { display: none; padding: 0; }
.tab-pane.active { display: block; }

/* ── Report bar ── */
.report-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 8px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.report-name-btn {
  flex: 1;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.report-name-btn small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-400);
  margin-top: 1px;
}
.report-new-btn {
  flex-shrink: 0;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.no-report-text {
  flex: 1;
  font-size: 14px;
  color: var(--gray-400);
}

/* ── Year file cards (home page) ── */
.year-cards-bar { background: white; border-bottom: 1px solid var(--gray-100); padding: 12px 16px 8px; }
.year-cards-scroll { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.year-cards-scroll::-webkit-scrollbar { display: none; }
.year-card {
  flex-shrink: 0; min-width: 110px;
  background: var(--gray-50); border: 1.5px solid var(--gray-200);
  border-radius: 12px; padding: 10px 14px;
  cursor: pointer; text-align: center; transition: all .15s;
}
.year-card-active {
  background: #eff6ff; border-color: var(--blue);
}
.year-card-name { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.year-card-total { font-size: 16px; font-weight: 800; color: var(--blue); margin-top: 4px; }
.year-card-count { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.year-card-new { color: var(--blue); border-style: dashed; font-size: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.year-card { position: relative; }
.year-card-del {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gray-200); border: none; cursor: pointer;
  font-size: 10px; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  line-height: 1; padding: 0;
}
.year-card-del:hover { background: #fee2e2; color: #dc2626; }
.year-cards-empty { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--gray-400); }
.year-select { width: 100%; padding: 10px 12px; font-size: 16px; border: 1.5px solid var(--gray-200); border-radius: 8px; background: white; }
.year-new-btn { background: var(--blue); color: white; border: none; border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }

/* ── Report year pills ── */
.report-year-pills { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 4px; }
.report-year-pill {
  padding: 6px 16px; border-radius: 20px; border: 1.5px solid var(--gray-200);
  background: var(--gray-50); font-size: 13px; font-weight: 600;
  color: var(--gray-600); cursor: pointer; transition: all .15s;
}
.report-year-pill.active { background: #eff6ff; border-color: var(--blue); color: var(--blue); }

/* ── Report / period picker modal ── */
.period-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50dvh;
  overflow-y: auto;
  margin-top: 8px;
}
.period-picker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 14px;
  border-radius: 10px;
  border: 1.5px solid var(--gray-200);
  font-size: 14px;
  font-weight: 600;
  transition: background .12s;
}
.period-picker-item.active-period {
  border-color: var(--blue);
  background: var(--blue-lt);
  color: var(--blue);
}
.report-picker-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  cursor: pointer;
  min-width: 0;
}
.report-picker-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.period-picker-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-400);
  margin-top: 2px;
}
.period-picker-item.active-period .period-picker-count { color: var(--blue); opacity: .7; }
.btn-delete-report {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 8px;
  opacity: .4;
  transition: opacity .15s;
  line-height: 1;
}
.btn-delete-report:active { opacity: 1; }

/* ── Clear filter button ── */
.clear-filter-btn {
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  cursor: pointer;
}

/* ── Category grid ── */
/* ── Member filter bar ── */
.member-filter-bar {
  display: flex;
  gap: 8px;
  padding: 8px 14px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.member-filter-bar::-webkit-scrollbar { display: none; }
.member-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200);
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.member-pill-active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.member-picker-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.member-pick-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200);
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.member-pick-pill.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.receipt-member-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--gray-400);
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 14px 6px;
}

.cat-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--blue);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.cat-card:active { transform: scale(.97); }
.cat-card.cat-transport { border-color: var(--blue); }
.cat-card.cat-travel    { border-color: var(--green); }
.cat-card.cat-meals     { border-color: var(--amber); }
.cat-card.cat-misc      { border-color: var(--purple); }
.cat-card.cat-color-1   { border-color: var(--blue); }
.cat-card.cat-color-2   { border-color: var(--green); }
.cat-card.cat-color-3   { border-color: var(--amber); }
.cat-card.cat-color-4   { border-color: var(--purple); }
.cat-card.cat-color-5   { border-color: #0891b2; }
.cat-card.cat-color-6   { border-color: #be185d; }
.cat-card.cat-mileage   { border-color: #64748b; }

.cat-icon  { font-size: 20px; margin-bottom: 4px; }
.cat-name  { font-size: 11px; color: var(--gray-600); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; line-height: 1.3; }
.cat-total { font-size: 18px; font-weight: 700; margin-top: 4px; }
.cat-count { font-size: 11px; color: var(--gray-400); margin-top: 1px; }

.cat-card.cat-active           { box-shadow: 0 0 0 2.5px currentColor, var(--shadow); opacity: 1; }
.cat-card.cat-transport.cat-active { box-shadow: 0 0 0 2.5px var(--blue),   var(--shadow); }
.cat-card.cat-travel.cat-active    { box-shadow: 0 0 0 2.5px var(--green),  var(--shadow); }
.cat-card.cat-meals.cat-active     { box-shadow: 0 0 0 2.5px var(--amber),  var(--shadow); }
.cat-card.cat-misc.cat-active      { box-shadow: 0 0 0 2.5px var(--purple), var(--shadow); }
.cat-card.cat-color-1.cat-active   { box-shadow: 0 0 0 2.5px var(--blue),   var(--shadow); }
.cat-card.cat-color-2.cat-active   { box-shadow: 0 0 0 2.5px var(--green),  var(--shadow); }
.cat-card.cat-color-3.cat-active   { box-shadow: 0 0 0 2.5px var(--amber),  var(--shadow); }
.cat-card.cat-color-4.cat-active   { box-shadow: 0 0 0 2.5px var(--purple), var(--shadow); }
.cat-card.cat-color-5.cat-active   { box-shadow: 0 0 0 2.5px #0891b2,       var(--shadow); }
.cat-card.cat-color-6.cat-active   { box-shadow: 0 0 0 2.5px #be185d,       var(--shadow); }
.cat-card.cat-mileage.cat-active   { box-shadow: 0 0 0 2.5px #64748b,       var(--shadow); }

.cat-filter-badge {
  margin-top: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-600);
  background: var(--gray-200);
  border-radius: 999px;
  padding: 2px 7px;
  display: inline-block;
}

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge {
  background: var(--blue);
  color: white;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}

/* ── Receipt list ── */
.receipt-list { padding: 0 12px 80px; }

.receipt-card {
  background: white;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform .12s;
}
.receipt-card:active { transform: scale(.98); }

.receipt-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--gray-100);
  animation: thumbIn 0.25s ease;
}
@keyframes thumbIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.receipt-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.receipt-info { flex: 1; min-width: 0; }
.receipt-desc {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.receipt-meta { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
/* Category management */
.category-manage-list { margin-bottom: 12px; }
.cat-manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.cat-manage-emoji { font-size: 20px; min-width: 28px; text-align: center; }
.cat-manage-name  { flex: 1; font-size: 14px; font-weight: 600; color: var(--gray-800); }
.sort-handle {
  font-size: 20px;
  color: var(--gray-400);
  cursor: grab;
  padding: 8px 6px;
  margin: -8px -2px;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
  -webkit-user-select: none;
}
.sort-handle:active { cursor: grabbing; color: var(--gray-600); }
.sort-dragging {
  opacity: 0;
  pointer-events: none;
}
.sort-placeholder {
  height: 3px;
  background: var(--blue);
  border-radius: 2px;
  margin: 0 8px;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(29,78,216,.18);
}
.cat-emoji-input  { width: 52px; font-size: 18px; text-align: center; border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 8px 4px; }
.cat-name-input   { flex: 1; border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; }
.category-add-row { display: flex; gap: 8px; align-items: center; }

.emoji-picker-wrap { position: relative; flex-shrink: 0; }
.emoji-pick-btn {
  width: 48px; height: 44px;
  font-size: 22px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.emoji-popup {
  position: fixed;
  z-index: 2000;
  display: none;
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 8px;
  grid-template-columns: repeat(7, 36px);
  gap: 4px;
  width: max-content;
  max-width: 290px;
}
.emoji-popup.open { display: grid; }
.emoji-option {
  width: 36px; height: 36px;
  font-size: 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.emoji-option:hover { background: var(--gray-100); }
.emoji-popup.open { display: grid; }

.receipt-cat-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-transport { background: var(--blue-lt);   color: var(--blue); }
.pill-travel    { background: var(--green-lt);  color: var(--green); }
.pill-meals     { background: var(--amber-lt);  color: var(--amber); }
.pill-misc      { background: var(--purple-lt); color: var(--purple); }

.receipt-amount { font-size: 15px; font-weight: 700; color: var(--gray-800); flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ── Camera / Scan tab ── */
.camera-area {
  position: relative;
  width: 100%;
  height: calc(100dvh - var(--header-h) - var(--tab-h) - 110px);
  background: #000;
  overflow: hidden;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.camera-guide {
  width: 80%;
  height: 60%;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
}

.preview-container {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.capture-controls {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: white;
  align-items: center;
  justify-content: center;
}

.scan-hint {
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  padding: 0 16px 8px;
}

/* ── Review form ── */
.review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.review-header h2 { font-size: 16px; }
.btn-back {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.review-image-wrap {
  position: relative;
  width: 100%;
  max-height: 200px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
}
.review-image {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
}

.analyzing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  gap: 10px;
}
.analyzing-overlay p { font-size: 14px; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.receipt-form {
  padding: 14px 16px 90px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-group input,
.form-group select {
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  background: white;
  color: var(--gray-800);
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-row { display: flex; gap: 10px; }
.flex-1 { flex: 1; }
.w-24 { width: 96px; flex-shrink: 0; }

.label-optional { font-weight: 400; color: var(--gray-400); text-transform: none; font-size: 11px; }

.amount-row { display: flex; align-items: center; gap: 8px; }
.amount-row input { flex: 1; }
.fx-orig-amt { font-size: 13px; font-weight: 600; color: var(--gray-700); white-space: nowrap; }
.fx-arrow { font-size: 13px; color: var(--gray-400); white-space: nowrap; }
.fx-badge {
  background: var(--amber-lt);
  color: var(--amber);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Export tab ── */
/* ── Report summary ── */
.report-summary-header {
  background: var(--blue);
  color: white;
  padding: 20px 16px 16px;
  text-align: center;
}
.report-summary-title { font-size: 16px; font-weight: 700; opacity: .9; }
.report-summary-range { font-size: 12px; opacity: .7; margin-top: 2px; }
.report-summary-total { font-size: 36px; font-weight: 800; margin: 10px 0 2px; }
.report-summary-sub   { font-size: 13px; opacity: .7; }
.report-cat-list { padding: 8px 16px; }
.report-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 12px;
}
.report-cat-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.report-cat-icon { font-size: 18px; flex-shrink: 0; }
.report-cat-name { font-size: 14px; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-cat-count { font-size: 11px; color: var(--gray-400); flex-shrink: 0; }
.report-cat-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.report-cat-amt { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.report-bar-track { width: 80px; height: 4px; background: var(--gray-100); border-radius: 2px; }
.report-bar-fill  { height: 100%; background: var(--blue); border-radius: 2px; }
.report-section-title {
  font-size: 11px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 16px 16px 4px;
}
.report-empty { padding: 12px 16px; font-size: 13px; color: var(--gray-400); }

/* By Member */
.report-member-pills {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 16px 12px;
}
.report-member-pill {
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--gray-200);
  background: var(--gray-50); font-size: 13px; font-weight: 500;
  color: var(--gray-600); cursor: pointer; transition: all .15s;
}
.report-member-pill.active {
  background: #ede9fe; border-color: #7c3aed; color: #5b21b6; font-weight: 600;
}
.report-member-list { padding: 0 16px 4px; }
.report-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--gray-100);
}
.report-member-avatar { font-size: 20px; flex-shrink: 0; }
.report-member-mid { width: 80px; flex-shrink: 0; }
.report-member-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.report-bar-track-member { flex: 1; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.report-bar-member { background: #7c3aed; height: 100%; border-radius: 4px; }
.report-member-amt { font-size: 14px; font-weight: 700; color: var(--gray-800); flex-shrink: 0; width: 64px; text-align: right; }
.report-member-empty { padding: 12px 16px; font-size: 13px; color: var(--gray-400); font-style: italic; }

/* Monthly Trend */
.report-month-chart {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 8px 16px 4px;
  overflow-x: auto; scrollbar-width: none;
}
.report-month-chart::-webkit-scrollbar { display: none; }
.report-month-col {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; flex-shrink: 0; min-width: 42px;
}
.report-month-bar-wrap {
  width: 28px; height: 80px;
  display: flex; align-items: flex-end;
}
.report-month-bar {
  width: 100%; min-height: 3px;
  background: var(--blue); border-radius: 4px 4px 0 0;
}
.report-month-toggle-row { display: flex; align-items: center; justify-content: space-between; }
.report-month-toggle-btn { font-size: 12px; font-weight: 600; color: var(--blue); background: none; border: 1.5px solid var(--blue); border-radius: 12px; padding: 2px 10px; cursor: pointer; }
.report-month-amt { font-size: 10px; color: var(--gray-500); font-weight: 600; }
.report-month-label { font-size: 10px; color: var(--gray-400); white-space: nowrap; }

.report-notes-section { padding: 8px 16px 4px; }
.report-mileage-note {
  font-size: 12px; color: var(--gray-500);
  padding: 6px 0; border-top: 1px solid var(--gray-100);
}

/* PDF export bar */
.report-pdf-bar {
  padding: 12px 16px;
  margin-bottom: 80px;
  border-top: 1px solid var(--gray-200);
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
.pdf-export-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pdf-details-check { font-size: 13px; color: var(--gray-500); }
.report-pdf-btn {
  width: auto;
  padding: 8px 20px;
  border-radius: 20px;
  gap: 8px;
  box-shadow: none;
  font-size: 14px;
}
.report-pdf-btn .export-icon { font-size: 16px; }
.report-pdf-btn .export-label { font-size: 14px; font-weight: 600; }
.report-pdf-btn .export-sublabel { display: none; }

.export-section {
  padding: 16px 16px 90px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
}

.export-summary {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.export-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}
.export-summary-row:last-child { border-bottom: none; }
.export-summary-row.total-row {
  font-weight: 700;
  background: var(--blue-lt);
  color: var(--blue);
}
.export-summary-row .row-cat { color: var(--gray-600); }
.export-summary-row .row-amount { font-weight: 600; }

.export-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-export {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-align: left;
  transition: transform .12s, box-shadow .12s;
  box-shadow: var(--shadow);
}
.btn-export:active { transform: scale(.98); }
.btn-excel { background: #16A34A; color: white; }
.btn-pdf   { background: #DC2626; color: white; }
.export-icon { font-size: 28px; flex-shrink: 0; }
.export-label { font-size: 16px; font-weight: 700; }
.export-sublabel { font-size: 12px; opacity: .8; margin-top: 2px; }

.overflow-warning {
  background: var(--amber-lt);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: #92400E;
}
.overflow-warning ul { margin-top: 6px; padding-left: 18px; }

/* ── Save-photo checkbox ── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-800);
  cursor: pointer;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

/* ── PDF support ── */
.pdf-review-ph {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #1E293B;
  color: white;
  font-size: 14px;
  font-weight: 600;
}
.pdf-view-link {
  display: block;
  background: var(--red-lt);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 14px;
  text-align: center;
}
.pdf-embed-wrap {
  width: 100%;
  height: 420px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--gray-100);
}
.pdf-embed {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 18px;
  transition: opacity .15s, transform .12s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--blue); color: white; }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-danger   { background: var(--red); color: white; }
.btn-large    { padding: 14px 28px; font-size: 16px; border-radius: 50px; }
.btn-block    { width: 100%; padding: 14px; font-size: 16px; }

/* ── Tab bar ── */
/* ── Save-photo banner ── */
#savePhotoBanner {
  position: relative;
  background: linear-gradient(90deg, #1D4ED8 0%, #2563EB 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  animation: bannerIn 0.25s ease;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
#savePhotoBanner .banner-text { flex: 1; line-height: 1.3; }
#savePhotoBanner .banner-save {
  background: white;
  color: #1D4ED8;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
#savePhotoBanner .banner-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
}

.tab-bar {
  display: flex;
  height: var(--tab-h);
  background: white;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  transition: color .15s;
}
.tab-btn span:first-child { font-size: 22px; }
.tab-btn.active { color: var(--blue); }
.tab-scan-btn {
  background: var(--blue);
  color: white !important;
  border-radius: 16px 16px 0 0;
  margin: 0 8px;
  box-shadow: 0 -3px 10px rgba(29,78,216,.3);
}
.tab-scan-btn.active { background: var(--blue-mid); }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}
.modal {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 40px;
  width: 100%;
  max-width: 480px;
  max-height: 80dvh;
  overflow-y: auto;
}
.modal-large { max-height: 90dvh; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-hint { font-size: 13px; color: var(--gray-400); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Detail modal */
.zoomable-wrap {
  width: 100%;
  max-height: 260px;
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 14px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-image {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
}
.detail-field {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}
.detail-field:last-child { border-bottom: none; }
.detail-label { color: var(--gray-600); font-weight: 600; }
.detail-value { color: var(--gray-800); text-align: right; max-width: 60%; }

/* ── Mileage tab ── */
/* ── HSA Tab ── */
.hsa-header {
  padding: 16px;
  background: #ecfdf5;
  border-bottom: 1px solid #a7f3d0;
}
.hsa-header-label {
  font-size: 11px; font-weight: 700; color: #065f46;
  text-transform: uppercase; letter-spacing: .05em;
}
.hsa-header-amount {
  font-size: 28px; font-weight: 800; color: #065f46; margin: 4px 0 2px;
}
.hsa-header-sub { font-size: 13px; color: #6ee7b7; }
.hsa-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: #059669;
  font-weight: 600;
}
.hsa-badge-large {
  display: inline-block;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
}
.hsa-label { padding: 4px 0; transition: background .15s, border-color .15s, color .15s; }
.hsa-label:has(input:checked) {
  background: #d1fae5;
  border-color: #059669;
  color: #065f46;
}
.hsa-label:has(input:checked) input[type="checkbox"] {
  accent-color: #059669;
}

.mileage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  gap: 12px;
}
.mileage-header-actions { display: flex; align-items: center; gap: 8px; }
.mileage-rate-block { display: flex; flex-direction: column; gap: 3px; }
.mileage-rate-label-row { display: flex; align-items: center; gap: 8px; }
.mileage-rate-label {
  font-size: 11px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .05em;
}
.mileage-rate-row { display: flex; align-items: center; gap: 8px; }
.irs-edit-btn {
  font-size: 12px; color: var(--blue); background: none; border: none;
  cursor: pointer; padding: 0; font-weight: 600;
}
.irs-rate-input {
  width: 74px; border: 2px solid var(--blue); border-radius: 8px;
  padding: 4px 6px; font-size: 14px; font-weight: 700; color: var(--gray-800);
  text-align: center; -moz-appearance: textfield;
}
.irs-rate-input::-webkit-outer-spin-button,
.irs-rate-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* IRS toggle */
.irs-toggle-wrap { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.irs-toggle-wrap input { opacity: 0; width: 0; height: 0; }
.irs-toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--gray-300); border-radius: 22px; transition: .2s;
}
.irs-toggle-slider:before {
  content: ''; position: absolute; width: 16px; height: 16px;
  left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .2s;
}
.irs-toggle-wrap input:checked + .irs-toggle-slider { background: var(--blue); }
.irs-toggle-wrap input:checked + .irs-toggle-slider:before { transform: translateX(16px); }
.mileage-rate-prefix, .mileage-rate-suffix {
  font-size: 15px; font-weight: 700; color: var(--gray-800);
}
.mileage-rate-input {
  width: 74px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  padding: 5px 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  text-align: center;
  -moz-appearance: textfield;
}
.mileage-rate-input::-webkit-outer-spin-button,
.mileage-rate-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mileage-rate-input:focus { outline: none; border-color: var(--blue); }

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; }

.mileage-list { padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 10px; }

.mileage-card {
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mileage-card:active { opacity: .85; }
.mileage-card-main { flex: 1; min-width: 0; }
.mileage-date { font-size: 12px; color: var(--gray-400); font-weight: 600; margin-bottom: 2px; }
.mileage-route {
  font-size: 14px; font-weight: 700; color: var(--gray-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mileage-desc {
  font-size: 12px; color: var(--gray-600); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mileage-card-right { text-align: right; flex-shrink: 0; }
.mileage-miles { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.mileage-deduction { font-size: 15px; font-weight: 800; color: var(--green); }

.mileage-total-bar {
  margin: 4px 16px 16px;
  background: var(--blue);
  border-radius: 14px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}
.mileage-total-label { font-size: 13px; font-weight: 700; opacity: .85; }
.mileage-total-values { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.mileage-total-miles { font-size: 12px; opacity: .8; }
.mileage-total-deduction { font-size: 20px; font-weight: 800; }

.mileage-virtual-card { border-left: 3px solid var(--blue); }
.mileage-virtual-thumb { background: var(--blue-lt) !important; color: var(--blue) !important; }

.ml-detail-rate {
  font-size: 12px; font-weight: 600; color: var(--gray-400);
  text-align: right; margin-bottom: 8px;
}
.ml-detail-table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: 10px; border: 1px solid var(--gray-200);
}
.ml-detail-table {
  width: 100%; border-collapse: collapse; font-size: 12px; min-width: 400px;
}
.ml-detail-table thead tr { background: var(--blue); color: white; }
.ml-detail-table thead th {
  padding: 8px; font-weight: 700; text-align: left; white-space: nowrap;
}
.ml-detail-table tbody td, .ml-detail-table tfoot td {
  padding: 7px 8px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800);
}
.ml-detail-table tfoot td {
  background: var(--blue-lt); font-weight: 700; border-bottom: none;
}
.ml-row-alt { background: var(--gray-50); }
.ml-num { text-align: right; }

.mileage-form-preview {
  background: var(--green-lt);
  color: var(--green);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

/* ── Admin panel ── */
#adminApp {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--gray-50);
}
.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 40px;
  -webkit-overflow-scrolling: touch;
}
.admin-irs-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.admin-irs-year {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.admin-irs-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mileage-rate-display {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-700);
}
.admin-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 4px 10px;
}
/* ── Admin: domain list ── */
.admin-domain-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 10px;
  line-height: 1.4;
}
.admin-domain-card {
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-domain-info { flex: 1; min-width: 0; }
.admin-domain-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-domain-val {
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
  margin-top: 2px;
}
.admin-domain-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.admin-domain-field {
  flex: 1;
  min-width: 120px;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: white;
}
.admin-domain-field:focus { border-color: var(--blue); }

.admin-search-input { width: 100%; box-sizing: border-box; padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: 12px; font-size: 14px; margin-bottom: 10px; outline: none; }
.admin-search-input:focus { border-color: var(--blue); }

.admin-family-card { background: white; border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.admin-family-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.admin-family-name-wrap { flex: 1; min-width: 0; }
.admin-family-name-input { font-size: 15px; font-weight: 700; color: var(--gray-800); border: none; background: transparent; padding: 2px 4px; border-radius: 6px; width: 100%; outline: none; }
.admin-family-name-input:hover { background: var(--gray-50); }
.admin-family-name-input:focus { background: #eff6ff; border: 1.5px solid var(--blue); }
.admin-family-members { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.admin-family-code-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.admin-family-code { font-family: monospace; font-size: 16px; font-weight: 700; color: var(--blue); letter-spacing: 2px; background: #eff6ff; padding: 4px 10px; border-radius: 8px; }
.admin-family-member-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.admin-family-member-pill { font-size: 12px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 12px; padding: 2px 10px; color: var(--gray-600); }

.admin-user-card {
  background: white;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-user-email {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-lt);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.admin-edit-btn, .admin-del-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.admin-edit-btn { background: var(--gray-100); color: var(--gray-800); }
.admin-edit-btn:hover { background: var(--gray-200); }
.admin-del-btn { background: var(--red-lt); color: var(--red); }
.admin-del-btn:hover { background: #fecaca; }

/* ── Toasts ── */
#toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-800);
  color: white;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
