/* ═══════════════════════════════════════════════════════════
   Sankirtan POS — Stylesheet
   Mobile-first wizard. Uses tokens from css/tokens.css.
   ═══════════════════════════════════════════════════════════ */

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

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--f-sans);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: var(--f-md);
  line-height: 1.5;
}

/* ════════════════════════════════════════
   HEADER
   ════════════════════════════════════════ */
#app-header {
  background: linear-gradient(135deg, var(--c-sankirtan-strong) 0%, var(--c-sankirtan-dark) 100%);
  color: var(--c-surface);
  height: var(--h-header);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 3px 10px rgba(0,0,0,0.30);
  flex-shrink: 0;
}

.header-inner {
  height: 100%;
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 0 var(--s-md);
  display: flex;
  align-items: center;
  gap: var(--s-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  flex: 1;
  min-width: 0;
}

.btn-back {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--c-surface);
  border-radius: var(--r-sm);
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
  line-height: 1;
}
.btn-back:hover { background: rgba(255,255,255,0.25); }

.brand-text h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.15;
  white-space: nowrap;
}

.header-subtitle {
  font-size: 0.68rem;
  font-weight: 300;
  opacity: 0.78;
  letter-spacing: 1px;
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.813rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   OFFLINE BANNER
   ════════════════════════════════════════ */
.offline-banner {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border-bottom: 1px solid var(--c-warn-border);
  text-align: center;
  padding: 6px var(--s-md);
  font-size: var(--f-xs);
  font-weight: 600;
}

/* Real failure state — the count could not be written to the device. */
.offline-banner--alert {
  background: var(--c-err);
  color: var(--c-white);
  border-bottom-color: var(--c-err);
}

/* ════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════ */
#app-main {
  flex: 1;
  width: 100%;
  max-width: var(--w-max);
  margin: 0 auto;
  padding: var(--s-md);
  padding-bottom: calc(var(--s-md) + env(safe-area-inset-bottom));
}

/* ════════════════════════════════════════
   BUTTON SYSTEM (matches Lakshmi patterns)
   ════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: var(--f-sm);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--c-sankirtan-strong);
  color: var(--c-surface);
}
.btn-primary:hover { background: var(--c-sankirtan-dark); }

.btn-outline-dark {
  background: transparent;
  color: var(--c-text-dim);
  border: 1.5px solid var(--c-border);
}
.btn-outline-dark:hover { border-color: var(--c-accent); color: var(--c-accent); }

.btn-sm {
  padding: 7px 13px;
  font-size: var(--f-xs);
  min-height: 36px;
}

/* ════════════════════════════════════════
   STEP SECTIONS (shared)
   ════════════════════════════════════════ */
.step-section {
  animation: stepIn 0.18s ease;
}
@keyframes stepIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-msg {
  text-align: center;
  padding: var(--s-2xl) var(--s-md);
  color: var(--c-text-dim);
  font-size: var(--f-sm);
  line-height: 1.7;
}

/* ════════════════════════════════════════
   LANDING SCREEN
   ════════════════════════════════════════ */
.home {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 6px 0 var(--s-md);
}

.home-greeting { text-align: center; }

.home-hello {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-sankirtan-strong);
}

.home-last {
  font-size: 0.813rem;
  color: var(--c-text-dim);
  margin-top: 4px;
}

.btn-start {
  width: 100%;
  padding: 20px 18px;
  border-radius: 18px;
  background: var(--c-accent);
  color: var(--c-white);
  font-size: 1.125rem;
  font-weight: 700;
  min-height: 60px;
  box-shadow: 0 4px 14px rgba(224,108,46,.32);
}
.btn-start:hover { background: var(--c-accent-h); }

/* ── Stat tiles ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-sm);
}

.stat-tile {
  padding: 14px 10px;
  border-radius: 15px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  text-align: center;
  min-width: 0;
}

.stat-tile-value {
  font-size: 1.3125rem;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

.stat-tile-label {
  font-size: 0.656rem;
  color: var(--c-text-dim);
  margin-top: 2px;
}

/* ── Temple card (dark) ── */
.temple-card {
  padding: 15px 16px;
  border-radius: 16px;
  background: var(--c-text);
  color: var(--c-white);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--s-md);
}

.temple-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-sm);
}

.temple-card-kicker {
  font-size: 0.688rem;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.temple-card-streak {
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--c-accent-on-dark);
}

.temple-card-value {
  font-size: 2.375rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.temple-card-caption {
  font-size: 0.719rem;
  opacity: 0.65;
}

/* ── Sync status ── */
.sync-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--c-ok-active);
}
.sync-card--warn { background: var(--c-warn-bg); border: 1px solid var(--c-warn-border); }

.sync-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-ok);
  color: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sync-badge--warn { background: var(--c-warn); }

.sync-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sync-text strong { font-size: 0.781rem; color: #2d7a55; }
.sync-card--warn .sync-text strong { color: var(--c-warn-text); }
.sync-text span { font-size: 0.688rem; color: var(--c-text-dim); }
.sync-text .pending-error { color: var(--c-err); }

.sync-actions { display: flex; gap: var(--s-sm); }

.home-note {
  font-size: var(--f-xs);
  color: var(--c-text-dim);
  text-align: center;
}

/* ── Home nav ── */
.home-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-sm);
}

.btn-nav {
  padding: 13px;
  border-radius: 13px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  font-family: inherit;
  font-size: 0.813rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: border-color var(--transition), color var(--transition);
}
.btn-nav:hover { border-color: var(--c-accent); color: var(--c-accent); }

.link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--f-sm);
  font-weight: 600;
  color: var(--c-accent);
  cursor: pointer;
  padding: var(--s-sm) 0;
  text-decoration: none;
  transition: color var(--transition);
}
.link-btn:hover { color: var(--c-accent-h); }
.link-btn--dim { color: var(--c-text-dim); }
.link-btn--dim:hover { color: var(--c-text); }

/* ════════════════════════════════════════
   BOOK ENTRY
   ════════════════════════════════════════ */
.step-section--books {
  padding-bottom: 96px; /* space for sticky totals bar */
}

.catalog-notice {
  background: var(--c-warn-bg);
  color: var(--c-warn-text);
  border: 1px solid var(--c-warn-border);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: var(--f-xs);
  margin-bottom: var(--s-md);
}

/* ── Language bar ── */
.lang-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--s-md);
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--c-border);
}

.lang-spacer { flex: 1; }

.lang-pill {
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  font-size: 0.719rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.lang-pill:hover { border-color: var(--c-accent); }
.lang-pill--on {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-white);
}

.lang-more {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: var(--c-neutral-active);
  color: var(--c-text-dim);
  font-family: inherit;
  font-size: 0.719rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
}
.lang-more:hover { color: var(--c-text); }

/* ── Bottom sheet ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: 300;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 310;
  max-width: var(--w-max);
  margin: 0 auto;
  background: var(--c-surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--s-md);
  padding-bottom: calc(var(--s-md) + env(safe-area-inset-bottom));
  box-shadow: var(--sh-lg);
  animation: sheetIn 0.18s ease;
}
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-md);
}

.sheet-title {
  font-size: 0.688rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}

.sheet-close {
  background: none;
  border: none;
  font-size: var(--f-md);
  color: var(--c-text-dim);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.sheet-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-sm);
}

/* ── Session summary (sheet + inline card on collection) ── */
.summary-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-md);
  margin-bottom: var(--s-lg);
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-sm);
  margin-bottom: var(--s-sm);
}

.sum-list {
  display: flex;
  flex-direction: column;
  max-height: 45vh;
  overflow-y: auto;
}

.sum-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-sm);
  padding: 7px 0;
  border-bottom: 1px solid var(--c-hairline);
}
.sum-row:last-child { border-bottom: none; }

.sum-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--c-text);
}

.sum-qty {
  font-size: 0.719rem;
  color: var(--c-text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.sum-books {
  font-size: 0.813rem;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  min-width: 2.25rem;
  text-align: right;
  flex-shrink: 0;
}

.sum-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-sm);
  margin-top: var(--s-sm);
  padding-top: var(--s-sm);
  border-top: 1px solid var(--c-border);
  font-size: var(--f-md);
  font-weight: 700;
  color: var(--c-text);
}
.sum-foot-pts { color: var(--c-text-dim); font-weight: 600; font-size: var(--f-sm); }

.sum-clear { margin-top: var(--s-md); }

.link-btn--danger { color: var(--c-err); }
.link-btn--danger:hover { color: var(--c-err); text-decoration: underline; }

/* Group header: a light rule with the size name and its point value, instead of
   a full-width solid saffron bar repeated seven times down the page. */
.book-group { margin-bottom: var(--s-lg); }

.book-group-header {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding: 0 2px var(--s-sm);
}

.book-group-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text);
  flex-shrink: 0;
}

.book-group-pts {
  font-family: var(--f-mono);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--c-accent-active);
  color: var(--c-sankirtan-strong);
  flex-shrink: 0;
}

.book-group-rule {
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

.book-group-count {
  font-size: 0.656rem;
  color: var(--c-text-dim);
  flex-shrink: 0;
}

.book-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px var(--s-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-bottom: none;
}
.book-row:first-of-type { border-radius: var(--r-md) var(--r-md) 0 0; }
.book-row:last-of-type  { border-radius: 0 0 var(--r-md) var(--r-md); border-bottom: 1px solid var(--c-border); }
.book-row:only-of-type  { border-radius: var(--r-md); }
/* Hairline between rows inside a group; the group edge keeps the full border. */
.book-row + .book-row { border-top-color: var(--c-hairline); }

/* Stock exhausted — dimmed, but still countable (see bookOut in state.js). */
.book-row--out { opacity: 0.45; }

.book-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Title and pill share one line, always: the title ellipsises rather than
   letting the pill wrap below it. A phone leaves ~200px here, so a wrapping
   pill would push every long title back to the three-line row this redesign
   exists to remove. The full title stays available on hover/long-press. */
.book-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  line-height: 1.25;
}

.book-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover-pill {
  font-size: 0.594rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.cover-pill--soft {
  background: var(--c-neutral-active);
  color: var(--c-text-dim);
}
.cover-pill--hard {
  background: var(--c-text);
  color: var(--c-white);
}

.book-meta {
  font-size: 0.719rem;
  color: var(--c-text-dim);
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 11px;
  padding: 2px;
}

/* 36px inside a 40px control is the floor for a thumb on the street. */
.qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--c-text-dim);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.qty-btn:active { transform: scale(0.92); }

.qty-btn--minus.is-zero { color: var(--c-disabled-strong); }
.qty-btn--minus:hover { background: var(--c-neutral-hover); }

.qty-btn--plus {
  background: var(--c-accent);
  color: var(--c-white);
  font-size: 1.125rem;
}
.qty-btn--plus:hover { background: var(--c-accent-h); }

.qty-input {
  width: 30px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--c-text);
  font-size: var(--f-md);
  font-weight: 700;
  text-align: center;
  font-family: inherit;
  padding: 0;
}
.qty-input.is-zero { color: var(--c-disabled); }
.qty-input:focus { outline: none; }
.qty-input::placeholder { color: var(--c-disabled); }

/* ── Catalog skeleton ── */
.book-skeleton { display: flex; flex-direction: column; gap: var(--s-lg); }
.skel-group { display: flex; flex-direction: column; }
.skel-head {
  height: 11px;
  width: 40%;
  border-radius: 4px;
  margin-bottom: 12px;
  background: var(--c-border);
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px var(--s-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-bottom: none;
}
.skel-row:first-of-type { border-radius: var(--r-md) var(--r-md) 0 0; }
.skel-row:last-of-type  { border-radius: 0 0 var(--r-md) var(--r-md); border-bottom: 1px solid var(--c-border); }
.skel-line {
  height: 10px;
  flex: 1;
  max-width: 55%;
  border-radius: 4px;
  background: var(--c-border);
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel-stepper {
  width: 110px;
  height: 40px;
  border-radius: 11px;
  background: var(--c-border);
  animation: skelPulse 1.4s ease-in-out infinite;
}
@keyframes skelPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Sticky totals bar */
.totals-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 12px var(--s-md);
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-md);
  z-index: 50;
  box-shadow: 0 -6px 18px rgba(0,0,0,.05);
  max-width: var(--w-max);
  margin: 0 auto;
}

.totals-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.totals-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.totals-item {
  font-size: var(--f-lg);
  font-weight: 700;
  color: var(--c-text);
}

.totals-item--amt {
  color: var(--c-ok);
}

.totals-sep {
  color: var(--c-text-dim);
  font-size: var(--f-sm);
}

.totals-saved {
  font-size: 0.688rem;
  color: var(--c-ok);
}
.totals-saved--err { color: var(--c-err); font-weight: 600; }

.btn-next {
  padding: 13px 22px;
  border-radius: 14px;
  font-size: var(--f-sm);
  background: var(--c-accent);
  flex-shrink: 0;
}
.btn-next:hover { background: var(--c-accent-h); }

/* ════════════════════════════════════════
   COLLECTION SCREEN
   ════════════════════════════════════════ */
.collection-block {
  margin-bottom: var(--s-lg);
}

/* ── Total card ── */
.total-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  padding: 22px var(--s-md);
  margin-bottom: var(--s-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.total-card-label {
  font-size: 0.688rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}

.total-card-field {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  width: 100%;
}

.total-card-currency {
  font-size: var(--f-2xl);
  font-weight: 700;
  color: var(--c-disabled);
  line-height: 1;
}

.total-card-input {
  width: 100%;
  max-width: 8ch;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 2.875rem;
  font-weight: 700;
  line-height: 1;
  color: var(--c-text);
  text-align: left;
  padding: 0;
}
.total-card-input:focus { outline: none; }
.total-card-input::placeholder { color: var(--c-disabled); }

.total-card-amount {
  font-size: 2.875rem;
  font-weight: 700;
  line-height: 1;
  color: var(--c-text);
}

.total-card-hint {
  font-size: 0.719rem;
  color: var(--c-text-dim);
}

/* ── Chips (payment method, location) ── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--s-sm);
}

.chip {
  padding: 10px 13px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  font-size: 0.781rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.chip:hover { border-color: var(--c-accent); }
.chip--on {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-white);
}
.chip--dark {
  background: var(--c-text);
  border-color: var(--c-text);
  color: var(--c-white);
}
.chip--more { color: var(--c-text-dim); }

.link-btn--sm { font-size: 0.75rem; color: var(--c-sankirtan-strong); }

.split-rows { margin-top: var(--s-sm); }

.note-input {
  min-height: var(--h-input);
  resize: vertical;
  line-height: 1.5;
  transition: min-height var(--transition), border-color var(--transition);
}
.note-input:focus { min-height: 84px; }

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-sankirtan-strong);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.optional-tag {
  font-weight: 400;
  color: var(--c-text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--f-xs);
}

.actual-input-wrapper {
  display: flex;
  align-items: stretch;
  border: 2.5px solid var(--c-accent);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--c-surface);
  transition: border-color var(--transition);
}
.actual-input-wrapper:focus-within { border-color: var(--c-sankirtan-strong); }

.currency-prefix {
  padding: 8px 10px 8px 14px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-sankirtan-strong);
  background: var(--c-neutral-hover);
  border-right: 1.5px solid var(--c-border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.actual-input {
  flex: 1;
  min-width: 0;
  padding: 8px 14px;
  border: none;
  font-family: inherit;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--c-sankirtan-strong);
  background: var(--c-surface);
}
.actual-input:focus { outline: none; }
.actual-input::placeholder { color: var(--c-border); font-weight: 400; }
.actual-input::-webkit-outer-spin-button,
.actual-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.actual-input[type=number] { -moz-appearance: textfield; }

.method-row {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  margin-bottom: 8px;
}
.method-label {
  flex: 1;
  font-size: var(--f-sm);
  font-weight: 600;
  color: var(--c-text);
}
.method-input-wrap {
  width: 8.5rem;
  flex-shrink: 0;
}
.method-input-wrap .currency-prefix { font-size: 1rem; padding: 6px 8px; }
.method-input-wrap .actual-input {
  font-size: 1.1rem;
  padding: 6px 10px;
  text-align: right;
}

.text-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--c-border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: var(--f-md);
  color: var(--c-text);
  background: var(--c-surface);
  min-height: var(--h-input);
  transition: border-color var(--transition);
}
.text-input:focus { outline: none; border-color: var(--c-accent); box-shadow: var(--focus-ring); }
.text-input::placeholder { color: var(--c-text-dim); }

.btn-submit {
  width: 100%;
  padding: 15px;
  font-size: var(--f-md);
  font-weight: 700;
  letter-spacing: 0.5px;
  min-height: 54px;
}

/* ════════════════════════════════════════
   CONFIRMATION SCREEN
   ════════════════════════════════════════ */
.step-section--confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--h-header) - var(--s-md) * 2);
}

.confirm-card {
  text-align: center;
  padding: var(--s-2xl) var(--s-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-md);
  width: 100%;
}

.confirm-icon {
  font-size: 4rem;
  line-height: 1;
}

.confirm-title {
  font-size: var(--f-3xl);
  font-weight: 700;
  color: var(--c-sankirtan-strong);
}

.confirm-sub {
  font-size: var(--f-md);
  color: var(--c-text-dim);
}

.confirm-stats {
  display: flex;
  gap: var(--s-lg);
  justify-content: center;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
  padding: var(--s-lg) var(--s-xl);
  margin: var(--s-sm) 0;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: var(--f-2xl);
  font-weight: 700;
  color: var(--c-text);
}

.stat-label {
  font-size: var(--f-xs);
  color: var(--c-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.confirm-auto {
  font-size: var(--f-xs);
  color: var(--c-text-dim);
  min-height: 1.5em;
}

/* ════════════════════════════════════════
   LEADERBOARD
   ════════════════════════════════════════ */
/* ── Segmented period control ── */
.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--c-neutral-active);
  margin-bottom: var(--s-md);
}

.segment {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--c-text-dim);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: background var(--transition), color var(--transition);
}
.segment--on {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--sh-sm);
}

/* ── Your rank ── */
.rank-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-radius: 18px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-accent);
  box-shadow: 0 2px 10px rgba(176,77,26,.1);
  margin-bottom: var(--s-md);
}

.rank-tile {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--c-accent-active);
  color: var(--c-sankirtan-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0625rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-body { flex: 1; min-width: 0; }
.rank-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-meta { font-size: 0.719rem; color: var(--c-text-dim); margin-top: 2px; }

.rank-aside {
  text-align: right;
  white-space: nowrap;
  min-width: 96px;
  flex-shrink: 0;
}
.rank-streak { font-size: 0.75rem; font-weight: 600; color: var(--c-ok); }
.rank-gap { font-size: 0.656rem; color: var(--c-text-dim); margin-top: 2px; }

/* ── Leader cards ── */
.leader-list { display: flex; flex-direction: column; gap: var(--s-sm); }

.leader-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
}
.leader-card--me { border-color: var(--c-accent); }

.leader-rank {
  width: 26px;
  font-size: 0.938rem;
  font-weight: 700;
  color: var(--c-sankirtan-strong);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.leader-name {
  flex: 1;
  min-width: 0;
  font-size: 0.844rem;
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  line-height: 1.2;
}
.leader-stat b { font-size: 0.875rem; font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; }
.leader-stat i { font-size: 0.625rem; font-style: normal; color: var(--c-text-dim); }
.leader-stat--money { min-width: 3.25rem; }

.leader-more {
  padding: 13px;
  border: 1px dashed var(--c-disabled-strong);
  border-radius: 14px;
  background: none;
  color: var(--c-text-dim);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.leader-more:hover { border-color: var(--c-accent); color: var(--c-accent); }

.lb-legend {
  font-size: 0.688rem;
  color: var(--c-text-dim);
  margin-top: var(--s-md);
  text-align: center;
}

.lb-loading {
  text-align: center;
  padding: var(--s-2xl) 0;
  color: var(--c-text-dim);
  font-size: var(--f-sm);
}

.lb-table-wrap {
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--f-sm);
}

.lb-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--c-sankirtan-strong);
  color: var(--c-sankirtan-strong);
  font-size: var(--f-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--c-bg);
}

.lb-table th:not(:first-child):not(:nth-child(2)) {
  text-align: right;
}

.lb-table th.sortable {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.lb-table th.sortable:hover { color: var(--c-text); }

.lb-row td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.lb-row:last-child td { border-bottom: none; }

.lb-rank {
  font-size: var(--f-xs);
  color: var(--c-text-dim);
  font-weight: 700;
  width: 28px;
}

.lb-name {
  font-weight: 600;
  color: var(--c-text);
}

.lb-num {
  text-align: right;
  color: var(--c-text-dim);
  font-size: var(--f-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lb-highlight {
  background: var(--c-accent-active) !important;
}
.lb-highlight .lb-name {
  color: var(--c-sankirtan-strong);
}

/* ════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════ */
/* Full-bleed brand band + auth block. Breaks out of #app-main's padding so the
   band reaches the edges on a phone, where a floating card wasted the viewport. */
.login-brand {
  margin: calc(var(--s-md) * -1) calc(var(--s-md) * -1) 0;
  padding: var(--s-lg) var(--s-lg) var(--s-lg);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 12px, transparent 12px 24px),
    var(--c-sankirtan-strong);
  color: var(--c-white);
}

.login-brand-top {
  position: absolute;
  top: 20px;
  left: var(--s-lg);
  right: var(--s-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-brand-org {
  font-size: 0.688rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.75;
}

.login-wordmark {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.login-sub {
  font-size: var(--f-sm);
  line-height: 1.4;
  opacity: 0.8;
  margin-top: 6px;
}

.login-auth {
  margin: 0 calc(var(--s-md) * -1);
  padding: 26px var(--s-lg) 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-auth .text-input { margin-bottom: var(--s-md); }

.login-rule {
  height: 1px;
  background: var(--c-border);
  margin: 6px 0;
}

.login-email-link {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.813rem;
  color: var(--c-sankirtan-strong);
}

.login-help {
  font-size: 0.719rem;
  line-height: 1.5;
  color: var(--c-text-dim);
  text-align: center;
}

.login-offline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px;
  border-radius: 11px;
  background: var(--c-ok-active);
  color: #2d7a55;
  font-size: 0.719rem;
}

.login-offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-ok);
  flex-shrink: 0;
}

.login-hint {
  font-size: 0.85rem;
  color: var(--c-text-dim);
  line-height: 1.5;
  margin-bottom: var(--s-md);
}

.btn-block { display: flex; width: 100%; justify-content: center; }

.btn-google {
  gap: 8px;
  align-items: center;
}

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 16px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  border-left: 5px solid var(--c-ok);
  z-index: 400;
  max-width: 300px;
  width: calc(100vw - 32px);
  animation: toastIn 0.3s ease forwards;
}
@keyframes toastIn {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.toast-content {
  padding: 14px 18px;
}

.toast-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-text);
}

/* ════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════ */
.hidden { display: none !important; }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (min-width: 540px) {
  /* Totals bar is constrained to content column on wider screens */
  .totals-bar {
    left: 50%;
    transform: translateX(-50%);
    width: var(--w-max);
    border-radius: var(--r-md) var(--r-md) 0 0;
    border-left: 1px solid var(--c-border);
    border-right: 1px solid var(--c-border);
  }
}

@media (max-width: 380px) {
  .confirm-stats { gap: var(--s-md); padding: var(--s-md) var(--s-lg); }
  .stat-value { font-size: var(--f-xl); }
}

/* Narrow phones: claw back horizontal room for the title before it truncates,
   without shrinking the 36px steppers. */
@media (max-width: 430px) {
  #app-main { padding-left: var(--s-sm); padding-right: var(--s-sm); }
  .book-row, .skel-row { padding-left: 12px; padding-right: 12px; }
  .totals-bar { padding-left: 12px; padding-right: 12px; }
}
