/* Jai Platform design system v1 — plain CSS, no build step.
   Tokens -> base -> layout -> components. Used by every page. */
:root {
  --ink: #16162a; --ink-2: #4a4e69; --ink-3: #7a7e95;
  --bg: #f6f4ef; --surface: #ffffff; --surface-2: #faf8f4; --line: #e4e0d6; --line-2: #cfc9ba;
  --brand: #26307a; --brand-2: #1b2360; --brand-soft: #e8eaf8;
  --accent: #d9731a; --accent-2: #b85d0e; --accent-soft: #fdeedd;
  --ok: #17794a; --ok-soft: #dff4e8; --warn: #9a6200; --warn-soft: #fff1cf; --bad: #b3261e; --bad-soft: #fde5e3;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(22,22,42,.06), 0 2px 8px rgba(22,22,42,.04);
  --shadow-2: 0 10px 30px rgba(22,22,42,.12);
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Devanagari", Roboto, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* legacy aliases so older pages keep working */
  --card: var(--surface); --text: var(--ink); --muted: var(--ink-2); --border: var(--line-2);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--s2); letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 800; }
h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 750; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 var(--s3); }
a { color: var(--brand); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); } .small { font-size: 13px; }

/* ---- Layout ---- */
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row-flex { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
@media (max-width: 720px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---- Top bar ---- */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-block: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: grid; place-items: center; color: #fff; font-size: 17px; }
.brand small { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.nav { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

/* ---- Buttons ---- */
.btn, button.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 14px var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.brand:hover { background: var(--brand-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }

/* ---- Cards, badges ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); box-shadow: var(--shadow-1); }
.card.flat { box-shadow: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field input, .field select, .field textarea, input.input, select.input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; color: var(--ink); font: 400 16px var(--font); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand-soft); }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; font-weight: 400; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.alert { padding: 10px 14px; border-radius: var(--r-sm); font-size: 14px; background: var(--brand-soft); color: var(--brand-2); }
.alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.ok { background: var(--ok-soft); color: var(--ok); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px; gap: 4px; }
.seg button { min-height: 40px; border: 0; border-radius: 6px; background: transparent; font: 700 14px var(--font); color: var(--ink-2); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-1); }

/* ---- Toasts & modal ---- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100% - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); font-size: 14px; animation: toast-in .2s ease-out; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(22,22,42,.6); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--r-lg); padding: var(--s5); width: min(520px, 100%); max-height: 88vh; overflow: auto; box-shadow: var(--shadow-2); }

/* ---- Landing ---- */
.hero { padding-block: clamp(32px, 7vw, 80px); display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--s6); align-items: center; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero p.lead { font-size: 18px; color: var(--ink-2); max-width: 56ch; }
.hero-art { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-2); border: 1px solid var(--line); background: var(--ink); }
.hero-art img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.product { display: flex; flex-direction: column; gap: var(--s2); }
.product .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--brand-soft); }
.section { padding-block: var(--s6); }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); padding: 0; margin: 0; }
.steps li { list-style: none; counter-increment: s; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 8px; }
.pro-card { display: flex; flex-direction: column; gap: var(--s2); }
.fee { font-weight: 800; background: var(--accent-soft); color: var(--accent-2); padding: 3px 10px; border-radius: 999px; }
.footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: var(--s5); margin-top: var(--s7); font-size: 13px; color: var(--ink-2); }
.footer a { color: var(--ink-2); margin-right: var(--s3); }

/* ---- Auth ---- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, var(--brand-2), var(--brand) 55%, #5a3a82); color: #fff; padding: var(--s7); display: flex; flex-direction: column; justify-content: center; gap: var(--s4); }
.auth-side h2 { font-size: 32px; } .auth-side li { margin-bottom: 10px; }
.auth-main { display: grid; place-items: center; padding: var(--s5); }
.auth-card { width: min(440px, 100%); }
@media (max-width: 860px) { .auth-shell { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---- Prose (legal) ---- */
.prose { max-width: 760px; margin: var(--s6) auto; }
.prose h2 { font-size: 19px; margin-top: var(--s5); color: var(--brand); }
.prose p, .prose li { color: var(--ink-2); }

/* ---- Tables / stats ---- */
.stat { font-size: 28px; font-weight: 800; color: var(--brand); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.tbl th, .tbl td { padding: 10px; border-bottom: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.idbox-sm { font: 800 24px ui-monospace, Consolas, monospace; letter-spacing: .3em; text-align: center; min-height: 52px; border: 2px solid var(--brand); border-radius: var(--r-sm); padding: 6px; width: 100%; background: #fff; }

/* ---- phones ---- */
/* a grid column of "1fr" can grow wider than the screen when something inside is wide; minmax(0,1fr) cannot */
.stack > *, .grid-2 > *, .grid-auto > *, .hub-grid > *, .book-grid > * { min-width: 0; }
a.small { display: inline-block; padding: 10px 0; }
@media (max-width: 480px) {
  body { font-size: 15px; }
  .wrap { width: calc(100% - 24px); }
  .card { padding: 14px; }
  .topbar .wrap { padding-block: 8px; }
  .nav { width: 100%; }
  .nav .btn { flex: 1 1 auto; }
  h1 { font-size: 28px; }
  .modal { padding: 16px; }
  .toast { font-size: 13px; }
}
@media (pointer: coarse) { .btn.sm { min-height: 40px; } .seg button { min-height: 44px; } }

@media (max-width: 480px) { .hide-sm { display: none; } .nav { flex-wrap: nowrap; } .nav .btn { padding-inline: 10px; min-width: 0; } }
