/* CSS Variable & Theme Configuration */
:root {
    --bg: #f6f8f7;
    --card: #fff;
    --ink: #16302b;
    --mut: #5b6f6a;
    --line: #d5dfdb;
    --acc: #0f766e;
    --warn: #b45309;
    --bad: #b91c1c;
    --ok: #15803d;
    --soft: #e4f1ee;
    --code: #0f2a26;
    --codeink: #d8efe9;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e1917;
        --card: #152522;
        --ink: #e3efec;
        --mut: #95aca6;
        --line: #27403b;
        --acc: #2dd4bf;
        --warn: #f59e0b;
        --bad: #f87171;
        --ok: #4ade80;
        --soft: #193430;
        --code: #0a1412;
    }
}

:root[data-theme="dark"] {
    --bg: #0e1917;
    --card: #152522;
    --ink: #e3efec;
    --mut: #95aca6;
    --line: #27403b;
    --acc: #2dd4bf;
    --warn: #f59e0b;
    --bad: #f87171;
    --ok: #4ade80;
    --soft: #193430;
    --code: #0a1412;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 17px/1.65 "Source Sans 3", system-ui, sans-serif;
}

/* Layout Utilities */
.w {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.g2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Typography */
h1, h2, h3 {
    font-family: Bitter, Georgia, serif;
    line-height: 1.25;
    margin: 0 0 .5em;
}

h1 {
    font-size: clamp(28px, 5vw, 42px);
}

h2 {
    font-size: 26px;
    margin-top: 0;
}

h3 {
    font-size: 19px;
}

.lead {
    font-size: 19px;
    color: var(--mut);
    max-width: 62ch;
}

ul {
    padding-left: 20px;
    margin: .4em 0;
}

li {
    margin: .25em 0;
}

/* Structural Components */
header {
    padding: 56px 0 32px;
    border-bottom: 1px solid var(--line);
}

section {
    padding: 44px 0;
    border-bottom: 1px solid var(--line);
}

footer {
    padding: 32px 0 48px;
    color: var(--mut);
    font-size: 15px;
}

/* Elements & Cards */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.chip {
    background: var(--soft);
    color: var(--acc);
    border-radius: 99px;
    padding: 3px 12px;
    font-size: 15px;
    font-weight: 600;
}

.step {
    display: inline-block;
    background: var(--acc);
    color: var(--bg);
    font-weight: 600;
    border-radius: 6px;
    padding: 1px 10px;
    font-size: 14px;
    margin-bottom: 8px;
}

.note {
    background: var(--soft);
    border-left: 4px solid var(--acc);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 18px;
}

/* Tables */
.sc {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    margin: 14px 0;
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14.5px;
    white-space: nowrap;
}

th, td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    background: var(--soft);
    font-weight: 600;
}

td.b {
    background: color-mix(in srgb, var(--bad) 16%, transparent);
    color: var(--bad);
    font-weight: 600;
}

td.f {
    background: color-mix(in srgb, var(--ok) 16%, transparent);
    color: var(--ok);
    font-weight: 600;
}

tr.x td {
    text-decoration: line-through;
    opacity: .55;
}

/* Code Display */
pre {
    background: var(--code);
    color: var(--codeink);
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    font: 14px/1.55 ui-monospace, Menlo, Consolas, monospace;
    margin: 14px 0;
}

/* Dashboard & Visualization Components */
.kpi {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.kpi div {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
}

.kpi b {
    display: block;
    font: 700 24px Bitter, serif;
    color: var(--acc);
}

.kpi span {
    font-size: 14px;
    color: var(--mut);
}

.bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 15px;
}

.bar i {
    display: block;
    height: 16px;
    background: var(--acc);
    border-radius: 3px;
}

.bar em {
    font-style: normal;
    min-width: 110px;
}

.bar u {
    text-decoration: none;
    color: var(--mut);
}

svg text {
    fill: var(--mut);
    font-size: 12px;
}

/* Responsive Styles */
@media (max-width: 720px) {
    .g2 {
        grid-template-columns: 1fr;
    }
    .kpi {
        grid-template-columns: 1fr 1fr;
    }
}
