:root,
html[data-theme="petrol"] {
    --accent: #066764;
    --accent-dark: #064e4c;
    --accent-soft: #e4f2ee;
    --accent-edge: #b7d9d3;
    --canvas: #f4f7f6;
    --rule: #d7e1df;
    --ink: #192e30;
    --muted: #506568;
    --danger: #98322c;
    color-scheme: light;
    font: 100%/1.5 "Inter", "Segoe UI", system-ui, sans-serif;
}

html[data-theme="indigo"] {
    --accent: #5143a4;
    --accent-dark: #372c76;
    --accent-soft: #f0edfc;
    --accent-edge: #cfc8ed;
    --canvas: #f6f5f9;
    --rule: #dcdbe5;
    --ink: #2b2838;
    --muted: #625e73;
}

html[data-theme="wald"] {
    --accent: #42683a;
    --accent-dark: #2d4d29;
    --accent-soft: #eaf2e6;
    --accent-edge: #c8dac1;
    --canvas: #f5f7f3;
    --rule: #dae1d6;
    --ink: #283126;
    --muted: #596953;
}

html[data-theme="schiefer"] {
    --accent: #3e586c;
    --accent-dark: #253e50;
    --accent-soft: #e6eef4;
    --accent-edge: #c2d3df;
    --canvas: #f3f5f7;
    --rule: #d8dfe4;
    --ink: #25303a;
    --muted: #566875;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
img, svg { max-width: 100%; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h1, h2, h3 { line-height: 1.18; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 3.4vw, 2.85rem); font-weight: 680; letter-spacing: -.045em; }
h2 { font-size: 1.28rem; font-weight: 680; letter-spacing: -.025em; }
h3 { font-size: 1.06rem; font-weight: 650; }
p:last-child { margin-bottom: 0; }
small, .muted { color: var(--muted); }
small { font-size: .875rem; }
hr { height: 1px; border: 0; margin: 1.5rem 0; background: var(--rule); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem 2rem;
    min-height: 4.5rem;
    padding: .8rem max(1.25rem, calc((100% - 78rem) / 2));
    background: white;
    border-bottom: 1px solid var(--rule);
}
.brand, .nav, .actions, .inline, .swatches { display: flex; align-items: center; gap: .65rem; }
.actions, .inline, .swatches, .nav { flex-wrap: wrap; }
.brand { color: var(--ink); font-size: 1.08rem; font-weight: 720; letter-spacing: -.03em; text-decoration: none; }
.brand img { max-width: 9rem; max-height: 2.4rem; width: auto; height: auto; object-fit: contain; }
.nav a, .nav button { padding: .5rem .75rem; border: 0; border-radius: .4rem; background: transparent; color: var(--muted); font-weight: 600; text-decoration: none; }
.nav a:hover, .nav button:hover, .nav a[aria-current="page"], .nav .active { background: var(--accent-soft); color: var(--accent-dark); }
main { width: min(78rem, calc(100% - 2.5rem)); margin: clamp(1.8rem, 4vw, 3.4rem) auto 4rem; }
.page-head { display: flex; gap: 1rem 2rem; flex-wrap: wrap; align-items: end; justify-content: space-between; margin-bottom: 1.6rem; }
.page-head h1 { margin-bottom: .15rem; }
.eyebrow { color: var(--accent); font-size: .81rem; font-weight: 720; letter-spacing: .09em; text-transform: uppercase; }
.panel, .stat, .table-wrap {
    min-width: 0;
    border: 1px solid var(--rule);
    border-radius: .8rem;
    background: white;
    box-shadow: 0 2px 6px rgb(26 47 48 / 3%);
}
.panel { padding: clamp(1rem, 2.5vw, 1.65rem); margin-block: 0 1.15rem; }
.panel > h2:first-child { margin-bottom: 1.1rem; }
.grid { display: grid; align-items: start; gap: 1.15rem 1.4rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.wide { grid-column: 1 / -1; }
.field { display: grid; align-content: start; gap: .36rem; min-width: 0; }
label, legend { color: var(--ink); font-size: .94rem; font-weight: 600; }
fieldset { min-width: 0; margin: 0 0 1.1rem; padding: 1rem; border: 1px solid var(--rule); border-radius: .55rem; }
legend { padding-inline: .35rem; }
input, select, textarea, button { font: inherit; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select, textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    padding: .55rem .72rem;
    border: 1px solid color-mix(in srgb, var(--ink) 32%, white);
    border-radius: .45rem;
    background-color: white;
    color: var(--ink);
    font-weight: 400;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
input:read-only:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { background-color: var(--canvas); }
select:not([multiple]) {
    appearance: none;
    padding-right: 2.45rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23546166' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .8rem center;
}
textarea { min-height: 5.2rem; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 1.12rem; height: 1.12rem; flex: none; margin: 0 .2rem 0 0; vertical-align: middle; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 500; }
button, .button, input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 2.65rem;
    padding: .55rem 1rem;
    border: 1px solid var(--accent);
    border-radius: .45rem;
    background: var(--accent);
    color: white;
    font-size: .94rem;
    font-weight: 650;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
}
button:hover, .button:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: white; }
.secondary { background: white; color: var(--accent-dark); border-color: var(--accent-edge); }
.secondary:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }
.danger { background: #fff7f5; color: var(--danger); border-color: #e7b5af; }
.danger:hover { background: var(--danger); color: white; border-color: var(--danger); }
button:disabled, input:disabled, select:disabled { opacity: .65; cursor: default; }
.grid + .actions, .field + .actions, form > .actions:last-child { margin-top: 1.2rem; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.filters .field { flex: 1 1 12rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .85rem; margin-bottom: 1.4rem; }
.stat { padding: .95rem 1.2rem; border-top: 3px solid var(--accent-edge); }
.stat strong { display: block; font-size: 1.65rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
th { background: var(--canvas); color: var(--muted); font-weight: 650; font-size: .875rem; white-space: nowrap; }
td { font-size: .96rem; }
td a { font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, white); }
.badge { display: inline-block; padding: .2rem .55rem; background: var(--accent-soft); border-radius: .35rem; color: var(--accent-dark); font-size: .84rem; font-weight: 650; white-space: nowrap; }
.notice, .error { padding: .8rem 1rem; margin-block: 0 1rem; border: 1px solid var(--accent-edge); border-inline-start: .25rem solid var(--accent); border-radius: .4rem; color: var(--accent-dark); background: var(--accent-soft); }
.error { border-color: #eac1bd; border-inline-start-color: var(--danger); color: #812c26; background: #fff3ef; }
.auth { max-width: 35rem; margin: clamp(2rem, 8vh, 6rem) auto; }
.auth h1 { font-size: clamp(1.75rem, 3.4vw, 2.25rem); }
.auth .field + .field { margin-top: .9rem; }
.hero-icon { display: inline-grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: .9rem; border-radius: .75rem; color: var(--accent-dark); background: var(--accent-soft); }
.hero-icon svg { width: 1.5rem; height: 1.5rem; }
details > summary { cursor: pointer; color: var(--accent-dark); font-weight: 650; }
details[open] > summary { margin-bottom: 1rem; }
.swatches label { display: flex; gap: .4rem; align-items: center; padding: .45rem .7rem; border: 1px solid var(--rule); border-radius: .45rem; cursor: pointer; }
.swatches label:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
code { overflow-wrap: anywhere; }
@media (max-width: 42rem) {
    .topbar { gap: .35rem .7rem; padding: .7rem 1rem; }
    main { width: calc(100% - 1.5rem); margin-top: 1.5rem; }
    .page-head { gap: .8rem; }
    .nav { gap: .15rem; }
    .nav a, .nav button { padding-inline: .5rem; }
    .panel, .table-wrap { border-radius: .55rem; }
    th, td { padding: .7rem; }
}
@media print {
    body, .panel, .stat { background: white; color: black; box-shadow: none; }
    .topbar, .actions, .filters, button { display: none; }
    main { width: 100%; margin: 0; }
    .table-wrap { overflow: visible; }
}
