/* cx33 - Grundlagen: Farben, Typografie, Formulare, Schaltflaechen.
   Eigenstaendig, keine externen Fonts, kein Framework. */

:root {
  --bg:        #0e1117;
  --bg-soft:   #151a23;
  --panel:     #171d27;
  --panel-2:   #1d2430;
  --line:      #263041;
  --line-lt:   #313c50;
  --text:      #e6ebf4;
  --muted:     #8d9bb2;
  --faint:     #63708a;
  --accent:    #6d8cff;
  --accent-2:  #8b5cf6;
  --ok:        #34d399;
  --warn:      #fbbf24;
  --bad:       #f87171;
  --radius:    12px;
  --shadow:    0 10px 30px rgba(0, 0, 0, .35);
  --mono:      ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:      #f4f6fb;
    --bg-soft: #eaeef7;
    --panel:   #ffffff;
    --panel-2: #f6f8fc;
    --line:    #dde3ee;
    --line-lt: #ccd5e5;
    --text:    #16202f;
    --muted:   #5d6b83;
    --faint:   #8695ad;
    --shadow:  0 8px 24px rgba(24, 39, 75, .08);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: var(--mono); font-size: 13px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }

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

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

label {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 14px;
}

label.wide { display: block; }

label.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text);
}

label.check input { width: auto; margin: 0; accent-color: var(--accent); }

/* Ein Kaestchen mit seiner Erklaerung darunter.
   Der Umweg ueber einen Block ist noetig: "label.check" ist inline-flex, zwei
   davon nebeneinander ergeben eine Zeile statt zweier. Und die Erklaerung
   darf ihre Blockdarstellung nicht als style-Attribut mitbringen - das Feld
   traegt "data-when", und das Umschalten des App-Typs setzt style.display
   zurueck und loescht damit alles, was dort sonst noch stand. */
.feld-check { display: block; margin: 6px 0 16px; }
.feld-check + .feld-check { margin-top: -6px; }
.feld-check > .muted { margin: 6px 0 0; font-size: 12.5px; max-width: 78ch; }
.feld-check > .muted + .muted { margin-top: 6px; }

input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line-lt);
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}

input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 140, 255, .18);
}

input[readonly] { color: var(--muted); cursor: pointer; }
input.copied { border-color: var(--ok); }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; min-height: 76px; }

/* Freitextfeld unter einer Auswahlliste - fuer den Fall, dass GitHub
   nicht erreichbar ist oder eine URL von Hand kommen soll. */
input.secondary { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
input.secondary:focus { color: var(--text); }
label select + input.secondary { border-style: dashed; }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* --- Schaltflaechen ------------------------------------------------------ */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid var(--line-lt);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .12s, background .12s, border-color .12s;
}

button:hover:not(:disabled), .btn:hover { filter: brightness(1.12); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(109, 140, 255, .3);
}

button.primary:disabled { box-shadow: none; }
button.danger { background: transparent; border-color: transparent; color: var(--bad); }
button.danger:hover:not(:disabled) { background: rgba(248, 113, 113, .12); filter: none; }
button.small, .btn.small { padding: 6px 11px; font-size: 12.5px; }
button.link { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 8px; }
button.link:hover { color: var(--text); background: var(--panel-2); filter: none; }

/* Ein Formular, das sich wie ein Bedienelement verhaelt: mehrere nebeneinander
   ergeben eine Zeile, nicht einen Stapel. */
form.inline { display: inline-flex; align-items: center; gap: 10px; margin: 0; vertical-align: middle; }
/* Eine Zeile, die sichtbar zur vorigen gehoert, aber nicht an ihr klebt.
   Gilt fuer beide Formen einer solchen Zeile: ein Formular, das sich wie ein
   Bedienelement verhaelt, und eine gewoehnliche Knopfzeile innerhalb eines
   groesseren Formulars. Vorher nur fuer die erste - an einer .row stand die
   Klasse dann im Markup und tat nichts. */
form.inline.abgesetzt, .row.abgesetzt {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  width: 100%;
  flex-wrap: wrap;
}
/* Und nicht an dem, was folgt. Unter dem Knopf "Erneut nach Updates sehen"
   begann sonst unmittelbar der Kasten mit dem Update-Verlauf - Abstand nach
   oben, keiner nach unten. Nur wenn ueberhaupt etwas folgt: als letztes
   Element im Kasten hat der Kasten schon sein eigenes Polster. */
form.inline.abgesetzt:not(:last-child), .row.abgesetzt:not(:last-child) { margin-bottom: 16px; }

/* In einer Zeile stehen Eingabefelder und Schaltflaechen auf derselben Hoehe.
   Der Abstand ueber dem Feld gehoert zur Beschriftung darueber - in einer
   Zeile gibt es die nicht. */
/* Unterkante, nicht Mitte: neben einem beschrifteten Feld soll ein Knopf auf
   Hoehe des Feldes stehen, nicht auf halber Hoehe der ganzen Gruppe. */
.row { align-items: flex-end; }
.bar { align-items: center; }
/* Die Schaltflaechen einer Tabellenzeile: nebeneinander, rechtsbuendig.
   Gleiche Hoehe fuer alle - auch fuer den roten Knopf, der seinen Rahmen nur
   nicht zeigt. */
.zeilen-aktionen { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.zeilen-aktionen > *, .zeilen-aktionen form.inline { display: inline-flex; align-items: center; }

/* --- Nummerierte Abschnitte im Formular ---------------------------------- */
/* Quelle, Ziel, Optionen: das Formular fragt in der Reihenfolge, in der man
   ohnehin denkt. Der Rahmen macht sichtbar, wo ein Schritt aufhoert. */

fieldset.abschnitt {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 18px 18px;
  margin: 0 0 16px;
  min-width: 0;
}

fieldset.abschnitt > legend {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
  padding: 0 8px;
  margin-left: -8px;
}

/* Felder, die erst ein Link einblendet. Ohne diese Zeile gewinnt eine
   display-Regel fuer input gegen das hidden-Attribut. */
[hidden] { display: none !important; }

/* Zwei Knoepfe, die eine Sache sind ("Hochladen: Dateien | Ordner").
   Derselbe Gedanke wie bei form.inline: enger als der Rest der Leiste. */
.bar .paar { display: inline-flex; align-items: center; gap: 6px; }
