/* =====================================================================
   SmithLedger — Jewelry ERP Mobile UI
   Palette: Navy (#0A1628), Silver (#C0C0C0 / #F0F2F5), Gold (#D4AF37)
   ===================================================================== */

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

:root {
  /* Brand Palette */
  --navy:         #0A1628;
  --navy-mid:     #142240;
  --navy-light:   #1E2E4A;
  --navy-subtle:  #243356;
  --gold:         #D4AF37;
  --gold-light:   #E8C842;
  --gold-pale:    #FFF8DC;
  --gold-dim:     #BFA030;
  --silver:       #C0C0C0;
  --silver-light: #E8EAED;
  --silver-pale:  #F0F2F5;
  --silver-card:  #FAFBFC;

  /* Status */
  --green:  #12B76A;
  --red:    #F04438;
  --amber:  #F79009;

  /* UI */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 100px;

  --shadow-sm: 0 1px 4px rgba(10,22,40,.08);
  --shadow-md: 0 4px 16px rgba(10,22,40,.12);
  --shadow-lg: 0 8px 32px rgba(10,22,40,.18);

  --font-base: 'Inter', sans-serif;

  --header-h: 60px;
  --ticker-h: 34px;
  --nav-h:    72px;
}

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-base);
  background: var(--silver-pale);
  color: var(--navy);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ────────────────────────────────────────────────────── */
#app {
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  min-height: 100dvh;
  background: var(--silver-pale);
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--header-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.3);
}

.header-left, .header-right { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 6px; }
.brand-icon { font-size: 20px; }
.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.icon-btn {
  width: 38px; height: 38px;
  border: none;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-full);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.icon-btn:active { transform: scale(.92); background: rgba(255,255,255,.15); }

.notif-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--gold);
  color: var(--navy);
  font-size: 9px;
  font-weight: 800;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--navy);
}

.avatar-ring {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.avatar { font-size: 12px; font-weight: 800; color: var(--navy); }

/* ── Rate Ticker ─────────────────────────────────────────────────── */
.rate-ticker {
  position: fixed;
  top: var(--header-h);
  left: 50%; transform: translateX(-50%);
  max-width: 430px; width: 100%;
  height: var(--ticker-h);
  background: var(--navy-mid);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  z-index: 99;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  padding-left: 8px;
}
.ticker-label {
  background: var(--gold);
  color: var(--navy);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.ticker-scroll {
  display: flex;
  white-space: nowrap;
  animation: ticker-move 28s linear infinite;
}
.ticker-scroll span { padding-right: 60px; }
@keyframes ticker-move { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }

/* ── Pages ────────────────────────────────────────────────────────── */
.page {
  display: none;
  padding-top: calc(var(--header-h) + var(--ticker-h) + 16px);
  padding-bottom: calc(var(--nav-h) + 24px);
  min-height: 100dvh;
  animation: fadeSlide .25s ease;
}
.page.active { display: block; }

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

.page-inner { padding: 0 16px; padding-bottom: calc(var(--nav-h) + 48px); }

/* No ticker on inner pages */
.page:not(#page-home) {
  padding-top: calc(var(--header-h) + 56px);
}

/* ── Page Top Bar (inner pages) ─────────────────────────────────── */
.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 4px;
}
.back-btn {
  width: 38px; height: 38px;
  border: none;
  background: var(--navy);
  border-radius: var(--radius-full);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .15s;
}
.back-btn:active { transform: scale(.92); }
.back-btn .material-symbols-rounded { font-size: 20px; }

.page-heading {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.4px;
}

/* ── Section & Utility ───────────────────────────────────────────── */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.2px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.link-btn {
  border: none;
  background: none;
  color: var(--gold-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-base);
}

/* ── Summary Cards ───────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px 16px;
}

.card {
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .12;
}
.card-navy {
  background: linear-gradient(140deg, var(--navy-mid), var(--navy-subtle));
  color: #fff;
}
.card-navy::before { background: var(--gold); }

.card-gold {
  background: linear-gradient(140deg, var(--gold), var(--gold-dim));
  color: var(--navy);
}
.card-gold::before { background: #fff; }

.card-icon .material-symbols-rounded {
  font-size: 22px;
  opacity: .7;
}
.card-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  opacity: .75;
  margin: 8px 0 4px;
}
.card-value {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.5px;
  line-height: 1.1;
}
.card-sub {
  font-size: 10px;
  margin-top: 8px;
  opacity: .8;
  display: flex;
  align-items: center;
  gap: 2px;
}
.card-sub .material-symbols-rounded { font-size: 13px; }
.trend-up .material-symbols-rounded { color: #4ade80; }

/* ── Quick Actions ───────────────────────────────────────────────── */
.quick-actions {
  padding: 0 16px 16px;
}
.quick-actions .section-title { margin-bottom: 12px; }

.qa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: #fff;
  border: 1.5px solid var(--silver-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-base);
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.qa-btn .material-symbols-rounded { font-size: 22px; color: var(--gold-dim); }
.qa-btn:active { transform: scale(.95); background: var(--gold-pale); border-color: var(--gold); }

/* ── Outstanding Strip ───────────────────────────────────────────── */
.outstanding-strip {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 16px 16px;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--silver-light);
}
.ost-card {
  flex: 1;
  padding: 14px 12px;
  text-align: center;
}
.ost-card.ost-red { border-right: 1.5px solid var(--silver-light); }
.ost-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 4px;
}
.ost-amount { font-size: 18px; font-weight: 900; letter-spacing: -.5px; }
.ost-red .ost-amount { color: var(--green); }
.ost-green .ost-amount { color: var(--red); }
.ost-count { font-size: 10px; color: #999; margin-top: 2px; }

/* ── Transaction List ────────────────────────────────────────────── */
.txn-section { padding: 0 16px 16px; }
.txn-list { display: flex; flex-direction: column; gap: 8px; }

.txn-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--silver-light);
  transition: transform .15s;
}
.txn-item:active { transform: scale(.98); }

.txn-avatar {
  width: 42px; height: 42px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.gold-avatar   { background: var(--gold-pale);   color: var(--gold-dim); }
.navy-avatar   { background: rgba(10,22,40,.08); color: var(--navy); }
.silver-avatar { background: var(--silver-light); color: #555; }

.txn-info { flex: 1; min-width: 0; }
.txn-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txn-meta { font-size: 10px; color: #888; margin-top: 2px; }

.txn-amounts { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.txn-value { font-size: 14px; font-weight: 800; letter-spacing: -.3px; }
.txn-value.received { color: var(--green); }
.txn-value.paid     { color: var(--red); }

.metal-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.tag-in  { background: #d1fae5; color: #065f46; }
.tag-out { background: #fee2e2; color: #991b1b; }

/* ── Karigar ─────────────────────────────────────────────────────── */
.karigar-list { display: flex; flex-direction: column; gap: 8px; }
.karigar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--silver-light);
}
.karigar-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.karigar-status .material-symbols-rounded { font-size: 14px; }
.karigar-status.pending { background: #fef3c7; color: #92400e; }
.karigar-status.done    { background: #d1fae5; color: #065f46; }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  letter-spacing: .3px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--silver-light);
  border-radius: var(--radius-md);
  font-family: var(--font-base);
  font-size: 14px;
  color: var(--navy);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  appearance: none;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,.15);
}
select.form-input { cursor: pointer; }
textarea.form-input { resize: none; }
.amount-large { font-size: 22px; font-weight: 800; text-align: center; }

.form-row { display: flex; gap: 10px; }
.form-group.half { flex: 1; }
.form-group.mt-2 { margin-top: 8px; }

.search-row { position: relative; }
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #aaa;
}
.search-input { padding-left: 40px; }

.form-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  border: 1.5px solid var(--silver-light);
  box-shadow: var(--shadow-sm);
}
.form-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--silver-light);
}

/* ── Calc Result Pill ────────────────────────────────────────────── */
.calc-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--silver-pale);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 8px;
}
.calc-result.highlight { background: var(--gold-pale); border: 1.5px solid rgba(212,175,55,.3); }
.calc-label { font-size: 11px; font-weight: 600; color: #777; text-transform: uppercase; letter-spacing: .3px; }
.calc-value { font-size: 16px; font-weight: 800; color: var(--navy); }
.gold-text { color: var(--gold-dim) !important; }

/* ── Segmented Control ───────────────────────────────────────────── */
.seg-control {
  display: flex;
  background: var(--silver-light);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: 16px;
  gap: 2px;
}
.seg-btn {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-base);
  font-size: 11px;
  font-weight: 600;
  color: #777;
  cursor: pointer;
  transition: all .2s;
}
.seg-btn.active {
  background: var(--navy);
  color: var(--gold-light);
  box-shadow: var(--shadow-sm);
}

/* ── Payment Chips ───────────────────────────────────────────────── */
.payment-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chip {
  padding: 7px 14px;
  border: 1.5px solid var(--silver-light);
  border-radius: var(--radius-full);
  background: #fff;
  font-family: var(--font-base);
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: all .2s;
}
.chip.active {
  background: var(--navy);
  color: var(--gold-light);
  border-color: var(--navy);
}
.chip:active { transform: scale(.95); }

/* ── Bill Summary ────────────────────────────────────────────────── */
.bill-summary {
  background: var(--silver-pale);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bill-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #666;
  font-weight: 500;
}
.bill-row span:last-child { font-weight: 700; color: var(--navy); }
.bill-total {
  border-top: 1.5px solid var(--silver-light);
  padding-top: 8px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 800 !important;
  color: var(--navy) !important;
}
.bill-total span { font-weight: 800 !important; }
#bs-total { color: var(--gold-dim) !important; font-size: 17px; }

/* ── Give / Get Toggle (Collect) ─────────────────────────────────── */
.give-get-toggle {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.gg-btn {
  flex: 1;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  border: 2px solid var(--silver-light);
  background: #fff;
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .2s;
  color: var(--navy);
}
.gg-btn .material-symbols-rounded { font-size: 20px; }
.gg-btn.active.gg-get  { background: #d1fae5; border-color: var(--green); color: #065f46; }
.gg-btn.active.gg-give { background: #fee2e2; border-color: var(--red); color: #991b1b; }

.outstanding-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-pale);
  border: 1px solid rgba(212,175,55,.3);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--navy);
  margin-top: 8px;
}
.outstanding-inline .material-symbols-rounded { font-size: 15px; color: var(--gold-dim); }

/* ── Rate Card Grid ──────────────────────────────────────────────── */
.rate-date-label {
  font-size: 11px;
  color: #888;
  font-weight: 600;
  margin-bottom: 14px;
  padding: 0 4px;
}
.rate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.rate-card {
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.rate-gold-24 { background: linear-gradient(140deg, var(--navy-mid), var(--navy-subtle)); color: #fff; }
.rate-gold-22 { background: linear-gradient(140deg, var(--gold), var(--gold-dim)); color: var(--navy); }
.rate-gold-18 { background: linear-gradient(140deg, #b8860b, #d4af37); color: #fff; }
.rate-silver  { background: linear-gradient(140deg, #9ca3af, #d1d5db); color: var(--navy); }
.rate-platinum{ background: linear-gradient(140deg, #4b5563, #9ca3af); color: #fff; }
.rate-gold-14 { background: linear-gradient(140deg, #78350f, #b45309); color: #fff; }

.rate-metal-icon { font-size: 24px; margin-bottom: 6px; }
.rate-metal-name { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.rate-metal-sub { font-size: 9px; font-weight: 600; opacity: .7; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.rate-price { font-size: 20px; font-weight: 900; letter-spacing: -1px; }
.rate-price span { font-size: 11px; font-weight: 600; opacity: .8; }
.rate-change { font-size: 11px; font-weight: 700; margin-top: 4px; }
.rate-change.up { color: #4ade80; }
.rate-change.down { color: #f87171; }
/* Override for light cards */
.rate-gold-22 .rate-change.up  { color: #065f46; }
.rate-silver  .rate-change.down { color: #991b1b; }

/* ── Rate Table ──────────────────────────────────────────────────── */
.rate-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rate-table th {
  text-align: left;
  font-weight: 700;
  color: #888;
  padding: 6px 4px;
  border-bottom: 1.5px solid var(--silver-light);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.rate-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--silver-light);
  color: var(--navy);
  font-weight: 500;
}
.rate-table td.up  { color: var(--green); font-weight: 700; }
.rate-table td.dn  { color: var(--red);   font-weight: 700; }

/* ── P&L Strip ───────────────────────────────────────────────────── */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.month-label { font-size: 15px; font-weight: 800; color: var(--navy); }
.month-arrow {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--navy);
  display: flex; align-items: center;
}
.month-arrow .material-symbols-rounded { font-size: 22px; }

.pl-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.pl-card {
  flex: 1;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.pl-card .material-symbols-rounded { font-size: 20px; flex-shrink: 0; }
.pl-income  { background: #d1fae5; }
.pl-income  .material-symbols-rounded { color: var(--green); }
.pl-expense { background: #fee2e2; }
.pl-expense .material-symbols-rounded { color: var(--red); }
.pl-profit  { background: var(--gold-pale); border: 1px solid rgba(212,175,55,.3); }
.pl-profit  .material-symbols-rounded { color: var(--gold-dim); }

.pl-label { font-size: 9px; font-weight: 600; color: #777; text-transform: uppercase; letter-spacing: .4px; }
.pl-val { font-size: 13px; font-weight: 800; color: var(--navy); }

/* ── Expense List ────────────────────────────────────────────────── */
.exp-list { display: flex; flex-direction: column; gap: 8px; }
.exp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--silver-light);
}
.exp-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.exp-icon .material-symbols-rounded { font-size: 20px; }
.exp-business    { background: rgba(10,22,40,.08); color: var(--navy); }
.exp-personal    { background: var(--gold-pale); color: var(--gold-dim); }
.exp-family      { background: #ede9fe; color: #7c3aed; }
.exp-income-icon { background: #d1fae5; color: var(--green); }

.fab-wrap {
  position: fixed;
  bottom: calc(var(--nav-h) + 20px);
  right: calc(50% - 215px + 20px);
}
.fab-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--navy-mid), var(--navy));
  color: var(--gold-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform .2s;
}
.fab-btn:active { transform: scale(.92); }
.fab-btn .material-symbols-rounded { font-size: 26px; }

/* ── Product Grid ────────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.product-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: 2px solid var(--silver-light);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: all .2s;
}
.product-tile.selected {
  border-color: var(--gold);
  background: var(--gold-pale);
}
.product-img { font-size: 26px; line-height: 1; }
.product-name { font-size: 9px; font-weight: 700; color: var(--navy); text-align: center; }
.product-check {
  position: absolute;
  top: 4px; right: 4px;
  font-size: 14px;
  color: var(--silver-light);
  transition: color .2s;
}
.product-tile.selected .product-check { color: var(--gold-dim); }
.add-tile { border-style: dashed; border-color: #ccc; }
.add-tile .product-img { opacity: .5; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--navy-mid), var(--navy));
  color: var(--gold-light);
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 14px rgba(10,22,40,.25);
  letter-spacing: .2px;
}
.primary-btn:active { transform: scale(.97); }
.primary-btn .material-symbols-rounded { font-size: 18px; }

.secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: #fff;
  color: var(--navy);
  border: 1.5px solid var(--silver-light);
  border-radius: var(--radius-full);
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}
.secondary-btn:active { transform: scale(.97); background: var(--silver-pale); }

.full-btn { width: 100%; margin-top: 8px; }
.got-btn { background: linear-gradient(135deg, #065f46, #059669); }

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.btn-row .secondary-btn { flex: 1; }
.btn-row .primary-btn   { flex: 2; }

/* ── Stock Modal ─────────────────────────────────────────────────── */
.stock-summary { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.stock-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--navy);
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 1px solid var(--silver-light);
}
.stock-label { color: #666; }
.stock-val { font-weight: 700; }
.total-row .stock-label { font-weight: 700; color: var(--navy); }
.text-warn { color: var(--amber); }

/* ── Bottom Navigation ───────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%; transform: translateX(-50%);
  max-width: 430px; width: 100%;
  height: var(--nav-h);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1.5px solid var(--silver-light);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(10,22,40,.1);
  z-index: 100;
  padding: 0 6px 8px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-base);
  padding: 6px 0;
  border-radius: var(--radius-md);
  transition: all .2s;
  color: #aaa;
  position: relative;
}
.nav-item:active { transform: scale(.92); }

.nav-icon { font-size: 22px; transition: color .2s; }
.nav-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  transition: color .2s;
}

/* Active state */
.nav-item.active { color: var(--navy); }
.nav-item.active .nav-icon { color: var(--navy); }

/* Center Sales Button */
.nav-sales-center {
  position: relative;
  flex: 1.2;
  margin-top: -14px;
}
.nav-center-ring {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dim));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(212,175,55,.5);
  border: 3px solid #fff;
  transition: transform .2s, box-shadow .2s;
  margin-bottom: 2px;
}
.nav-center-icon { font-size: 24px; color: var(--navy); }
.nav-center-label { color: var(--gold-dim); font-weight: 800; font-size: 9px; }
.nav-sales-center:active .nav-center-ring { transform: scale(.92); }
.nav-sales-center.active .nav-center-ring {
  box-shadow: 0 6px 24px rgba(212,175,55,.6);
}

/* ── Modals ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal-sheet {
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 16px 20px 40px;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  max-height: 85dvh;
  overflow-y: auto;
  transform: translateY(30px);
  transition: transform .3s cubic-bezier(.2,.8,.4,1);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 36px; height: 4px;
  background: var(--silver-light);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
}
.modal-header .icon-btn {
  background: var(--silver-pale);
  color: var(--navy);
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 20px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--gold-light);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 300;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

/* ── Material Symbols ────────────────────────────────────────────── */
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  vertical-align: middle;
}

/* ================================================================
   COLLECT / LEDGER PAGE — NEW STYLES
   ================================================================ */

/* ── Outstanding Summary Card ─────────────────────────────────────── */
.ost-summary-card {
  background: linear-gradient(150deg, var(--navy-mid) 0%, var(--navy-subtle) 100%);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.ost-summary-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .06;
}

.ost-summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.ost-summary-header .material-symbols-rounded {
  font-size: 18px;
  color: var(--gold-light);
}
.ost-summary-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: .6px;
  flex: 1;
}
.ost-summary-badge {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: .3px;
}

.ost-summary-grid {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 14px;
}
.ost-box {
  flex: 1;
  padding: 0 4px;
}
.ost-box-divider {
  width: 1px;
  background: rgba(255,255,255,.15);
  align-self: stretch;
  margin: 0 12px;
}
.ost-box-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 4px;
}
.ost-receivable .ost-box-label { color: #86efac; }
.ost-payable   .ost-box-label { color: #fca5a5; }
.ost-box-amt {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  color: #fff;
  margin-bottom: 2px;
}
.ost-box-sub {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  margin-bottom: 8px;
}
.ost-metal-row { display: flex; flex-wrap: wrap; gap: 4px; }
.ost-metal-chip {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.gold-chip   { background: rgba(212,175,55,.25); color: var(--gold-light); }
.silver-chip { background: rgba(192,192,192,.2); color: #e5e7eb; }
.red-chip    { background: rgba(239,68,68,.2);  color: #fca5a5; }

.ost-net-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.1);
}
.ost-net-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.65);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.ost-net-val {
  font-size: 16px;
  font-weight: 900;
  color: #86efac;
  letter-spacing: -.5px;
}

/* ── Party List Cards ─────────────────────────────────────────────── */
.party-list { display: flex; flex-direction: column; gap: 10px; }

.party-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
  position: relative;
}
.party-card:active { transform: scale(.98); box-shadow: var(--shadow-md); }

.receivable-card { border-left-color: var(--green); }
.payable-card    { border-left-color: var(--red); }
.settled-card    { border-left-color: var(--silver); opacity: .75; }
.overdue-card    { border-left-color: var(--amber); background: #fffbeb; }

.party-info { flex: 1; min-width: 0; }
.party-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.party-meta { font-size: 10px; color: #888; margin-top: 1px; }
.party-metal-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.party-since { font-size: 9px; color: #aaa; font-weight: 500; }

.party-bal-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.party-type-badge {
  font-size: 8px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.receivable-badge { background: #d1fae5; color: #065f46; }
.payable-badge    { background: #fee2e2; color: #991b1b; }
.overdue-badge    { background: #fef3c7; color: #92400e; }
.settled-badge    { background: var(--silver-light); color: #666; }

.party-balance {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.5px;
}
.receivable-amt { color: var(--green); }
.payable-amt    { color: var(--red); }
.settled-amt    { color: #aaa; }

.party-overdue { font-size: 9px; color: #aaa; }
.overdue-text  { color: var(--amber) !important; font-weight: 700 !important; }

.party-chevron {
  font-size: 18px;
  color: #ccc;
  flex-shrink: 0;
}

.tag-neutral { background: var(--silver-light); color: #777; }

/* ── Collect / Ledger Layer System ────────────────────────────────── */
#collect-list-view {
  display: block;
}

/* Fixed full-screen overlay — same pattern as modals */
.ledger-detail-view {
  display: none;
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  background: var(--silver-pale);
  z-index: 150;          /* above header (100) but below modals (200) */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.ledger-detail-view.open {
  display: block;
  animation: slideInRight .28s cubic-bezier(.2,.8,.4,1);
}

@keyframes slideInRight {
  from { transform: translateX(calc(-50% + 100%)); opacity: .6; }
  to   { transform: translateX(-50%);              opacity: 1; }
}

/* ── Ledger Header (Sticky) ───────────────────────────────────────── */
.ledger-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
  padding: 0 0 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}

.ledger-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  /* 60px header + 12px breathing room */
  padding: 72px 16px 12px;
}
.ledger-header-top .back-btn {
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}

.ledger-party-id {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ldg-party-name {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ldg-party-meta { font-size: 10px; color: rgba(255,255,255,.55); margin-top: 1px; }

.ldg-whatsapp-btn {
  background: rgba(37,211,102,.2);
  color: #25d366;
  flex-shrink: 0;
}

/* ── Closing Balance Banner ───────────────────────────────────────── */
.closing-balance-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 16px 12px;
  background: rgba(255,255,255,.07);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.12);
}
.cb-left { flex: 1; }
.cb-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.6);
  margin-bottom: 4px;
}
.cb-amount {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 4px;
}
.cb-metal {
  font-size: 11px;
  color: var(--gold-light);
  font-weight: 600;
}
.cb-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(134,239,172,.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  border: 1px solid rgba(134,239,172,.2);
}
.cb-status-icon {
  font-size: 22px;
  color: #86efac;
}
.cb-status-text {
  font-size: 10px;
  font-weight: 800;
  color: #86efac;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .4px;
  line-height: 1.3;
}

/* ── GOT / GIVE / BILL Action Row ──────────────────────────────────── */
.ldg-action-row {
  display: flex;
  gap: 8px;
  padding: 0 16px;
}
.ldg-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 800;
  transition: transform .15s, opacity .2s;
}
.ldg-action-btn .material-symbols-rounded { font-size: 20px; }
.ldg-action-sub {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  opacity: .75;
}
.ldg-action-btn:active { transform: scale(.95); }

.ldg-got  { background: #d1fae5; color: #065f46; }
.ldg-give { background: #fee2e2; color: #991b1b; }
.ldg-bill { background: var(--gold-pale); color: var(--gold-dim); }

/* ── Ledger Entry Timeline ────────────────────────────────────────── */
.ledger-entries {
  padding: 16px 16px calc(var(--nav-h) + 32px);
}

.ledger-opening-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #888;
  font-weight: 600;
  background: var(--silver-light);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 12px;
}
.ledger-opening-row .material-symbols-rounded { font-size: 15px; color: #aaa; }

.ledger-entry {
  display: flex;
  gap: 0;
  align-items: flex-start;
  margin-bottom: 4px;
  background: #fff;
  border-radius: var(--radius-md);
  overflow: visible;
  padding: 12px 12px 12px 0;
  border: 1.5px solid var(--silver-light);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.le-date-col {
  flex-shrink: 0;
  width: 44px;
  text-align: center;
  padding: 2px 4px 0 8px;
}
.le-date {
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}
.le-day { font-size: 9px; color: #aaa; font-weight: 600; }

.le-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 24px;
  flex-shrink: 0;
  padding-top: 4px;
}
.le-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.credit-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(18,183,106,.15); }
.debit-dot  { background: var(--red);   box-shadow: 0 0 0 3px rgba(240,68,56,.12); }
.le-line { width: 2px; flex: 1; background: var(--silver-light); margin-top: 4px; min-height: 20px; }

.le-detail { flex: 1; min-width: 0; padding-top: 2px; }
.le-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.le-ref { font-size: 10px; color: #888; margin-top: 2px; }
.le-type-row { margin-top: 6px; }
.le-type-tag {
  font-size: 8px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.credit-tag   { background: #d1fae5; color: #065f46; }
.debit-tag    { background: #fee2e2; color: #991b1b; }
.metal-tag-le { background: var(--gold-pale); color: var(--gold-dim); border: 1px solid rgba(212,175,55,.3); }

.le-amounts {
  text-align: right;
  flex-shrink: 0;
  padding-top: 2px;
}
.le-txn-amt {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -.5px;
}
.credit-color { color: var(--green); }
.debit-color  { color: var(--red); }
.le-balance {
  font-size: 9px;
  color: #aaa;
  font-weight: 600;
  margin-top: 4px;
  white-space: nowrap;
}

/* ── Ledger Closing Row ───────────────────────────────────────────── */
.ledger-closing-row {
  background: var(--navy);
  border-radius: var(--radius-lg);
  margin-top: 12px;
  overflow: hidden;
}
.lcr-inner {
  display: flex;
  gap: 0;
  padding: 16px;
}
.lcr-inner > div { flex: 1; }
.lcr-inner > div:first-child { border-right: 1px solid rgba(255,255,255,.1); padding-right: 16px; }
.lcr-inner > div:last-child  { padding-left: 16px; }
.lcr-label {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.lcr-val {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.5px;
}
.lcr-val.receive { color: #86efac; }
.lcr-val.pay     { color: #fca5a5; }
.lcr-val span { font-size: 9px; font-weight: 600; opacity: .7; display: block; margin-top: 2px; }

/* ── Party Form Banner (inside collect modal) ─────────────────────── */
.party-form-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--silver-pale);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1.5px solid var(--silver-light);
}
.cf-party-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
}
.cf-balance {
  font-size: 11px;
  color: var(--gold-dim);
  font-weight: 600;
  margin-top: 2px;
}

/* ── Page: Collect — base layout ─────────────────────────────────── */
#page-collect {
  /* No overflow:hidden — that was clipping the ledger overlay */
  padding-top: 0 !important;
  min-height: 100dvh;
}
#collect-list-view {
  /* header (60) + ticker-equiv spacing (56) */
  padding-top: calc(var(--header-h) + 56px);
  padding-bottom: calc(var(--nav-h) + 16px);
  min-height: 100dvh;
}
