/* ============================================================
   HisabSetu AI — design tokens
   ============================================================ */
:root {
  --green-950: #043126;
  --green-900: #06402f;
  --green-800: #07523c;
  --green-700: #0b6b4f;
  --green-600: #0e7a5a;
  --green-500: #14906c;
  --green-100: #d9ece4;
  --green-50: #eaf4ef;

  --cream: #f6f4ed;
  --cream-deep: #efece2;
  --card: #ffffff;
  --surface: #ffffff;
  --ink: #16231e;
  --ink-soft: #33443c;
  --muted: #68776f;
  --line: #e5e3da;
  --line-strong: #d4d2c6;

  --green-700-text: #0b6b4f;
  --green-800-strong: #07523c;
  --green-700-ink: #0b6b4f;

  --skeleton-hi: #fbfaf6;

  --credit: #b45309;
  --credit-soft: #fdf0df;
  --on-credit-soft: #7c3a06;
  --credit-soft-line: #f3ddc2;
  --payment: #0b6b4f;
  --payment-soft: #e6f3ec;
  --danger: #b42318;
  --danger-soft: #fdedea;
  --info: #1d4e89;
  --info-soft: #eaf1fa;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(18, 40, 31, 0.05), 0 18px 40px -30px rgba(18, 40, 31, 0.45);
  --shadow-float: 0 20px 50px -22px rgba(6, 64, 47, 0.45);
  --shadow-mic: 0 14px 30px -10px rgba(11, 107, 79, 0.55);

  /* Noto Sans for Latin, then the Noto family of each script the app speaks,
     so Devanagari, Bengali, Gujarati, Gurmukhi, Kannada, Malayalam, Tamil and
     Telugu text never falls back to a mismatched system face. */
  --font: "Noto Sans", "Noto Sans Devanagari", "Noto Sans Bengali",
    "Noto Sans Gujarati", "Noto Sans Gurmukhi", "Noto Sans Kannada",
    "Noto Sans Malayalam", "Noto Sans Tamil", "Noto Sans Telugu",
    "Segoe UI", system-ui, -apple-system, "Nirmala UI", sans-serif;
  --mono: "Cascadia Mono", "Consolas", monospace;
}

/* ============================================================
   Dark theme — overrides only the surface/ink tokens.
   Financial colors (credit/payment/danger) keep their meaning.
   ============================================================ */
[data-theme="dark"] {
  --cream: #0d1512;
  --cream-deep: #1a241f;
  --card: #131c18;
  --surface: #1b2521;
  --ink: #e8f0eb;
  --ink-soft: #c2d1c9;
  --muted: #93a89d;
  --line: #2a3831;
  --line-strong: #3a4b43;

  --green-50: #12281f;
  --green-100: #1b3a2c;
  --green-700-text: #4ec398;
  --green-800-strong: #6fd0aa;
  --green-700-ink: #5cc79f;

  --skeleton-hi: #233029;

  --credit: #f0a860;
  --credit-soft: #2c2114;
  --on-credit-soft: #f4c48c;
  --credit-soft-line: #4a3a22;
  --payment: #37b488;
  --payment-soft: #122820;
  --danger: #f2796b;
  --danger-soft: #2c1a17;
  --info: #7aa8e0;
  --info-soft: #16202e;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 40px -30px rgba(0, 0, 0, 0.8);
  --shadow-float: 0 20px 50px -22px rgba(0, 0, 0, 0.75);
  --shadow-mic: 0 14px 30px -10px rgba(20, 144, 108, 0.5);
}

[data-theme="dark"] body {
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(20, 144, 108, 0.14), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(240, 168, 96, 0.06), transparent 55%),
    var(--cream);
}

[data-theme="dark"] .icon-btn,
[data-theme="dark"] .pill-soft { background: var(--card); }
[data-theme="dark"] .icon-btn:hover { background: var(--cream-deep); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(11, 107, 79, 0.09), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(180, 83, 9, 0.05), transparent 55%),
    var(--cream);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; flex: none; }

.hidden { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--green-800); color: #fff; padding: 10px 16px; border-radius: 10px;
  text-decoration: none; transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 3px solid rgba(14, 122, 90, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.page { max-width: 1200px; margin: 0 auto; padding: 22px 22px 40px; }

/* ============================================================
   Header
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  width: 50px; height: 50px; border-radius: 16px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--green-600), var(--green-900));
  box-shadow: 0 10px 24px -12px rgba(6, 64, 47, 0.7);
  flex: none;
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text h1 {
  font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 750;
}
.brand-text h1 span { color: var(--green-600); }
.brand-text p {
  font-size: 12.5px; color: var(--muted); margin-top: 2px;
  font-weight: 500; letter-spacing: 0.01em;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Segmented control: theme + language switch */
.seg-select {
  display: inline-flex; align-items: center; height: 40px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; overflow: hidden; color: var(--ink-soft);
}
[data-theme="dark"] .seg-select { background: var(--card); }
[data-theme="dark"] .summary-note,
[data-theme="dark"] .chip,
[data-theme="dark"] .result-message.speech {
  color: var(--green-700-text);
  background: var(--green-50);
  border-color: var(--green-100);
}
.seg-select:focus-within { outline: 3px solid rgba(14, 122, 90, 0.35); outline-offset: 1px; }
.seg-select .seg-icon {
  width: 34px; height: 100%; display: grid; place-items: center;
  color: var(--muted); flex: none; border-right: 1px solid var(--line);
}
.seg-select .seg-icon svg { width: 16px; height: 16px; }
.seg-select select {
  appearance: none; -webkit-appearance: none; background: transparent;
  border: 0; outline: 0; height: 100%; padding: 0 26px 0 10px;
  font-size: 12.5px; font-weight: 600; color: inherit; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a89d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  /* The chevron above is a fixed muted gray for light mode; dark mode swaps in
     a currentColor-based chevron so it follows the theme ink instead. */
  background-repeat: no-repeat; background-position: right 7px center; background-size: 13px;
}
[data-theme="dark"] .seg-select select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a89d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.seg-select select option { color: var(--ink); background: var(--card); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pill svg { width: 15px; height: 15px; }
.pill-soft { background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); }
.pill-outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.pill-live { background: var(--green-50); color: var(--green-800-strong); border: 1px solid var(--green-100); }
.pill-count { background: var(--cream-deep); color: var(--ink-soft); height: 28px; padding: 0 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); flex: none; }
.pill-live.is-off { background: var(--cream-deep); color: var(--muted); border-color: var(--line); }
.pill-live.is-off .dot { background: var(--line-strong); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  display: grid; place-items: center; transition: background .15s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--cream); }
.icon-btn:active { transform: scale(.96); }
.icon-btn-green { background: var(--green-50); border-color: var(--green-100); color: var(--green-700-ink); }
.icon-btn-green:hover { background: var(--green-100); }

/* ============================================================
   Cards and layout
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.money-strip {
  display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: 1fr 1fr;
}
.money-hero { grid-column: span 2; }

.money-card { display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }

.money-hero {
  color: #fff; border: 0;
  background:
    radial-gradient(340px 200px at 96% 0%, rgba(255, 255, 255, 0.16), transparent 65%),
    radial-gradient(280px 220px at 6% 110%, rgba(255, 255, 255, 0.09), transparent 60%),
    linear-gradient(135deg, var(--green-700), var(--green-900));
  box-shadow: var(--shadow-float);
  min-height: 156px;
  justify-content: space-between;
}
.money-hero-top { display: flex; align-items: center; justify-content: space-between; }
.money-hero .eyebrow { color: rgba(255, 255, 255, 0.72); }
.money-hero-icon {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.13); color: #fff; border: 1px solid rgba(255, 255, 255, 0.16);
}
.money-value {
  font-size: clamp(34px, 8vw, 44px);
  font-weight: 740; letter-spacing: -0.035em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.money-hero-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 12px; color: rgba(255, 255, 255, 0.74); margin-top: 12px;
}
.money-hero-date { font-weight: 600; }
.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted);
}
.metric-icon {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 8px;
}
.metric-icon svg { width: 18px; height: 18px; }
.metric-credit { background: var(--credit-soft); color: var(--credit); }
.metric-payment { background: var(--payment-soft); color: var(--payment); }
.metric-value {
  font-size: clamp(22px, 5vw, 27px); font-weight: 720;
  letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.metric-foot { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(315px, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-head.compact { margin-bottom: 14px; align-items: center; }
.section-head h2 { font-size: 19px; letter-spacing: -0.02em; font-weight: 700; line-height: 1.25; }
.section-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   Voice card
   ============================================================ */
.voice-card { padding-bottom: 18px; }
.voice-stage {
  display: flex; align-items: center; gap: 22px;
  padding: 16px 14px; border-radius: var(--radius-lg);
  background:
    radial-gradient(280px 160px at 18% 20%, rgba(11, 107, 79, 0.07), transparent 65%),
    var(--cream);
  border: 1px solid var(--line);
}
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; }
.mic-btn {
  position: relative; width: 96px; height: 96px; border-radius: 50%;
  border: 0; color: #fff; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--green-500), var(--green-800));
  box-shadow: var(--shadow-mic);
  transition: transform .16s ease, box-shadow .16s ease;
}
.mic-btn:hover { transform: translateY(-2px); }
.mic-btn:active { transform: scale(.97); }
.mic-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.mic-icon { position: relative; z-index: 2; display: grid; place-items: center; }
.mic-icon svg { width: 38px; height: 38px; }
.mic-rings { position: absolute; inset: 0; border-radius: 50%; }
.mic-rings::before, .mic-rings::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid rgba(14, 122, 90, 0.25); opacity: 0;
}
.mic-btn.is-recording .mic-rings::before { animation: ring 1.8s ease-out infinite; }
.mic-btn.is-recording .mic-rings::after { animation: ring 1.8s ease-out .6s infinite; }
.mic-btn.is-recording { background: linear-gradient(150deg, #c2410c, #9a2c07); box-shadow: 0 14px 30px -10px rgba(154, 44, 7, 0.6); }
@keyframes ring {
  0% { transform: scale(.9); opacity: .8; }
  100% { transform: scale(1.45); opacity: 0; }
}
.mic-caption { text-align: center; max-width: 220px; }
.mic-caption strong { display: block; font-size: 13px; font-weight: 700; }
.mic-caption span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.wave-block { flex: 1; min-width: 0; }
.wave {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 62px; padding: 0 4px;
}
.wave span {
  width: 4px; height: 8px; border-radius: 4px; background: var(--green-100);
  transition: height .2s ease, background .2s ease;
}
/* Idle shape so the control reads as a waveform, not a dotted line. */
.wave span:nth-child(2n) { height: 13px; }
.wave span:nth-child(3n) { height: 19px; }
.wave span:nth-child(5n) { height: 26px; }
.wave span:nth-child(7n) { height: 33px; }
.wave span:nth-child(11n) { height: 15px; }
.wave span:nth-child(4n) { height: 22px; }
.wave.is-live span { background: var(--green-500); animation: wave 1.1s ease-in-out infinite; }
.wave span:nth-child(3n) { animation-delay: .12s; }
.wave span:nth-child(4n) { animation-delay: .24s; }
.wave span:nth-child(5n) { animation-delay: .36s; }
.wave span:nth-child(7n) { animation-delay: .48s; }
@keyframes wave {
  0%, 100% { height: 8px; opacity: .65; }
  50% { height: 44px; opacity: 1; }
}
.timer {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  font-variant-numeric: tabular-nums; font-weight: 650; font-size: 15px;
}
.timer-limit { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.voice-steps {
  display: flex; gap: 8px; margin: 12px 2px 4px;
  font-size: 11px; color: var(--muted); flex-wrap: wrap;
}
.voice-steps span { display: inline-flex; align-items: center; gap: 6px; }
.voice-steps span + span::before { content: "·"; margin-right: 2px; color: var(--line-strong); }
.voice-steps b {
  width: 17px; height: 17px; border-radius: 50%; background: var(--green-50);
  color: var(--green-700-ink); display: inline-grid; place-items: center; font-size: 10px;
}

.text-fallback { margin-top: 14px; }
.input-row {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md); padding: 6px 6px 6px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-row:focus-within { border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(14, 122, 90, 0.12); }
.input-icon { color: var(--muted); width: 18px; height: 18px; }
.input-row input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 14.5px; padding: 10px 0;
}
.input-row input::placeholder { color: #97a29c; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 13px;
  border: 1px solid transparent; font-weight: 650; font-size: 14px;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: linear-gradient(160deg, var(--green-600), var(--green-800));
  color: #fff; box-shadow: 0 10px 22px -14px rgba(6, 64, 47, 0.8);
}
.btn-primary:hover { background: linear-gradient(160deg, var(--green-500), var(--green-700)); }
.btn-secondary { background: var(--surface); border-color: var(--green-100); color: var(--green-800-strong); }
.btn-secondary:hover { background: var(--green-50); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: transparent; min-height: 38px; padding: 0 10px; }
.btn-ghost:hover { background: var(--cream); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #f6d7d2; }
.btn-danger:hover { background: #fbe0dc; }
.btn-sm { min-height: 34px; font-size: 12.5px; border: 1px solid var(--line); background: var(--surface); }
.btn-block { width: 100%; }
.btn-send { min-height: 42px; padding: 0 16px; flex: none; }
.btn-send svg { width: 16px; height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 550;
  transition: background .15s ease, border-color .15s ease;
}
.chip:hover { background: var(--green-50); border-color: var(--green-100); color: var(--green-800-strong); }

.help { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.help summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.help summary:hover { color: var(--green-700-ink); }
.help ul { margin: 10px 0 0; padding-left: 18px; list-style: disc; font-size: 12.5px; color: var(--muted); }
.help li { margin-bottom: 6px; }
.help code { background: var(--cream); padding: 1px 5px; border-radius: 5px; font-size: 11.5px; }

/* ============================================================
   Transcript
   ============================================================ */
.transcript-card { border-left: 4px solid var(--green-500); }
.transcript-card .section-head { margin-bottom: 8px; }
.transcript-text {
  font-size: 19px; font-weight: 620; letter-spacing: -0.01em; line-height: 1.45;
  margin-top: 4px; overflow-wrap: anywhere;
}
.transcript-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.meta-chip {
  font-size: 11.5px; background: var(--cream); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 9px; color: var(--ink-soft);
}
.meta-chip b { color: var(--ink); font-weight: 650; }
.badge {
  font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: var(--green-50); color: var(--green-800-strong); white-space: nowrap;
}
.badge-mid { background: var(--credit-soft); color: var(--credit); }
.badge-low { background: var(--danger-soft); color: var(--danger); }
.transcript-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ============================================================
   Result cards
   ============================================================ */
.result-card { padding: 0; overflow: hidden; scroll-margin-top: 20px; }
[data-theme="dark"] .result-accent { opacity: 0.9; }
.result-inner { padding: 20px; }
.result-accent { height: 4px; background: var(--green-600); }
.result-accent.amber { background: var(--credit); }
.result-accent.blue { background: var(--info); }
.result-accent.red { background: var(--danger); }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.result-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.result-kicker .k-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); }
.result-title { font-size: 20px; font-weight: 720; letter-spacing: -0.02em; line-height: 1.3; }
.result-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.confirm-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.confirm-amount { font-size: clamp(34px, 8vw, 42px); font-weight: 750; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.type-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 6px 11px; margin-bottom: 8px;
}
.type-credit { background: var(--credit-soft); color: var(--credit); }
.type-payment { background: var(--payment-soft); color: var(--payment); }

.confirm-rows { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.confirm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; font-size: 13.5px; background: var(--card);
}
.confirm-row + .confirm-row { border-top: 1px solid var(--line); }
.confirm-row .k { color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 7px; }
.confirm-row .v { font-weight: 650; text-align: right; }
.confirm-row .v.big { font-size: 16px; }
.balance-flow { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.balance-flow .arrow { color: var(--muted); }
.balance-flow .now { color: var(--muted); font-weight: 500; text-decoration: line-through; text-decoration-thickness: 1px; }
.balance-flow .next { color: var(--green-800-strong); }

.customer-line { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: var(--green-50); color: var(--green-800-strong); border: 1px solid var(--green-100);
}
.avatar.warm { background: var(--credit-soft); color: var(--credit); border-color: var(--credit-soft-line); }
.customer-line .name { font-weight: 680; }
.customer-line .sub { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.warn-box {
  display: flex; gap: 10px; margin-top: 14px; padding: 12px 13px;
  border-radius: var(--radius-md); background: var(--credit-soft);
  border: 1px solid var(--credit-soft-line); color: var(--on-credit-soft); font-size: 12.5px; line-height: 1.5;
}
.warn-box svg { width: 18px; height: 18px; margin-top: 1px; color: var(--credit); }
.warn-box strong { display: block; font-size: 13px; margin-bottom: 2px; }

.confirm-actions { display: grid; grid-template-columns: 1.5fr 1fr; gap: 9px; margin-top: 16px; }
.confirm-actions .btn { min-height: 50px; font-size: 14.5px; }
.confirm-actions .btn-correct { grid-column: 1 / -1; min-height: 40px; font-size: 12.5px; }
.pending-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; font-size: 11px; color: var(--muted);
}
.pending-foot svg { width: 13px; height: 13px; }

.result-message {
  font-size: 15px; line-height: 1.55; color: var(--ink-soft);
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 14px; margin-top: 14px;
}
.result-message.speech {
  background: var(--green-50); border-color: var(--green-100); color: var(--green-700-text);
}

.answer-value { font-size: clamp(32px, 8vw, 40px); font-weight: 750; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.answer-label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.answer-rows { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.answer-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; font-size: 13px; }
.answer-row + .answer-row { border-top: 1px solid var(--line); }
.answer-row .k { color: var(--muted); }
.answer-row .v { font-weight: 650; font-variant-numeric: tabular-nums; }

.customer-picks { display: grid; gap: 8px; margin-top: 14px; }
.customer-pick {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 11px 13px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, background .15s;
}
.customer-pick:hover { border-color: var(--green-500); background: var(--green-50); }
.customer-pick .pick-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.customer-pick .pick-balance { font-size: 12.5px; font-weight: 650; color: var(--credit); white-space: nowrap; }
.customer-pick .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }

.answer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.answer-actions .btn { flex: 1; min-width: 130px; }

.success-hero { text-align: center; padding: 8px 0 4px; }
.success-badge {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 12px;
  display: grid; place-items: center; background: var(--green-50); color: var(--green-700-ink);
  border: 1px solid var(--green-100);
}
.success-badge svg { width: 30px; height: 30px; }
.success-amount { font-size: clamp(30px, 8vw, 38px); font-weight: 750; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.success-note { font-size: 13px; color: var(--muted); margin-top: 2px; }
.success-balance {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  background: var(--cream); border: 1px solid var(--line); padding: 8px 14px;
  border-radius: 999px; font-size: 12.5px;
}
.success-balance strong { font-size: 14px; color: var(--green-800-strong); }

.manual-form { margin-top: 16px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--cream); }
.manual-form h3 { font-size: 14px; margin-bottom: 10px; }
.form-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.field.full { grid-column: 1 / -1; }
.field input, .field select {
  height: 42px; border-radius: 10px; border: 1.5px solid var(--line-strong);
  background: var(--surface); padding: 0 11px; font-size: 14px; font-weight: 500; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(14,122,90,.12); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg-btn {
  height: 38px; border-radius: 9px; border: 1.5px solid var(--line-strong);
  background: var(--surface); font-size: 12.5px; font-weight: 600;
}
.seg-btn.is-active { border-color: var(--green-600); background: var(--green-50); color: var(--green-800-strong); }
.form-actions { display: flex; gap: 8px; margin-top: 12px; }
.form-actions .btn { flex: 1; min-height: 42px; font-size: 13px; }

.parser-notes { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.note {
  font-size: 11px; padding: 5px 9px; border-radius: 8px;
  background: var(--cream); border: 1px solid var(--line); color: var(--muted);
}
.note.warn { background: var(--credit-soft); border-color: var(--credit-soft-line); color: var(--on-credit-soft); }
.speak-row { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.speak-note { font-size: 11px; color: var(--muted); }

/* ============================================================
   Ledger
   ============================================================ */
.search-box {
  display: flex; align-items: center; gap: 6px; background: var(--cream);
  border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 38px;
  min-width: 0;
}
.search-box svg { width: 15px; height: 15px; color: var(--muted); }
.search-box input { border: 0; background: transparent; outline: none; font-size: 12.5px; width: 118px; min-width: 0; }
.ledger-tools { display: flex; align-items: center; gap: 7px; flex: none; }
.ledger-tools .icon-btn { width: 38px; height: 38px; flex: none; }
.add-customer-form {
  margin-bottom: 14px; padding: 12px; border-radius: var(--radius-md);
  background: var(--green-50); border: 1px solid var(--green-100);
}
.add-customer-row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.add-customer-row input {
  flex: 1 1 150px; min-width: 0; height: 38px; border-radius: 9px;
  border: 1.5px solid var(--line-strong); background: var(--surface); padding: 0 11px; font-size: 13px;
}
.add-customer-row input:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(14,122,90,.12); }
.add-customer-form .fineprint { margin-top: 7px; }
.ledger-head {
  display: flex; justify-content: space-between; padding: 0 4px 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.customer-list { display: flex; flex-direction: column; }
.customer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--line);
}
.customer-row:last-child { border-bottom: 0; }
.customer-row-btn {
  display: flex; align-items: center; gap: 11px; background: none; border: 0;
  padding: 0; text-align: left; flex: 1; min-width: 0; border-radius: 10px;
}
.customer-row-btn:hover .cust-name { color: var(--green-700-ink); }
.cust-name { font-weight: 650; font-size: 14px; transition: color .15s; }
.cust-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.balance-pill {
  font-size: 13px; font-weight: 700; padding: 6px 11px; border-radius: 9px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.balance-baaki { background: var(--credit-soft); color: var(--on-credit-soft); }
.balance-clear { background: var(--cream-deep); color: var(--muted); }
.balance-advance { background: var(--green-50); color: var(--green-800-strong); }
.cust-ask {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  height: 30px; padding: 0 9px; border-radius: 8px; font-size: 10.5px; font-weight: 650;
  flex: none;
}
.cust-ask:hover { border-color: var(--green-500); color: var(--green-700-ink); }

.skeleton-row {
  height: 52px; border-radius: 12px; margin-bottom: 8px;
  background: linear-gradient(90deg, var(--cream-deep) 25%, var(--skeleton-hi) 50%, var(--cream-deep) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty-state { font-size: 12.5px; color: var(--muted); text-align: center; padding: 18px 8px; }

/* ============================================================
   Daily summary / aside
   ============================================================ */
.daily-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.daily-stat {
  background: var(--cream); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 3px;
}
.daily-stat span { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.daily-stat strong { font-size: 17px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.credit-text { color: var(--credit); }
.payment-text { color: var(--payment); }
.summary-note {
  margin-top: 10px; font-size: 12px; line-height: 1.55; color: var(--green-700-text);
  background: var(--green-50); border: 1px solid var(--green-100);
  border-radius: 11px; padding: 9px 11px;
}
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.mini-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mini-head h3 { font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.text-btn { border: 0; background: none; color: var(--green-700-ink); font-size: 11.5px; font-weight: 650; padding: 2px 0; }
.text-btn:hover { text-decoration: underline; }
.top-list { display: flex; flex-direction: column; }
.top-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.top-rank {
  width: 19px; height: 19px; border-radius: 6px; background: var(--cream-deep); color: var(--muted);
  display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none;
}
.top-row:first-child .top-rank { background: var(--green-700); color: #fff; }
.top-name { flex: 1; font-size: 12.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-amount { font-size: 12.5px; font-weight: 700; color: var(--credit); font-variant-numeric: tabular-nums; }
.top-empty { font-size: 12px; color: var(--muted); padding: 8px 0; }

.reminder-box { margin-top: 12px; background: var(--credit-soft); border: 1px solid var(--credit-soft-line); border-radius: 12px; padding: 10px 12px; }
.reminder-title { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--on-credit-soft); text-transform: uppercase; letter-spacing: .06em; }
.reminder-title svg { width: 14px; height: 14px; }
.reminder-box ul { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.reminder-box li { font-size: 11.5px; color: var(--on-credit-soft); line-height: 1.45; }
.fineprint { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.daily-card .btn-block { margin-top: 14px; min-height: 42px; font-size: 12.5px; }

.txn-list { display: flex; flex-direction: column; }
.txn-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.txn-row:last-child { border-bottom: 0; }
.txn-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 15px; font-weight: 700; flex: none;
}
.txn-icon.credit { background: var(--credit-soft); color: var(--credit); }
.txn-icon.payment { background: var(--payment-soft); color: var(--payment); }
.txn-icon svg { width: 15px; height: 15px; }
.txn-main { flex: 1; min-width: 0; }
.txn-name { font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.txn-amt { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.txn-amt.credit { color: var(--credit); }
.txn-amt.payment { color: var(--payment); }

.status-list { display: flex; flex-direction: column; gap: 9px; }
.status-list li { display: flex; gap: 9px; align-items: flex-start; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--line-strong); }
.status-dot.ok { background: var(--green-500); box-shadow: 0 0 0 3px var(--green-50); }
.status-dot.warn { background: #d97706; box-shadow: 0 0 0 3px #fef3c7; }
.status-list strong { display: block; font-size: 12px; font-weight: 650; }
.status-list small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.status-note {
  margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); line-height: 1.5;
}
.status-note code { background: var(--cream); padding: 1px 4px; border-radius: 4px; font-size: 10px; }

.footer { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.footer p { font-size: 11.5px; color: var(--muted); }
.footer strong { color: var(--ink-soft); }

/* ============================================================
   Toast / busy
   ============================================================ */
.toast-wrap {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 28px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--green-950); color: #fff; border-radius: 13px;
  padding: 11px 14px; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.55);
  animation: toast-in .2s ease-out;
  pointer-events: auto;
}
.toast svg { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.toast.toast-error { background: #7a1d14; }
.toast.toast-warn { background: #7c3a06; }
.toast.toast-success { background: var(--green-800); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.busy-overlay {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(6, 20, 15, 0.42); backdrop-filter: blur(3px);
  padding: 20px;
}
.busy-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px 26px; text-align: center;
  max-width: 340px; width: 100%; box-shadow: var(--shadow-float);
}
.busy-card p { font-size: 15px; font-weight: 650; margin-top: 12px; }
.busy-card small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; display: inline-block;
  border: 3px solid var(--green-100); border-top-color: var(--green-600);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.noscript { padding: 20px; background: var(--credit-soft); color: var(--on-credit-soft); font-weight: 600; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1019px) {
  .layout { display: flex; flex-direction: column; gap: 16px; }
  .layout > .stack { display: contents; }
  .layout aside.stack { display: flex; flex-direction: column; gap: 16px; order: 4; }
  #voice-card { order: 1; }
  #transcript-card { order: 2; }
  #result-card { order: 3; }
  .ledger-card { order: 5; }
  .money-value { font-size: 40px; }
}

@media (min-width: 720px) {
  .money-strip { grid-template-columns: 1.5fr 1fr 1fr; }
  .money-hero { grid-column: auto; }
}

@media (max-width: 640px) {
  .page { padding: 14px 13px 30px; }
  .topbar { margin-bottom: 16px; gap: 8px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
  .brand-mark svg { width: 22px; height: 22px; }
  .brand-text h1 { font-size: 19px; }
  .brand-text p { font-size: 11px; }
  .pill-outline { display: none; }
  .card { padding: 16px; border-radius: 20px; }
  .money-strip { gap: 10px; margin-bottom: 14px; }
  .money-hero { min-height: 138px; }
  .money-value { font-size: 36px; }
  .metric-value { font-size: 20px; }
  .metric-icon { width: 30px; height: 30px; margin-bottom: 6px; }
  .metric-foot { font-size: 10.5px; }
  .section-head { margin-bottom: 14px; gap: 10px; }
  .section-head h2 { font-size: 17px; }
  .section-sub { font-size: 11.5px; }
  .pill-live { font-size: 10.5px; padding: 0 10px; height: 30px; }
  .voice-stage { flex-direction: column; gap: 12px; padding: 18px 12px; }
  .mic-btn { width: 88px; height: 88px; }
  .mic-icon svg { width: 34px; height: 34px; }
  .mic-caption { max-width: none; }
  .wave-block { width: 100%; }
  .wave { height: 46px; }
  .voice-steps { font-size: 10px; justify-content: center; }
  .input-row { flex-wrap: wrap; padding: 8px; gap: 6px; }
  .input-icon { display: none; }
  .input-row input { flex: 1 1 100%; padding: 8px 4px; font-size: 14px; }
  .btn-send { width: 100%; min-height: 44px; }
  .transcript-text { font-size: 17px; }
  .confirm-actions { grid-template-columns: 1fr; }
  .confirm-actions .btn-correct { grid-column: auto; }
  .confirm-rows .confirm-row { padding: 10px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .answer-actions .btn { min-width: 0; }
  .topbar-actions .icon-btn { width: 38px; height: 38px; }
  .footer { margin-top: 20px; }
  .toast-wrap { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .search-box input { width: 92px; }
}

@media (max-width: 380px) {
  .brand-text p { display: none; }
  .money-hero-foot { font-size: 10.5px; }
  .daily-grid { grid-template-columns: 1fr; }
  .cust-ask { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* Author styles must not override the hidden attribute */
[hidden] { display: none !important; }
.type-pill svg { width: 14px; height: 14px; }

/* ============================================================
   Shopkeeper mode — plain words, big tap targets, less clutter.
   Appended last so it wins over the base layout rules.
   ============================================================ */
body { font-size: 16.5px; }

.card { padding: clamp(18px, 4vw, 26px); }

.btn:not(.btn-sm) { min-height: 50px; padding: 12px 20px; font-size: 16px; border-radius: 14px; }
.btn-sm { min-height: 42px; padding: 9px 14px; font-size: 14px; }
.icon-btn { width: 46px; height: 46px; }
.chip { min-height: 44px; padding: 10px 16px; font-size: 14.5px; }
.input-row input { font-size: 16px; }

.mic-caption strong { font-size: 16px; }
.mic-caption span { font-size: 13px; }
.voice-steps { font-size: 12.5px; }
.fineprint { font-size: 12.5px; }
.eyebrow { font-size: 12px; }

/* "Install on your phone" — the app, not a URL to remember */
.install-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 14px 18px;
  border-radius: 18px; border: 1px solid var(--green-100);
  background: linear-gradient(135deg, var(--green-50), var(--card));
  box-shadow: var(--shadow-card);
}
.install-banner.hidden { display: none !important; }
.install-copy { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; }
.install-copy strong { font-size: 15.5px; }
.install-copy span { color: var(--muted); font-size: 13px; }
[data-theme="dark"] .install-banner {
  background: linear-gradient(135deg, var(--green-50), var(--card));
  border-color: var(--line);
}

/* Technical status stays available, but folded away */
.advanced-card { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 12px; }
.advanced-card summary {
  cursor: pointer; list-style: none; padding: 8px 0;
  font-size: 13px; color: var(--muted);
}
.advanced-card summary::-webkit-details-marker { display: none; }
.advanced-card summary::after { content: " ›"; }
.advanced-card[open] summary::after { content: " ⌄"; }
.advanced-card[open] summary { color: var(--ink-soft); }
.advanced-card .status-card { margin-top: 10px; }

@media (max-width: 720px) {
  .page { padding: 12px 12px 28px; }
  .mic-btn { width: 112px; height: 112px; }
  .mic-caption strong { font-size: 17px; }
  .btn:not(.btn-sm) { min-height: 54px; font-size: 17px; }
  .money-value { font-size: 40px; }
}

/* ============================================================
   Three screens instead of one long page.
   Bolo → Grahak → Hisaab, switched by the bottom bar.
   ============================================================ */
.view { display: none; flex-direction: column; gap: 16px; }
.view.is-active { display: flex; }
.view-narrow { max-width: 860px; margin-inline: auto; width: 100%; }

.hisab-grid { display: grid; gap: 16px; align-items: start; }
/* The view already spaces its children. */
.view .money-strip { margin-bottom: 0; }
.view .advanced-card { margin-top: 0; }

/* "Kul baaki" peek on the talking screen — tap to open the full hisaab. */
.balance-chip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 13px 16px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--green-100);
  background: linear-gradient(135deg, var(--green-50), var(--card));
  color: var(--ink); font: inherit; text-align: left;
  transition: transform .16s ease, box-shadow .16s ease;
}
.balance-chip:active { transform: scale(.99); }
.balance-chip:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }
.balance-chip-label { font-size: 13px; font-weight: 650; color: var(--muted); }
.balance-chip strong {
  margin-left: auto; font-size: 20px; font-weight: 760;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.balance-chip-go { display: inline-flex; color: var(--muted); }
.balance-chip-go svg { width: 16px; height: 16px; }
[data-theme="dark"] .balance-chip { border-color: var(--line); }

/* Bottom bar: thumb-reachable, three big targets. */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 26px -18px rgba(6, 64, 47, 0.5);
}
@supports (backdrop-filter: blur(8px)) {
  .bottom-nav { background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); }
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 58px; padding: 6px 4px; border: 0; border-radius: 16px;
  background: transparent; color: var(--muted); font: inherit;
  font-size: 12.5px; font-weight: 650; cursor: pointer;
  transition: color .18s ease, background .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn svg { width: 24px; height: 24px; }
.nav-btn.is-active { color: var(--green-800); background: var(--green-50); }
.nav-btn.is-active svg { stroke-width: 2.2; }
.nav-btn:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }
[data-theme="dark"] .nav-btn.is-active { background: var(--green-950); color: #8ad7bb; }

/* Room for the bar, and toasts clearing it. */
body { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
#toast-wrap { bottom: calc(96px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  .bottom-nav {
    left: 50%; right: auto; transform: translateX(-50%);
    bottom: 18px; width: min(470px, 92vw);
    border: 1px solid var(--line); border-radius: 22px;
    padding: 8px; box-shadow: var(--shadow-float);
  }
  .nav-btn { min-height: 54px; }
  body { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  #toast-wrap { bottom: calc(112px + env(safe-area-inset-bottom)); }
  .hisab-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 899px) {
  .hisab-grid { grid-template-columns: 1fr; }
}

/* Narrow phone: brand gets its own row, controls sit underneath. */
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
  .brand-text h1 { font-size: 19px; }
  .brand-text p { font-size: 11.5px; }
  .topbar-actions { width: 100%; justify-content: flex-end; gap: 6px; }
  #sample-badge { order: -1; margin-right: auto; }
  .seg-select { height: 40px; }
  .seg-select .seg-icon { display: none; }
  .seg-select select { padding: 0 24px 0 12px; font-size: 13px; }
  .topbar-actions .icon-btn { width: 42px; height: 42px; }
  .balance-chip { padding: 11px 13px; }
  .balance-chip strong { font-size: 19px; }
}

/* ============================================================
   Voice language — header switch, change button, first-run chooser
   ============================================================ */

.lang-switch {
  display: inline-flex; align-items: stretch; height: 40px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--surface);
}
[data-theme="dark"] .lang-switch { background: var(--card); }
.lang-switch-btn {
  border: 0; background: transparent; padding: 0 12px;
  font: inherit; font-size: 12.5px; font-weight: 650; color: var(--ink-soft);
  cursor: pointer; white-space: nowrap;
  max-width: 38vw; overflow: hidden; text-overflow: ellipsis;
}
.lang-switch-btn + .lang-switch-btn { border-left: 1px solid var(--line); }
.lang-switch-btn.is-active { background: var(--green-50); color: var(--green-800-strong); }
.lang-switch-btn:focus-visible { outline: 3px solid rgba(14, 122, 90, 0.35); outline-offset: -3px; }
[data-theme="dark"] .lang-switch-btn { color: #9fc0b2; }
[data-theme="dark"] .lang-switch-btn.is-active { background: var(--green-950); color: #8ad7bb; }

.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 8px 2px;
  background: none; border: 0; color: var(--green-700-ink);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
.link-btn svg { width: 16px; height: 16px; flex: none; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--green-600); outline-offset: 3px; border-radius: 8px; }

body.lang-modal-open { overflow: hidden; }

.lang-modal {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: rgba(6, 20, 15, 0.55);
  backdrop-filter: blur(4px);
  overflow-y: auto;
}
.lang-modal[hidden] { display: none; }
.lang-modal-panel {
  width: 100%; max-width: 660px; max-height: calc(100dvh - 32px);
  overflow-y: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: 20px; box-shadow: var(--shadow-float);
}
.lang-modal-title { font-size: clamp(17px, 4.6vw, 22px); line-height: 1.3; }
.lang-modal-title span {
  display: block; margin-top: 2px;
  font-size: 0.76em; font-weight: 600; color: var(--muted);
}
.lang-modal-title .lang-modal-q {
  margin-top: 0; font-size: 1em; font-weight: 700; color: inherit;
}
.lang-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px; margin-top: 16px;
}
.lang-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 78px; padding: 12px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink);
  font: inherit; cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.lang-card:hover { border-color: var(--green-500); }
.lang-card:active { transform: scale(0.985); }
.lang-card:focus-visible { outline: 3px solid rgba(14, 122, 90, 0.35); outline-offset: 2px; }
.lang-card.is-selected { border-color: var(--green-600); background: var(--green-50); }
[data-theme="dark"] .lang-card { background: var(--card); }
[data-theme="dark"] .lang-card.is-selected { background: var(--green-950); border-color: var(--green-600); }
.lang-card-name { font-size: 17px; font-weight: 650; line-height: 1.25; }
.lang-card-code { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.lang-modal-note {
  margin-top: 14px; font-size: 12px; line-height: 1.5; color: var(--muted);
}

@media (max-width: 560px) {
  .lang-switch { height: 36px; }
  .lang-switch-btn { padding: 0 10px; font-size: 12px; max-width: 40vw; }
  .lang-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .lang-card { min-height: 70px; padding: 10px 12px; }
  .lang-card-name { font-size: 16px; }
}
