/* Akarika Technologies brand: orange and light orange. Deep orange (#c2410c) is used for text and
   buttons so contrast stays at or above WCAG AA; brighter oranges are used for decoration. */
:root {
  --bg: #fffaf5;
  --surface: #ffffff;
  --surface-2: #fff3e8;
  --ink: #23170e;
  --ink-2: #4d3b2e;
  --muted: #7d6a5b;
  --line: #f3e0cf;
  --brand: #c2410c;
  --brand-hover: #ea580c;
  --brand-bright: #f97316;
  --brand-light: #fdba74;
  --brand-ink: #ffffff;
  --brand-soft: #ffedd5;
  --accent: #f59e0b;
  --low: #15803d;
  --low-soft: #dcfce7;
  --mid: #a16207;
  --mid-soft: #fef9c3;
  --high: #b91c1c;
  --high-soft: #fee2e2;
  --vhigh: #7f1d1d;
  --focus: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(124, 45, 18, .06), 0 8px 28px rgba(194, 65, 12, .08);
  --hero-glow: radial-gradient(60% 60% at 85% 10%, rgba(253, 186, 116, .45), transparent 70%),
               radial-gradient(50% 50% at 0% 90%, rgba(255, 237, 213, .9), transparent 70%);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15100c; --surface: #1e1611; --surface-2: #2a1f17; --ink: #fbefe4; --ink-2: #e7d4c4; --muted: #b39e8c;
    --line: #3b2c21; --brand: #fb923c; --brand-hover: #fdba74; --brand-bright: #f97316; --brand-light: #fdba74;
    --brand-ink: #1f1006; --brand-soft: #3a2414; --accent: #fbbf24;
    --low: #4ade80; --low-soft: #14301f; --mid: #facc15; --mid-soft: #332a0b; --high: #f87171; --high-soft: #3b1717;
    --vhigh: #fca5a5; --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 28px rgba(0,0,0,.3);
    --hero-glow: radial-gradient(60% 60% at 85% 10%, rgba(249, 115, 22, .22), transparent 70%),
                 radial-gradient(50% 50% at 0% 90%, rgba(251, 146, 60, .10), transparent 70%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15100c; --surface: #1e1611; --surface-2: #2a1f17; --ink: #fbefe4; --ink-2: #e7d4c4; --muted: #b39e8c;
  --line: #3b2c21; --brand: #fb923c; --brand-hover: #fdba74; --brand-bright: #f97316; --brand-light: #fdba74;
  --brand-ink: #1f1006; --brand-soft: #3a2414; --accent: #fbbf24;
  --low: #4ade80; --low-soft: #14301f; --mid: #facc15; --mid-soft: #332a0b; --high: #f87171; --high-soft: #3b1717;
  --vhigh: #fca5a5; --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 28px rgba(0,0,0,.3);
  --hero-glow: radial-gradient(60% 60% at 85% 10%, rgba(249, 115, 22, .22), transparent 70%),
               radial-gradient(50% 50% at 0% 90%, rgba(251, 146, 60, .10), transparent 70%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.muted { color: var(--muted); }
.fine { font-size: .85rem; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main { min-height: 70vh; outline: none; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.2rem; letter-spacing: -.01em; }
.brand b { color: var(--brand); font-weight: 700; }
.brand-mark { width: 30px; height: 30px; color: var(--brand); }
.brand.small { font-size: 1.05rem; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.theme-toggle { margin-left: 6px; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.nav-toggle { display: none; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; padding: 10px; }
.nav-toggle span { display: block; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; display: none; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .theme-toggle { margin: 8px 0 0; }
}

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 12px 20px; font: 600 1rem var(--font); cursor: pointer; text-decoration: none; transition: transform .08s ease, background .15s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 14px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 18px; }
fieldset { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
legend { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; padding: 0; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: var(--ink-2); }
.field .req { color: var(--brand); }
.field .unit { font-weight: 500; color: var(--muted); font-size: .82rem; }
.field input, .field select, .input { width: 100%; height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 0 12px; font: 1rem var(--font); }
.field input:focus, .field select:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.field.invalid input, .field.invalid select { border-color: var(--high); }
.field .err { color: var(--high); font-size: .8rem; margin-top: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); width: 100%; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; text-align: center; padding: 10px 6px; cursor: pointer; font-weight: 500; color: var(--ink-2); border-right: 1px solid var(--line); font-size: .92rem; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--brand); color: var(--brand-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

/* ---------- landing ---------- */
.hero { padding: 64px 0 40px; position: relative; overflow: hidden; background: var(--hero-glow); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 28px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .85rem; margin-bottom: 18px; }
.lead { font-size: 1.18rem; color: var(--ink-2); max-width: 36em; }
.hero h1 span { color: var(--brand); }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); }
.hero-card .row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.hero-card .row:last-child { border-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 36px 0 0; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-size: 1.7rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .88rem; }
.section { padding-top: 56px; padding-bottom: 56px; }
.section-head { max-width: 680px; margin-bottom: 28px; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.tool { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.tool:hover { border-color: var(--brand); transform: translateY(-2px); }
.tool .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 14px; }
.tool .icon svg { width: 24px; height: 24px; }
.tool p { color: var(--ink-2); font-size: .95rem; flex: 1; }
.tool .go { color: var(--brand); font-weight: 600; font-size: .95rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; counter-reset: s; }
.step { padding: 20px; border-left: 3px solid var(--brand); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.step::before { counter-increment: s; content: "0" counter(s); font-weight: 800; color: var(--brand); display: block; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.band-strip { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.callout { background: var(--brand-soft); border-radius: var(--radius); padding: 18px 20px; color: var(--ink); }

/* ---------- tool pages ---------- */
.page-head { padding-top: 36px; padding-bottom: 18px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.tab { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 9px 14px; border-radius: 999px; font: 600 .92rem var(--font); cursor: pointer; text-decoration: none; }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; padding-bottom: 56px; }
@media (max-width: 980px) { .layout-2 { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 84px; }
@media (max-width: 980px) { .sticky { position: static; } }
.empty { text-align: center; padding: 44px 18px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; margin: 0 auto 12px; color: var(--line); }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0 18px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .25s; }

.result-top { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.gauge { width: 190px; flex: none; }
.band-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 5px 12px; border-radius: 999px; font-size: .9rem; }
.band-low { background: var(--low-soft); color: var(--low); }
.band-elevated { background: var(--mid-soft); color: var(--mid); }
.band-high { background: var(--high-soft); color: var(--high); }
.big-num { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.contrib { margin: 6px 0 0; padding: 0; list-style: none; }
.contrib li { display: grid; grid-template-columns: minmax(0, 1fr) 120px 58px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.contrib li:last-child { border-bottom: 0; }
.contrib .name small { display: block; color: var(--muted); font-size: .8rem; }
.contrib .bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 99px; }
.contrib .bar i { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.contrib .bar .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); }
.contrib .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.up { color: var(--high); } .down { color: var(--low); }
.actions { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.actions li { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 12px 14px; }
.actions li.p-high { border-left-color: var(--high); }
.actions li.p-medium { border-left-color: var(--mid); }
.actions li.p-low { border-left-color: var(--brand); }
.actions li.p-routine { border-left-color: var(--line); }
.actions b { display: block; margin-bottom: 2px; }
.actions span { color: var(--ink-2); font-size: .92rem; }
.note { font-size: .85rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.alert { border-radius: 10px; padding: 12px 14px; background: var(--high-soft); color: var(--high); font-weight: 500; margin-bottom: 14px; }

/* KDIGO heat map */
.heat { display: grid; grid-template-columns: 92px repeat(3, 1fr); gap: 3px; font-size: .8rem; }
.heat div { padding: 8px 6px; border-radius: 6px; text-align: center; }
.heat .h { background: var(--surface-2); font-weight: 700; color: var(--ink-2); }
.heat .c-low { background: #2f9e6a; color: #fff; }
.heat .c-moderate { background: #e6c14a; color: #3a2c00; }
.heat .c-high { background: #e2803a; color: #fff; }
.heat .c-very_high { background: #c0392b; color: #fff; }
.heat .on { outline: 3px solid var(--ink); outline-offset: -3px; font-weight: 800; transform: scale(1.04); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-2); font-weight: 700; color: var(--ink-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.best td { background: var(--brand-soft); font-weight: 600; }

/* perf */
.metric-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.metric b { display: block; font-size: 1.6rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric span { color: var(--muted); font-size: .82rem; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.chart svg text { fill: var(--muted); font: 11px var(--font); }
.chart .axis { stroke: var(--line); }
.chart .grid { stroke: var(--line); stroke-dasharray: 2 4; }
.chart .ref { stroke: var(--muted); stroke-dasharray: 4 4; }
.chart .series { fill: none; stroke: var(--brand); stroke-width: 2.4; }
.chart .series-2 { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.chart .area { fill: color-mix(in srgb, var(--brand) 14%, transparent); }
.chart .dot { fill: var(--brand); }
.cm { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 4px; font-size: .88rem; }
.cm div { padding: 14px 8px; text-align: center; border-radius: 8px; background: var(--surface-2); }
.cm .h { background: none; color: var(--muted); font-weight: 600; padding: 6px; }
.cm .tp, .cm .tn { background: var(--low-soft); color: var(--low); font-weight: 800; font-size: 1.2rem; }
.cm .fp, .cm .fn { background: var(--high-soft); color: var(--high); font-weight: 800; font-size: 1.2rem; }
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr 56px; gap: 10px; align-items: center; padding: 5px 0; font-size: .88rem; }
.bars .track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bars .track i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bars .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* batch */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 18px; text-align: center; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop.drag, .drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop input { display: none; }
.summary-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

/* toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 50; font-weight: 500; max-width: calc(100% - 32px); }

/* footer */
.footer { border-top: 1px solid var(--line); background: var(--surface); padding: 40px 0 24px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer ul a { color: var(--ink-2); text-decoration: none; font-size: .94rem; }
.footer ul a:hover { color: var(--brand); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.brand-sub { display: block; font-size: .72rem; color: var(--muted); letter-spacing: .02em; margin-top: -2px; font-weight: 500; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

/* legal + content pages */
.prose { max-width: 820px; }
.prose h2 { font-size: 1.3rem; margin-top: 1.8em; }
.prose h3 { font-size: 1.05rem; margin-top: 1.4em; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .35em; }
.prose .updated { color: var(--muted); font-size: .9rem; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }

/* contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 22px; align-items: start; padding-bottom: 56px; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.contact-item:last-child { border-bottom: 0; }
.contact-item .icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.contact-item .icon svg { width: 20px; height: 20px; }
.field textarea { width: 100%; min-height: 140px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: 1rem var(--font); resize: vertical; }
.field textarea:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 30%, transparent); }

/* cookie / storage notice */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 40; max-width: 560px; margin-left: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.consent p { margin: 0; flex: 1 1 260px; font-size: .9rem; color: var(--ink-2); }

.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.print-only { display: none; }
@media print {
  .topbar, .footer, .no-print, .btn, .tabs, form { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; color: #000; }
  .layout-2 { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .sticky { position: static; }
}
