@font-face {
    font-family: "Manrope";
    src: url("fonts/manrope.woff2") format("woff2");
    font-weight: 200 800;
    font-display: swap;
}

:root {
    --c-bg: hsl(220 8% 91%);
    --c-surface: hsl(220 14% 99%);
    --c-surface-hover: hsl(220 10% 95%);
    --c-dark: hsl(220 7% 18%);
    --c-dark-2: hsl(220 6% 25%);
    --c-on-dark: hsl(220 10% 94%);
    --c-on-dark-muted: hsl(220 6% 70%);
    --c-text: hsl(220 12% 14%);
    --c-text-muted: hsl(220 6% 40%);
    --c-border: hsl(220 8% 80%);
    --c-accent: hsl(64 88% 58%);
    --c-on-accent: hsl(220 12% 12%);
    --c-focus: hsl(220 70% 45%);
    --c-success: hsl(150 40% 30%);
    --c-success-soft: hsl(150 40% 90%);
    --c-warning: hsl(32 70% 34%);
    --c-warning-soft: hsl(40 80% 90%);
    --c-error: hsl(0 55% 42%);
    --c-error-soft: hsl(0 70% 94%);
    --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
    --r-s: 12px; --r-m: 20px; --r-l: 28px; --r-pill: 999px;
    --ease: cubic-bezier(.2, .7, .2, 1);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --c-bg: hsl(220 7% 12%);
        --c-surface: hsl(220 7% 19%);
        --c-surface-hover: hsl(220 7% 23%);
        --c-dark: hsl(220 8% 7%);
        --c-dark-2: hsl(220 7% 14%);
        --c-text: hsl(220 10% 93%);
        --c-text-muted: hsl(220 6% 70%);
        --c-border: hsl(220 6% 32%);
        --c-accent: hsl(64 85% 60%);
        --c-on-accent: hsl(220 12% 10%);
        --c-focus: hsl(64 85% 60%);
        --c-success: hsl(150 45% 65%);
        --c-success-soft: hsl(150 30% 20%);
        --c-warning: hsl(38 80% 65%);
        --c-warning-soft: hsl(38 40% 20%);
        --c-error: hsl(0 70% 72%);
        --c-error-soft: hsl(0 35% 22%);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { scroll-padding-top: var(--s-7); }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
[v-cloak] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--c-text-muted); }
.small { font-size: .75rem; }
h1 { margin: 0; font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
h2 { margin: 0; font-size: 1.125rem; font-weight: 600; line-height: 1.2; }
svg.i { width: 18px; height: 18px; flex: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Basis-Komponenten */
.btn {
    border: 0; border-radius: var(--r-pill); padding: var(--s-2) var(--s-5); font-weight: 700; min-height: 44px;
    background: var(--c-accent); color: var(--c-on-accent); display: inline-flex; gap: var(--s-2); align-items: center; justify-content: center; white-space: nowrap;
    &:hover { background: color-mix(in oklch, var(--c-accent), black 8%); }
    &.ghost { background: transparent; border: 1px solid var(--c-border); color: var(--c-text); &:hover { background: var(--c-surface-hover); } }
    &.danger { background: transparent; border: 1px solid var(--c-error); color: var(--c-error); }
    &:disabled { opacity: .55; cursor: not-allowed; }
}
.ibtn {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--c-border); background: var(--c-surface);
    display: inline-grid; place-items: center; flex: none;
    &:hover { background: var(--c-surface-hover); }
}
.pill {
    border: 1px solid var(--c-border); background: var(--c-surface); border-radius: var(--r-pill);
    padding: var(--s-1) var(--s-4); font-size: .8125rem; font-weight: 600; min-height: 36px; white-space: nowrap;
    &[aria-pressed="true"] { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
}
.pills { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.card { background: var(--c-surface); border-radius: var(--r-l); padding: var(--s-4) var(--s-5); display: grid; gap: var(--s-3); align-content: start; }
.card-dark { background: var(--c-dark); color: var(--c-on-dark); border-radius: var(--r-l); padding: var(--s-5); display: grid; gap: var(--s-3); & .muted { color: var(--c-on-dark-muted); } }
.row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.badge {
    display: inline-flex; align-items: center; gap: var(--s-1); font-size: .75rem; font-weight: 600;
    padding: 2px var(--s-2); border-radius: var(--r-pill); white-space: nowrap;
    & svg.i { width: 12px; height: 12px; }
    &.ok { background: var(--c-success-soft); color: var(--c-success); }
    &.wait { background: var(--c-warning-soft); color: var(--c-warning); }
    &.over { background: var(--c-error-soft); color: var(--c-error); }
    &.neutral { background: var(--c-bg); color: var(--c-text); }
}
.bar {
    height: 8px; border-radius: var(--r-pill); background: var(--c-bg); overflow: hidden;
    & span { display: block; height: 100%; background: var(--c-text); border-radius: inherit; }
    &.over span { background: var(--c-error); }
}
.field {
    display: grid; gap: var(--s-1);
    & label { font-size: .75rem; font-weight: 600; color: var(--c-text-muted); }
    & input, & select, & textarea { border: 1px solid var(--c-border); background: var(--c-surface); border-radius: var(--r-s); padding: var(--s-2) var(--s-3); min-height: 44px; width: 100%; }
    & .hint { font-size: .75rem; color: var(--c-text-muted); }
    & .err { font-size: .75rem; color: var(--c-error); display: flex; gap: var(--s-1); align-items: center; }
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-3); }
.alert { border-radius: var(--r-s); padding: var(--s-3) var(--s-4); background: var(--c-error-soft); color: var(--c-error); display: flex; gap: var(--s-2); align-items: center; }
.skeleton { background: linear-gradient(90deg, var(--c-surface) 0%, var(--c-surface-hover) 50%, var(--c-surface) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r-m); min-height: 64px; }
@keyframes sk { to { background-position: -200% 0; } }

/* App-Shell */
.shell {
    display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh;
    @media (width < 860px) { grid-template-columns: minmax(0, 1fr); }
}
.side {
    background: var(--c-dark); color: var(--c-on-dark); padding: var(--s-5) var(--s-4); display: grid; align-content: start; gap: var(--s-1);
    position: sticky; top: 0; height: 100vh;
    & .brand { font-weight: 700; font-size: 1.125rem; padding: 0 var(--s-3) var(--s-5); display: flex; justify-content: space-between; align-items: center; }
    & a { text-decoration: none; color: var(--c-on-dark-muted); padding: var(--s-2) var(--s-3); border-radius: var(--r-pill); min-height: 44px; display: flex; gap: var(--s-3); align-items: center; font-weight: 600;
        &:hover { color: var(--c-on-dark); }
        &[aria-current="page"] { background: var(--c-accent); color: var(--c-on-accent); } }
    & .side_foot { margin-top: var(--s-6); display: grid; gap: var(--s-1); }
    & .side_foot button { background: none; border: 0; color: var(--c-on-dark-muted); text-align: left; padding: var(--s-2) var(--s-3); min-height: 40px; }
    @media (width < 860px) {
        position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s var(--ease);
        &.open { transform: none; }
    }
}
.topbar {
    display: none;
    @media (width < 860px) { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: var(--c-dark); color: var(--c-on-dark); position: sticky; top: 0; z-index: 10;
        & .ibtn { background: var(--c-dark-2); border-color: var(--c-dark-2); color: var(--c-on-dark); } }
}
.scrim { position: fixed; inset: 0; background: hsl(220 15% 5% / .5); z-index: 15; }
.main { padding: var(--s-6) var(--s-6) var(--s-7); display: grid; gap: var(--s-5); align-content: start; min-width: 0; max-width: 1200px;
    @media (width < 860px) { padding: var(--s-4); }
}
.head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; & .acts { display: flex; gap: var(--s-2); flex-wrap: wrap; } }

/* Übersicht */
.ov { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-4); align-items: start;
    @media (width < 1000px) { grid-template-columns: minmax(0, 1fr); } }
.gauge { position: relative; display: grid; justify-items: center;
    & svg { width: 100%; max-width: 280px; height: auto; }
    & .gauge_val { position: absolute; bottom: 4px; text-align: center; }
    & strong { font-size: 2rem; font-weight: 600; display: block; line-height: 1; } }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2);
    & div { background: var(--c-dark-2); border-radius: var(--r-m); padding: var(--s-3); }
    & strong { display: block; font-size: 1.0625rem; } }
.post { display: grid; gap: var(--s-2); padding: var(--s-3) 0; border-bottom: 1px solid var(--c-border);
    &:last-child { border-bottom: 0; }
    & .post_meta { display: flex; justify-content: space-between; gap: var(--s-2); font-size: .8125rem; color: var(--c-text-muted); flex-wrap: wrap; } }

/* Tabellen */
.tbl_wrap { overflow-x: auto; background: var(--c-surface); border-radius: var(--r-m); container-type: inline-size; }
.tbl {
    width: 100%; border-collapse: collapse; font-size: .875rem;
    & th { text-align: left; font-size: .75rem; color: var(--c-text-muted); font-weight: 600; padding: var(--s-3); border-bottom: 1px solid var(--c-border); white-space: nowrap; position: sticky; top: 0; background: var(--c-surface); }
    & th button { background: none; border: 0; padding: 0; font-weight: 600; color: inherit; }
    & td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-border); }
    & .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
    & .nw { white-space: nowrap; }
    & tbody tr:hover td { background: var(--c-surface-hover); }
    & tfoot td { font-weight: 700; border-bottom: 0; }
    & .acts { display: flex; gap: var(--s-1); justify-content: flex-end; }
    & .month td { background: var(--c-bg); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-text-muted); }
}
@container (width < 640px) {
    .tbl thead { display: none; }
    .tbl tr:not(.month) { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s-3); padding: var(--s-3); border-bottom: 1px solid var(--c-border); }
    .tbl tr:not(.month) td { border: 0; padding: 2px 0; }
    .tbl td[data-label]::before { content: attr(data-label) ": "; color: var(--c-text-muted); font-size: .75rem; }
}
.filters { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.search { display: flex; align-items: center; gap: var(--s-2); background: var(--c-surface); border-radius: var(--r-pill); padding: 0 var(--s-4); min-height: 44px; border: 1px solid var(--c-border); flex: 1 1 220px;
    & input { border: 0; background: transparent; flex: 1; min-width: 0; outline: none; } }
.select-pill { border: 1px solid var(--c-border); background: var(--c-surface); border-radius: var(--r-pill); padding: 0 var(--s-4); min-height: 44px; }

/* Dialoge */
dialog.dlg {
    border: 0; border-radius: var(--r-l); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--c-bg); color: var(--c-text);
    &::backdrop { background: hsl(220 15% 5% / .55); }
    & form, & .dlg_body { display: grid; gap: var(--s-4); padding: var(--s-5); }
    & .dlg_acts { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; }
    &.wide { width: min(880px, calc(100vw - 32px)); }
}
.preview { background: var(--c-dark); border-radius: var(--r-m); display: grid; place-items: center; min-height: 180px; overflow: hidden;
    & img { max-width: 100%; max-height: 60vh; display: block; }
    & iframe { width: 100%; height: 60vh; border: 0; background: white; } }
.drop { border: 2px dashed var(--c-border); border-radius: var(--r-m); padding: var(--s-5); text-align: center; display: grid; gap: var(--s-2); justify-items: center; background: var(--c-surface);
    &.over { border-color: var(--c-text); } }
.choice { display: grid; grid-template-columns: 48px 1fr; gap: var(--s-3); align-items: center; text-align: left; padding: var(--s-4); border-radius: var(--r-m); border: 0; background: var(--c-surface);
    & .ico { width: 48px; height: 48px; border-radius: 50%; background: var(--c-accent); color: var(--c-on-accent); display: grid; place-items: center; }
    &:hover { background: var(--c-surface-hover); } }

.toast { position: fixed; left: 50%; bottom: var(--s-5); transform: translateX(-50%); background: var(--c-dark); color: var(--c-on-dark); border-radius: var(--r-m); padding: var(--s-3) var(--s-4); display: flex; gap: var(--s-4); align-items: center; z-index: 50; max-width: calc(100vw - 32px);
    & button { background: none; border: 0; color: var(--c-accent); font-weight: 700; min-height: 36px; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s-4);
    & form { width: min(400px, 100%); display: grid; gap: var(--s-4); background: var(--c-surface); border-radius: var(--r-l); padding: var(--s-6) var(--s-5); }
    & .brand { background: var(--c-dark); color: var(--c-on-dark); border-radius: var(--r-m); padding: var(--s-4); font-weight: 700; font-size: 1.25rem; border-bottom: 4px solid var(--c-accent); } }
.pw { position: relative; & input { padding-right: 52px; } & button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; } }

/* Einstellungen */
.set { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); min-height: 48px; border-bottom: 1px solid var(--c-border); & span { overflow-wrap: anywhere; min-width: 0; } }
.code { font-family: ui-monospace, monospace; font-size: .75rem; background: var(--c-bg); border-radius: var(--r-s); padding: var(--s-2) var(--s-3); overflow-wrap: anywhere; }
.switch { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; min-height: 48px; & input { width: 22px; height: 22px; accent-color: var(--c-text); } }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
a.btn, a.pill, a.ibtn { text-decoration: none; color: inherit; }
a.btn:not(.ghost) { color: var(--c-on-accent); }
