/* ==========================================================================
   Shikayat Sahayak — custom design system (no UI template)
   Light + dark themes via CSS variables on <html data-theme="...">
   Type: "Baloo 2" for display, "Mukta" for text (both support Devanagari)
   ========================================================================== */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #edf1f7;
  --surface-3: #e3e9f2;
  --ink: #13213c;
  --ink-2: #33415e;
  --muted: #5d6882;
  --line: #d9e0eb;
  --line-strong: #c3cddc;

  --brand: #0d6b63;
  --brand-hover: #0a5952;
  --brand-ink: #ffffff;
  --brand-soft: #dcf0ec;

  --marigold: #e0a01a;
  --marigold-soft: #fcf0d4;

  --red: #c42636;   --red-soft: #fbe4e7;
  --green: #1d8047; --green-soft: #ddf2e5;
  --blue: #2c57c9;  --blue-soft: #e3e9fb;
  --violet: #6a49bf;--violet-soft: #ece6fa;
  --amber: #a8680f; --amber-soft: #fcefd6;
  --teal: #0d6b63;  --teal-soft: #dcf0ec;
  --gray: #5d6882;  --gray-soft: #e8ecf2;

  --shadow-1: 0 1px 2px rgba(19, 33, 60, .06), 0 1px 1px rgba(19, 33, 60, .04);
  --shadow-2: 0 10px 30px -12px rgba(19, 33, 60, .25);
  --focus: 0 0 0 3px rgba(13, 107, 99, .35);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --font-display: "Baloo 2", "Mukta", system-ui, sans-serif;
  --font-text: "Mukta", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0c1527;
  --surface: #131f37;
  --surface-2: #1a2845;
  --surface-3: #223255;
  --ink: #e6ebf5;
  --ink-2: #c6cfe0;
  --muted: #95a2bd;
  --line: #25365a;
  --line-strong: #33466e;

  --brand: #3cc2b3;
  --brand-hover: #5ad1c4;
  --brand-ink: #04231f;
  --brand-soft: rgba(60, 194, 179, .15);

  --marigold: #f2b84b;
  --marigold-soft: rgba(242, 184, 75, .15);

  --red: #ff6b78;   --red-soft: rgba(255, 107, 120, .14);
  --green: #4fd08a; --green-soft: rgba(79, 208, 138, .14);
  --blue: #7ea2ff;  --blue-soft: rgba(126, 162, 255, .14);
  --violet: #b39cff;--violet-soft: rgba(179, 156, 255, .14);
  --amber: #f2b84b; --amber-soft: rgba(242, 184, 75, .14);
  --teal: #3cc2b3;  --teal-soft: rgba(60, 194, 179, .15);
  --gray: #95a2bd;  --gray-soft: rgba(149, 162, 189, .14);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 14px 34px -14px rgba(0, 0, 0, .6);
  --focus: 0 0 0 3px rgba(60, 194, 179, .4);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; color: var(--ink); font-weight: 700; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.95rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: var(--brand-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.container-narrow { width: min(760px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; word-break: break-word; }
.text-right { text-align: right; }
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: .5rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.75rem; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .55rem 1.1rem;
  border: 1px solid var(--btn-bd); border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-fg);
  font: 600 1rem/1.2 var(--font-text); cursor: pointer; text-decoration: none !important;
  transition: background-color .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-bd: var(--brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { --btn-bg: var(--red-soft); --btn-fg: var(--red); --btn-bd: transparent; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: .3rem .8rem; font-size: .9rem; }
.btn-lg { min-height: 54px; padding: .8rem 1.6rem; font-size: 1.1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; }

/* ---------- Forms ---------- */
.field { display: block; }
.field + .field { margin-top: 1.1rem; }
.label { display: block; font-weight: 600; margin-bottom: .35rem; color: var(--ink); }
.label .req { color: var(--red); margin-left: .15rem; }
.help { display: block; font-size: .88rem; color: var(--muted); margin-top: .3rem; }
.error { display: block; font-size: .9rem; color: var(--red); margin-top: .3rem; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: .6rem .85rem;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  font: 400 1rem/1.4 var(--font-text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.input-sm, .select-sm { min-height: 38px; padding: .35rem .65rem; font-size: .92rem; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix { display: flex; align-items: center; padding: 0 .8rem; border: 1.5px solid var(--line-strong); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--surface-2); color: var(--muted); font-weight: 600; }
.input-group .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: .2rem; accent-color: var(--brand); flex: none; }
.choice-list { display: grid; gap: .5rem; }
.choice { display: flex; gap: .6rem; align-items: center; padding: .65rem .85rem; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { accent-color: var(--brand); width: 18px; height: 18px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* File drop */
.dropzone { display: block; border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 1.25rem; text-align: center; background: var(--surface-2); cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone .dz-title { font-weight: 700; display: block; }
.file-list { list-style: none; margin: .6rem 0 0; padding: 0; text-align: left; }
.file-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin-top: .35rem; font-size: .9rem; }

/* Translatable inputs (admin) */
.tr-group { display: grid; gap: .45rem; }
.tr-item { display: grid; grid-template-columns: 44px 1fr; gap: .5rem; align-items: start; }
.tr-code { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; }
.tr-item.is-small .tr-code { min-height: 38px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.35rem; box-shadow: var(--shadow-1); }
.card-flat { box-shadow: none; }
.card-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; margin: 0 0 .9rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head .card-title { margin: 0; }
.section { padding: 3rem 0; }
.divider-dotted { border-top: 1.5px dashed var(--line-strong); margin: 1.25rem 0; }

/* Chips / tones */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .65rem; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--gray-soft); color: var(--gray); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.no-dot::before { display: none; }
.tone-blue   { background: var(--blue-soft);   color: var(--blue); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-amber  { background: var(--amber-soft);  color: var(--amber); }
.tone-teal   { background: var(--teal-soft);   color: var(--teal); }
.tone-green  { background: var(--green-soft);  color: var(--green); }
.tone-red    { background: var(--red-soft);    color: var(--red); }
.tone-gray   { background: var(--gray-soft);   color: var(--gray); }

/* Alerts */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--r-md); border: 1px solid transparent; margin-bottom: 1rem; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.alert-error   { background: var(--red-soft);   color: var(--red);   border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-info    { background: var(--blue-soft);  color: var(--blue);  border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.alert-warn    { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert .alert-close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.2rem; line-height: 1; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .75rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .actions { display: flex; gap: .35rem; justify-content: flex-end; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .empty-icon { font-size: 2.2rem; display: block; margin-bottom: .5rem; }

/* Pagination */
.pagination { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: 1.25rem; list-style: none; padding: 0; }
.pagination a, .pagination span { display: inline-flex; min-width: 38px; height: 38px; align-items: center; justify-content: center; padding: 0 .6rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .92rem; text-decoration: none; }
.pagination .active span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pagination .disabled span { opacity: .45; }

/* Details / accordion */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 1rem 2.2rem 1rem 0; font-weight: 600; font-size: 1.05rem; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .3rem; top: .75rem; font-size: 1.5rem; color: var(--brand); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq .faq-body { padding: 0 0 1.1rem; color: var(--ink-2); }

/* Dropdown (native details) */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: .35rem; z-index: 50; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; gap: .5rem; align-items: center; padding: .5rem .7rem; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; font-size: .95rem; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-menu .is-current { color: var(--brand); font-weight: 700; }

/* ---------- Front: header / footer ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .bar { display: flex; align-items: center; gap: 1rem; min-height: 66px; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; text-decoration: none !important; }
.brand img { height: 38px; width: auto; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 1.15rem; }
.site-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.site-nav a.nav-link { color: var(--ink-2); font-weight: 600; padding: .45rem .75rem; border-radius: 999px; }
.site-nav a.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.site-nav a.nav-link.is-active { color: var(--brand); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.menu-btn { display: none; }
@media (max-width: 820px) {
  .menu-btn { display: inline-flex; margin-left: auto; }
  .site-nav { display: none; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: .75rem 1.25rem 1.25rem; gap: .35rem; margin: 0; }
  .site-nav.is-open { display: flex; }
  .site-nav .row { justify-content: flex-start; }
}

.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); background: var(--surface); padding: 2.5rem 0 1.5rem; font-size: .95rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.site-footer h4 { font-size: 1rem; margin-bottom: .6rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: .3rem 0; }
.site-footer a { color: var(--ink-2); }
.site-footer .legal { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr; gap: 1.25rem; } }

/* ---------- Front: home ---------- */
.hero { padding: 3rem 0 1.5rem; }
.hero h1 { max-width: 18ch; margin-bottom: .35em; }
.hero .lede { font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; }
.hero-actions { margin-top: 1.25rem; }

.tiles { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-top: 1.75rem; }
.tile { position: relative; display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem 1.1rem 1rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); color: var(--ink); text-decoration: none !important; transition: border-color .15s, transform .15s, box-shadow .15s; min-height: 132px; }
.tile:hover { border-color: var(--tile-color, var(--brand)); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.tile .tile-icon { font-size: 1.9rem; line-height: 1; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--tile-color, var(--brand)) 14%, transparent); margin-bottom: .45rem; }
.tile .tile-name { font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; line-height: 1.25; }
.tile .tile-desc { font-size: .9rem; color: var(--muted); line-height: 1.4; }
.tile.is-emergency { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.tile .tile-flag { position: absolute; top: .8rem; right: .8rem; font-size: .72rem; font-weight: 700; color: var(--red); background: var(--red-soft); padding: .1rem .5rem; border-radius: 999px; }

.sos { display: flex; gap: 1rem 1.5rem; align-items: center; flex-wrap: wrap; padding: 1rem 1.25rem; border-radius: var(--r-lg); background: var(--red-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
.sos-title { font-weight: 700; color: var(--red); display: flex; align-items: center; gap: .5rem; }
.sos-list { display: flex; gap: .5rem; flex-wrap: wrap; }
.sos-item { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .85rem; border-radius: 999px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--red) 25%, var(--line)); color: var(--ink); font-weight: 600; text-decoration: none !important; }
.sos-item strong { color: var(--red); font-family: var(--font-display); font-size: 1.1rem; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; counter-reset: step; }
.steps li { list-style: none; position: relative; padding-top: 3rem; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 0; width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; background: var(--marigold-soft); color: var(--amber); border: 1.5px solid var(--marigold); }
.steps li::after { content: ""; position: absolute; top: 1.1rem; left: 2.8rem; right: -.8rem; border-top: 1.5px dashed var(--line-strong); }
.steps li:last-child::after { display: none; }
.steps h3 { margin-bottom: .25rem; }
.steps p { color: var(--muted); font-size: .95rem; margin: 0; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr 1fr; } .steps li::after { display: none; } }
@media (max-width: 480px) { .steps { grid-template-columns: 1fr; } }

.promise { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.promise .col { padding: 1.25rem; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.promise ul { margin: 0; padding-left: 1.1rem; }
.promise li { margin: .35rem 0; }
@media (max-width: 760px) { .promise { grid-template-columns: 1fr; } }

/* ---------- Front: complaint form ---------- */
.form-shell { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
.form-shell aside { position: sticky; top: 90px; }
@media (max-width: 900px) { .form-shell { grid-template-columns: 1fr; } .form-shell aside { position: static; } }
.form-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.35rem; }
.form-section + .form-section { margin-top: 1rem; }
.form-section-head { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.form-section-head .num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; flex: none; }
.form-section-head h2 { font-size: 1.25rem; margin: 0; }
.cat-badge { display: inline-flex; align-items: center; gap: .6rem; padding: .35rem .9rem .35rem .4rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.cat-badge .ic { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; }
.never-share { display: flex; gap: .6rem; padding: .8rem 1rem; border-radius: var(--r-md); background: var(--marigold-soft); color: var(--ink); font-size: .95rem; border: 1px solid color-mix(in srgb, var(--marigold) 40%, transparent); }

/* ---------- Case file (the one bold element) ---------- */
.casefile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 0 var(--r-lg) var(--r-lg) var(--r-lg); padding: 1.5rem 1.5rem 1.25rem; margin-top: 2.3rem; box-shadow: var(--shadow-1); }
.casefile .tab { position: absolute; top: -2.3rem; left: -1px; height: 2.3rem; padding: 0 1.1rem; display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0; font-weight: 600; color: var(--muted); font-size: .9rem; }
.case-no { font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: .02em; margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.stamp { display: inline-block; padding: .35rem .9rem; border: 2.5px solid currentColor; border-radius: 8px; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; transform: rotate(-3deg); background: transparent !important; box-shadow: inset 0 0 0 2px color-mix(in srgb, currentColor 20%, transparent); }
.stamp.tone-gray { color: var(--gray); } .stamp.tone-green { color: var(--green); } .stamp.tone-red { color: var(--red); }
.stamp.tone-blue { color: var(--blue); } .stamp.tone-violet { color: var(--violet); } .stamp.tone-amber { color: var(--amber); } .stamp.tone-teal { color: var(--teal); }
.copy-btn { border: 0; background: var(--surface-2); color: var(--muted); border-radius: 8px; padding: .25rem .55rem; cursor: pointer; font: 600 .82rem var(--font-text); }

.progress-steps { display: grid; grid-template-columns: repeat(4, 1fr); margin: 1.4rem 0 .4rem; }
.progress-steps .ps { position: relative; text-align: center; font-size: .85rem; color: var(--muted); padding-top: 1.9rem; }
.progress-steps .ps::before { content: ""; position: absolute; top: .55rem; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--line-strong); z-index: 1; }
.progress-steps .ps::after { content: ""; position: absolute; top: 1.05rem; left: -50%; width: 100%; height: 3px; background: var(--line-strong); }
.progress-steps .ps:first-child::after { display: none; }
.progress-steps .ps.done { color: var(--ink); font-weight: 600; }
.progress-steps .ps.done::before { background: var(--brand); border-color: var(--brand); }
.progress-steps .ps.done::after { background: var(--brand); }
.progress-steps .ps.current::before { box-shadow: 0 0 0 5px var(--brand-soft); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 17px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-left: 50px; padding-bottom: 1.2rem; }
.tl-dot { position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--surface); font-size: 1rem; }
.tl-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; font-size: .92rem; }
.tl-head strong { font-weight: 700; }
.tl-time { color: var(--muted); font-size: .82rem; }
.bubble { margin-top: .4rem; padding: .75rem .95rem; border-radius: 4px var(--r-md) var(--r-md) var(--r-md); background: var(--surface-2); color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.bubble.from-team { background: var(--brand-soft); }
.bubble.is-internal { background: var(--marigold-soft); border: 1px dashed var(--marigold); }
.attachments { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.attachment { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .88rem; color: var(--ink); max-width: 100%; }
.attachment img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

.qa { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: .5rem 1rem; margin: 0; }
.qa dt { color: var(--muted); font-size: .92rem; }
.qa dd { margin: 0; word-break: break-word; }
@media (max-width: 560px) { .qa { grid-template-columns: 1fr; } .qa dd { margin-bottom: .5rem; } }

.channel { display: flex; gap: .85rem; align-items: flex-start; padding: .9rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.channel + .channel { margin-top: .6rem; }
.channel .ch-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; font-size: 1.15rem; }
.channel .ch-name { font-weight: 700; }
.channel .ch-links { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .45rem; }

.case-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; padding: 1rem 1.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink); text-decoration: none !important; }
.case-row + .case-row { margin-top: .6rem; }
.case-row:hover { border-color: var(--brand); }
.case-row .cr-no { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }

/* Auth */
.auth-wrap { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(440px, 100%); }
.auth-card h1 { font-size: 1.9rem; }
.segmented { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 1.25rem; }
.segmented button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: .55rem .6rem; font: 600 .93rem var(--font-text); color: var(--muted); cursor: pointer; }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.otp-input { font-family: var(--font-display); font-size: 1.8rem; letter-spacing: .55em; text-align: center; font-weight: 700; padding-left: 1.2rem; }
[hidden] { display: none !important; }

/* Print document */
.doc-sheet { background: #fff; color: #111; max-width: 800px; margin: 2rem auto; padding: 3rem 3.2rem; border-radius: 6px; box-shadow: var(--shadow-2); font-size: 16px; line-height: 1.7; }
.doc-sheet h1 { color: #111; font-size: 1.5rem; }
.doc-toolbar { max-width: 800px; margin: 1.5rem auto 0; display: flex; gap: .5rem; flex-wrap: wrap; }
@media print {
  body { background: #fff; }
  .no-print, .site-header, .site-footer, .doc-toolbar { display: none !important; }
  .doc-sheet { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* ==========================================================================
   Admin panel
   ========================================================================== */
.admin { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; font-size: 16px; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 1rem .75rem 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { font-size: 1.12rem; padding: .25rem .5rem 1rem; }
.side-group { margin-top: 1rem; }
.side-label { font-size: .78rem; color: var(--muted); padding: 0 .75rem .35rem; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: .96rem; text-decoration: none !important; }
.side-link:hover { background: var(--surface-2); }
.side-link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.side-link .ico { width: 22px; text-align: center; }
.side-link .count { margin-left: auto; font-size: .75rem; background: var(--red); color: #fff; border-radius: 999px; padding: 0 .45rem; font-weight: 700; }
.admin-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; min-height: 62px; padding: 0 1.5rem; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar form.search { flex: 1; max-width: 420px; }
.topbar .spacer { flex: 1; }
.admin-content { padding: 1.5rem; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.7rem; margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 980px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-2); }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; }
  .sidebar-toggle { display: inline-flex; }
  .admin-content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.1rem; color: var(--ink); text-decoration: none !important; display: block; }
.stat:hover { border-color: var(--brand); }
.stat .stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .stat-label { color: var(--muted); font-size: .9rem; }
.stat.is-alert .stat-value { color: var(--red); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 1rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bars .bar-fill { width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: var(--brand); min-height: 3px; }
.bars .bar-num { font-size: .72rem; color: var(--muted); }
.bars .bar-label { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: .5rem; align-items: center; margin: .45rem 0; font-size: .92rem; }
.hbar .track { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: -.2rem; }
.hbar .track span { display: block; height: 100%; background: var(--marigold); border-radius: 99px; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.case-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .case-layout { grid-template-columns: 1fr; } }
.side-card + .side-card { margin-top: 1rem; }
.tabs-nav { display: flex; gap: .35rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs-nav a, .tabs-nav button { padding: .6rem .95rem; border: 0; border-bottom: 2.5px solid transparent; background: none; color: var(--muted); font: 600 .95rem var(--font-text); cursor: pointer; white-space: nowrap; text-decoration: none !important; margin-bottom: -1px; }
.tabs-nav .is-active { color: var(--brand); border-bottom-color: var(--brand); }
.composer { border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); padding: .75rem; }
.composer .textarea { border: 0; box-shadow: none; padding: .35rem; min-height: 90px; }
.composer .textarea:focus { box-shadow: none; }
.composer-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: .65rem; margin-top: .4rem; }
.seg-radio { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg-radio label { padding: .3rem .8rem; border-radius: 999px; font-size: .88rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-radio label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg-radio label:has(input[value=internal]:checked) { color: var(--amber); }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.field-card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.field-card > summary { list-style: none; cursor: pointer; display: flex; gap: .75rem; align-items: center; padding: .75rem 1rem; }
.field-card > summary::-webkit-details-marker { display: none; }
.field-card[open] > summary { border-bottom: 1px solid var(--line); }
.field-card .field-body { padding: 1rem; }
.field-card + .field-card { margin-top: .5rem; }
.settings-nav { display: flex; flex-direction: column; gap: .2rem; }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .settings-layout { grid-template-columns: 1fr; } .settings-nav { flex-direction: row; overflow-x: auto; } }
.setting-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.setting-row:last-of-type { border-bottom: 0; }
@media (max-width: 760px) { .setting-row { grid-template-columns: 1fr; gap: .4rem; } }
.key-status { font-size: .82rem; color: var(--green); font-weight: 600; }
.admin-login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 20% 10%, var(--brand-soft), transparent 45%), var(--bg); }
.tr-table td { vertical-align: top; }
.tr-table .key { font-size: .8rem; color: var(--muted); word-break: break-all; }
.tr-table .ref { font-size: .92rem; color: var(--ink-2); }
.tr-table .textarea { min-height: 44px; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light:has(+ .logo-dark) { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* ==========================================================================
   Mobile app shell — bottom nav, app headers, wizard, sheets, safe areas
   ========================================================================== */

:root {
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 62px;
}

/* Touch behaviour: no blue flash, smooth scroll, no accidental zoom */
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }
@media (max-width: 820px) {
  .input, .select, .textarea { font-size: 16px; } /* iOS zoom rokta hai */
}
button, .btn, a { -webkit-touch-callout: none; }

/* ---------- Bottom navigation (mobile only) ---------- */
.bottom-nav { display: none; }
@media (max-width: 820px) {
  .has-bottom-nav { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(1.5) blur(14px);
    border-top: 1px solid var(--line);
    padding-bottom: var(--safe-b);
    box-shadow: 0 -1px 14px -6px rgba(0,0,0,.18);
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; height: var(--nav-h); color: var(--muted); font-size: .7rem; font-weight: 600;
    text-decoration: none !important; position: relative; background: none; border: 0; font-family: var(--font-text);
  }
  .bn-item svg { width: 23px; height: 23px; stroke-width: 1.9; }
  .bn-item.is-active { color: var(--brand); }
  .bn-item.is-active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
  }
  .bn-item:active { background: var(--surface-2); }
  .bn-item .bn-badge {
    position: absolute; top: 6px; left: 50%; margin-left: 4px;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
    background: var(--red); color: #fff; font-size: .62rem; line-height: 17px; text-align: center;
  }
  /* Centre action button */
  .bn-item.bn-cta { color: var(--brand); }
  .bn-item.bn-cta .bn-ring {
    width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
    display: grid; place-items: center; margin-top: -14px; box-shadow: 0 6px 16px -6px var(--brand);
    border: 3px solid var(--bg);
  }
  .bn-item.bn-cta .bn-ring svg { width: 21px; height: 21px; stroke-width: 2.4; }
  .bn-item.bn-cta.is-active::before { display: none; }
}

/* ---------- App-style header on mobile ---------- */
@media (max-width: 820px) {
  .site-header .bar { min-height: 58px; }
  .site-header { padding-top: var(--safe-t); }
  .app-bar { display: flex; align-items: center; gap: .5rem; min-height: 52px; }
  .app-bar .app-back {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    border: 0; background: var(--surface-2); color: var(--ink); flex: none;
  }
  .app-bar .app-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin: 0; }
  .hero { padding: 1.5rem 0 1rem; }
  .section { padding: 2rem 0; }
  .container, .container-narrow { width: calc(100% - 2rem); }
  .card, .form-section { padding: 1.1rem; border-radius: var(--r-md); }
  .casefile { margin-top: 2rem; padding: 1.15rem; }
}
.app-bar { display: none; }
@media (max-width: 820px) { .app-bar.show-mobile { display: flex; } .hide-mobile { display: none !important; } }
@media (min-width: 821px) { .show-desktop-only { display: block; } }

/* ---------- Sticky action bar ---------- */
.action-bar { margin-top: 1.25rem; }
@media (max-width: 820px) {
  .action-bar.is-sticky {
    position: sticky; bottom: calc(var(--safe-b) + 8px); z-index: 20;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    padding: .6rem 0; margin-inline: -1rem; padding-inline: 1rem;
    border-top: 1px solid var(--line);
  }
  .action-bar .btn { width: 100%; }
}

/* ---------- Multi-step wizard ---------- */
.wizard-head { position: sticky; top: 58px; z-index: 25; background: var(--bg); padding: .75rem 0 .6rem; margin-bottom: .75rem; }
@media (min-width: 821px) { .wizard-head { top: 66px; } }
.wizard-track { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.wizard-track span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s cubic-bezier(.4,0,.2,1); }
.wizard-meta { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .45rem; font-size: .85rem; }
.wizard-meta .w-step { color: var(--muted); font-weight: 600; }
.wizard-meta .w-name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.wizard-step[hidden] { display: none !important; }
.wizard-step { animation: stepIn .25s ease-out; }
@keyframes stepIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.wizard-nav { display: flex; gap: .6rem; align-items: center; }
.wizard-nav .btn-next, .wizard-nav .btn-submit { flex: 1; }
.field-error-flash { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- Segmented OTP boxes ---------- */
.otp-boxes { display: flex; gap: .5rem; justify-content: center; direction: ltr; }
.otp-boxes input {
  width: 46px; height: 56px; text-align: center; font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 700; border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); padding: 0;
}
.otp-boxes input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.otp-boxes input.is-filled { border-color: var(--brand); background: var(--brand-soft); }
@media (max-width: 380px) { .otp-boxes input { width: 40px; height: 50px; font-size: 1.3rem; } }

/* ---------- Image previews in upload ---------- */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; margin-top: .75rem; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .thumb-doc { display: grid; place-items: center; height: 100%; font-size: 1.6rem; }
.thumb .thumb-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; font-size: .6rem; background: rgba(0,0,0,.6); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .thumb-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: .9rem; line-height: 1; cursor: pointer; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 90; display: flex; flex-direction: column; gap: .5rem; width: min(420px, calc(100% - 2rem)); }
@media (min-width: 821px) { .toast-wrap { bottom: 20px; } }
.toast { display: flex; gap: .6rem; align-items: center; padding: .7rem 1rem; border-radius: var(--r-md); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); font-size: .95rem; animation: toastIn .25s ease-out; }
.toast.is-ok { background: var(--green); color: #fff; }
.toast.is-err { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Install banner ---------- */
.install-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 70;
  width: min(460px, calc(100% - 1.5rem));
  display: flex; gap: .75rem; align-items: center;
  padding: .8rem 1rem; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  animation: toastIn .3s ease-out;
}
@media (min-width: 821px) { .install-banner { bottom: 20px; } }
.install-banner .ib-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-banner .ib-title { font-weight: 700; font-size: .95rem; }
.install-banner .ib-sub { font-size: .8rem; color: var(--muted); }

/* ---------- Buttons: loading state + ripple-ish press ---------- */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid currentColor; border-top-color: transparent;
  color: var(--btn-fg); animation: spin .6s linear infinite;
}
.btn-primary.is-loading::after { color: var(--brand-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Case list as app rows ---------- */
@media (max-width: 820px) {
  .case-row { grid-template-columns: 1fr auto; padding: .9rem 1rem; align-items: center; }
  .case-row .cr-no { font-size: 1rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .tile { min-height: 0; padding: .9rem; }
  .tile .tile-icon { width: 42px; height: 42px; font-size: 1.5rem; margin-bottom: .35rem; }
  .tile .tile-name { font-size: 1rem; }
  .tile .tile-desc { display: none; }
  .sos { flex-direction: column; align-items: stretch; gap: .7rem; }
  .sos-item { justify-content: center; }
  .qa { grid-template-columns: 1fr; gap: .15rem; }
  .qa dd { margin-bottom: .6rem; font-weight: 600; }
  .timeline::before { left: 15px; }
  .tl-item { padding-left: 44px; }
  .tl-dot { width: 32px; height: 32px; }
  .form-shell { gap: 1rem; }
  .progress-steps .ps { font-size: .72rem; }
  h1 { font-size: 1.9rem; }
  .hero h1 { font-size: 2.1rem; }
}

/* ---------- Pull-to-refresh hint / offline bar ---------- */
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 95; padding: .45rem 1rem; text-align: center; background: var(--amber); color: #fff; font-size: .85rem; font-weight: 600; }

/* ---------- Skeleton shimmer ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 820px) { .show-mobile-only { display: block !important; } }
.wizard-ready .wizard-step.form-section { margin-top: 0; }

/* Sticky action bar must sit above the bottom navigation */
@media (max-width: 820px) {
  .has-bottom-nav .action-bar.is-sticky { bottom: calc(var(--nav-h) + var(--safe-b) + 4px); }
  .has-bottom-nav .wizard-head { top: 52px; }
}

/* Keep the wizard a stable height so short steps don't leave a big gap */
@media (max-width: 820px) {
  .wizard-ready .wizard-step { min-height: 52vh; }
  .wizard-ready ~ .site-footer, .has-bottom-nav .site-footer { margin-top: 2rem; }
}
.wizard-nav .btn-back { flex: 0 0 34%; }

/* Login / OTP cards sit near the top on a phone, not floating in the middle */
@media (max-width: 820px) {
  .auth-wrap { min-height: 0; align-items: start; padding: .5rem 1rem 1rem; }
  .auth-card { width: 100%; }
  .auth-card h1 { font-size: 1.6rem; }
}

.site-footer .cols-4 { grid-template-columns: 1.3fr 1fr 1fr 1fr; }
@media (max-width: 900px) { .site-footer .cols-4 { grid-template-columns: 1fr 1fr; } }
/* On a phone the bottom bar already handles navigation, so the footer stays short */
@media (max-width: 820px) {
  .has-bottom-nav .site-footer { padding: 1.5rem 0 1rem; font-size: .88rem; }
  .has-bottom-nav .site-footer .footer-nav { display: none; }
  .has-bottom-nav .site-footer .cols-4 { grid-template-columns: 1fr; gap: 1rem; }
  .has-bottom-nav .site-footer .footer-pages { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
  .has-bottom-nav .site-footer .legal { margin-top: 1rem; }
}
