/*
 * slytica-Theme (§9.1.2): ausschließlich deccster-Theme-Token-Overrides
 * plus minimaler Layout-Glue für die Panel-Grids (§1.3) — Werte nur über
 * deccster-Variablen (--space-*, --size-*, --color-*).
 * Dark ist deccster-Default; das Light-Theme kommt über #theme-link.
 */

:root {
    --call-to-action-color: #2a8f6d;
    --call-to-action-dark-color: #1f6b52;
    --call-to-action-light-color: #3fae88;
    --call-to-action-lighter-color: #6cc7a8;
    /* von components/dashboard/dashboard.css referenziert, aber in keinem
       deccster-Theme definiert — auf vorhandenes Token mappen */
    --border-color: var(--grey-dark-color);
    /* dashboard.css definiert die Tile-Variablen nur unter [is=dashboard];
       wir nutzen die Tiles standalone (ohne Editier-Direktive) — daher die
       Komponenten-Defaults hier auf :root spiegeln (reine Token-Zuordnung) */
    --dashboard-tile-background: var(--content-box-color);
    --dashboard-tile-background-current: var(--dashboard-tile-background);
    --dashboard-tile-border: none;
    --dashboard-tile-border-radius: var(--border-radius);
    --dashboard-tile-shadow: var(--unshifted-thin-box-shadow);
    --dashboard-tile-padding: var(--space-s);
}

/* --- Redesign 1.1 (redesign/2026-10-14_0813/designsystem.md) ---
   Struktur und Farben bleiben; professioneller wird es durch IBM Plex mit
   Tabellenziffern, Haarlinien statt Schatten, ruhigere Flächen und Grün als
   einzige Signalfarbe. Umgesetzt als Token-Overrides der Bibliothek; wo eine
   Komponente keinen Token anbietet, steht die Abweichung weiter unten. */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 700; font-display: swap; src: url('../fonts/ibm-plex-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

/* Gilt für beide Themes: Schrift, Raster, Radien, Akzent */
:root {
    --primary-font: 'IBM Plex Sans', system-ui, sans-serif;
    --secondary-font: var(--primary-font);
    --mono-font: 'IBM Plex Mono', ui-monospace, monospace;
    /* Schriftskala: Basis 14 px (deccster: 14,4 px bei Gewicht 200) */
    --font-unit: 0.875rem;
    --font-weight: 400;
    --letter-spacing: 0;
    /* Kleintext (Beschreibungen, Labels, Metazeilen) 13 px statt 10,5 px */
    --font-size-s: 0.8125rem;

    --call-to-action-color: #2a9673;
    --call-to-action-dark-color: #237f62;
    --call-to-action-light-color: #34a983;
    --call-to-action-lighter-color: #5fcaa1;
    --success-color: #5fcaa1;
    --error-color: #e0574f;
    --warn-color: #d9a441;

    /* Radien: Segmente/Badges 4 · Felder/Buttons 6 · Karten 8 */
    --border-radius-s: 4px;
    --border-radius: 6px;
    --border-radius-m: 8px;
    --control-border-radius: 6px;
    --card-border-radius: 8px;
    --dashboard-tile-border-radius: 8px;
    --card-padding: var(--space-m);
    --dashboard-tile-padding: var(--space-m);
    --dashboard-tile-shadow: none;
    --card-shadow: none;
}

/* Dunkle Flächen und Linien des Entwurfs. Das Light-Theme (#theme-link mit href)
   behält die Bibliothekswerte. */
:root:not(:has(#theme-link[href])) {
    --background-color: #212121;
    --grey-darker-color: #212121;
    --content-box-color: #1a1a1a;
    --background-darker-color: #141414;
    --background-little-darker-color: #1a1a1a;
    --background-littel-lighter-color: #262626;
    --background-lighter-color: #2b2b2b;
    --background-more-lighter-color: #2b2b2b;
    --grey-dark-color: #2d2d2d;
    --foreground-color: #ebebe8;
    --foreground-medium-soft-color: #a4a4a0;
    --foreground-soft-color: #737370;
    --border: 1px solid #3b3b3b;
    --divider-border: 1px solid #2d2d2d;
    --border-lighter: 1px solid #2d2d2d;
}

/* Karten und Kacheln: Haarlinie statt Schatten (löst die rahmenlose Variante ab) */
[is='card'],
[is='dashboard-tile'] {
    border: 1px solid var(--grey-dark-color);
    box-shadow: none;
}

/* Ausnahme nur für Preisseite und Preis-Teaser der Marketing-Site: Die Regel
   oben steht außerhalb der Layer und würde die Hervorhebung des empfohlenen
   Tarifs (deccster landingpage.css, has~=featured-plan) überschreiben
   (Design-Konzept T1, Lücke L5). revert-layer gibt Rahmen und Ring an die
   Bibliothek zurück; die App nutzt diese Bausteine nicht. */
:is([is='pricing-table'], [is='feature-compare']) [is='card'][has~='featured-plan'] {
    border: revert-layer;
    box-shadow: revert-layer;
}

code, kbd, pre {
    font-family: var(--mono-font);
    font-size: 0.92em;
}

/* Zahlen in Kennzahlen, Listen und Tabellen untereinander bündig */
[is='dashboard-metric-value'],
[data-role='count'],
[data-role='metric-value'],
td {
    font-variant-numeric: tabular-nums;
}

/* Seitennavigation: feste Breite, Haarlinie zum Inhalt, aktiver Punkt mit
   hellerem Grund und grüner Markierung am linken Rand */
[is='side-navigation'] {
    width: 232px;
    border-right: 1px solid var(--grey-dark-color);
    padding-top: var(--space-s);
}

[is='side-navigation'] a {
    position: relative;
    color: var(--foreground-medium-soft-color);
    font-size: var(--font-size-sm);
    padding: var(--space-xxs) var(--space-xs);
}

[is='side-navigation'] a:hover {
    color: var(--foreground-color);
    background-color: var(--background-lighter-color);
}

[is='side-navigation'] a[now~='active'] {
    font-weight: 500;
    color: var(--foreground-color);
    background-color: var(--background-lighter-color);
}

[is='side-navigation'] a[now~='active']::after {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-xs) - 4px);
    top: var(--space-xxs);
    bottom: var(--space-xxs);
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--call-to-action-color);
}

[is='side-navigation'] a[now~='active'][has*='-icon']::before {
    color: var(--call-to-action-lighter-color);
}

/* Zurück-Link und Name der Website über den Unterseiten (js/shell.js) */
[is='side-navigation'] [data-role='nav-back'] {
    font-size: var(--font-size-s);
}

[is='side-navigation'] [data-role='site-name'] {
    padding: var(--space-s) var(--space-xs) var(--space-xs);
    font-weight: 600;
    color: var(--foreground-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Kopfzeile: Seitentitel 20 px halbfett */
[is='app-navigation'] > [is='app-navigation-title'] {
    font-size: var(--font-size-ml);
    font-weight: 600;
}

/* Kennzahl-Kacheln: leises Label, große ruhige Zahl, Metazeile darunter */
[is='dashboard-tile']:has([is='dashboard-metric']) [is='dashboard-tile-title'] {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--foreground-medium-soft-color);
}

[is='dashboard-metric-value'] {
    font-size: 2.75rem;
    font-weight: 500;
    line-height: 1.1;
}

[is='dashboard-metric-label'] {
    font-size: var(--font-size-s);
    color: var(--foreground-soft-color);
}

/* Panel-Titel (Verlauf, Seiten, Quellen …) */
[is='dashboard-tile']:not(:has([is='dashboard-metric'])) [is='dashboard-tile-title'] {
    font-size: 1rem;
    font-weight: 600;
}

/* Segment-Umschalter: Rahmen um die Gruppe, aktive Option grün mit kleinem Radius */
[is='button-tabs'] {
    --button-tabs-background: var(--background-darker-color);
    padding: 2px;
    gap: 2px;
    border: 1px solid var(--grey-dark-color);
}

[is='button-tabs'] > [is='button'],
[is='button-tabs'] > button {
    border-radius: var(--border-radius-s) !important;
    font-size: var(--font-size-s);
    padding: var(--space-xxs) var(--space-s);
    color: var(--foreground-medium-soft-color);
}

[is='button-tabs'] > [now~='active'] {
    color: var(--call-to-action-text-color);
    font-weight: 500;
}

/* Hinweisband: leiser Grund mit Markierung links statt heller Fläche */
[is='message'][has~='info-style'] {
    background: var(--background-littel-lighter-color);
    border-left: 2px solid var(--foreground-soft-color);
    border-radius: var(--border-radius-s);
    font-size: var(--font-size-s);
}

/* Tabs: Linie unter dem Streifen. [is=tabs] umschließt auch die Panels, deshalb
   trägt das Panel die Linie als oberen Rand. */
/* Gilt nicht für den Pillen-Umschalter in der App-Navigation (Websites/Views) */
:not([is='app-navigation-tabs']) > [is='tabs'] {
    padding-bottom: 0;
    gap: 0 var(--space-m);
}

:not([is='app-navigation-tabs']) > [is='tabs'] > [is='tab'] {
    font-size: var(--font-size-sm);
    padding: var(--space-xs) 0;
}

/* Pillen-Umschalter Websites/Views: Haarlinie um die Gruppe */
[is='app-navigation-tabs'] > [is='tabs'] {
    border: 1px solid var(--grey-dark-color);
    padding: 2px;
}

[is='tabs'] > [is='tab-panel'] {
    border-top: 1px solid var(--grey-dark-color);
    padding: var(--space-m) 0 0;
}

[is='tabs'] > [is='tab'][data-role='danger-tab'] {
    color: var(--error-color);
    border-bottom-color: transparent;
}

[is='tabs'] > [is='tab'][data-role='danger-tab'][now~='active'] {
    border-bottom-color: var(--error-color);
}

/* Fußzeile der App-Seiten (js/shell.js): leise Zeile am unteren Rand; der
   Inhalt wird dafür zur Spalte über mindestens die Fensterhöhe */
[is='content']:has(> [data-role='app-footer']) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

[is='footer'][data-role='app-footer'] {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding: var(--space-m) 0 0;
    border-top: 1px solid var(--grey-dark-color);
    background: none;
    font-size: var(--font-size-s);
    color: var(--foreground-soft-color);
}

[is='footer'][data-role='app-footer'] a {
    color: inherit;
}

/* Raster und Kacheln rahmenlos (User-Feedback). [is=dashboard] setzt diese beiden
   Token als Komponenten-Default auf sich selbst; der :root-Wert oben greift daher
   nur für die standalone genutzten Kacheln und muss hier wiederholt werden. */
[is='dashboard'] {
    --dashboard-grid-border: none;
    --dashboard-tile-border: none;
    /* Redesign 1.1: Raster bündig mit Zeitraumleiste und Kopfzeile */
    --dashboard-padding: var(--space-s) 0 0;
}

/* Seiten, deren Leiste von der App-Shell kommt, schalten die Leiste ab, die
   [is=dashboard] selbst rendert: Die Toolbar soll AUSSERHALB der Komponente stehen,
   damit sie die Abstände des Rasters nicht beeinflusst (User-Feedback). Die
   Komponente bietet dafür keinen Schalter, deshalb hier als Theme-Abweichung. */
[is='dashboard'][data-navigation='shell'] > [is='app-navigation'] {
    display: none;
}

/* Import/Export der Dashboard-KONFIGURATION (JSON) bringt [is=dashboard] in seiner
   Leiste immer mit. In dieser App tragen die Leisten stattdessen Teilen und
   CSV-Export; zwei Paare mit demselben Symbolpaar sind Duplikate (User-Feedback).
   Die Komponente bietet keinen Schalter dafür, deshalb hier ausgeblendet. */
[is='dashboard'] > [is='app-navigation'] [data-action='dashboard-import-json'],
[is='dashboard'] > [is='app-navigation'] [data-action='dashboard-export-json'] {
    display: none;
}

/* --- App-Navigation: rahmenlos (User-Feedback) --- */

/* [is=app-navigation] bringt ab Werk einen 1px-Rahmen mit; die Komponente bietet
   dafür keinen Token, deshalb hier als Theme-Abweichung. Gilt für alle Leisten,
   auch die, die [is=dashboard] selbst rendert. */
[is='app-navigation'] {
    border: none;
}

/* Aktionskachel „Website hinzufügen": hintergrundlos mit gestricheltem Rahmen und
   Beschriftung eine Stufe über der Standardgröße (User-Feedback: `--font-size-m`;
   `--font-size-l` war zu groß). Der Rahmen kommt aus der Ghost-Variablen des
   Buttons; die Schriftgröße vergrößert Text und Icon gemeinsam, weil das Icon in
   der Bibliothek 1 em misst. */
[data-role='add-website'] {
    --button-ghost-border: 2px dashed var(--border-color);
    font-size: var(--font-size-m);
    gap: var(--space-xs);
}

[data-role='add-website']:hover {
    --button-ghost-border: 2px dashed var(--call-to-action-color);
    color: var(--call-to-action-color);
}

/* --- Mobil-Navigation (bis 640 px) --- */

/* Die Tabs der Übersichtsebene schweben im Mobil-Header der Bibliothek unterhalb
   der Kopfzeile. Außerhalb von [is=app-frame] bekommt der Inhalt dafür keinen
   Platz — ohne diesen Abstand deckt der Tab-Streifen die erste Kachel ab. Die
   Höhe entspricht dem Tab-Streifen (--size-l) samt seinem Abstand (--space-xs). */
@media (max-width: 640px) {
    [is='content']:has([is='app-navigation-tabs'] [is='tab']) {
        padding-top: calc(var(--size-l) + 3 * var(--space-xs));
    }
}

/* Auf der Übersichtsebene hat die Mobil-Kopfzeile keinen Menü-Schalter. Zwischen
   641 und 800 px (Kopfzeile schon sichtbar, App-Navigation noch nicht darüber
   gelegt) bliebe sie deshalb als leere Leiste stehen. */
@media (min-width: 641px) {
    [is='mobile-navigation-header']:not(:has(#side-nav-toggle)) {
        display: none;
    }
}

/* --- Websites-Übersicht: die ganze Projekt-Kachel ist ein Link --- */

/* [is=dashboard-tile] kennt keinen Link-Modus. Der Link im Kachelinhalt spannt sich
   deshalb über die gesamte Kachel — die ist bereits `position: relative`. Hover und
   Fokus greifen über :has() auf die Kachel durch und nutzen deren eigene Variablen,
   damit sie wie der Auswahl-Zustand der Komponente aussehen. */
[data-role='tile-link'] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xxs);
    color: inherit;
    text-decoration: none;
}

[data-role='tile-link']::after {
    content: '';
    position: absolute;
    inset: 0;
}

[is='dashboard-tile']:has([data-role='tile-link']:hover) {
    --dashboard-tile-background-current: var(--background-lighter-color);
}

/* Der Tastaturfokus gehört auf die ganze Kachel, nicht auf den schmalen Textbereich
   des Links — deshalb dort keine Outline und stattdessen dieselbe Markierung, die
   die Komponente für ausgewählte Kacheln verwendet. */
[data-role='tile-link']:focus-visible {
    outline: none;
}

[is='dashboard-tile']:has([data-role='tile-link']:focus-visible) {
    box-shadow: 0 0 0 2px var(--call-to-action-color), var(--dashboard-tile-shadow);
}

/* --- Layout-Glue: Grid-Anordnung der Dashboard-Panels --- */

[data-layout='metrics'] {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-m);
}

[data-layout='metrics'] [is='dashboard-tile'] {
    min-height: var(--size-xxxl);
}

[data-layout='panels'] {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-m);
    align-items: start;
}

[data-layout='toolbar'] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-s);
}

/* Controls in der Toolbar nicht auf Formularbreite dehnen */
[data-layout='toolbar'] input[is='input'],
[data-layout='toolbar'] select[is='select'],
/* type=date wird von der Bibliothek in ein [is=date-input] gewickelt, das ohne
   diese Zeile die volle Zeilenbreite belegt und die Werkzeugleiste umbricht */
[data-layout='toolbar'] [is='date-input'] {
    width: auto;
}


/* Aktionskachel: das Bedienelement füllt den Inhalt der Kachel
   (z. B. „Website hinzufügen" auf der Websites-Übersicht) */
[data-layout='fill'] {
    display: flex;
    height: 100%;
}

[data-layout='fill'] > * {
    flex: 1;
}

[data-layout='center-card'] {
    max-width: calc(var(--size-xxxxl) * 2);
    margin: var(--space-xl) auto;
    padding-inline: var(--space-m);
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
}

[data-layout='center-card'][data-width='wide'] {
    max-width: calc(var(--size-xxxxl) * 3);
}

[data-layout='row'] {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    flex: 0 0 auto;
    white-space: nowrap;
}

[data-layout='spread'] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
}

/* Ohne zweites (ausgeblendetes) Panel nimmt das erste die volle Breite ein
   (Events-Liste ohne gewähltes Event) */
[data-layout='panels']:has(> [hidden]) {
    grid-template-columns: 1fr;
}

@media (max-width: 900px) {
    [data-layout='metrics'] { grid-template-columns: repeat(2, 1fr); }
    [data-layout='panels'] { grid-template-columns: 1fr; }
}

/* Raster-Auswahl des Verlauf-Charts: Button-Tabs rechts in der Kachel-Kopfzeile
   (User-Feedback). Die Kopfzeile ist ein space-between-Flex aus Titel und
   Kachel-Aktionen; `margin-left: auto` schiebt die Tabs an den rechten Rand. */
[data-role='granularity-tabs'],
[is='dashboard-tile-header'] > [data-role='panel-tabs'] {
    margin-left: auto;
    flex: 0 0 auto;
}

/* Außerhalb des Bearbeitungsmodus sind die Kachel-Aktionen unsichtbar, die
   Bibliothek hält ihren Platz aber frei (opacity statt display). Das drückt die
   Tabs von der Außenkante weg und kürzt in schmalen Kacheln den Titel, obwohl
   Platz da wäre (bei 1001 px Fensterbreite blieben 35 von 115 px für den Titel). */
[is='dashboard']:not([now~='editing']) [is='dashboard-tile-actions'] {
    display: none;
}

/* Tab-Streifen der Listen-Panels von der Liste absetzen (User-Feedback: zwischen
   Button-Tabs und Liste fehlte der Abstand) */
[data-panel-index] > [data-role='panel-tabs'] {
    margin-bottom: var(--space-s);
}

/* ListPanel-Zeilen: klickbar, Anteilsbalken über Theme-Farbe */
[data-role='list-row'] {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: var(--space-s);
    padding: var(--space-xxs) var(--space-xs);
    border-radius: var(--border-radius-s);
    cursor: pointer;
    overflow: hidden;
}

[data-role='list-row']:hover {
    background: var(--background-lighter-color);
}

[data-role='list-row'] > [data-role='bar'] {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--call-to-action-color);
    opacity: 0.18;
    border-radius: var(--border-radius-s);
    pointer-events: none;
}

[data-role='list-row'] > [data-role='label'] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* margin-left: auto hält die Zahl rechtsbündig, auch wenn dahinter noch ein
   Icon-Button steht (space-between setzte sie sonst in die Zeilenmitte). */
[data-role='list-row'] > [data-role='count'] {
    color: var(--foreground-soft-color);
    flex-shrink: 0;
    margin-left: auto;
}

[data-role='list-row'] > [is='icon-button'] {
    flex-shrink: 0;
}

/* Link-Icon der Seitenliste: leise wie die Zahl, damit es nicht mit den Daten konkurriert */
[data-role='list-row'] > a[is='icon-button'] {
    --icon-button-color: var(--foreground-soft-color);
    text-decoration: none;
}

[data-role='list-row'] > a[is='icon-button']:hover {
    --icon-button-color: var(--foreground-color);
}

/* Charts global ohne eigene Fläche: nur der Kachel-/Seitenhintergrund ist sichtbar
   (Token-Override der Bibliothek, charts.css setzt Hintergrund und Rahmen). */
[is$='-chart'] {
    --chart-background: transparent;
    --chart-border-color: transparent;
    /* Gitter und Achsen: Bibliotheks-Default ist auf dunklem Grund unsichtbar */
    --chart-grid-color: var(--grey-dark-color);
    --chart-axis-color: var(--grey-dark-color);
}

/* Chart-Palette in der Primärfarbe (statt der Bibliotheks-Skala mit Rot als
   Serie 1). Auch auf :root, damit die Legendenmarker dieselben Farben nutzen;
   benachbarte Serien wechseln zwischen hell und dunkel. */
:root,
[is$='-chart'] {
    --chart-series-1-color: var(--call-to-action-color);
    --chart-series-2-color: var(--call-to-action-lighter-color);
    --chart-series-3-color: var(--call-to-action-dark-color);
    --chart-series-4-color: var(--call-to-action-light-color);
    --chart-series-5-color: color-mix(in srgb, var(--call-to-action-color) 55%, var(--background-color));
    --chart-series-6-color: color-mix(in srgb, var(--call-to-action-lighter-color) 55%, var(--background-color));
    --chart-series-7-color: color-mix(in srgb, var(--call-to-action-color) 30%, var(--background-color));
}

/* Kuchendiagramm-Panels (Geräte, Bildschirmgrößen): Chart über die volle Breite,
   die In-Segment-Beschriftung entfällt zugunsten der Legende darunter. */
[data-role='pie-chart'] {
    --chart-width: 100%;
    --chart-height: 250px;
    --chart-padding: 0;
    --pie-label-radius: 0;
}

/* Balkendiagramm-Panels (Geräte): volle Breite, gleiche Höhe wie die Kuchendiagramme */
[data-role='bar-chart'] {
    --chart-width: 100%;
    --chart-height: 250px;
}

/* Länderkarte füllt die Kachel wie die Kuchendiagramme: volle Inhaltshöhe, kein
   Innenabstand; die Stufen-Legende zeichnet die Komponente selbst darunter. */
[data-role='country-map'] {
    --chart-height: 310px;
    --chart-padding: 0;
}

/* Einzelnes Segment als zwei Hälften (siehe renderPie) — beide in Serie 1 */
[data-role='pie-chart'][data-single] {
    --pie-2-background: var(--pie-1-background);
}

/* Legende unter dem Chart: Einträge nebeneinander, brechen responsiv um */
[data-role='pie-legend'] {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xs) var(--space-m);
}

[data-role='legend-item'] {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xxs);
    padding: var(--space-xxs) var(--space-xs);
    border-radius: var(--border-radius-s);
    cursor: pointer;
}

[data-role='legend-item']:hover {
    background: var(--background-lighter-color);
}

[data-role='legend-item'] > [data-role='count'] {
    color: var(--foreground-soft-color);
}

/* Farbmarker der Legende: dieselbe Serienfarbe wie das Segment (Palette oben) */
[data-role='legend-marker'] {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--chart-series-1-color);
}
[data-role='legend-marker'][data-series='2'] { background: var(--chart-series-2-color); }
[data-role='legend-marker'][data-series='3'] { background: var(--chart-series-3-color); }
[data-role='legend-marker'][data-series='4'] { background: var(--chart-series-4-color); }
[data-role='legend-marker'][data-series='5'] { background: var(--chart-series-5-color); }
[data-role='legend-marker'][data-series='6'] { background: var(--chart-series-6-color); }
[data-role='legend-marker'][data-series='7'] { background: var(--chart-series-7-color); }

/* MetricCard-Inhalte (websites.html; Dashboard nutzt [is=dashboard-metric-*]) */
[data-role='metric-value'] {
    font-size: var(--font-size-l);
    color: var(--foreground-color);
}

[data-role='metric-label'] {
    color: var(--foreground-soft-color);
    font-size: var(--font-size-s);
}

[data-role='delta-up'] { color: var(--success-color); font-size: var(--font-size-s); }
[data-role='delta-down'] { color: var(--error-color); font-size: var(--font-size-s); }
[data-role='delta-neutral'] { color: var(--foreground-soft-color); font-size: var(--font-size-s); }

/* Live-Kachel: grüner Punkt vor der Beschriftung signalisiert die laufende
   Aktualisierung (nicht „Besucher vorhanden"). */
[data-role='live-metric'] [is='dashboard-metric-label'] {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xxs);
}

[data-role='live-dot'] {
    width: var(--space-xs);
    height: var(--space-xs);
    border-radius: 50%;
    background: var(--success-color);
}


/* --- Redesign 1.1: Inhalte der Karten --- */

/* Inline-Code als ruhiger Chip (Event-Namen, Pfade, Attribute) */
:not(pre) > code {
    padding: 1px var(--space-xxs);
    border-radius: var(--border-radius-s);
    background: var(--background-darker-color);
    border: 1px solid var(--grey-dark-color);
}

/* Schreibgeschützte Textfelder zeigen in dieser App Code (Snippets, DECISIONS #22a) */
[is='textarea'][readonly] {
    font-family: var(--mono-font);
    font-size: var(--font-size-s);
}

/* Kartenkopf: Titel 16 px halbfett, Beschreibung darunter */
[data-role='card-head'] {
    display: flex;
    flex-direction: column;
    gap: var(--space-xxs);
    min-width: 0;
}

[data-role='card-head'] > strong {
    font-size: 1rem;
    font-weight: 600;
}

[data-role='card-head'] > [is='small-text'] {
    color: var(--foreground-medium-soft-color);
    max-width: 60ch;
}

/* Unterabschnitt einer Karte, durch eine Haarlinie abgesetzt */
[data-layout='section'] {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
    padding-top: var(--space-m);
    border-top: 1px solid var(--grey-dark-color);
}

/* Optionen und Felder in zwei Spalten */
[data-layout='columns'] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xs) var(--space-l);
}

/* Feld mit Beschriftung links (Hostname-Override) */
[data-layout='field-row'] {
    display: grid;
    grid-template-columns: 16rem minmax(0, 26rem);
    align-items: center;
    gap: var(--space-m);
    margin-top: var(--space-m);
}

/* Abschnitt mit Titel/Beschreibung links und Bedienung rechts (Events) */
[data-layout='split-section'] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: var(--space-l);
    padding-bottom: var(--space-m);
    border-bottom: 1px solid var(--grey-dark-color);
}

[data-layout='split-section']:has(+ [is='button-row']) {
    padding-bottom: 0;
    border-bottom: none;
}

/* Toggle mit Beschreibung darunter */
[data-role='option-text'] {
    display: inline-flex;
    flex-direction: column;
}

[data-role='option-text'] > [is='small-text'] {
    color: var(--foreground-soft-color);
}

/* Einzelne Textfelder nicht über die ganze Kartenbreite ziehen */
#settings-tabs [is='form-row'] > [is='input'],
#settings-tabs [data-layout='toolbar'] > [is='input'],
#settings-tabs [data-layout='row'] > [is='input'] {
    max-width: 35rem;
}

#settings-tabs [data-layout='toolbar'] > [is='input'],
#settings-tabs [data-layout='spread'] [data-layout='row'] > [is='input'] {
    width: 17.5rem;
}

/* Fußzeile einer Karte: Speichern-Zeile rechtsbündig mit Trennlinie */
[is='card'] [is='button-row']:last-child {
    padding-top: var(--space-m);
    margin-top: var(--space-xs);
    border-top: 1px solid var(--grey-dark-color);
}

/* Leerzustand einer Liste: zentriert und leise */
[data-role='empty'] {
    display: block;
    padding: var(--space-l) 0;
    text-align: center;
    color: var(--foreground-soft-color);
}

/* Schrittliste (Ad-Blocker-Bypass): Nummer im Kreis, Titel, Text; Haarlinien */
[data-role='steps'] {
    counter-reset: step;
    margin: 0;
    border-top: 1px solid var(--grey-dark-color);
}

[data-role='steps'] > div {
    counter-increment: step;
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    gap: var(--space-m);
    margin: 0;
    padding: var(--space-s) 0;
    border-bottom: 1px solid var(--grey-dark-color);
}

[data-role='steps'] dt {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    font-weight: 600;
}

[data-role='steps'] dt::before {
    content: counter(step);
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    font-size: var(--font-size-s);
    font-weight: 500;
    color: var(--call-to-action-lighter-color);
}

[data-role='steps'] dd {
    margin: 0;
    color: var(--foreground-medium-soft-color);
}

/* Danger Zone: Karten mit roter Haarlinie, zerstörende Aktionen rot umrandet */
[data-role='danger-card'] {
    border-color: color-mix(in srgb, var(--error-color) 35%, transparent);
}

[is='button'][has~='ghost-style'][has~='error-color'] {
    --button-ghost-border: 1px solid var(--error-color);
}

[is='button'][has~='ghost-style'][has~='error-color']:hover {
    background: color-mix(in srgb, var(--error-color) 12%, transparent);
}

/* Nebenaktion (ghost-style) mit sichtbarer Kontur wie im Entwurf */
[is='button'][has~='ghost-style']:not([has~='error-color'], [data-role='add-website']) {
    --button-ghost-border: var(--border);
}

/* --- Cookie-Banner (DECISIONS.md #43) --- */

/* Editor links, Vorschau rechts (mitlaufend) */
[data-layout='banner-editor'] {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--space-l);
    align-items: start;
}

[data-role='banner-preview-column'] {
    position: sticky;
    top: var(--space-m);
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}

/* Angedeutete Website als Bühne der Vorschau; das Banner liegt absolut darin */
[data-role='banner-preview'] {
    position: relative;
    min-height: 26rem;
    overflow: hidden;
    border: 1px solid var(--grey-dark-color);
    border-radius: var(--border-radius);
    background:
        linear-gradient(var(--grey-dark-color), var(--grey-dark-color)) 1.5rem 1.5rem / 40% 0.75rem no-repeat,
        repeating-linear-gradient(to bottom, transparent 0 1.25rem, var(--background-darker-color) 1.25rem 1.75rem) 1.5rem 3.5rem / calc(100% - 3rem) 9rem no-repeat,
        var(--background-color);
}

/* Statuszeile „Cookie-Banner: wird angezeigt …" */
[data-role='consent-status'] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin: 0;
}

[data-role='consent-status']:empty,
[data-role='consent-hint']:empty {
    display: none;
}

/* Zustandspunkt vor Statuszeile und Funktionsliste: grün = Banner/Funktion aktiv */
[data-role='consent-status']::before,
[data-role='consent-features'] > li::before {
    content: '';
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--foreground-soft-color);
}

[data-role='consent-status'][data-state='on']::before,
[data-role='consent-features'] > li[data-state='on']::before {
    background: var(--success-color);
}

/* Gewählte Sprache mit Entfernen-Button */
[data-role='language-pill'] {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xxs);
    min-height: 2rem;
    padding: 0 var(--space-xxs) 0 var(--space-s);
    border: 1px solid var(--grey-dark-color);
    border-radius: 999px;
}

[data-role='language-pill']:not(:has(button)) {
    padding-right: var(--space-s);
}

/* Hinweis an einer einwilligungspflichtigen Einstellung */
[data-role='consent-hint'] {
    margin: 0;
    padding: var(--space-xs) var(--space-s);
    border-left: 3px solid var(--call-to-action-color);
    background: var(--background-darker-color);
    font-size: var(--font-size-s);
}

[data-role='consent-hint'][data-state='warn'] {
    border-left-color: var(--warn-color);
}

[data-role='consent-features'] {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin: 0;
    padding: 0;
    list-style: none;
}

[data-role='consent-features'] > li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

#banner-languages {
    flex-wrap: wrap;
    gap: var(--space-xs);
}

@media (max-width: 1100px) {
    [data-layout='banner-editor'] {
        grid-template-columns: 1fr;
    }

    [data-role='banner-preview-column'] {
        position: static;
    }
}

@media (max-width: 900px) {
    [data-layout='columns'],
    [data-layout='split-section'],
    [data-layout='field-row'] {
        grid-template-columns: 1fr;
    }

    [data-role='steps'] > div {
        grid-template-columns: 1fr;
        gap: var(--space-xxs);
    }
}

/* Live-Badge der Website-Karten: grüne Tönung mit Punkt */
[is='chip'][data-live] {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xxs);
    margin-top: auto;
    padding: 2px var(--space-xs);
    border-radius: var(--border-radius-s);
    background: color-mix(in srgb, var(--call-to-action-color) 14%, transparent);
    color: var(--call-to-action-lighter-color);
    font-size: var(--font-size-s);
}

[is='chip'][data-live]::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Anmelde- und Registrierungsdialog: Haarlinie, großer Radius, ruhiger Kopf;
   die Hauptaktion füllt die Zeile */
[is='dialog-window'][has~='modal-layout'] {
    border: 1px solid var(--grey-dark-color);
    border-radius: 12px;
    box-shadow: 0 24px 48px rgb(0 0 0 / 45%);
}

[is='dialog-window'][has~='modal-layout'] > [is='dialog-window-header'] {
    border-bottom: none;
    padding-top: var(--space-m);
}

[is='dialog-window'][has~='modal-layout'] [is='dialog-window-title'] {
    font-size: var(--font-size-m);
    font-weight: 600;
}

[is='dialog-window'][has~='modal-layout'] > [is='dialog-window-footer'] [is='button-row'] {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

[is='dialog-window'][has~='modal-layout'] > [is='dialog-window-footer'] [is='button-row'] > [is='button'] {
    flex: 1 1 auto;
}

[is='dialog-window'][has~='modal-layout'] > [is='dialog-window-footer'] [is='small-text'] {
    text-align: center;
    color: var(--foreground-medium-soft-color);
}

[is='dialog-window'][has~='modal-layout'] > [is='dialog-window-footer'] a {
    color: var(--foreground-color);
}

/* Benutzerblock: lesbare Initiale und E-Mail (Bibliothek: Kleinstschrift) */
[is='user-account-avatar'] {
    font-size: var(--font-size-s);
    font-weight: 600;
}

[is='user-account-email'] {
    font-size: 0.75rem;
    color: var(--foreground-soft-color);
}

/* Datei-Ablage (Import): gestrichelte Haarlinie wie die Hinzufügen-Fläche */
[is='file-upload'] {
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-m);
}

/* --- Logo (Node layout/logo-anpassen) ---
   Die Wortmarke gibt es für dunkle und helle Flächen. Das Theme wechselt über
   #theme-link (leer = dunkel, sonst default_light.css) — App und Website
   setzen dafür keine Klasse, also entscheidet :has() am Theme-Link.
   Die Höhe setzt der Ort über --brand-logo-height. */
[data-brand-logo] {
    display: block;
    height: var(--brand-logo-height, 1.75rem);
    width: auto;
}

[data-brand-logo=on-light] {
    display: none;
}

:root:has(#theme-link[href*='light']) [data-brand-logo=on-dark] {
    display: none;
}

:root:has(#theme-link[href*='light']) [data-brand-logo=on-light] {
    display: block;
}

[data-role=dialog-brand] {
    --brand-logo-height: 2.25rem;
    display: flex;
    justify-content: center;
    margin: 0 0 var(--space-m);
}

[data-role=footer-brand] {
    --brand-logo-height: 1.25rem;
}

/* --- Syntax-Hervorhebung ---
   Der Site-Build hebt Code hervor (highlight.js, apps/site/build.js) und setzt
   data-token statt Klassen. Wenige, ruhige Farben: Grün bleibt der Akzent,
   Zeichenketten warm, Zahlen und Literale kühl, Kommentare zurückgenommen. */
:root {
    --code-keyword-color: #1f7a5c;
    --code-string-color: #9a5b00;
    --code-literal-color: #2f62b5;
    --code-name-color: #6b3fa0;
    --code-comment-color: var(--foreground-soft-color);
}

:root:not(:has(#theme-link[href])) {
    --code-keyword-color: var(--call-to-action-lighter-color);
    --code-string-color: #e3b86b;
    --code-literal-color: #7fb4ff;
    --code-name-color: #c7a6f5;
}

[data-token=keyword],
[data-token=built_in],
[data-token=meta],
[data-token=tag] {
    color: var(--code-keyword-color);
}

[data-token=string],
[data-token=regexp] {
    color: var(--code-string-color);
}

[data-token=number],
[data-token=literal],
[data-token=variable],
[data-token=template-variable],
[data-token=symbol] {
    color: var(--code-literal-color);
}

[data-token=title],
[data-token=attr],
[data-token=attribute],
[data-token=property],
[data-token=name],
[data-token=params] {
    color: var(--code-name-color);
}

[data-token=comment],
[data-token=doctag] {
    color: var(--code-comment-color);
    font-style: italic;
}
