/* ------------------------------------------------------------------ *
 * KaamSathi — built for a ₹7,000 Android phone held in bright daylight
 * by someone with dusty hands.
 *
 * Design rules that everything below follows:
 *   · Money is the largest thing on any screen. It is why people open this.
 *   · Colour is load-bearing and consistent: green = earned/paid/good,
 *     amber = act now, red = still owed / absent. Never colour alone —
 *     every state also carries a word.
 *   · Motion only ever confirms an action or shows where something came
 *     from. It is all transform/opacity so a cheap GPU can do it, and it
 *     all disappears under prefers-reduced-motion.
 *   · Targets are 44px+ and text does not go below .72rem.
 * ------------------------------------------------------------------ */

:root {
  --green-900: #08402F;
  --green-800: #0C5544;
  --green-700: #12705A;
  --green-600: #16826A;
  --green-500: #1B8C6F;
  --green-300: #6FD9B6;
  --green-100: #DCF0E9;
  --amber-600: #B36F04;
  --amber-500: #F0980D;
  --amber-400: #FFC24D;
  --amber-100: #FFF1D6;
  --red-600:   #C0392B;
  --red-500:   #E05445;
  --red-100:   #FDE7E4;

  --bg:        #FAF6EE;
  --surface:   #FFFFFF;
  --surface-2: #F3EFE5;
  --ink:       #10201C;
  --ink-2:     #566B64;
  --line:      #E5DFD2;

  --radius:    16px;
  --radius-sm: 12px;
  --tap:       48px;

  --shadow-1: 0 1px 2px rgba(16, 32, 28, .05), 0 2px 6px rgba(16, 32, 28, .05);
  --shadow-2: 0 2px 4px rgba(16, 32, 28, .06), 0 10px 24px rgba(16, 32, 28, .09);
  --shadow-up: 0 -6px 20px rgba(16, 32, 28, .10);

  --header: linear-gradient(160deg, var(--green-800) 0%, var(--green-900) 100%);

  --font: 'Segoe UI', 'Nirmala UI', 'Noto Sans', 'Noto Sans Devanagari', system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(.22, .68, .36, 1);
  --quick: 160ms var(--ease);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0D1512;
    --surface:   #16201C;
    --surface-2: #1F2C27;
    --ink:       #EDF4F1;
    --ink-2:     #9BB2AA;
    --line:      #2A3833;
    --green-100: #113026;
    --amber-100: #33280F;
    --red-100:   #3A1E1A;
    --header: linear-gradient(160deg, #0F5947 0%, #072A20 100%);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .5), 0 12px 28px rgba(0, 0, 0, .38);
    --shadow-up: 0 -6px 20px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding-bottom: 86px; }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-2); }

/* ---------- motion primitives ---------- */

@keyframes rise-in  { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-in  { from { opacity: 0; } }
@keyframes pop-in   { from { opacity: 0; transform: scale(.92); } }
@keyframes slide-up { from { transform: translateY(16px); opacity: .4; } }
@keyframes sheen    { to   { background-position: 200% 0; } }
@keyframes tick     { from { stroke-dashoffset: 60; } to { stroke-dashoffset: 0; } }
@keyframes burst    { from { opacity: 0; transform: scale(.7); }
                      60%  { opacity: 1; transform: scale(1.06); }
                      to   { opacity: 1; transform: scale(1); } }

/* Every screen arrives the same way, so navigation feels like one surface. */
.wrap > * { animation: rise-in 260ms var(--ease) both; }
.wrap > *:nth-child(1) { animation-delay: 0ms; }
.wrap > *:nth-child(2) { animation-delay: 26ms; }
.wrap > *:nth-child(3) { animation-delay: 52ms; }
.wrap > *:nth-child(4) { animation-delay: 78ms; }
.wrap > *:nth-child(5) { animation-delay: 104ms; }
.wrap > *:nth-child(n+6) { animation-delay: 130ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}

/* ---------- typography ---------- */
h1, h2, h3 { margin: 0; line-height: 1.25; }
.hi { font-weight: 700; letter-spacing: -.01em; }
.en { color: var(--ink-2); font-size: .8rem; font-weight: 600; }
.muted { color: var(--ink-2); }
.tiny { font-size: .78rem; }
.num, .rupee { font-variant-numeric: tabular-nums; }
.rupee { font-weight: 800; letter-spacing: -.02em; }
.pos { color: var(--green-700); }
.neg { color: var(--red-600); }
@media (prefers-color-scheme: dark) {
  .pos { color: var(--green-300); }
  .neg { color: #F58F80; }
}

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--header); color: #fff;
  box-shadow: 0 2px 12px rgba(8, 64, 47, .22);
}
.appbar img { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.appbar .title { font-weight: 800; font-size: 1.08rem; letter-spacing: -.02em; }
.appbar .sub { font-size: .75rem; opacity: .82; font-weight: 500; }
.appbar button {
  background: rgba(255, 255, 255, .16); color: #fff; border: 0;
  border-radius: 999px; min-height: 36px; padding: 0 14px; font: inherit;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: background var(--quick), transform var(--quick);
}
.appbar button:active { transform: scale(.95); background: rgba(255, 255, 255, .28); }
.back {
  background: none !important; border: 0; color: #fff; font-size: 1.6rem;
  line-height: 1; padding: 0 6px !important; cursor: pointer; min-height: auto !important;
}

/* ---------- layout ---------- */
.wrap { padding: 14px; display: grid; gap: 12px; }
.wrap:has(~ .fab) { padding-bottom: 78px; }
/* The hazri pane adds a save bar *above* the tab bar — ~124px of fixed
   chrome. Without this the last worker card is unreachable behind it. */
.wrap.haswide { padding-bottom: 100px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 14px;
  transition: transform var(--quick), box-shadow var(--quick);
}
.card.tight { padding: 11px 12px; }
a.card:active, .card.link:active { transform: scale(.985); box-shadow: var(--shadow-2); }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 10px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrapflex { flex-wrap: wrap; gap: 12px; }
.rightnum { text-align: right; white-space: nowrap; }
.center { text-align: center; }
a.link, .link { text-decoration: none; color: inherit; }
.chev { color: var(--ink-2); font-size: 1.5rem; line-height: 1; flex: none; opacity: .55; }

.sectionhead { display: flex; align-items: baseline; gap: 8px; padding: 2px 2px 0; }
.sectionhead h2 { font-size: 1.02rem; }

/* ---------- avatar: a face for every name ---------- */
.who {
  width: 40px; height: 40px; border-radius: 999px; flex: none;
  display: grid; place-items: center;
  font-weight: 800; font-size: .95rem; color: #fff;
  background: var(--green-600);
  box-shadow: inset 0 -2px 6px rgba(0, 0, 0, .13);
}
.who.t0 { background: #1B8C6F; } .who.t1 { background: #C97A05; }
.who.t2 { background: #2F6FB5; } .who.t3 { background: #A34B8F; }
.who.t4 { background: #4C7A1F; } .who.t5 { background: #B4514A; }
.who.lg { width: 56px; height: 56px; font-size: 1.3rem; }

.avatar {
  width: 54px; height: 54px; border-radius: 999px; background: var(--green-100);
  display: grid; place-items: center; font-size: 1.8rem; flex: none;
}

/* ---------- chips ---------- */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.chip.skill { background: var(--green-100); color: var(--green-700); }
.chip.live  { background: var(--amber-100); color: var(--amber-600); }
.chip.done  { background: var(--surface-2); color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  .chip.skill { color: var(--green-300); }
  .chip.live  { color: var(--amber-400); }
}

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; cursor: pointer; border-radius: var(--radius-sm);
  border: 1px solid transparent; min-height: var(--tap); padding: 0 16px;
  font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; gap: 7px; text-decoration: none;
  transition: transform var(--quick), box-shadow var(--quick), background var(--quick);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--green-700); color: #fff; box-shadow: 0 2px 8px rgba(18, 112, 90, .3); }
.btn.primary:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
.btn.accent  { background: var(--amber-500); color: #3A2703; box-shadow: 0 2px 8px rgba(240, 152, 13, .32); }
.btn.ghost   { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.danger  { background: var(--red-100); color: var(--red-600); }
.btn.block   { width: 100%; }
.btn.sm      { min-height: 38px; padding: 0 12px; font-size: .84rem; border-radius: 10px; }

.fab {
  position: fixed; right: max(14px, calc(50vw - 266px)); bottom: 98px; z-index: 25;
  background: var(--amber-500); color: #3A2703; border: 0; border-radius: 999px;
  min-height: 54px; padding: 0 22px; font-weight: 800; font-size: .96rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .24);
  animation: pop-in 240ms var(--ease) both 120ms;
}
.fab:active { transform: scale(.94); }

/* ---------- bottom nav ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: var(--shadow-up);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 4px 9px; text-decoration: none;
  color: var(--ink-2); font-size: .71rem; font-weight: 700;
  position: relative; transition: color var(--quick);
}
.tabbar a .ico {
  display: block; font-size: 1.3rem; line-height: 1.35;
  transition: transform 220ms var(--ease);
}
.tabbar a.on { color: var(--green-700); }
.tabbar a.on .ico { transform: translateY(-2px) scale(1.12); }
.tabbar a.on::after {
  content: ''; position: absolute; top: 0; left: 50%; translate: -50% 0;
  width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--green-700);
  animation: fade-in 200ms var(--ease) both;
}
@media (prefers-color-scheme: dark) {
  .tabbar a.on { color: var(--green-300); }
  .tabbar a.on::after { background: var(--green-300); }
}

/* ---------- segmented tabs ---------- */
.segs {
  display: flex; gap: 6px; padding: 10px 14px 0;
  animation: fade-in 200ms var(--ease) both;
}
.segs a {
  flex: 1; text-align: center; text-decoration: none; padding: 10px 6px;
  border-radius: var(--radius-sm); font-weight: 700; font-size: .9rem;
  background: var(--surface-2); color: var(--ink-2);
  transition: background var(--quick), color var(--quick), transform var(--quick);
}
.segs a:active { transform: scale(.97); }
.segs a.on { background: var(--green-700); color: #fff; box-shadow: 0 2px 8px rgba(18, 112, 90, .28); }

/* ---------- date strip ---------- */
.datestrip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow-1);
}
.datestrip button {
  min-height: 40px; min-width: 40px; padding: 0; border-radius: 10px;
  background: var(--surface-2); color: var(--ink); font-size: 1.2rem;
}
.datestrip .d { flex: 1; text-align: center; font-weight: 800; }
.datestrip .d small { display: block; font-weight: 600; font-size: .72rem; color: var(--ink-2); }
.datestrip input[type=date] { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ---------- hazri card ---------- */
.hazri { display: grid; gap: 10px; }
.hazri .top { display: flex; align-items: center; gap: 10px; }
.hazri .name { font-weight: 700; }
.hazri .amt { margin-left: auto; text-align: right; }
.hazri .amt .rupee { font-size: 1.1rem; transition: color var(--quick); }

.segbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
/* Row, not column: stacking a Latin short-code under Devanagari clips the
   matras on the line above at any height a thumb-sized button can have. */
.segbtns button {
  min-height: 48px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: .86rem; border-radius: var(--radius-sm);
  padding: 0 4px; gap: 5px; line-height: 1.3;
}
.segbtns button b { font-size: .98rem; }
.segbtns button .tiny { opacity: .6; font-size: .7rem; font-weight: 700; }
.segbtns button[aria-pressed=true] { animation: pop-in 180ms var(--ease); }
.segbtns button[aria-pressed=true][data-s=full]   { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.segbtns button[aria-pressed=true][data-s=half]   { background: var(--amber-500); color: #3A2703; border-color: var(--amber-500); }
.segbtns button[aria-pressed=true][data-s=absent] { background: var(--red-600);   color: #fff; border-color: var(--red-600); }

.ot { display: flex; align-items: center; gap: 8px; }
.ot .lbl { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.ot .step {
  display: flex; align-items: center; margin-left: auto;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.ot .step button {
  min-height: 36px; min-width: 40px; padding: 0; background: var(--surface-2);
  color: var(--ink); border-radius: 0; font-size: 1.2rem;
}
.ot .step span { min-width: 54px; text-align: center; font-weight: 800; font-size: .88rem; }

/* ---------- sticky save bar ---------- */
.savebar {
  position: fixed; left: 0; right: 0; bottom: 62px; z-index: 28;
  max-width: 560px; margin: 0 auto; padding: 10px 14px;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-up);
  animation: slide-up 240ms var(--ease) both;
}

/* ---------- totals ---------- */
.totals {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.totals > div { background: var(--surface); padding: 13px 8px; text-align: center; }
.totals .v { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.totals .k { font-size: .71rem; font-weight: 700; color: var(--ink-2); margin-top: 1px; }

.statrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.statrow .k { font-size: .69rem; font-weight: 700; color: var(--ink-2); }
.statrow .v { font-weight: 800; font-size: 1rem; letter-spacing: -.02em; }

/* Paid-vs-owed bar: the whole state of a site in one glance. */
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > i {
  display: block; height: 100%; border-radius: 999px; background: var(--green-600);
  transition: width 520ms var(--ease);
}

/* ---------- key / value ---------- */
.kv { display: grid; }
.kv > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .88rem;
}
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--ink-2); }

/* ---------- ledger ---------- */
.ledger { display: grid; }
.ledger .e {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 2px; border-bottom: 1px dashed var(--line);
}
.ledger .e:last-child { border-bottom: 0; }
.ledger .dot { width: 9px; height: 9px; border-radius: 999px; margin-top: 7px; flex: none; }
.ledger .dot.work { background: var(--green-500); }
.ledger .dot.payment { background: var(--amber-500); }
.ledger .dot.absent { background: var(--red-600); }
.ledger .r { margin-left: auto; text-align: right; white-space: nowrap; }

/* ---------- forms ---------- */
label.f { display: grid; gap: 6px; font-size: .84rem; font-weight: 700; color: var(--ink-2); }
.fen { font-weight: 600; opacity: .75; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  min-height: var(--tap); padding: 0 13px; width: 100%;
  transition: border-color var(--quick), box-shadow var(--quick);
}
textarea { padding: 10px 13px; min-height: 70px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green-600);
  box-shadow: 0 0 0 3px var(--green-100);
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* Rate-change scope: two options that must not be skimmed, because one of
   them rewrites wage history. */
.scope { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.scope legend { padding: 0 0 6px; font-size: .84rem; font-weight: 700; color: var(--ink-2); }
.scope label {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
}
.scope label:has(input:checked) { border-color: var(--green-700); background: var(--green-100); }
.scope input { width: auto; min-height: auto; margin: 3px 0 0; flex: none; accent-color: var(--green-700); }
.scope b { display: block; font-size: .9rem; }
.scope em { display: block; font-style: normal; font-size: .78rem; color: var(--ink-2); margin-top: 2px; }

/* ---------- bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
/* display:flex above beats [hidden]'s display:none — say it explicitly, or the
   empty sheet stays a full-screen overlay that eats every tap. */
.sheet[hidden], .toast[hidden] { display: none; }
.sheet .scrim {
  position: absolute; inset: 0; background: rgba(6, 20, 16, .55);
  backdrop-filter: blur(2px); animation: fade-in 200ms var(--ease) both;
}
.sheet .panel {
  position: relative; width: 100%; max-width: 560px; background: var(--bg);
  border-radius: 22px 22px 0 0; padding: 8px 14px calc(16px + env(safe-area-inset-bottom));
  max-height: 90dvh; overflow-y: auto; animation: slide-up 240ms var(--ease);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
}
/* Grab handle: says "this drawer came from the bottom" without a word. */
.sheet .panel::before {
  content: ''; display: block; width: 40px; height: 4px; border-radius: 999px;
  background: var(--line); margin: 6px auto 12px;
}
.sheet h3 { margin-bottom: 12px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 132px; translate: -50% 0; z-index: 80;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .9rem; max-width: 90vw; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  animation: slide-up 220ms var(--ease);
}
.toast.bad { background: var(--red-600); color: #fff; }

/* ---------- success burst after a save ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(8, 64, 47, .28); backdrop-filter: blur(1px);
  animation: fade-in 140ms var(--ease);
  pointer-events: none;
}
.celebrate .disc {
  width: 108px; height: 108px; border-radius: 999px; background: var(--green-700);
  display: grid; place-items: center; box-shadow: 0 12px 36px rgba(0, 0, 0, .32);
  animation: burst 380ms var(--ease) both;
}
.celebrate svg { width: 54px; height: 54px; }
.celebrate path {
  fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 60; animation: tick 320ms var(--ease) 140ms both;
}

/* ---------- skeletons ---------- */
.skel { display: grid; gap: 12px; }
.skel .bar {
  height: 76px; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  animation: sheen 1.1s linear infinite;
}
.skel .bar:nth-child(2) { opacity: .75; }
.skel .bar:nth-child(3) { opacity: .5; }
.loading { text-align: center; padding: 26px; color: var(--ink-2); font-size: .9rem; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 36px 18px; color: var(--ink-2); }
.empty .big {
  font-size: 2.6rem; line-height: 1;
  display: grid; place-items: center; width: 84px; height: 84px;
  margin: 0 auto 10px; border-radius: 999px; background: var(--surface-2);
}
.empty h3 { margin: 8px 0 4px; color: var(--ink); font-size: 1.05rem; }

/* ---------- login / onboarding ---------- */
.login { padding: 24px 18px; display: grid; gap: 14px; place-content: center; min-height: 100dvh; }
.login img { width: 200px; margin: 0 auto; animation: pop-in 320ms var(--ease) both; }
.login .card, .login > .tiny, .login > .btn { width: min(100%, 420px); margin-inline: auto; }
.login.wide .card { width: min(100%, 520px); }
.login .btn.narrow { width: min(100%, 420px); }
.login a { color: var(--green-700); font-weight: 700; }
@media (prefers-color-scheme: dark) { .login a { color: var(--green-300); } }

.phonein {
  display: flex; align-items: stretch; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); overflow: hidden;
  transition: border-color var(--quick), box-shadow var(--quick);
}
.phonein span {
  padding: 0 12px; font-weight: 800; color: var(--ink-2);
  border-right: 1.5px solid var(--line); display: flex; align-items: center;
  background: var(--surface-2);
}
.phonein input { border: 0; border-radius: 0; letter-spacing: 1px; font-weight: 700; }
.phonein input:focus { box-shadow: none; }
.phonein:focus-within { border-color: var(--green-600); box-shadow: 0 0 0 3px var(--green-100); }

.otpbox {
  text-align: center; font-size: 1.6rem; font-weight: 800;
  letter-spacing: 12px; padding: 0; text-indent: 12px;
}
.otphint { background: var(--amber-100); color: var(--amber-600); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .85rem; text-align: center; font-weight: 700; }
.loginerr {
  background: var(--red-100); color: var(--red-600); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: .87rem; font-weight: 600; text-align: center;
  width: min(100%, 420px); margin-inline: auto;
  animation: pop-in 200ms var(--ease) both;
}

/* "OTP nahi aaya?" — the honest bit of the login screen. */
.otphelp {
  width: min(100%, 420px); margin-inline: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: .82rem;
  animation: rise-in 240ms var(--ease) both;
}
.otphelp b { display: block; margin-bottom: 6px; }
.otphelp ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.otphelp li { margin: 3px 0; }
.waitnote { text-align: center; font-size: .8rem; color: var(--ink-2); }
.waitnote .dots::after {
  content: '…'; display: inline-block; width: 1em; text-align: left;
  animation: fade-in 900ms steps(4) infinite alternate;
}

.langbar { display: flex; gap: 6px; justify-content: center; width: min(100%, 420px); margin-inline: auto; }
.langbar .lang {
  flex: 1; min-height: 40px; padding: 0 8px; font-size: .85rem; font-weight: 700;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2);
}
.langbar .lang.on { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.card .langbar { width: 100%; }

.steps { display: flex; gap: 6px; justify-content: center; }
.steps span { width: 26px; height: 4px; border-radius: 999px; background: var(--line); transition: all 260ms var(--ease); }
.steps span.on { background: var(--green-700); width: 42px; }
.steps span.done { background: var(--green-500); }

.rolecards { display: grid; gap: 10px; }
.rolecard {
  display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto auto;
  gap: 0 12px; text-align: left; padding: 13px; min-height: 0;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); box-shadow: var(--shadow-1);
}
/* Fixed box: an emoji that falls back to a wider glyph must not push the text. */
.rolecard .ic {
  grid-row: 1 / 4; font-size: 1.8rem; align-self: center;
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 999px; background: var(--surface-2);
  overflow: hidden; white-space: nowrap;
}
.rolecard b { font-size: 1.08rem; }
.rolecard .en { font-size: .78rem; }
.rolecard.on {
  border-color: var(--green-700); background: var(--green-100);
  box-shadow: 0 0 0 3px var(--green-100), var(--shadow-1);
}
.rolecard.on .ic { background: var(--green-700); }

.tradegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 8px; }
.tradegrid.small { max-height: 258px; overflow-y: auto; padding: 2px; }
.tradechip {
  display: grid; gap: 1px; place-items: center; text-align: center; padding: 10px 4px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); font-size: .8rem; font-weight: 700; min-height: 76px; cursor: pointer;
  position: relative;
}
.tradechip .ic { font-size: 1.45rem; line-height: 1.1; }
.tradechip .en { font-size: .64rem; font-weight: 600; }
.tradechip.on, .tradechip:has(input:checked) {
  border-color: var(--green-700); background: var(--green-100);
  animation: pop-in 180ms var(--ease);
}
.tradechip.on::after, .tradechip:has(input:checked)::after {
  content: '✓'; position: absolute; top: 4px; right: 6px;
  font-size: .74rem; color: var(--green-700); font-weight: 800;
}
.tradechip input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.placebox { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .86rem; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: .8rem; font-weight: 600; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- switches ---------- */
.switch { display: flex; align-items: center; gap: 12px; font-size: .87rem; cursor: pointer; }
.switch input { width: 46px; min-height: 26px; height: 26px; flex: none; margin: 0; accent-color: var(--green-700); }
.switch.big { font-size: .95rem; }
.switch span { flex: 1; }

/* ---------- discovery ---------- */
.locbar .hi { font-size: 1rem; }
.tradefilter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.tchip {
  flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: .8rem;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 700;
}
.tchip.on { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.tradelist { display: flex; flex-wrap: wrap; gap: 5px; }

/* Firebase parks the invisible reCAPTCHA badge here. */
#recaptcha-holder { display: flex; justify-content: center; }

/* ---------- narrow phones ---------- */
@media (max-width: 380px) {
  .wrap { padding: 12px 10px; }
  .card { padding: 12px; }
  .segs { padding: 8px 10px 0; gap: 4px; }
  .segs a { font-size: .84rem; padding: 9px 4px; }
  .totals .v { font-size: 1.06rem; }
  .statrow .v { font-size: .92rem; }
  .fab { padding: 0 18px; min-height: 50px; font-size: .92rem; }
  .tabbar a { font-size: .67rem; }
  .langbar .lang { font-size: .8rem; padding: 0 4px; }
  .who { width: 36px; height: 36px; font-size: .85rem; }
  .otpbox { font-size: 1.4rem; letter-spacing: 9px; text-indent: 9px; }
}
