/* ==========================================================================
   codemoon Studio – Web: Grundgestaltung (an claude.ai angelehnt, eigene Marke)
   Farben/Abstände als Variablen; heller und dunkler Modus (automatisch oder per Schalter).
   ========================================================================== */
:root {
  --hg: #faf9f5;            /* Seitenhintergrund (warmes Elfenbein) */
  --hg-2: #f4f2ec;          /* Seitenleiste */
  --flaeche: #ffffff;       /* Karten, Eingabefeld */
  --flaeche-2: #f0eee6;     /* Hover, Chips */
  --rand: #e6e3d9;
  --rand-stark: #d3cfc2;
  --text: #1f1e1b;
  --text-2: #5d5b54;
  --text-3: #8b887e;
  --akzent: #5b54e8;        /* codemoon-Violett */
  --akzent-2: #4a43d4;
  --akzent-hell: #ecebfd;
  --akzent-text: #ffffff;
  --verlauf: linear-gradient(135deg, #3b82f6, #6366f1 55%, #8b5cf6);
  --gut: #1f8a4c;
  --gut-hell: #e4f4ea;
  --warnung: #a86a00;
  --warnung-hell: #fdf3dc;
  --fehler: #c2362f;
  --fehler-hell: #fbe7e5;
  --schatten: 0 1px 2px rgba(31, 30, 27, .06), 0 4px 16px rgba(31, 30, 27, .06);
  --schatten-gross: 0 12px 40px rgba(31, 30, 27, .16);
  --radius: 12px;
  --radius-gross: 20px;
  --schrift: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --schrift-serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --schrift-code: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  --syn-kommentar: #8b887e; --syn-text: #2f7d32; --syn-steuerung: #8a3ab9; --syn-funktion: #1f63c6;
  --syn-zahl: #b5541c; --syn-variable: #a3361f; --syn-typ: #0e7c86; --syn-parameter: #6b5d00; --syn-tag: #a3361f;
  color-scheme: light;
}
:root[data-thema="dunkel"] {
  --hg: #262624; --hg-2: #1f1e1d; --flaeche: #30302e; --flaeche-2: #3a3936; --rand: #3f3e3a; --rand-stark: #55534d;
  --text: #f3f1ea; --text-2: #c2bfb4; --text-3: #8f8c82; --akzent: #7c76ff; --akzent-2: #918cff; --akzent-hell: #34325a;
  --gut: #4cc47e; --gut-hell: #1f3a2a; --warnung: #e6b450; --warnung-hell: #3d3420; --fehler: #ff7b72; --fehler-hell: #47231f;
  --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --schatten-gross: 0 12px 40px rgba(0, 0, 0, .5);
  --syn-kommentar: #8f8c82; --syn-text: #8fd18f; --syn-steuerung: #d5a6ff; --syn-funktion: #82b4ff; --syn-zahl: #f2a36b;
  --syn-variable: #ff9b85; --syn-typ: #6fd3d9; --syn-parameter: #e3d27a; --syn-tag: #ff9b85;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --hg: #262624; --hg-2: #1f1e1d; --flaeche: #30302e; --flaeche-2: #3a3936; --rand: #3f3e3a; --rand-stark: #55534d;
    --text: #f3f1ea; --text-2: #c2bfb4; --text-3: #8f8c82; --akzent: #7c76ff; --akzent-2: #918cff; --akzent-hell: #34325a;
    --gut: #4cc47e; --gut-hell: #1f3a2a; --warnung: #e6b450; --warnung-hell: #3d3420; --fehler: #ff7b72; --fehler-hell: #47231f;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --schatten-gross: 0 12px 40px rgba(0, 0, 0, .5);
    --syn-kommentar: #8f8c82; --syn-text: #8fd18f; --syn-steuerung: #d5a6ff; --syn-funktion: #82b4ff; --syn-zahl: #f2a36b;
    --syn-variable: #ff9b85; --syn-typ: #6fd3d9; --syn-parameter: #e3d27a; --syn-tag: #ff9b85;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--hg); color: var(--text); font-family: var(--schrift); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* Logo: Querlogo hell/dunkel je nach Thema */
.logo-quer { height: 30px; width: auto; display: block; }
.logo-quer.fuer-dunkel { display: none; }
:root[data-thema="dunkel"] .logo-quer.fuer-hell { display: none; }
:root[data-thema="dunkel"] .logo-quer.fuer-dunkel { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) .logo-quer.fuer-hell { display: none; }
  :root:not([data-thema="hell"]) .logo-quer.fuer-dunkel { display: block; }
}

/* Knöpfe */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--rand-stark);
  background: var(--flaeche); color: var(--text); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 550;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; text-decoration: none; }
.knopf:hover { background: var(--flaeche-2); text-decoration: none; }
.knopf:active { transform: translateY(1px); }
.knopf:disabled { opacity: .55; cursor: not-allowed; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.primaer:hover { background: var(--akzent-2); border-color: var(--akzent-2); }
.knopf.gefahr { color: var(--fehler); border-color: var(--fehler); background: transparent; }
.knopf.gefahr:hover { background: var(--fehler-hell); }
.knopf.leise { border-color: transparent; background: transparent; color: var(--text-2); }
.knopf.leise:hover { background: var(--flaeche-2); color: var(--text); }
.knopf.klein { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.knopf.gross { padding: 12px 22px; font-size: 16px; border-radius: 12px; }
.knopf.voll { width: 100%; }
.symbol-knopf { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px;
  border: none; background: transparent; color: var(--text-2); cursor: pointer; }
.symbol-knopf:hover { background: var(--flaeche-2); color: var(--text); }
.symbol-knopf svg, .knopf svg { width: 18px; height: 18px; flex: none; }

/* Formulare */
.feld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.feld > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.eingabe, select.eingabe, textarea.eingabe { width: 100%; border: 1px solid var(--rand-stark); background: var(--flaeche);
  border-radius: 10px; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.eingabe:focus { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-hell); }
textarea.eingabe { resize: vertical; min-height: 120px; font-family: var(--schrift-code); font-size: 13px; }
.haken { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); margin: 8px 0 16px; }
.haken input { margin-top: 3px; accent-color: var(--akzent); width: 16px; height: 16px; flex: none; }
.hinweis-text { font-size: 13px; color: var(--text-3); }

/* Schalter */
.schalter { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.schalter input { position: absolute; opacity: 0; width: 1px; height: 1px; left: 0; top: 0; }
.schalter .bahn { width: 36px; height: 20px; border-radius: 20px; background: var(--rand-stark); position: relative; transition: background .15s; flex: none; }
.schalter .bahn::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.schalter input:checked + .bahn { background: var(--akzent); }
.schalter input:checked + .bahn::after { transform: translateX(16px); }

/* Karten, Marken */
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius-gross); padding: 22px; box-shadow: var(--schatten); }
.marke { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--flaeche-2); color: var(--text-2); white-space: nowrap; }
.marke.gut { background: var(--gut-hell); color: var(--gut); }
.marke.warnung { background: var(--warnung-hell); color: var(--warnung); }
.marke.fehler { background: var(--fehler-hell); color: var(--fehler); }
.marke.akzent { background: var(--akzent-hell); color: var(--akzent); }

.meldung { border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; border: 1px solid transparent; }
.meldung.fehler { background: var(--fehler-hell); color: var(--fehler); border-color: color-mix(in srgb, var(--fehler) 30%, transparent); }
.meldung.gut { background: var(--gut-hell); color: var(--gut); }
.meldung.warnung { background: var(--warnung-hell); color: var(--warnung); }
.meldung.info { background: var(--akzent-hell); color: var(--akzent); }

/* Tabellen */
.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); }
table.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th, .tabelle td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--rand); vertical-align: middle; }
.tabelle th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 650; background: var(--hg-2); }
.tabelle tr:last-child td { border-bottom: none; }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle tbody tr:hover { background: color-mix(in srgb, var(--flaeche-2) 60%, transparent); }
.tabelle tr.summe td { font-weight: 700; background: var(--hg-2); }

/* Hinweis-Toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px;
  z-index: 1000; pointer-events: none; }
.toast { background: var(--text); color: var(--hg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--schatten-gross);
  font-size: 14px; animation: rein .2s ease-out; pointer-events: auto; max-width: min(90vw, 520px); }
.toast.fehler { background: var(--fehler); color: #fff; }
@keyframes rein { from { opacity: 0; transform: translateY(8px); } }

/* Dialog */
.schleier { position: fixed; inset: 0; background: rgba(20, 20, 18, .45); display: flex; align-items: center; justify-content: center;
  z-index: 900; padding: 16px; animation: einblenden .15s; }
@keyframes einblenden { from { opacity: 0; } }
.dialog { background: var(--flaeche); border-radius: var(--radius-gross); box-shadow: var(--schatten-gross); width: min(460px, 100%);
  padding: 24px; border: 1px solid var(--rand); max-height: 90vh; overflow: auto; }
.dialog.breit { width: min(720px, 100%); }
.dialog h3 { margin: 0 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 18px; color: var(--text-2); }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* Lade-Punkte */
.lade { display: inline-flex; gap: 4px; align-items: center; }
.lade i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: puls 1.2s infinite ease-in-out; }
.lade i:nth-child(2) { animation-delay: .15s; } .lade i:nth-child(3) { animation-delay: .3s; }
@keyframes puls { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* Markdown-Inhalte */
.md { font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; }
.md p { margin: 0 0 .8em; }
.md h2, .md h3, .md h4 { font-family: var(--schrift); margin: 1.2em 0 .5em; line-height: 1.3; }
.md h2 { font-size: 1.3em; } .md h3 { font-size: 1.15em; } .md h4 { font-size: 1.02em; }
.md ul, .md ol { margin: 0 0 .9em; padding-left: 1.5em; }
.md li { margin: .25em 0; }
.md code { font-family: var(--schrift-code); font-size: .88em; background: var(--flaeche-2); padding: .1em .35em; border-radius: 5px; }
.md pre { margin: 0; overflow-x: auto; }
.md pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.55; }
.md blockquote { margin: 0 0 .9em; padding: .2em 1em; border-left: 3px solid var(--rand-stark); color: var(--text-2); }
.md hr { border: none; border-top: 1px solid var(--rand); margin: 1.2em 0; }
.md table { border-collapse: collapse; margin: 0 0 1em; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--rand); padding: 6px 10px; text-align: left; }
.md th { background: var(--hg-2); font-weight: 650; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md > :last-child { margin-bottom: 0; }
.code-block { border: 1px solid var(--rand); border-radius: 10px; overflow: hidden; margin: 0 0 1em; background: var(--hg-2); }
.code-kopf { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; font-size: 12px; color: var(--text-3);
  border-bottom: 1px solid var(--rand); background: var(--flaeche-2); }
.code-kopf button { border: none; background: transparent; color: var(--text-2); cursor: pointer; font-size: 12px; }
.code-block pre { padding: 12px 14px; }
.syn-kommentar { color: var(--syn-kommentar); font-style: italic; } .syn-text { color: var(--syn-text); }
.syn-steuerung { color: var(--syn-steuerung); } .syn-funktion { color: var(--syn-funktion); } .syn-zahl { color: var(--syn-zahl); }
.syn-variable { color: var(--syn-variable); } .syn-typ { color: var(--syn-typ); } .syn-parameter { color: var(--syn-parameter); }
.syn-tag { color: var(--syn-tag); } .syn-attribut { color: var(--syn-funktion); } .syn-schluessel { color: var(--syn-steuerung); }

/* Fußzeile */
.fuss { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; padding: 28px 16px; color: var(--text-3); font-size: 13px; }
.fuss a { color: var(--text-3); }
