/* DuckCurve Horizon - Designsystem der Oberflaeche.
   Eine Datei, weil die Oberflaeche ohne Bauschritt ausgeliefert wird. */

:root {
  color-scheme: dark;

  --flaeche-0: #0d1117;
  --flaeche-1: #151b24;
  --flaeche-2: #1c2531;
  --flaeche-3: #243040;
  --rand: #2b3849;
  --rand-hell: #3d4d62;

  --text: #e6edf3;
  --text-leise: #9aa9ba;
  --text-still: #6b7c90;

  --akzent: #4ea8de;
  --akzent-hell: #7cc6f0;
  --gut: #56d364;
  --warn: #e3b341;
  --kritisch: #f06a6a;

  --r: 10px;
  --r-klein: 6px;
  --schatten: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --seitenleiste: 232px;
  --kopf: 56px;

  --schrift: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--flaeche-0); color: var(--text);
  font-family: var(--schrift); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- Gerüst */
#app { display: grid; grid-template-columns: var(--seitenleiste) 1fr; grid-template-rows: var(--kopf) 1fr; height: 100vh; }

header.kopf {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px;
  padding: 0 18px; background: var(--flaeche-1); border-bottom: 1px solid var(--rand);
}
.marke { display: flex; align-items: baseline; gap: 9px; font-weight: 650; letter-spacing: -.01em; }
.marke .kurve { width: 22px; height: 22px; border-radius: 5px; display: block; align-self: center; }
.marke .version { font: 400 11px/1 var(--mono); color: var(--text-still); }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-leise); }

/* Herkunft und Kennung im Kopf: Rueckweg, wer da ist, und das Ende der Sitzung. */
.anmeldung { display: flex; align-items: center; gap: 10px; }
.anmeldung .zurueck {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px;
  border: 1px solid var(--rand-hell); border-radius: 999px;
  color: var(--text-leise); text-decoration: none; font-size: 12px; white-space: nowrap;
}
.anmeldung .zurueck:hover { background: var(--flaeche-2); color: var(--text); border-color: var(--akzent); }
.anmeldung .zurueck .pfeil { font-size: 13px; line-height: 1; }
.anmeldung .wer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.anmeldung .wer .zeichen {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; background: var(--flaeche-3); color: var(--text);
  font: 600 10.5px/1 var(--schrift); letter-spacing: .02em;
}
.anmeldung .namen { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.anmeldung .person { color: var(--text); font-size: 12px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 18ch; }
.anmeldung .org { color: var(--text-still); font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }

nav.seitenleiste {
  background: var(--flaeche-1); border-right: 1px solid var(--rand);
  padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
}
nav.seitenleiste.gesperrt { opacity: .4; pointer-events: none; }
nav .gruppe { font: 600 10px/1 var(--schrift); letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-still); padding: 16px 10px 7px; }
nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-klein);
  color: var(--text-leise); text-decoration: none; font-size: 13px; cursor: pointer;
  border: 1px solid transparent;
  /* In der schmalen Ansicht wird die Leiste zur waagerechten Reihe. Ohne diese
     beiden Zeilen schrumpfen die Eintraege, bis die Beschriftung umbricht und
     abgeschnitten wird - die hinteren Ansichten waren so nicht erreichbar. */
  flex: 0 0 auto; white-space: nowrap;
}
nav a:focus-visible { outline: 2px solid var(--akzent); outline-offset: -1px; }
nav a:hover { background: var(--flaeche-2); color: var(--text); }
nav a.aktiv { background: var(--flaeche-3); color: var(--text); border-color: var(--rand-hell); font-weight: 550; }
nav a .zeichen { width: 17px; text-align: center; opacity: .85; }

main.inhalt { overflow-y: auto; padding: 20px 22px 60px; }
main.inhalt > h1 { margin: 0 0 4px; font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
main.inhalt > p.unterzeile { margin: 0 0 20px; color: var(--text-leise); max-width: 76ch; }

/* ---------------------------------------------------------------- Bausteine */
.karte { background: var(--flaeche-1); border: 1px solid var(--rand); border-radius: var(--r); padding: 16px; }
.karte + .karte { margin-top: 14px; }
.karte > h2 { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.karte > p.hinweis { margin: 0 0 14px; font-size: 12px; color: var(--text-leise); }

.raster { display: grid; gap: 14px; }
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.raster.drei { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kennzahl { background: var(--flaeche-2); border: 1px solid var(--rand); border-radius: var(--r-klein); padding: 11px 13px; }
.kennzahl .wert { font: 600 20px/1.15 var(--schrift); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  /* Kennzahlen sind meist kurze Zahlen, gelegentlich aber ein langer Bezeichner wie ein
     Szenarioname. Der darf umbrechen statt am Rand der Kachel abgeschnitten zu werden. */
  overflow-wrap: anywhere; }
.kennzahl .name { font-size: 11px; color: var(--text-leise); margin-top: 4px; }
.kennzahl .wert small { font-size: 12px; font-weight: 500; color: var(--text-leise); margin-left: 3px; }

/* Bedienelemente */
label.feld { display: block; margin-bottom: 12px; }
label.feld > span { display: block; font-size: 12px; color: var(--text-leise); margin-bottom: 5px; }
input[type=number], input[type=text], select {
  width: 100%; padding: 7px 9px; background: var(--flaeche-0); color: var(--text);
  border: 1px solid var(--rand-hell); border-radius: var(--r-klein); font: inherit; font-size: 13px;
}
input:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
input[type=range] { width: 100%; accent-color: var(--akzent); }
input[type=checkbox] { accent-color: var(--akzent); width: 15px; height: 15px; vertical-align: -2px; margin-right: 6px; }

button {
  padding: 8px 15px; border-radius: var(--r-klein); border: 1px solid var(--rand-hell);
  background: var(--flaeche-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--flaeche-3); border-color: var(--akzent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.haupt { background: var(--akzent); border-color: var(--akzent); color: #06121c; font-weight: 600; }
/* Fuer den zweiten Schritt einer Loeschung: Der Knopf soll aussehen wie das,
   was er tut, damit niemand ihn fuer den harmlosen der beiden haelt. */
button.gefahr { background: var(--kritisch); border-color: var(--kritisch); color: #1a0606; font-weight: 600; }
button.gefahr:hover:not(:disabled) { filter: brightness(1.12); }
button.haupt:hover:not(:disabled) { background: var(--akzent-hell); border-color: var(--akzent-hell); }
button.gefahr { border-color: var(--kritisch); color: var(--kritisch); }
button.klein { padding: 4px 9px; font-size: 12px; }
button.leise { padding: 5px 10px; font-size: 12px; background: transparent; color: var(--text-leise); }
button.leise:hover:not(:disabled) { background: var(--flaeche-2); color: var(--text); }

/* Ein Verweis, der wie ein Knopf aussieht. Gebraucht dort, wo das Ziel eine andere
   Anwendung ist: Das gehoert ein Verweis zu sein, damit Mittelklick und Adresse in
   der Statusleiste funktionieren, soll aber die Wichtigkeit eines Knopfes haben. */
a.knopf {
  display: inline-block; padding: 8px 15px; border-radius: var(--r-klein);
  border: 1px solid var(--rand-hell); background: var(--flaeche-2); color: var(--text);
  font-size: 13px; text-decoration: none;
}
a.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: #06121c; font-weight: 600; }
a.knopf.haupt:hover { background: var(--akzent-hell); border-color: var(--akzent-hell); }

.schalterreihe { display: flex; flex-wrap: wrap; gap: 6px; }
.schalter {
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--rand-hell);
  background: var(--flaeche-2); color: var(--text-leise); font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; user-select: none;
}
.schalter:hover { color: var(--text); }
.schalter.an { background: var(--flaeche-3); color: var(--text); border-color: var(--akzent); }
.schalter .punkt { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Tabellen */
table.daten { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.daten th, table.daten td { padding: 6px 9px; text-align: right; border-bottom: 1px solid var(--rand); }
table.daten th:first-child, table.daten td:first-child { text-align: left; }
table.daten thead th { color: var(--text-leise); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; background: var(--flaeche-1); }
table.daten td { font-variant-numeric: tabular-nums; }
table.daten tbody tr:hover { background: var(--flaeche-2); }
.tabellenrahmen { max-height: 460px; overflow: auto; border: 1px solid var(--rand); border-radius: var(--r-klein); }

/* Ableseschild der Diagramme */
.ableseschild {
  position: fixed; z-index: 60; display: none; pointer-events: none;
  background: rgba(21,27,36,.97); border: 1px solid var(--rand-hell); border-radius: var(--r-klein);
  padding: 8px 10px; box-shadow: var(--schatten); font-size: 12px; min-width: 130px; max-width: 320px;
}
.ableseschild .kopf { color: var(--text-leise); font-size: 11px; margin-bottom: 6px;
  border-bottom: 1px solid var(--rand); padding-bottom: 5px; }
.ableseschild .zeile { display: flex; align-items: center; gap: 7px; line-height: 1.7; }
.ableseschild .punkt { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.ableseschild .name { color: var(--text-leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ableseschild .wert { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 550; padding-left: 10px; }

/* Meldungen */
.meldung { border-radius: var(--r-klein); padding: 11px 13px; font-size: 12.5px; border: 1px solid; display: flex; gap: 10px; }
.meldung + .meldung { margin-top: 8px; }
.meldung .titel { font-weight: 600; display: block; margin-bottom: 2px; }
.meldung.kritisch { background: rgba(240,106,106,.09); border-color: rgba(240,106,106,.42); }
.meldung.wichtig  { background: rgba(227,179,65,.09);  border-color: rgba(227,179,65,.42); }
.meldung.info     { background: rgba(78,168,222,.09);  border-color: rgba(78,168,222,.38); }
.meldung .zeichen { font-size: 15px; line-height: 1.2; }

.marke-quelle { display: inline-block; font: 500 10px/1.5 var(--mono); padding: 1px 6px; border-radius: 4px;
  background: var(--flaeche-3); color: var(--text-leise); border: 1px solid var(--rand-hell); }

/* Fortschritt */
.balken { height: 7px; background: var(--flaeche-3); border-radius: 999px; overflow: hidden; }
.balken > i { display: block; height: 100%; background: linear-gradient(90deg, var(--akzent), var(--akzent-hell));
  border-radius: 999px; transition: width .4s ease; }
.protokoll { font: 12px/1.55 var(--mono); background: var(--flaeche-0); border: 1px solid var(--rand);
  border-radius: var(--r-klein); padding: 10px 12px; max-height: 250px; overflow-y: auto; color: var(--text-leise); }
.protokoll div { white-space: pre-wrap; }
.protokoll .zeit { color: var(--text-still); margin-right: 8px; }

.zustand { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; }
.zustand::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-still); }
.zustand.laeuft::before { background: var(--akzent); animation: puls 1.5s ease-in-out infinite; }
.zustand.fertig::before { background: var(--gut); }
.zustand.fehler::before, .zustand.abgebrochen::before { background: var(--kritisch); }
.zustand.unterbrochen::before { background: var(--warn); }
@keyframes puls { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Diagramme und Karte */
.leinwand-rahmen { position: relative; width: 100%; }
canvas { display: block; width: 100%; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12px; color: var(--text-leise); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.kartenhuelle { position: relative; background: var(--flaeche-0); border-radius: var(--r-klein); overflow: hidden;
  border: 1px solid var(--rand); }
.kartenhuelle canvas { cursor: crosshair; }
.sprechblase {
  position: absolute; pointer-events: none; background: var(--flaeche-3); border: 1px solid var(--rand-hell);
  border-radius: var(--r-klein); padding: 7px 10px; font-size: 12px; box-shadow: var(--schatten);
  max-width: 260px; z-index: 5; opacity: 0; transition: opacity .1s;
}
.sprechblase.sichtbar { opacity: 1; }
.sprechblase b { display: block; margin-bottom: 2px; }
.sprechblase .zeile { color: var(--text-leise); font-variant-numeric: tabular-nums; }

.zeitleiste { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.zeitleiste .jahr { font: 600 17px/1 var(--mono); min-width: 52px; font-variant-numeric: tabular-nums; }
.zeitleiste input[type=range] { flex: 1; }

.laden { color: var(--text-still); font-size: 13px; padding: 24px; text-align: center; }
.leer { color: var(--text-still); font-size: 13px; padding: 30px; text-align: center; border: 1px dashed var(--rand-hell);
  border-radius: var(--r-klein); }

.zweispaltig { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) {
  #app { grid-template-columns: 1fr; grid-template-rows: var(--kopf) auto 1fr; }
  nav.seitenleiste {
    flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 4px;
    padding: 8px 10px; border-right: none; border-bottom: 1px solid var(--rand);
    scroll-snap-type: x proximity;
    /* Am rechten Rand ausblenden, damit sichtbar ist, dass es weitergeht. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  nav.seitenleiste::-webkit-scrollbar { height: 0; }
  nav a { scroll-snap-align: start; }
  nav .gruppe { display: none; }
  .zweispaltig { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  main.inhalt { padding: 16px 14px 48px; }
  .karte { padding: 13px; }
  main.inhalt > h1 { font-size: 18px; }
  /* Die Marke kuerzen, damit der Zustand rechts nicht verdraengt wird. */
  .marke .version { display: none; }
  header.kopf { padding: 0 14px; gap: 10px; }
  /* Im Kopf ist dann kein Platz mehr fuer Klarnamen. Der Rueckweg bleibt, das
     Zeichen bleibt (mit dem Namen im title), der Rest weicht. */
  .anmeldung .namen, .anmeldung .abmelden { display: none; }
  .anmeldung .zurueck { padding: 5px 9px; }
}

.fussnote { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rand);
  font-size: 11.5px; color: var(--text-still); max-width: 90ch; }
a { color: var(--akzent); }
