:root {
  /* ===== SC Morcha Registry — design tokens =====
     Change values here, never in components. Documented in the "SC Morcha Registry" Design System. */

  /* Brand */
  --saffron: #e8650a;        /* primary actions, active states, highlights */
  --saffron-d: #c4520a;      /* fills that carry white text (primary buttons, selected chips, current nav); saffron text on light */
  --saffron-dd: #a84508;     /* hover / pressed of saffron-d fills */
  --saffron-l: #fff3ea;      /* tinted backgrounds, step numbers */
  --saffron-2: #f08a2c;      /* gradient mid stop */
  --saffron-3: #f5a34f;      /* gradient end, accent text on dark */
  --saffron-border: #f6cfae; /* borders of saffron-tinted boxes */
  --green: #12823b;          /* success, approve, flag stripe */
  --green-l: #e9f7ee;
  --green-border: #bfe5cc;

  /* Neutrals */
  --ink: #1f2430;   --ink-2: #4b5363;   --ink-3: #6b7180;   /* text: primary / secondary / muted */
  --white: #fff;
  --bg: #f6f7f9;            /* page */
  --card: #fff;             /* cards, sheets */
  --surface-2: #fafbfc;     /* table headers, drop zones */
  --surface-3: #f2f4f7;     /* subtle fills, tracks, neutral badges */
  --surface-4: #eef0f3;     /* inactive pills / steps */
  --line: #e4e7ec;          /* default borders */
  --line-2: #f0f2f5;        /* row dividers */
  --border-input: #909499;  /* inputs, chips, dashed outlines */
  --hover: #fffaf6;         /* row hover */
  --switch-off: #d0d5dd;
  --saffron-4: #f5b68a;     /* chart bars (light) */
  --nav-badge: rgba(255,255,255,.13);
  --overlay: rgba(15,18,26,.5);

  /* Dark chrome (sidebar, mobile bar, toasts) */
  --nav-bg: #1b1f2a; --nav-bg-2: #262b39; --nav-line: #2c3242; --nav-text: #c9cfdb; --nav-muted: #9aa3b5; --nav-faint: #9aa3b5;

  /* Status */
  --red: #c62828;   --red-l: #fdecec;   --red-border: #f4c7c7;  --red-border-2: #f1b0b0; --red-tint: #fffafa; --red-cell: #fff6f6;
  --amber: #9b661a; --amber-l: #fdf6e3; --amber-border: #f3e2b6; --amber-ink: #7a5410;
  --blue: #1d5fd1;  --blue-l: #eaf1fd;
  --green-ink: #0d5e2b; --red-ink: #8e1c1c;

  /* Typography */
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans Gujarati", "Shruti", Roboto, sans-serif;
  --fs-3xs: 10px; --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-base: 15px;
  --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 20px; --fs-3xl: 22px; --fs-4xl: 26px; --fs-display: 34px;
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700; --fw-black: 800;
  --lh-tight: 1.25; --lh-base: 1.45;

  /* Spacing (4px grid, with 2px half-steps for fine tuning) */
  --sp-0: 2px; --sp-1: 4px; --sp-1h: 6px; --sp-2: 8px; --sp-2h: 10px; --sp-3: 12px; --sp-3h: 14px; --sp-4: 16px;
  --sp-4h: 18px; --sp-5: 20px; --sp-5h: 22px; --sp-6: 24px; --sp-7: 28px; --sp-8: 32px; --sp-10: 40px; --sp-15: 60px; --sp-20: 80px;
  --sp-bottom-bar: 90px;     /* room under content for sticky bottom bars on phones */

  /* Radius */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --r-xl: 12px; --r-2xl: 16px; --r-pill: 99px; --r-round: 50%;
  --radius: var(--r-lg);

  /* Elevation */
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.08);   /* cards */
  --shadow-up: 0 -6px 16px rgba(0,0,0,.06);                                /* sticky bottom bars */
  --shadow-float: 0 8px 24px rgba(0,0,0,.25);                              /* floating bars */
  --shadow-toast: 0 8px 30px rgba(0,0,0,.25);
  --shadow-modal: 0 20px 60px rgba(0,0,0,.25);
  --shadow-drawer: 0 0 40px rgba(0,0,0,.35);
  --shadow-knob: 0 1px 2px rgba(0,0,0,.2);

  /* Focus & motion */
  --focus-ring: 0 0 0 3px rgba(232,101,10,.15);
  --focus-outline: 3px solid rgba(232,101,10,.45);
  --dur-fast: .15s; --dur-med: .22s; --ease: ease;

  /* Layers */
  --z-sticky: 20; --z-bar: 30; --z-appbar: 40; --z-modal: 50; --z-drawer-bg: 55; --z-drawer: 60; --z-toast: 99;

  /* Touch */
  --tap: 44px;

  font-family: var(--font);
  color: var(--ink); font-size: var(--fs-base);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--saffron-d); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
.gu { color: var(--ink-3); font-weight: var(--fw-regular); font-size: .9em; margin-left: .25em; }
.muted { color: var(--ink-3); } .small { font-size: var(--fs-sm); } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: var(--sp-1h); border: 1px solid var(--line); background: var(--white); color: var(--ink);
  padding: var(--sp-2) var(--sp-3h); border-radius: var(--r-md); font: inherit; font-weight: var(--fw-semibold); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--saffron-d); border-color: var(--saffron-d); color: var(--white); }
.btn.primary:hover { background: var(--saffron-dd); border-color: var(--saffron-dd); }
.btn.green { background: var(--green); border-color: var(--green); color: var(--white); }
.btn.danger { color: var(--red); border-color: var(--red-border); }
.btn.danger.solid { background: var(--red); color: var(--white); border-color: var(--red); }
.btn.sm { padding: var(--sp-1h) var(--sp-2h); font-size: var(--fs-sm); } .btn.lg { padding: var(--sp-3) var(--sp-5h); font-size: var(--fs-lg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.link { border: 0; background: none; padding: 0; color: var(--saffron-d); }

label.f { display: block; font-weight: var(--fw-semibold); font-size: var(--fs-md); margin-bottom: var(--sp-1h); color: var(--ink-2); }
label.f .req { color: var(--red); margin-left: var(--sp-0); }
input, select, textarea { width: 100%; font: inherit; padding: var(--sp-2h) var(--sp-3); border: 1px solid var(--border-input); border-radius: var(--r-md); background: var(--white); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--saffron); box-shadow: var(--focus-ring); }
input[type=checkbox], input[type=radio] { width: auto; }
.field { margin-bottom: var(--sp-3h); }
.field.err input, .field.err select, .field.err textarea { border-color: var(--red); background: var(--red-tint); }
.field .msg { color: var(--red); font-size: var(--fs-xs); margin-top: var(--sp-1); min-height: 0; }
.field .hint { color: var(--ink-3); font-size: var(--fs-xs); margin-top: var(--sp-1); }
.grid { display: grid; gap: 0 var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.c2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.span2 { grid-column: span 2; } @media (max-width: 560px) { .span2 { grid-column: auto; } }

/* ---------- public site ---------- */
.topbar { background: linear-gradient(90deg, var(--saffron) 0%, var(--saffron-2) 60%, var(--saffron-3) 100%); color: var(--white); }
.topbar .in { max-width: 980px; margin: 0 auto; padding: var(--sp-4h) var(--sp-5); display: flex; align-items: center; gap: var(--sp-3h); }
.topbar .logo { width: 52px; height: 52px; border-radius: var(--r-round); background: var(--white); display: grid; place-items: center; overflow: hidden; flex: none; }
.topbar .logo img { width: 100%; height: 100%; object-fit: contain; }
.topbar .logo span { color: var(--saffron); font-weight: var(--fw-black); font-size: var(--fs-xl); }
.topbar h1 { font-size: var(--fs-2xl); margin: 0; } .topbar .sub { opacity: .92; font-size: var(--fs-md); }
.stripe { height: 4px; background: linear-gradient(90deg, var(--saffron) 0 33%, var(--white) 33% 66%, var(--green) 66%); }
.wrap { max-width: 980px; margin: 0 auto; padding: var(--sp-5h) var(--sp-5) var(--sp-15); }
.tabs { display: flex; gap: var(--sp-1); margin-bottom: var(--sp-4h); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: var(--sp-2h) var(--sp-4); font: inherit; font-weight: var(--fw-semibold); color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--saffron-d); border-bottom-color: var(--saffron); }
.login-link { text-align: right; font-size: var(--fs-md); color: var(--ink-3); margin: 0 0 var(--sp-2); }
.login-link a { color: var(--saffron-d); font-weight: var(--fw-semibold); text-decoration: none; white-space: nowrap; }
.login-link a:hover { text-decoration: underline; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--sp-5) var(--sp-5h); margin-bottom: var(--sp-4h); }
.sec-title { display: flex; align-items: center; gap: var(--sp-2h); font-size: var(--fs-lg); font-weight: var(--fw-bold); margin: 0 0 var(--sp-3h); }
.sec-title .n { width: 26px; height: 26px; border-radius: var(--r-round); background: var(--saffron-l); color: var(--saffron-d); display: grid; place-items: center; font-size: var(--fs-sm); flex: none; }
.sec-title .opt { margin-left: auto; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--ink-3); background: var(--surface-3); padding: var(--sp-0) var(--sp-2); border-radius: var(--r-pill); }
.notice { padding: var(--sp-3) var(--sp-3h); border-radius: var(--r-md); background: var(--amber-l); color: var(--amber-ink); border: 1px solid var(--amber-border); margin-bottom: var(--sp-4); }
.notice.ok { background: var(--green-l); color: var(--green-ink); border-color: var(--green-border); }
.notice.bad { background: var(--red-l); color: var(--red-ink); border-color: var(--red-border); }
.success-box { text-align: center; padding: var(--sp-8) var(--sp-5); }
.success-box .tick { width: 64px; height: 64px; border-radius: var(--r-round); background: var(--green-l); color: var(--green); display: grid; place-items: center; font-size: var(--fs-display); margin: 0 auto var(--sp-3); }
.title-badge { display: inline-block; background: var(--saffron-l); color: var(--saffron-d); border: 1px solid var(--saffron-border); border-radius: var(--r-lg); padding: var(--sp-2h) var(--sp-4); margin: 0 0 var(--sp-3h); font-size: var(--fs-lg); line-height: 1.45; }
.title-badge b { color: var(--ink); }
.regno { font-size: var(--fs-4xl); font-weight: var(--fw-black); letter-spacing: .5px; color: var(--saffron-d); margin: var(--sp-1h) 0 var(--sp-3h); }
.photo-pick { display: flex; gap: var(--sp-3h); align-items: center; }
.photo-pick .pv { width: 84px; height: 100px; border-radius: var(--r-md); border: 1px dashed var(--border-input); background: var(--surface-2) center/cover no-repeat; display: grid; place-items: center; color: var(--ink-3); font-size: var(--fs-xs); text-align: center; flex: none; }
.consent { display: flex; gap: var(--sp-2h); align-items: flex-start; font-size: var(--fs-md); color: var(--ink-2); }
.consent input { margin-top: var(--sp-1); }
.footer { text-align: center; color: var(--ink-3); font-size: var(--fs-sm); padding: var(--sp-5); }
.age-tag { font-size: var(--fs-xs); color: var(--green); font-weight: var(--fw-semibold); margin-top: var(--sp-1); }

/* ---------- admin ---------- */
.adm { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--nav-bg); color: var(--nav-text); padding: var(--sp-4) var(--sp-3); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: var(--white); font-weight: var(--fw-bold); padding: var(--sp-1) var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--nav-line); margin-bottom: var(--sp-2h); }
.side .brand small { display: block; color: var(--saffron-3); font-weight: var(--fw-semibold); font-size: var(--fs-xs); }
.side a { display: flex; align-items: center; gap: var(--sp-2h); color: var(--nav-text); text-decoration: none; padding: var(--sp-2h) var(--sp-2h); border-radius: var(--r-md); font-weight: var(--fw-medium); font-size: var(--fs-md); }
.side a:hover { background: var(--nav-bg-2); color: var(--white); }
.side a.on { background: var(--saffron-d); color: var(--white); }
.side .grp { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--nav-muted); padding: var(--sp-3h) var(--sp-2h) var(--sp-1h); }
.side .badge-n { margin-left: auto; background: var(--nav-badge); color: var(--white); font-size: var(--fs-2xs); padding: var(--sp-0) var(--sp-2); border-radius: var(--r-pill); }
.main { padding: var(--sp-5h) var(--sp-7) var(--sp-15); min-width: 0; }
.ph { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4h); flex-wrap: wrap; }
.ph h2 { margin: 0; font-size: var(--fs-3xl); } .ph .sp { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-3h); margin-bottom: var(--sp-4h); }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3h) var(--sp-4); box-shadow: var(--shadow); cursor: default; }
.kpi .v { font-size: var(--fs-4xl); font-weight: var(--fw-black); } .kpi .l { color: var(--ink-3); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.kpi.click { cursor: pointer; } .kpi.click:hover { border-color: var(--saffron); }
.kpi.s .v { color: var(--saffron-d); } .kpi.g .v { color: var(--green); } .kpi.a .v { color: var(--amber); } .kpi.r .v { color: var(--red); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--sp-4h); }
.bars .row { display: grid; grid-template-columns: 150px 1fr 44px; gap: var(--sp-2h); align-items: center; margin: var(--sp-2) 0; font-size: var(--fs-sm); }
.bars .row .lb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bars .row .tr { background: var(--surface-3); border-radius: var(--r-xs); height: 12px; overflow: hidden; }
.bars .row .tr i { display: block; height: 100%; background: var(--saffron); border-radius: var(--r-xs); }
.bars .row .vv { text-align: right; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: var(--sp-1); height: 90px; padding-top: var(--sp-1h); }
.spark i { flex: 1; background: var(--saffron-4); border-radius: var(--r-xs) var(--r-xs) 0 0; min-height: 2px; position: relative; }
.spark i:hover { background: var(--saffron); }

.toolbar { display: flex; gap: var(--sp-2h); flex-wrap: wrap; align-items: center; margin-bottom: var(--sp-3); }
.toolbar input, .toolbar select { width: auto; min-width: 150px; padding: var(--sp-2) var(--sp-2h); font-size: var(--fs-md); }
.toolbar .search { min-width: 260px; flex: 1; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-2h); margin-bottom: var(--sp-3); }
.filters select, .filters input { padding: var(--sp-2) var(--sp-2h); font-size: var(--fs-md); }
table.t { width: 100%; border-collapse: collapse; background: var(--white); font-size: var(--fs-md); }
.tw { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
table.t th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--surface-2); padding: var(--sp-2h) var(--sp-3); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: var(--sp-2h) var(--sp-3); border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:hover td { background: var(--hover); }
table.t tr.clk { cursor: pointer; }
table.t .nm { font-weight: var(--fw-semibold); } table.t .sub { color: var(--ink-3); font-size: var(--fs-xs); }
.pill { display: inline-block; padding: var(--sp-0) var(--sp-2h); border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: capitalize; }
.pill.pending { background: var(--amber-l); color: var(--amber); } .pill.approved { background: var(--green-l); color: var(--green); }
.pill.rejected { background: var(--red-l); color: var(--red); } .pill.inactive { background: var(--surface-4); color: var(--ink-3); }
.pill.src { background: var(--blue-l); color: var(--blue); text-transform: none; font-weight: var(--fw-semibold); }
.pager { display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-end; padding: var(--sp-3) 0; font-size: var(--fs-md); color: var(--ink-3); }
.bulkbar { display: flex; gap: var(--sp-2); align-items: center; background: var(--nav-bg); color: var(--white); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); margin-bottom: var(--sp-2h); }
.empty { padding: var(--sp-10); text-align: center; color: var(--ink-3); }

.modal-bg { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: var(--sp-8) var(--sp-4); z-index: var(--z-modal); overflow-y: auto; }
.modal { background: var(--white); border-radius: var(--r-xl); width: 100%; max-width: 900px; box-shadow: var(--shadow-modal); }
.modal.sm { max-width: 460px; } .modal.md { max-width: 640px; }
.modal .mh { display: flex; align-items: center; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); gap: var(--sp-2h); }
.modal .mh h3 { margin: 0; font-size: var(--fs-xl); flex: 1; }
.modal .mb { padding: var(--sp-4h) var(--sp-5); } .modal .mf { padding: var(--sp-3h) var(--sp-5); border-top: 1px solid var(--line); display: flex; gap: var(--sp-2h); justify-content: flex-end; flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-3); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--nav-bg); color: var(--white); padding: var(--sp-3) var(--sp-4h); border-radius: var(--r-md); z-index: var(--z-toast); box-shadow: var(--shadow-toast); font-weight: var(--fw-medium); }
.toast.bad { background: var(--red); }

.detail { display: grid; grid-template-columns: 130px 1fr; gap: var(--sp-5); }
.detail .ph-big { width: 130px; height: 160px; border-radius: var(--r-lg); background: var(--surface-3) center/cover no-repeat; display: grid; place-items: center; color: var(--ink-3); font-size: var(--fs-display); font-weight: var(--fw-bold); }
dl.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--sp-3) var(--sp-4h); margin: 0; }
dl.kv div { min-width: 0; } dl.kv dt { font-size: var(--fs-xs); color: var(--ink-3); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .03em; }
dl.kv dd { margin: var(--sp-0) 0 0; font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.subhead { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--saffron-d); text-transform: uppercase; letter-spacing: .05em; margin: var(--sp-4h) 0 var(--sp-2h); border-bottom: 1px solid var(--line); padding-bottom: var(--sp-1h); }
.hist { font-size: var(--fs-sm); color: var(--ink-2); } .hist div { padding: var(--sp-1h) 0; border-bottom: 1px dashed var(--line-2); }

.matrix td.c { text-align: center; } .matrix .vac { color: var(--red); font-weight: var(--fw-bold); background: var(--red-cell); }
.matrix .holder { display: block; font-size: var(--fs-xs); white-space: nowrap; } .matrix .holder.pending { color: var(--amber); }
.dropzone { border: 2px dashed var(--border-input); border-radius: var(--r-xl); padding: var(--sp-8); text-align: center; background: var(--surface-2); cursor: pointer; }
.dropzone.over { border-color: var(--saffron); background: var(--saffron-l); }
.steps { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.steps span { padding: var(--sp-1h) var(--sp-3); border-radius: var(--r-pill); background: var(--surface-4); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--ink-3); }
.steps span.on { background: var(--saffron-d); color: var(--white); }

.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--saffron-l), var(--bg) 60%, var(--green-l)); padding: var(--sp-5); }
.login .card { width: 100%; max-width: 380px; }

/* ---------- ID card ---------- */
.idcards { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.idc { width: 86mm; height: 54mm; border-radius: 3mm; overflow: hidden; background: #fff; border: 1px solid #ddd; position: relative; font-size: 9pt; color: #222; display: flex; flex-direction: column; }
.idc .hd { background: linear-gradient(90deg, var(--saffron), #f5a34f); color: #fff; padding: 2mm 3mm; display: flex; gap: 2mm; align-items: center; }
.idc .hd b { font-size: 8.5pt; line-height: 1.15; display: block; } .idc .hd small { font-size: 6.5pt; opacity: .95; }
.idc .hd .lg { width: 8mm; height: 8mm; border-radius: 50%; background: #fff; flex: none; overflow: hidden; display: grid; place-items: center; color: var(--saffron); font-weight: 800; font-size: 7pt; }
.idc .hd .lg img { width: 100%; height: 100%; object-fit: contain; }
.idc .bd { display: flex; gap: 3mm; padding: 2.5mm 3mm; flex: 1; }
.idc .pic { width: 20mm; height: 25mm; border-radius: 1.5mm; background: #eee center/cover no-repeat; flex: none; border: 1px solid #ddd; }
.idc .inf { flex: 1; min-width: 0; line-height: 1.3; }
.idc .inf .n { font-size: 10.5pt; font-weight: 800; color: #111; }
.idc .inf .d { color: var(--saffron-d); font-weight: 700; font-size: 9pt; }
.idc .inf .u { font-size: 7.5pt; color: #444; } .idc .inf .r { font-size: 7.5pt; margin-top: 1.2mm; font-weight: 700; }
.idc .qr { width: 17mm; height: 17mm; flex: none; align-self: flex-end; }
.idc .ft { height: 2.2mm; background: linear-gradient(90deg, var(--saffron) 0 50%, var(--green) 50%); }

@media print {
  body { background: var(--white); } .wrap { padding: 0; } .card { border: 0; box-shadow: none; } .no-print, .side, .mbar, .drawer-bg, .ph, .modal .mh, .modal .mf { display: none !important; }
  .modal-bg { position: static; background: none; padding: 0; } .modal { box-shadow: none; max-width: none; }
  .idc { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .adm { display: block; } .main { padding: 0; }
}
.toolbar input[type=checkbox] { min-width: 0; width: auto; }

/* ---------- simplified form: chips, date boxes, steps, optional panel ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { border: 1px solid var(--border-input); background: var(--white); border-radius: var(--r-pill); padding: var(--sp-2h) var(--sp-4); font: inherit; font-size: var(--fs-md); cursor: pointer; color: var(--ink); line-height: 1.2; }
.chip:hover { border-color: var(--saffron); }
.chip.on { background: var(--saffron-d); border-color: var(--saffron-d); color: var(--white); font-weight: var(--fw-semibold); }
.field.err .chips .chip { border-color: var(--red-border-2); }
.dob3 { display: grid; grid-template-columns: 74px 1fr 96px; gap: var(--sp-2); max-width: 360px; }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.stepper .st { cursor: default; } .stepper .st.done { cursor: pointer; }
.stepper .st i { display: block; height: 6px; border-radius: var(--r-xs); background: var(--line); margin-bottom: var(--sp-1h); }
.stepper .st span { font-size: var(--fs-xs); color: var(--ink-3); font-weight: var(--fw-semibold); }
.stepper .st.on i, .stepper .st.done i { background: var(--saffron); }
.stepper .st.on span { color: var(--saffron-d); }
.stepnav { display: flex; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-1) 0 var(--sp-4h); }
.stepnav .btn { min-width: 140px; justify-content: center; }
details.more > summary { list-style: none; cursor: pointer; font-weight: var(--fw-bold); font-size: var(--fs-lg); display: block; position: relative; padding-right: var(--sp-20); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .plus { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-round); background: var(--saffron-l); color: var(--saffron-d); margin-right: var(--sp-2); font-size: var(--fs-base); }
details.more > summary .opt { position: absolute; right: 0; top: 2px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--ink-3); background: var(--surface-3); padding: var(--sp-0) var(--sp-2); border-radius: var(--r-pill); }
details.more[open] > summary .plus { transform: rotate(45deg); }
.rv { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-3h); margin-bottom: var(--sp-3); }
.rvh { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-2); }

/* =====================================================================
   RESPONSIVE LAYER — phones (280px folds → large phones), tablets, desktops
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, svg, canvas { max-width: 100%; }
.grid > *, .cols > *, .kpis > *, .filters > * { min-width: 0; }
dd, td, .nm { overflow-wrap: break-word; } dd { overflow-wrap: anywhere; } .pill { white-space: nowrap; }
:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* mobile app bar + drawer (admin & hosted registry) */
.mbar { display: none; }
.mobile-only { display: none !important; }
.drawer-bg { display: none; }
.main { max-width: 1500px; width: 100%; }

/* bigger touch targets on touch screens */
@media (pointer: coarse) {
  .btn { min-height: 44px; } .btn.sm { min-height: 38px; padding: var(--sp-2) var(--sp-3); }
  .chip { min-height: 44px; padding: var(--sp-2h) var(--sp-4); }
  input, select { min-height: 46px; } input[type=checkbox], input[type=radio] { min-height: 0; width: 22px; height: 22px; }
  .tabs button { padding: var(--sp-3) var(--sp-4); } .side a { padding: var(--sp-3) var(--sp-3); }
  .x { font-size: 30px; padding: var(--sp-1) var(--sp-2); }
}

/* ---------- tablets & small laptops ---------- */
@media (max-width: 1100px) {
  .adm { grid-template-columns: 210px 1fr; } .main { padding: var(--sp-5); }
  .cols { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}

/* tablets: compact tables so they fit without sideways scrolling */
@media (min-width: 701px) and (max-width: 1100px) {
  table.t th, table.t td { padding: var(--sp-2) var(--sp-2); font-size: var(--fs-sm); }
  table.t th { font-size: var(--fs-2xs); letter-spacing: .02em; }
  table.t td .sub { font-size: var(--fs-xs); }
  table.t td.nowrap.small { font-size: var(--fs-xs); } table.t { word-break: normal; }
}
@media (min-width: 701px) and (max-width: 900px) {
  table.t [data-label="Age"] { display: none; }
  table.t td input, table.t td select { min-width: 0 !important; }
}

/* ---------- phones & portrait tablets: drawer navigation ---------- */
@media (max-width: 900px) {
  .adm { display: block; }
  .mbar { display: flex; align-items: center; gap: var(--sp-2h); position: sticky; top: 0; z-index: var(--z-appbar); background: var(--nav-bg); color: var(--white);
    padding: var(--sp-2h) var(--sp-3); padding-top: max(var(--sp-2h), env(safe-area-inset-top)); padding-left: max(var(--sp-3), env(safe-area-inset-left)); padding-right: max(var(--sp-3), env(safe-area-inset-right)); }
  .mbar .hamb { background: none; border: 0; color: var(--white); font-size: 24px; line-height: 1; width: 44px; height: 44px; border-radius: var(--r-md); cursor: pointer; flex: none; }
  .mbar .hamb:active { background: var(--nav-line); }
  .mbar .ttl { flex: 1; min-width: 0; font-weight: var(--fw-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar .ttl small { display: block; font-weight: var(--fw-medium); color: var(--saffron-3); font-size: var(--fs-2xs); }
  .mbar .act { color: var(--white); text-decoration: none; background: var(--saffron-d); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); font-weight: var(--fw-bold); font-size: var(--fs-md); white-space: nowrap; }
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: min(84vw, 300px); height: auto; z-index: var(--z-drawer); transform: translateX(-105%);
    transition: transform var(--dur-med) var(--ease); box-shadow: var(--shadow-drawer); padding-top: max(var(--sp-4), env(safe-area-inset-top)); padding-bottom: max(var(--sp-4), env(safe-area-inset-bottom)); }
  .adm.nav-open .side { transform: none; }
  .adm.nav-open .drawer-bg { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-drawer-bg); }
  .main { padding: var(--sp-4) var(--sp-3h) var(--sp-bottom-bar); padding-left: max(var(--sp-3h), env(safe-area-inset-left)); padding-right: max(var(--sp-3h), env(safe-area-inset-right)); }
  .ph { gap: var(--sp-2); } .ph h2 { font-size: var(--fs-2xl); width: 100%; } .ph .sp { display: none; }
  .ph .btn { flex: 1 1 auto; justify-content: center; }
  .detail { grid-template-columns: 1fr; } .detail .ph-big { width: 110px; height: 135px; margin: 0 auto; }
}

/* ---------- phones ---------- */
@media (max-width: 700px) {
  body { font-size: var(--fs-base); }
  input, select, textarea { font-size: var(--fs-lg); } /* stops iOS zooming into fields */
  .grid, .grid.c2 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .card { padding: var(--sp-4) var(--sp-3h); border-radius: var(--r-xl); }
  .cols, .cols[style] { grid-template-columns: 1fr !important; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2h); }
  .kpi { padding: var(--sp-3); } .kpi .v { font-size: var(--fs-3xl); } .kpi .l { font-size: var(--fs-xs); }
  .bars .row { grid-template-columns: minmax(80px, 38%) 1fr 34px; gap: var(--sp-2); }
  .toolbar { gap: var(--sp-2); } .toolbar .search, .toolbar select, .toolbar input:not([type=checkbox]) { flex: 1 1 100%; min-width: 0; width: 100%; }
  .toolbar label { display: flex !important; align-items: center; gap: var(--sp-2); }
  .toolbar .btn { flex: 1 1 auto; justify-content: center; } .toolbar label { flex: 1 1 100%; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; } .tabs button { flex: none; white-space: nowrap; }
  .pager { flex-wrap: wrap; justify-content: center; gap: var(--sp-2); }
  .mobile-only { display: inline-flex !important; }
  .bulkbar { position: sticky; bottom: max(8px, env(safe-area-inset-bottom)); z-index: var(--z-bar); flex-wrap: wrap; box-shadow: var(--shadow-float); }
  .bulkbar > div[style*="flex:1"] { display: none; }
  .notice { font-size: var(--fs-md); }

  /* tables become stacked cards */
  .tw { background: none; border: 0; box-shadow: none; overflow: visible; }
  .tw[style*="max-height"] { max-height: none !important; }
  table.t:not(.matrix), table.t:not(.matrix) tbody, table.t:not(.matrix) tr, table.t:not(.matrix) td { display: block; width: 100%; }
  table.t:not(.matrix) { background: none; }
  table.t:not(.matrix) thead { display: none; }
  table.t:not(.matrix) tr { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-xl); padding: var(--sp-2h) var(--sp-3h); margin-bottom: var(--sp-2h); box-shadow: var(--shadow); position: relative; }
  table.t:not(.matrix) tr:hover td { background: none; }
  table.t:not(.matrix) td { border: 0; padding: var(--sp-1h) 0; display: grid; grid-template-columns: minmax(90px, 36%) 1fr; gap: var(--sp-2h); align-items: start; }
  table.t:not(.matrix) td::before { content: attr(data-label); font-size: var(--fs-2xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding-top: var(--sp-0); }
  table.t:not(.matrix) td > .sub { grid-column: 2; margin-top: calc(var(--sp-1h) * -1); }
  table.t:not(.matrix) td > .pill, table.t:not(.matrix) td > .btn { justify-self: start; }
  table.t:not(.matrix) td[data-label=""] { display: block; } table.t:not(.matrix) td[data-label=""]::before { display: none; }
  table.t:not(.matrix) td.selcell { position: absolute; top: 8px; right: 8px; width: auto; padding: var(--sp-1); }
  table.t:not(.matrix) td input:not([type=checkbox]), table.t:not(.matrix) td select { width: 100%; }
  table.t:not(.matrix) tfoot { display: none; }
  /* designation chart stays a grid, scrolls sideways with a sticky first column */
  .tw:has(> table.matrix) { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); }
  table.matrix td:first-child, table.matrix th:first-child { position: sticky; left: 0; background: var(--white); z-index: 2; box-shadow: 1px 0 0 var(--line); }
  table.matrix th, table.matrix td { padding: var(--sp-2) var(--sp-2h); font-size: var(--fs-sm); }

  /* dialogs become full-screen sheets */
  .modal-bg { padding: 0; align-items: stretch; }
  .modal, .modal.sm, .modal.md { max-width: none; min-height: 100%; border-radius: 0; display: flex; flex-direction: column; }
  .modal .mh { position: sticky; top: 0; background: var(--white); z-index: 2; padding-top: max(var(--sp-3h), env(safe-area-inset-top)); }
  .modal .mh h3 { font-size: var(--fs-lg); }
  .modal .mb { flex: 1; padding: var(--sp-4) var(--sp-3h); }
  .modal .mf { position: sticky; bottom: 0; background: var(--white); z-index: 2; padding: var(--sp-2h) var(--sp-3) max(var(--sp-2h), env(safe-area-inset-bottom)); gap: var(--sp-2); box-shadow: var(--shadow-up); }
  .modal .mf .btn { flex: 1 1 calc(33% - 8px); justify-content: center; }
  .modal .mf .btn[style*="margin-right: auto"] { margin-right: 0 !important; }
  .modal.sm { min-height: 0; margin-top: auto; border-radius: var(--r-2xl) var(--r-2xl) 0 0; } .modal-bg:has(.modal.sm) { align-items: flex-end; }
  dl.kv { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2h) var(--sp-3h); }

  /* registration form */
  .wrap { padding: var(--sp-3h) var(--sp-3) var(--sp-10); padding-left: max(var(--sp-3), env(safe-area-inset-left)); padding-right: max(var(--sp-3), env(safe-area-inset-right)); }
  .topbar .in { padding: var(--sp-3) var(--sp-3h); padding-top: max(var(--sp-3), env(safe-area-inset-top)); gap: var(--sp-2h); }
  .topbar .logo { width: 42px; height: 42px; } .topbar h1 { font-size: var(--fs-lg); } .topbar .sub { font-size: var(--fs-xs); }
  .tabs button { padding: var(--sp-2h) var(--sp-3); font-size: var(--fs-md); }
  .chip { font-size: var(--fs-md); }
  .stepnav { position: sticky; bottom: 0; z-index: var(--z-sticky); background: linear-gradient(to top, var(--bg) 70%, transparent); margin: 0 calc(var(--sp-3) * -1); padding: var(--sp-3h) var(--sp-3) max(var(--sp-3), env(safe-area-inset-bottom)); }
  .stepnav .btn { min-width: 0; flex: 1; }
  .stepper { gap: var(--sp-1h); } .stepper .st span { font-size: var(--fs-2xs); line-height: 1.2; display: block; }
  #submitCard .btn.lg, .card > div > .btn.lg { width: 100%; justify-content: center; }
  .regno { font-size: var(--fs-3xl); overflow-wrap: anywhere; }
  .photo-pick { flex-wrap: wrap; }
  details.more > summary { padding-right: 0; } details.more > summary .opt { position: static; margin-left: var(--sp-1h); }
  .dropzone { padding: var(--sp-6) var(--sp-3h); }
  .idcards { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: var(--sp-2); }
  .idc { flex: none; }
  .login .card { padding: var(--sp-5h) var(--sp-4h); }
  .toast { left: 12px; right: 12px; transform: none; bottom: max(16px, env(safe-area-inset-bottom)); text-align: center; }
}

/* ---------- small phones (iPhone SE, older Android, 360px and below) ---------- */
@media (max-width: 380px) {
  .kpis { grid-template-columns: 1fr 1fr; } .kpi .v { font-size: var(--fs-2xl); }
  .filters { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; }
  table.t:not(.matrix) td { grid-template-columns: 1fr; gap: var(--sp-0); }
  table.t:not(.matrix) td > .sub { grid-column: auto; margin-top: 0; }
  .stepper .st:not(.on) span { visibility: hidden; height: 0; }
  .stepper .st.on span { position: relative; white-space: nowrap; }
  .dob3 { grid-template-columns: 62px 1fr 84px; gap: var(--sp-1h); }
  .chip { padding: var(--sp-2h) var(--sp-3); }
  .modal .mf { display: grid; grid-template-columns: 1fr 1fr; }
  .modal .mf .btn { min-height: 40px; padding: var(--sp-2) var(--sp-1h); font-size: var(--fs-md); }
  .topbar .sub { display: none; }
}
/* ---------- very narrow (folded phones ~280px) ---------- */
@media (max-width: 320px) {
  body { font-size: var(--fs-md); } .card { padding: var(--sp-3h) var(--sp-2h); } .wrap { padding-left: var(--sp-2); padding-right: var(--sp-2); }
  .dob3 { grid-template-columns: 1fr 1fr; } .dob3 #k_yy { grid-column: span 2; }
  .kpis { grid-template-columns: 1fr; }
  .stepnav .btn { font-size: var(--fs-md); padding: var(--sp-2h) var(--sp-2); }
  .stepnav { margin: 0 calc(var(--sp-2) * -1); padding-left: var(--sp-2); padding-right: var(--sp-2); }
  .mbar .act { display: none; }
}
/* ---------- landscape phones: keep the sticky bars short ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .mbar { position: static; } .stepnav { position: static; background: none; }
  .modal .mh, .modal .mf { position: static; }
}
/* ---------- large screens ---------- */
@media (min-width: 1600px) { .main { padding: var(--sp-7) var(--sp-10) var(--sp-15); } }
.wardcity select { max-width: 440px; font-weight: var(--fw-semibold); }
.wardcity .sec-title { margin-bottom: var(--sp-2h); }

/* ---------- Masters / Lists editor ---------- */
.me-add { padding: var(--sp-4h) var(--sp-5); }
.me-step { display: flex; align-items: center; gap: var(--sp-2h); font-weight: var(--fw-bold); margin-bottom: var(--sp-2); }
.me-step .n { width: 24px; height: 24px; border-radius: var(--r-round); background: var(--saffron-l); color: var(--saffron-d); display: grid; place-items: center; font-size: var(--fs-xs); flex: none; }
.me-add select { max-width: 460px; font-weight: var(--fw-semibold); }
.me-addrow { display: flex; gap: var(--sp-2h); align-items: flex-start; }
.me-addrow textarea { flex: 1; resize: none; min-height: 44px; line-height: 1.4; overflow-y: auto; }
.me-addrow textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-addrow .btn { min-height: 44px; flex: none; }
.me-extra { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; margin-top: var(--sp-2h); }
.me-extra input:not([type=checkbox]) { max-width: 300px; }
.me-check { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-md); color: var(--ink-2); }
.me-tip { font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--sp-2); }
.me-dup { font-size: var(--fs-sm); color: var(--amber); margin-top: var(--sp-1); min-height: 0; }
.me-bar { display: flex; gap: var(--sp-3); align-items: center; margin: var(--sp-1) 0 var(--sp-2h); flex-wrap: wrap; }
.me-bar input { max-width: 360px; flex: 1 1 220px; }
.me-list { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.me-list > .card.empty { margin: 0; border: 0; box-shadow: none; }
.me-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2h) var(--sp-3h); border-bottom: 1px solid var(--line-2); min-height: 56px; }
.me-row:last-child { border-bottom: 0; }
.me-row:hover { background: var(--hover); }
.me-row.editing { background: var(--saffron-l); }
.me-name { flex: 1; min-width: 0; font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.me-name .gu { display: inline-block; margin-left: var(--sp-2); }
.me-used { display: inline-block; margin-left: var(--sp-2h); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--blue); background: var(--blue-l); padding: var(--sp-0) var(--sp-2); border-radius: var(--r-pill); white-space: nowrap; }
.me-acts { display: flex; gap: var(--sp-1h); flex: none; }
.me-edit { flex: 1; display: flex; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.me-edit input { flex: 1 1 200px; min-width: 0; }
.me-ord { display: flex; flex-direction: column; gap: var(--sp-0); flex: none; }
.me-ord .ic { border: 1px solid var(--line); background: var(--white); border-radius: var(--r-sm); width: 30px; height: 22px; font-size: var(--fs-3xs); line-height: 1; cursor: pointer; color: var(--ink-2); }
.me-ord .ic:hover:not(:disabled) { border-color: var(--saffron); color: var(--saffron-d); }
.me-ord .ic:disabled { opacity: .3; cursor: default; }
.me-switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; flex: none; font-size: var(--fs-sm); color: var(--ink-2); }
.me-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.me-switch span { width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--switch-off); position: relative; transition: background var(--dur-fast); flex: none; }
.me-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: var(--r-round); background: var(--white); transition: transform var(--dur-fast); box-shadow: var(--shadow-knob); }
.me-switch input:checked + span { background: var(--saffron); }
.me-switch input:checked + span::after { transform: translateX(16px); }
.me-switch input:focus-visible + span { outline: var(--focus-outline); outline-offset: 2px; }
.me-switch em { font-style: normal; }
.me-hidden { margin-top: var(--sp-3h); background: var(--white); border: 1px dashed var(--border-input); border-radius: var(--radius); padding: var(--sp-2h) var(--sp-3h); }
.me-hidden summary { cursor: pointer; font-weight: var(--fw-semibold); color: var(--ink-2); }
.me-row.is-hidden { opacity: .75; padding-left: 0; padding-right: 0; }
.toast.has-act { display: flex; align-items: center; gap: var(--sp-3h); padding-right: var(--sp-2h); }
.toast-act { background: var(--white); color: var(--ink); border: 0; border-radius: var(--r-sm); padding: var(--sp-1h) var(--sp-3); font: inherit; font-weight: var(--fw-bold); cursor: pointer; }
@media (max-width: 700px) {
  .me-add { padding: var(--sp-3h); }
  .me-row { flex-wrap: wrap; gap: var(--sp-2) var(--sp-2h); padding: var(--sp-3); }
  .me-name { flex: 1 1 calc(100% - 50px); }
  .me-switch { order: 3; }
  .me-acts { order: 4; margin-left: auto; }
  .me-row.editing .me-acts { width: 100%; } .me-row.editing .me-acts .btn { flex: 1; justify-content: center; }
  .me-bar input { max-width: none; }
}
@media (max-width: 380px) {
  .me-acts .btn span { display: none; }
  .me-addrow { flex-direction: column; align-items: stretch; } .me-addrow .btn { width: 100%; justify-content: center; }
}
