/*
 * Witte Insights – Stylesheet
 *
 * Colours, radii and type follow docs/ui-referenz/README.md. The brand
 * colours live in the generated /assets/css/brand.css, which is loaded after
 * this file; the values here are the fallback used before an agency has saved
 * its branding.
 *
 * No <style> blocks and no inline styles are allowed (Content-Security-Policy).
 * The only exception is a style attribute for a computed value such as a bar
 * width, which is why the policy keeps style-src-attr.
 */

/* ---------------------------------------------------------------- Schrift */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/InterVariable.woff2') format('woff2-variations');
}

/* ------------------------------------------------------------- Variablen */

:root {
    /* Branding – wird von brand.css überschrieben */
    --color-primary: #B23C2A;
    --color-primary-hover: #8E2E20;
    --color-primary-text: #FFFFFF;
    --color-primary-soft: #F6E9E6;
    --color-primary-faint: #E3B2A7;
    --color-accent: #1D4E89;

    /* Neutraltöne – fest */
    --bg: #F6F2EC;
    --surface: #FFFFFF;
    --surface-sunken: #EDE6DB;
    --line: #E7E0D5;
    --line-inner: #EEE7DC;
    --line-strong: #CFC6B8;
    --track: #F0EAE0;

    --text: #1F1F1F;
    --text-soft: #3D3A35;
    --text-muted: #5F5A52;
    --text-small: #6B6B6B;

    /* Statusfarben */
    --positive: #1E6B23;
    --positive-bg: #E6F2E7;
    --negative: #B3261E;
    --negative-bg: #FBE7E5;
    --notice: #6B4700;
    --notice-bg: #FCF1DC;
    --info: #1D4E89;
    --info-bg: #E5EEF8;
    --demo: #5C4300;
    --demo-bg: #FFF7E0;
    --demo-line: #EBD9A6;
    --switch-on: #2E7D32;
    --switch-off: #A79F92;

    /* Form */
    --radius-card: 12px;
    --radius-control: 8px;
    --radius-pill: 999px;
    --tap: 44px;
    --gap: 16px;
    --gap-lg: 24px;
    --content-max: 1200px;
}

/* ------------------------------------------------------------ Grundlagen */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3, h4 {
    margin: 0;
    letter-spacing: -0.01em;
}

p {
    margin: 0;
}

a {
    color: var(--color-primary);
}

a:hover {
    color: var(--color-primary-hover);
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    font-weight: 600;
}

.skip-link:focus {
    left: 8px;
    top: 8px;
}

/* ----------------------------------------------------------------- Rahmen */

.app {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex: 1 1 240px;
    flex-direction: column;
    gap: 20px;
    padding: 20px 16px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.main {
    flex: 999 1 560px;
    min-width: 0;
    padding: 24px 32px 56px;
}

.wrap {
    display: flex;
    flex-direction: column;
    gap: var(--gap-lg);
    max-width: var(--content-max);
    margin: 0 auto;
}

@media (max-width: 760px) {
    .main {
        padding: 20px 16px 48px;
    }

    .sidebar {
        flex: 1 1 100%;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

/* -------------------------------------------------------------- Wortmarke */

.brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 12px;
}

.brand__logo {
    max-height: 40px;
    width: auto;
}

.brand__name {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brand__name em {
    color: var(--color-primary);
    font-style: normal;
}

.brand__claim {
    font-size: 12px;
    color: var(--text-small);
}

/* ------------------------------------------------------------- Navigation */

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nav__item {
    display: flex;
    /* Wie im Klickdummy: in der schmalen Seitenleiste eine Zeile je Eintrag,
       auf dem Handy brechen die Einträge mehrspaltig um. */
    flex: 1 1 150px;
    align-items: center;
    gap: 10px;
    min-height: var(--tap);
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.nav__item:hover {
    background: var(--surface-sunken);
    color: var(--text);
}

.nav__item[aria-current='page'] {
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
    font-weight: 600;
}

.nav__label {
    flex: 1 1 auto;
}

.nav__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--color-primary);
    color: var(--color-primary-text);
    font-size: 12px;
    font-weight: 700;
}

.nav-foot {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line-inner);
}

/* In dieser Spalte wäre die Flex-Basis von .nav__item eine Höhe von 150 px. */
.nav-foot .nav__item {
    flex: 0 0 auto;
}

/* ----------------------------------------------------------------- Kopf */

.page-head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
    align-items: flex-end;
    justify-content: space-between;
}

.page-head__main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.kicker {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-small);
}

.page-head h1 {
    font-size: 26px;
    font-weight: 700;
}

.page-head__meta {
    font-size: 14px;
    color: var(--text-muted);
}

.page-head__tools {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.statusline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    padding-bottom: var(--gap);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--text-small);
}

.view-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.view-title h2 {
    font-size: 28px;
    font-weight: 700;
}

.view-title p {
    font-size: 15px;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------- Karten */

.card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
}

.card__title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-small);
}

.card__foot {
    margin-top: auto;
    padding-top: 6px;
    font-size: 12px;
    color: var(--text-small);
}

.section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section__head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    justify-content: space-between;
}

.section__head h3 {
    font-size: 18px;
    font-weight: 700;
}

.grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: start;
}

.grid--kpi {
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.grid--tiles {
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* -------------------------------------------------------------- Kennzahlen */

.num {
    font-variant-numeric: tabular-nums;
}

.metric__value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.metric__value--large {
    font-size: 56px;
    line-height: 1;
}

.metric__unit {
    font-size: 13px;
    color: var(--text-muted);
}

.delta {
    font-size: 13px;
    font-weight: 600;
}

.delta--up {
    color: var(--positive);
}

.delta--down {
    color: var(--negative);
}

.delta--flat {
    color: var(--text-small);
}

.bar {
    height: 8px;
    overflow: hidden;
    background: var(--track);
    border-radius: 4px;
}

.bar__fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 4px;
}

.source {
    font-size: 12px;
    color: var(--text-small);
}

.step-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
    font-size: 12px;
    font-weight: 700;
}

/* ------------------------------------------------------------------ Chips */

.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--surface-sunken);
    color: var(--text-muted);
}

.chip--positive {
    background: var(--positive-bg);
    color: var(--positive);
}

.chip--negative {
    background: var(--negative-bg);
    color: var(--negative);
}

.chip--notice {
    background: var(--notice-bg);
    color: var(--notice);
}

.chip--info {
    background: var(--info-bg);
    color: var(--info);
}

/* ---------------------------------------------------------------- Hinweise */

.note {
    padding: 10px 14px;
    border-radius: var(--radius-control);
    font-size: 13px;
    line-height: 1.45;
}

.note--demo {
    background: var(--demo-bg);
    border: 1px solid var(--demo-line);
    color: var(--demo);
}

.note--info {
    background: var(--info-bg);
    color: var(--info);
}

.note--notice {
    background: var(--notice-bg);
    color: var(--notice);
}

.note--error {
    background: var(--negative-bg);
    color: var(--negative);
}

.note--success {
    background: var(--positive-bg);
    color: var(--positive);
}

/* Datenquelle fehlt: nie Nullen zeigen, sondern den Weg zur Einrichtung. */
.empty {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    padding: 20px;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-card);
}

.empty__text {
    font-size: 14px;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 0 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--surface-sunken);
    color: var(--text);
}

.btn--primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-primary-text);
}

.btn--primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: var(--color-primary-text);
}

.btn--danger {
    background: var(--negative);
    border-color: var(--negative);
    color: #FFFFFF;
}

.btn--link {
    min-height: var(--tap);
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font-size: 14px;
    text-decoration: underline;
}

.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* --------------------------------------------------------------- Formulare */

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-soft);
}

.hint {
    font-size: 13px;
    color: var(--text-muted);
}

.input,
.select,
.textarea {
    min-height: 48px;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    font-size: 16px;
}

.textarea {
    min-height: 120px;
    padding: 12px 14px;
    line-height: 1.5;
}

.select {
    font-weight: 600;
}

.error-text {
    font-size: 13px;
    color: var(--negative);
}

/* ----------------------------------------------------------------- Tabelle */

.table-scroll {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line-inner);
    vertical-align: top;
}

.table th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-small);
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

/* ------------------------------------------------------------------ Tabs */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--line);
}

.tabs__item {
    min-height: var(--tap);
    padding: 0 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.tabs__item[aria-current='page'] {
    border-bottom-color: var(--color-primary);
    color: var(--text);
}

/* ---------------------------------------------------------------- Diagramm */

.chart {
    display: block;
    width: 100%;
    height: auto;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
    font-size: 13px;
    color: var(--text-muted);
}

.chart-legend__swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.chart-labels {
    display: grid;
    font-size: 11px;
    color: var(--text-small);
    text-align: center;
}

/* -------------------------------------------------- Alarme und Aufgaben */

.alert-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-height: var(--tap);
    padding: 10px 12px;
    border: 1px solid var(--line-inner);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
}

.alert-row:hover {
    background: var(--surface-sunken);
    color: var(--text);
}

.task {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

/* Der Knopf ist 44 px groß, das Kästchen darin kleiner – so bleibt das
   Tippziel groß genug, ohne dass die Grafik klobig wirkt. */
.task__check {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    margin: -10px 0 0 -10px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.task__box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 2px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--color-primary-text);
}

.task__check[aria-pressed='true'] .task__box {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.task--done {
    color: var(--text-small);
    text-decoration: line-through;
}

.task-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.task-group .task {
    padding: 14px 0;
    border-top: 1px solid var(--line-inner);
}

.task-group .task:first-child {
    border-top: 0;
}

/* ----------------------------------------------- Einstellungen, Branding */

/* Farbfelder: der Wert kommt berechnet aus PHP, deshalb als style-Attribut.
   Die Content-Security-Policy erlaubt genau das über style-src-attr. */
.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.swatches__item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.swatches__chip {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
}

.log {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    line-height: 1.5;
}

.log code {
    overflow-wrap: anywhere;
}

input[type='color'] {
    width: 56px;
    height: var(--tap);
    padding: 2px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    cursor: pointer;
}

input[type='file'].input {
    padding: 10px 12px;
    line-height: 1.4;
}

input[type='checkbox'] {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--color-primary);
}

label.row {
    min-height: var(--tap);
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.card code {
    padding: 1px 5px;
    background: var(--surface-sunken);
    border-radius: 4px;
    font-size: 0.92em;
}

.card ul,
.card ol {
    margin: 0;
    padding-left: 20px;
}

/* ------------------------------------------------------- Installer, Login */

body.centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 16px;
}

.sheet {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: 100%;
    max-width: 720px;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.sheet h1 {
    font-size: 26px;
    font-weight: 700;
}

.sheet h2 {
    font-size: 15px;
}

.sheet ul,
.sheet ol {
    margin: 0;
    padding-left: 20px;
}

.sheet li + li {
    margin-top: 4px;
}

.sheet code {
    padding: 1px 5px;
    background: var(--surface-sunken);
    border-radius: 4px;
    font-size: 0.92em;
}

.sheet summary {
    min-height: var(--tap);
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
}

.code-block {
    padding: 12px 14px;
    overflow-wrap: anywhere;
    background: var(--surface-sunken);
    border-radius: var(--radius-control);
    font-size: 14px;
}

.code-block code {
    padding: 0;
    background: none;
}

.sheet__foot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 18px;
    border-top: 1px solid var(--line-inner);
    font-size: 14px;
}

.nav-foot form {
    margin: 0;
}

.nav-foot .nav__item {
    width: 100%;
}

.qr {
    align-self: flex-start;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
}

/* Prüfliste der Systemvoraussetzungen */

.checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.checklist__item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.45;
}

.checklist__dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 5px;
    background: var(--text-small);
}

.checklist__item--ok .checklist__dot {
    background: var(--positive);
}

.checklist__item--warn .checklist__dot {
    background: #B8860B;
}

.checklist__item--fail .checklist__dot {
    background: var(--negative);
}

.checklist__detail {
    display: block;
    color: var(--text-muted);
}

.checklist__item--fail .checklist__detail {
    color: var(--negative);
}

/* --------------------------------------------- Responsive Nachkorrekturen */

/* Dieser Block steht bewusst am Ende: Regeln mit gleicher Spezifität gewinnen
   nach Reihenfolge, und hier wird Basisverhalten von weiter oben überschrieben. */

@media (max-width: 760px) {
    /* Auf dem Handy steht die Navigation über dem Inhalt. Sie darf den
       Bildschirm nicht mit Leerraum füllen, deshalb kein margin-top: auto. */
    .nav-foot {
        margin-top: 0;
    }
}

@media print {
    .sidebar,
    .skip-link {
        display: none;
    }
}
