/* ============================================================
   Verwaltungszentrale arturkornelsen.de – zentrale Stildatei.
   Dunkles Theme, an den bisherigen Platzhalter angelehnt.
   Ein Design-Set von Artur kommt spaeter: Farben und Abstaende
   stehen deshalb ausschliesslich als Variablen hier oben.
   ============================================================ */

:root {
  --bg:        #10141a;
  --bg-raised: #171d26;
  --bg-hover:  #1c2532;
  --bg-input:  #0d1117;
  --line:      #2d3748;
  --line-soft: #222b38;
  --text:      #e8eaed;
  --muted:     #a0aec0;
  --dim:       #6b7a8f;
  --accent:    #8ab4f8;
  --ok:        #68d391;
  --warn:      #f6ad55;
  --danger:    #fc8181;
  --radius:    10px;
  --gap:       1rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 16px;
}

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

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

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--gap);
  padding: .6rem 1rem; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  color: var(--text); font-weight: 600; letter-spacing: .3px;
}
.brand:hover { text-decoration: none; }
.monogram {
  width: 32px; height: 32px; border: 2px solid var(--line);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .8rem; color: var(--muted); flex: none;
}
nav.main { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; align-items: center; }
nav.main a, nav.main button {
  color: var(--muted); font-size: .9rem;
  padding: .4rem .7rem; border-radius: 8px; border: 1px solid transparent;
  background: none; cursor: pointer; font-family: inherit;
}
nav.main a:hover, nav.main button:hover { background: var(--bg-input); color: var(--text); text-decoration: none; }
nav.main a.active { color: var(--text); border-color: var(--line); background: var(--bg-input); }

nav.subnav { margin: 0 0 1.5rem; gap: .25rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* ---------- Typografie ---------- */

h1 { font-size: 1.45rem; font-weight: 600; margin-bottom: .3rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .6rem; }
h3 { font-size: .95rem; font-weight: 600; }
.lead { color: var(--muted); margin-bottom: 1.5rem; }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: .85rem; }
.small { font-size: .85rem; }

.page-head {
  display: flex; align-items: flex-start; gap: var(--gap);
  flex-wrap: wrap; margin-bottom: 1.25rem;
}
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Flaechen ---------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1rem;
}
.card + .card { margin-top: var(--gap); }
section.block { margin-top: 2rem; }

.grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  /* Alle Zeilen gleich hoch – sonst ist jede Rasterzeile so hoch wie ihr
     laengster Inhalt und die Kacheln haben unterschiedliche Groessen. */
  grid-auto-rows: 1fr;
}
/* Im Raster erzeugt der Abstand ohnehin schon "gap". Ohne diese Zeile
   bekaeme jede Kachel ausser der ersten einen zusaetzlichen oberen Rand
   und die erste saesse als einzige buendig – genau andersherum als
   gewuenscht. */
.grid > .card + .card { margin-top: 0; }

/* ---------- Anklickbare Kacheln ----------
   Die ganze Kachel oeffnet den Eintrag, nicht nur die Ueberschrift.
   Umgesetzt ueber eine unsichtbare Flaeche, die der Hauptlink aufspannt:
   kein JavaScript, und der Link bleibt ein echter Link (Tastatur,
   Mittelklick, "im neuen Tab oeffnen" funktionieren weiter).
   Wichtig: .kachel-link selbst darf NICHT positioniert sein, sonst
   bezieht sich das ::after auf den Link statt auf die Kachel. */
.kachel { position: relative; }
.kachel-link::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  border-radius: var(--radius);
}
/* Alle uebrigen Links der Kachel liegen ueber der Flaeche und bleiben
   damit einzeln anklickbar. */
.kachel a:not(.kachel-link) { position: relative; z-index: 1; }
.kachel:hover { border-color: var(--line); background: var(--bg-hover); }
.kachel:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.kachel-link { color: var(--text); }
.kachel-link:hover { text-decoration: none; }

/* ---------- Projektkacheln ---------- */

.tile { display: flex; flex-direction: column; gap: .5rem; }
.tile h2 { margin: 0; }
.tile .desc { color: var(--muted); font-size: .9rem; flex: 1; }

.badge {
  display: inline-block; font-size: .72rem; letter-spacing: .4px;
  text-transform: uppercase; padding: .15rem .5rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.badge.aktiv { color: var(--ok); border-color: #2f6b4a; }
.badge.pausiert { color: var(--warn); border-color: #7a5623; }
.badge.abgeschlossen { color: var(--dim); }
.badge.erreicht { color: var(--ok); border-color: #2f6b4a; }

.progress { height: 6px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; }
.progress.gross { height: 10px; }
/* Ampel fuer Auslastungsbalken – Schwellen stehen in app/vps.py. */
.progress > span.ok { background: var(--ok); }
.progress > span.warn { background: var(--warn); }
.progress > span.danger { background: var(--danger); }
.progress > span { transition: width .4s ease; }

/* ---------- Serverzustand ---------- */

.metriken { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.metrik { display: flex; flex-direction: column; gap: .6rem; }
.metrik-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.metrik-kopf h3 { margin: 0; font-size: .95rem; color: var(--muted); font-weight: 600; }
.metrik .wert {
  font-size: 1.6rem; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.metrik .wert.ok { color: var(--text); }
.metrik .wert.warn { color: var(--warn); }
.metrik .wert.danger { color: var(--danger); }
.metrik p.dim { margin: 0; font-size: .82rem; }
.kerne { display: flex; gap: .35rem; }
.kern { flex: 1; }
.badge.gestoppt { color: var(--dim); }
.badge.krank { color: var(--danger); border-color: #7a2f2f; }
.warnung { color: var(--warn); }

/* ---------- Live-Status ---------- */

.alarmleiste {
  background: #2a1416; border: 1px solid #7a2f2f; color: var(--danger);
  border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: var(--gap);
}
.alarmleiste a { color: var(--danger); text-decoration: underline; }

.metrik.status-stoerung, .metrik.status-fehler { border-color: #7a2f2f; }
.metrik.status-ok { border-color: #2f6b4a; }
.metrik h3 a { color: var(--text); }
.metrik .url { word-break: break-all; font-size: .78rem; }
.quoten { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.quoten strong { color: var(--text); font-variant-numeric: tabular-nums; }
.fehlertext { color: var(--danger); font-size: .85rem; overflow-wrap: anywhere; }
.stand { text-align: right; font-size: .78rem; }
.card.stoerung.offen { border-color: #7a2f2f; }
.inline-check { display: flex; align-items: center; gap: .5rem; color: var(--text); }
.inline-check input { width: auto; }
.inline-check.klein { font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.kanalliste { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.kanalliste .badge.aktiv::before { content: "✓ "; }
fieldset { border: 1px solid var(--line-soft); border-radius: var(--radius);
           padding: .8rem; margin: 1rem 0; }
legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }
.row.zwei { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row.drei { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row.vier { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------- Diagramme (Inline-SVG) ---------- */

.diagramm { width: 100%; height: auto; display: block; overflow: visible; }
.diagramm .raster { stroke: var(--line-soft); stroke-width: 1; }
.diagramm .achse { fill: var(--dim); font-size: 10px; }
.diagramm .balken { fill: var(--accent); opacity: .55; }
.diagramm .balken2 { fill: var(--accent); }
.diagramm .linie { fill: none; stroke: var(--accent); stroke-width: 1.6;
                   stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.diagramm .stoerung { stroke: var(--danger); stroke-width: 1.5;
                      vector-effect: non-scaling-stroke; }
.diagramm.streifen { height: 26px; }
.diagramm .feld.ok { fill: var(--ok); }
.diagramm .feld.teilweise { fill: var(--warn); }
.diagramm .feld.fehler { fill: var(--danger); }
.diagramm .feld.leer { fill: var(--line-soft); }
.diagramm g:hover .balken, .diagramm g:hover .feld { opacity: 1; filter: brightness(1.25); }

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

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=url], input[type=number],
input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: .5rem .6rem;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: .95rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { margin-bottom: .75rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > .field { flex: 1 1 12rem; margin-bottom: .75rem; }
.check { display: flex; align-items: center; gap: .45rem; color: var(--text); font-size: .9rem; }
.check input { width: auto; }

button, .btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-input); color: var(--text);
  font-family: inherit; font-size: .9rem; line-height: 1.4;
}
button:hover, .btn:hover { background: #1c2532; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0b1220; font-weight: 600; }
.btn-primary:hover { background: #a6c8ff; }
.btn-danger { color: var(--danger); border-color: #6b3030; }
.btn-danger:hover { background: #2a1717; }
.btn-small { padding: .25rem .55rem; font-size: .8rem; }
.btn-ghost { border-color: transparent; background: none; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text); }
.inline-form { display: inline; }

/* ---------- Meldungen ---------- */

.flash, .error, .notice {
  border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: 1rem;
  border: 1px solid var(--line); font-size: .9rem;
}
.flash  { border-color: #2f6b4a; background: #14251d; color: #cdebd9; }
.error  { border-color: #6b3030; background: #251616; color: #f6c7c7; }
.notice { border-color: #7a5623; background: #241d12; color: #f0d9b5; }

/* ---------- Listen / Zugaenge ---------- */

.item {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--bg-raised); margin-bottom: .6rem;
}
.item-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem; flex-wrap: wrap;
}
.item-head .title { font-weight: 600; }
.item-head .spacer { flex: 1; }
.item-body { padding: 0 .9rem .9rem; border-top: 1px solid var(--line-soft); padding-top: .9rem; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
summary .chev { color: var(--dim); font-size: .75rem; }
details[open] summary .chev { transform: rotate(90deg); display: inline-block; }

.secret {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem; background: var(--bg-input);
  border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem;
}
.secret .value { flex: 1; word-break: break-all; min-width: 6rem; }
.secret .value.hidden { color: var(--dim); letter-spacing: .15em; }

/* ---------- Kanban ---------- */

.kanban { display: grid; gap: var(--gap); grid-template-columns: repeat(3, 1fr); }
.column {
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: .7rem; min-height: 8rem;
}
.column > h3,
.column > details > summary {
  color: var(--muted); font-size: .8rem; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: .6rem; display: flex; gap: .4rem;
}
/* Klappbare Spaltenkoepfe: eigener Pfeil statt des Browser-Dreiecks, damit
   er links steht und zum uebrigen Dunkelthema passt. */
.column > details > summary {
  cursor: pointer; align-items: center; list-style: none; user-select: none;
}
.column > details > summary::-webkit-details-marker { display: none; }
.column > details > summary::before {
  content: "▸"; color: var(--dim); font-size: .9em; width: .8em;
}
.column > details[open] > summary::before { content: "▾"; }
.column > details > summary:hover { color: var(--text); }
.column > details:not([open]) > summary { margin-bottom: 0; }
.column.dragover { border-color: var(--accent); background: #141b26; }
.taskcard {
  background: var(--bg-input); border: 1px solid var(--line);
  border-radius: 8px; padding: .55rem .65rem; margin-bottom: .5rem; cursor: grab;
}
.taskcard:active { cursor: grabbing; }
.taskcard.dragging { opacity: .45; }
.taskcard .t { font-size: .92rem; }
.taskcard .meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  margin-top: .35rem; font-size: .78rem; color: var(--dim); }
.taskcard .move { display: flex; gap: .25rem; margin-left: auto; }
.taskcard.ueberfaellig { border-color: #6b3030; }

.goal { border-left: 3px solid var(--line); padding-left: .8rem; margin-bottom: 1.25rem; }
.goal.reached { border-left-color: var(--ok); }

.checklist { list-style: none; margin: .5rem 0 0; }
.checklist li { display: flex; align-items: center; gap: .5rem; padding: .15rem 0; font-size: .9rem; }
.checklist li.done .txt { color: var(--dim); text-decoration: line-through; }

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }

/* ---------- Anmeldung ---------- */

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .monogram { width: 64px; height: 64px; font-size: 1.4rem; margin: 0 auto 1.25rem; }
.auth-card h1 { text-align: center; font-size: 1.2rem; }
.auth-card .lead { text-align: center; font-size: .9rem; margin-bottom: 1.5rem; }
.qr { background: #fff; padding: .75rem; border-radius: var(--radius); width: max-content; margin: 0 auto 1rem; }
.qr svg { display: block; width: 220px; height: 220px; }
.secret-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em; text-align: center; word-break: break-all;
  background: var(--bg-input); border: 1px solid var(--line);
  border-radius: 8px; padding: .5rem; font-size: .9rem;
}
input.code { font-size: 1.35rem; letter-spacing: .4em; text-align: center; font-family: ui-monospace, Menlo, monospace; }

footer.sig { text-align: center; color: var(--dim); font-size: .75rem; margin-top: 2rem; }

/* Zeilenumbrueche aus Freitextfeldern erhalten – ohne HTML einzuschleusen. */
.pre-line { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Hilfsfeld fuer den Kopier-Fallback ohne Clipboard-API. */
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.hidden-el { display: none; }

/* ---------- Kleine Bildschirme ---------- */

@media (max-width: 720px) {
  .kanban { grid-template-columns: 1fr; }
  .topbar-inner { padding: .5rem .75rem; }
  nav.main { width: 100%; margin-left: 0; }
  nav.main a, nav.main button { flex: 1; text-align: center; justify-content: center; }
  main { padding: 1rem .75rem 3rem; }
  .page-head .actions { width: 100%; }
}
