/* Mobile-first, large type, high contrast. No external fonts (CSP). */
:root {
  --bg: #f6f7f4; --surface: #fff; --text: #17201d; --muted: #4d5a55; --line: #cfd6d1;
  --brand: #0b5d4b; --brand-d: #084437; --brand-t: #e3f1ec;
  --warn: #7a4b00; --warn-bg: #fff4dc; --warn-line: #e0b050;
  --danger: #9b1c1c; --danger-bg: #fdeaea; --danger-line: #d98a8a;
  --focus: #0a58ca; --r: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", "Nirmala UI", Latha, "Tamil Sangam MN", sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; }
:lang(ta) { line-height: 1.8; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .9rem; } ul, ol { margin: 0 0 .9rem; padding-left: 1.3rem; } li { margin-bottom: .35rem; }
a { color: var(--brand-d); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.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: 0; background: #000; color: #fff; padding: .7rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.muted { color: var(--muted); font-size: .9rem; }
.loading-initial { padding: 2rem; text-align: center; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 44rem; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; text-decoration: none; color: var(--brand-d); }
.brand-mark { color: #c0392b; }
.lang { display: flex; border: 2px solid var(--brand); border-radius: 999px; overflow: hidden; }
.lang-btn { font: inherit; font-size: .9rem; border: 0; background: #fff; color: var(--brand-d); padding: .45rem .8rem; min-height: 44px; cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--brand); color: #fff; }

main { max-width: 44rem; margin: 0 auto; padding: 1rem; outline: none; }
main.wide { max-width: 62rem; }
main.narrow { max-width: 32rem; }
.narrow { max-width: 34rem; margin-inline: auto; }
.foot { max-width: 44rem; margin: 0 auto; padding: 1rem 1rem 3rem; color: var(--muted); font-size: .85rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem; margin-bottom: 1rem; }
.hero { text-align: center; padding: 1.5rem 1rem; }
.center { text-align: center; }
.box { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; min-height: 56px; padding: .7rem 1.3rem; border-radius: 12px; border: 2px solid var(--brand); background: #fff; color: var(--brand-d); cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-small { min-height: 44px; padding: .4rem .9rem; font-size: .9rem; }
.btn[disabled] { opacity: .6; cursor: wait; }
.link-quiet { background: none; border: 0; font: inherit; color: var(--brand-d); text-decoration: underline; padding: .6rem .2rem; min-height: 44px; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.actions .btn { flex: 1 1 10rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; align-items: center; }
.row-between { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
.inline { display: inline; }

.field { margin-bottom: 1rem; }
label { font-weight: 600; display: block; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
  font: inherit; width: 100%; min-height: 56px; padding: .6rem .8rem; border: 2px solid #8a958f; border-radius: 10px; background: #fff; color: var(--text); }
.input-unit { display: flex; align-items: center; gap: .5rem; } .input-unit .unit { color: var(--muted); white-space: nowrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.hint, .help { color: var(--muted); font-size: .9rem; }
.field-error { color: var(--danger); font-weight: 600; margin-top: .4rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-inline-size: 0; }
.unit-toggle { display: flex; gap: .5rem; flex-wrap: wrap; }
.unit-toggle label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; min-height: 44px; }
.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 500; }
.check input { width: 1.6rem; height: 1.6rem; flex: none; margin-top: .2rem; }

.options { display: grid; gap: .6rem; }
.opt { margin: 0; font-weight: 500; position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt-box { display: block; border: 2px solid #8a958f; border-radius: 12px; padding: .85rem 1rem .85rem 3rem; min-height: 56px; background: #fff; position: relative; }
.opt-box::before { content: ""; position: absolute; left: 1rem; top: 50%; width: 1.3rem; height: 1.3rem; margin-top: -.65rem; border: 2px solid #5b6760; border-radius: 50%; background: #fff; }
.opt input[type=checkbox] + .opt-box::before { border-radius: 5px; }
.opt input:checked + .opt-box { border-color: var(--brand); background: var(--brand-t); }
.opt input:checked + .opt-box::before { background: var(--brand); box-shadow: inset 0 0 0 3px #fff; }
.opt input:focus-visible + .opt-box { outline: 3px solid var(--focus); outline-offset: 2px; }

progress.progress { width: 100%; height: 12px; accent-color: var(--brand); }
.progress-text { font-size: .9rem; color: var(--muted); }
details { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .8rem; margin: .7rem 0; background: #fff; }
summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

.banner { border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid var(--line); background: #fff; }
.banner-error { background: var(--danger-bg); border-color: var(--danger-line); color: #5f1111; }
.banner-ok, .banner-success { background: var(--brand-t); border-color: var(--brand); }
.banner-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.status:empty { display: none; }

.note { margin: 0 0 .6rem; padding: .6rem .8rem; border-radius: 8px; border-left: 5px solid var(--line); background: #f1f3f1; }
.note-consult, .note-caution { background: var(--warn-bg); border-left-color: var(--warn-line); color: #4a2d00; }
.note-urgent { background: var(--danger-bg); border-left-color: var(--danger); color: #5f1111; font-weight: 600; }
.note-info { background: var(--brand-t); border-left-color: var(--brand); }
.note-box { margin: .6rem 0; }
.safety { border-width: 2px; border-color: var(--warn-line); }
.safety-urgent { border-color: var(--danger); background: #fffafa; }
.safety ul { list-style: none; padding: 0; }

.report-head { margin-bottom: 1rem; }
.report .card h2 { color: var(--brand-d); }
.calc { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .8rem; }
.formula { font-family: ui-monospace, Menlo, Consolas, monospace; background: #f1f3f1; padding: .4rem .6rem; border-radius: 6px; font-size: .9rem; }
.result { font-size: 1.05rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; vertical-align: middle; border: 1px solid; }
.tag-self { background: #eef2ff; border-color: #6b7fd7; color: #1f2d7a; }
.tag-calc { background: var(--brand-t); border-color: var(--brand); color: var(--brand-d); }
.tag-est { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.prio, .plist { padding-left: 0; list-style: none; }
.prio li, .plist li { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-bottom: .7rem; background: #fff; }
.why { color: var(--muted); }
.moves { padding-left: 1.2rem; }
.checks { list-style: none; padding: 0; }
.checks li { display: flex; gap: .7rem; align-items: flex-start; }
.checks .box { flex: none; width: 1.3rem; height: 1.3rem; border: 2px solid #5b6760; border-radius: 4px; margin-top: .25rem; padding: 0; }

.table-wrap { overflow-x: auto; margin: .5rem 0 1rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
th { background: #eef1ee; }
.week { min-width: 30rem; }
table.kv th { width: 45%; background: transparent; font-weight: 600; }

.chip { display: inline-block; font-size: .8rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; background: #eef1ee; border: 1px solid var(--line); margin-right: .3rem; }
.chip-hold { background: var(--danger-bg); border-color: var(--danger-line); color: #5f1111; }
.chip-gentle { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip-normal, .chip-st-submitted { background: var(--brand-t); border-color: var(--brand); color: var(--brand-d); }
.chip-st-invited { background: #f1f3f1; }
.chip-st-started, .chip-st-consented { background: #eef2ff; border-color: #6b7fd7; color: #1f2d7a; }

.review { list-style: none; padding: 0; }
.rv-row { display: flex; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.rv-row .answers { flex: 1; } .rv-act { flex: none; }
.p-card { list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .9rem; margin-bottom: .7rem; }
.p-name { font-weight: 700; font-size: 1.1rem; }
.p-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .4rem .8rem; margin: .6rem 0 0; font-size: .9rem; }
.p-facts dt { color: var(--muted); } .p-facts dd { margin: 0; font-weight: 600; }
.link-panel { background: var(--brand-t); border: 1px solid var(--brand); border-radius: 12px; padding: 1rem; }
.link-panel input { font-family: ui-monospace, monospace; font-size: .8rem; }
.confirm { border: 2px solid var(--danger); border-radius: 12px; padding: 1rem; background: var(--danger-bg); margin-top: 1rem; }
.audit { font-size: .9rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.working { text-align: center; padding: 2rem 1rem; }

@media (min-width: 40rem) {
  html { font-size: 118%; }
  .options.cols, .meals { }
  main { padding: 1.5rem; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .opt-box { transition: background .15s, border-color .15s; } }
@media print {
  html { font-size: 100%; }
  body { background: #fff; }
  .no-print, .top, .skip, .lang, .foot, .actions, .toolbar { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { break-inside: avoid; border-color: #999; }
  .table-wrap { overflow: visible; }
  a { color: inherit; text-decoration: none; }
}
