:root {
  --bg: #ffffff;
  --surface: #f6faf9;
  --card: #ffffff;
  --text: #10231f;
  --muted: #4b5f5a;
  --line: #d9e6e3;
  --accent: #0f766e;
  --accent-strong: #0b5c56;
  --accent-soft: #e6f4f2;
  --on-accent: #ffffff;
  --do: #166534;
  --do-bg: #ecfdf3;
  --dont: #9f1239;
  --dont-bg: #fff1f3;
  --warn-bg: #fffbeb;
  --warn-line: #f59e0b;
  --focus: #f59e0b;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(16, 35, 31, .06), 0 6px 20px rgba(16, 35, 31, .06);
  --font: 'Noto Sans', 'Noto Sans Tamil', 'Noto Sans Malayalam', 'Noto Sans Devanagari', 'Noto Sans Telugu', 'Noto Sans Kannada', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1614; --surface: #121f1c; --card: #162623; --text: #e7f2ef; --muted: #a3b8b2; --line: #26403a;
    --accent: #2dd4bf; --accent-strong: #5eead4; --accent-soft: #123430; --on-accent: #062420;
    --do: #86efac; --do-bg: #0f2a1c; --dont: #fda4af; --dont-bg: #2d1218; --warn-bg: #2a2210;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 18px; line-height: 1.55;
}
img { max-width: 100%; }
a { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.wordmark { font-weight: 700; font-size: 19px; letter-spacing: .2px; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.lang-switch select {
  font: inherit; font-size: 16px; padding: 8px 32px 8px 12px; min-height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
@media (max-width: 420px) { .wordmark { display: none; } }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 96px; outline: none; }
main.wide { max-width: 1200px; }

/* ---------- typography */
h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 18px; }
h2 { font-size: 22px; margin: 28px 0 12px; }
h3 { font-size: 19px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.lead { font-size: 19px; color: var(--muted); margin-top: -6px; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 600; font-size: 18px; line-height: 1.2;
  min-height: 52px; padding: 12px 20px; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); text-decoration: none;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.secondary { background: var(--card); color: var(--accent-strong); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { background: var(--card); color: var(--dont); border-color: color-mix(in srgb, var(--dont) 40%, transparent); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 16px; border-radius: 12px; }
.btn.tiny { min-height: 36px; padding: 4px 10px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 22px; height: 22px; flex: none; }

/* ---------- landing */
.hero { text-align: center; padding: 18px 0 8px; }
.hero img { width: 76px; height: 76px; }
.hero h1 { margin-top: 14px; }
.role-buttons { display: grid; gap: 14px; margin-top: 22px; }
.role-btn {
  display: flex; align-items: center; gap: 16px; text-align: left; width: 100%;
  padding: 18px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); min-height: 84px;
}
.role-btn { text-decoration: none; }
.role-btn:hover { border-color: var(--accent); }
.role-btn .ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.role-btn .ico svg { width: 28px; height: 28px; }
.role-btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.role-btn.primary .ico { background: rgba(255, 255, 255, .18); color: var(--on-accent); }
.role-btn .chev { margin-left: auto; opacity: .7; }

/* ---------- forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field label, .label { font-weight: 600; }
.field .hint { font-size: 15px; color: var(--muted); }
input[type=text], input[type=password], input[type=url], input[type=date], input[type=number], select, textarea {
  font: inherit; font-size: 18px; width: 100%; padding: 12px 14px; min-height: 52px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; bottom: 6px; border: 0; background: var(--accent-soft); color: var(--accent-strong); border-radius: 10px; padding: 0 12px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; }
.error { color: var(--dont); background: var(--dont-bg); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font-weight: 600; }
.ok { color: var(--do); background: var(--do-bg); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; min-height: 44px; }
.check input { width: 22px; height: 22px; }

/* ---------- language grid */
.lang-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.lang-btn {
  min-height: 92px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-size: 24px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center; gap: 2px; padding: 10px;
}
.lang-btn small { font-size: 14px; font-weight: 400; color: var(--muted); }
.lang-btn[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.lang-btn:hover { border-color: var(--accent); }

/* ---------- test cards */
.test-list { display: grid; gap: 16px; }
.test-card { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.test-card img { width: 96px; height: 96px; border-radius: 22px; object-fit: cover; background: var(--accent-soft); }
.test-card h2 { margin: 0 0 10px; font-size: 23px; }
.test-card .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.test-card .details { grid-column: 1 / -1; background: var(--surface); border-radius: 14px; padding: 14px 16px; white-space: pre-line; }
@media (max-width: 420px) { .test-card { grid-template-columns: 72px 1fr; } .test-card img { width: 72px; height: 72px; border-radius: 18px; } }

/* ---------- test page */
.page-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.notice { background: var(--warn-bg); border-left: 5px solid var(--warn-line); border-radius: 12px; padding: 12px 14px; margin: 10px 0 16px; }
.video-box { border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16 / 9; position: relative; }
.video-box video, .video-box iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.video-poster { width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; position: relative; background: #0b3b37; color: #fff; display: block; }
.video-poster img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; }
.video-poster .play { position: absolute; inset: 0; margin: auto; width: 78px; height: 78px; border-radius: 50%; background: rgba(15, 118, 110, .92); display: grid; place-items: center; }
.video-poster .play svg { width: 36px; height: 36px; fill: #fff; margin-left: 4px; }
.video-poster .vt { position: absolute; left: 12px; bottom: 10px; right: 12px; text-align: left; font-weight: 600; text-shadow: 0 1px 3px #000; }
.video-list { display: grid; gap: 8px; margin-top: 10px; }
.video-list button { text-align: left; justify-content: flex-start; }
.video-list button[aria-current=true] { border-color: var(--accent); background: var(--accent-soft); }

.voice-bar {
  position: sticky; top: 66px; z-index: 10; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin: 18px 0 10px; box-shadow: var(--shadow);
}
.voice-bar .speed { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 15px; }
.voice-bar .speed select { min-height: 44px; width: auto; padding: 6px 10px; font-size: 16px; }
.voice-msg { font-size: 15px; color: var(--dont); width: 100%; }
.voice-msg:empty { display: none; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: s; }
.step {
  display: grid; grid-template-columns: 48px 1fr; gap: 12px 14px; align-items: start;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .2s, background .2s;
}
.step .num { width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; font-size: 20px; }
.step .txt { font-size: 20px; line-height: 1.5; margin: 0; padding-top: 8px; }
.step .media { grid-column: 2; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.step .media img { width: 100%; max-width: 320px; border-radius: 14px; border: 1px solid var(--line); }
.step.reading { border-color: var(--accent); background: var(--accent-soft); }
.step.reading .num { background: var(--accent); color: var(--on-accent); }
@media (max-width: 420px) { .step { grid-template-columns: 40px 1fr; padding: 14px; } .step .num { width: 40px; height: 40px; font-size: 18px; } .step .txt { font-size: 19px; padding-top: 4px; } }

.warnings { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 640px) { .warnings { grid-template-columns: 1fr 1fr; } }
.warn { border-radius: var(--radius); padding: 16px 18px; border: 2px solid; }
.warn h3 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.warn ul { margin: 0; padding-left: 22px; }
.warn li { margin: 6px 0; }
.warn.do { background: var(--do-bg); border-color: color-mix(in srgb, var(--do) 35%, transparent); }
.warn.do h3 { color: var(--do); }
.warn.dont { background: var(--dont-bg); border-color: color-mix(in srgb, var(--dont) 35%, transparent); }
.warn.dont h3 { color: var(--dont); }
.flyer { margin-top: 22px; }
.help { margin-top: 26px; text-align: center; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; gap: 10px; justify-content: center;
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
}
.bottom-nav .btn { flex: 1; max-width: 360px; }

/* ---------- loading / toast */
.loading-screen { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 16px; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
#toast.show { opacity: 1; }

/* ---------- staff / admin */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 6px 0 18px; }
.tabs a { text-decoration: none; color: var(--muted); padding: 10px 14px; border-radius: 12px 12px 0 0; font-weight: 600; font-size: 16px; border-bottom: 3px solid transparent; }
.tabs a[aria-current=page] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar .field { margin: 0; min-width: 180px; flex: 1; }
.split { display: grid; gap: 20px; }
@media (min-width: 1000px) { .split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } .split .preview { position: sticky; top: 80px; } }
.preview { border: 2px dashed var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); max-height: calc(100vh - 100px); overflow: auto; }
.preview .step .txt { font-size: 17px; }
.preview-label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.item { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--card); margin-bottom: 12px; }
.item-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.item-head .grow { flex: 1; font-weight: 700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-strong); }
.pill.off { background: var(--dont-bg); color: var(--dont); }
.pill.todo { background: var(--warn-bg); color: #92400e; }
.file-line { font-size: 15px; color: var(--muted); word-break: break-all; }
progress { width: 100%; height: 10px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat .v { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat .k { font-size: 14px; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding: 10px 0 0; border-bottom: 1px solid var(--line); }
.chart .bar { flex: 1; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.chart .bar:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; }
.chart-labels { display: flex; gap: 4px; font-size: 11px; color: var(--muted); }
.chart-labels span { flex: 1; text-align: center; overflow: hidden; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 48px; gap: 10px; align-items: center; font-size: 15px; }
.hbar .track { display: block; background: var(--surface); border-radius: 6px; height: 14px; overflow: hidden; }
.hbar .fill { display: block; background: var(--accent); height: 100%; border-radius: 6px; }
.grid2 { display: grid; gap: 16px; }
@media (min-width: 800px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
.tr-row { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tr-row .en { font-size: 15px; color: var(--muted); }
.tr-row code { font-size: 13px; color: var(--muted); }

/* hidden must win over .btn display rules */
[hidden] { display: none !important; }
/* headings get programmatic focus for screen readers on route change; no ring for that */
[tabindex="-1"]:focus { outline: none; }
