/*
 * GroupsSUITE-Launcher — Oberfläche.
 *
 * Farben, Radien, Schriftgrössen und die Schrift selbst stehen in tokens.css
 * und stammen aus GroupsCAMP. Hier steht nur, was der Launcher daraus baut.
 *
 * Die Klassennamen folgen GroupsCAMP überall dort, wo es sie dort schon gibt
 * (.panel, .dash-*, .auth-screen, .btn, .field-*). Nicht aus Sparsamkeit,
 * sondern damit ein späterer Abgleich ein Vergleich bleibt und keine
 * Übersetzung. Eigen sind nur die Modulkacheln — dafür gibt es in GroupsCAMP
 * keine Vorlage.
 */

/* --- Grundlage ------------------------------------------------------------ */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  /* Blaues Raster im Hintergrund, wie in GroupsCAMP. */
  background-image:
    radial-gradient(1200px 600px at 50% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
button { font-family: inherit; }

/* Sichtbarer Tastaturfokus überall — der Launcher wird auch mit der Tastatur
   bedient, und der Standardring des Browsers verschwindet auf dunklem Grund. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Hülle: angemeldet ---------------------------------------------------- */
.dashboard { min-height: 100%; display: flex; flex-direction: column; }

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.dash-brand {
  font-size: var(--fs-brand);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.dash-brand .suite { color: var(--t2); }

.dash-top-right { display: flex; align-items: center; gap: 1rem; }
.user-email { font-size: var(--fs-sub); color: var(--t3); }

/* button_to legt ein <form> um den Knopf — ohne diese Zeile drückt es die
   Kopfzeile auseinander. */
.dash-top-right form { margin: 0; }

.logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--t2);
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
}
.logout:hover { color: var(--ink); }

.dash-main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.dash-welcome { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.dash-title { font-size: var(--fs-title); font-weight: 600; margin: 0; }
.dash-lead { color: var(--t3); margin: 0.35rem 0 0; }

/* --- Hülle: abgemeldet ---------------------------------------------------- */
.auth-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2rem 1rem;
}
.auth-stack {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Bereich und Karte ---------------------------------------------------- */
/* Ein Bereich ist eine Überschrift samt Inhalt. Ab Schritt 3 steht hier mehr
   als ein Raster aus Kacheln. */
.area { margin-top: 2rem; }
.area-title {
  font-size: var(--fs-panel-title);
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--t2);
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
/* Akzentstreifen an der Oberkante — die Kartenform von GroupsCAMP. */
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
}
.panel-title { font-size: var(--fs-panel-title); font-weight: 600; margin: 0; }

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-chip);
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

/* --- Meldungen ------------------------------------------------------------ */
.flash {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  font-size: var(--fs-sub);
  border-radius: 10px;
  border: 1px solid;
}
.flash-notice { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.flash-alert { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); background: color-mix(in srgb, var(--err) 12%, transparent); }

/* Angemeldet stehen die Meldungen über dem Inhalt und brauchen Abstand nach
   unten; abgemeldet erledigt das der gap der .auth-stack. */
.dash-main > .flash { margin-bottom: 1.25rem; }

/* --- Wortmarke auf den abgemeldeten Seiten -------------------------------- */
.wordmark {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.wordmark .mark { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.02em; }
.wordmark .mark .suite { color: var(--t2); }
.wordmark .tagline { color: var(--t3); font-size: 0.85rem; }

/* --- Formulare ------------------------------------------------------------ */
.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-size: 0.8rem; font-weight: 600; color: var(--t2); }
.field-input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
}
.field-input::placeholder { color: var(--t4); }
.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn {
  width: 100%;
  appearance: none;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--primary-d); }
.btn:disabled { opacity: 0.6; cursor: default; }

.auth-foot { margin: 0; font-size: var(--fs-sub); color: var(--t3); text-align: center; }

/* --- Modulkacheln --------------------------------------------------------- */
/* Eigen für den Launcher — dafür gibt es in GroupsCAMP keine Vorlage. Form und
   Zustände folgen trotzdem der Karte: 1px Rand, --radius, Akzentstreifen. Der
   steht hier links statt oben, weil die Kachel ihre eigene Modulfarbe trägt. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.1rem 1.4rem;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tile:hover { border-color: var(--line-2); background: var(--panel-2); }
.tile-accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--tile-accent, var(--accent));
}
.tile-name { font-weight: 600; font-size: var(--fs-body); }
.tile-desc { color: var(--t3); font-size: var(--fs-sub); }

/* Nicht eingerichtet: dieselbe Form, zurueckgenommen. Der gestrichelte Rand ist
   derselbe wie beim leeren Zustand — was noch nicht da ist, sieht in dieser
   Oberflaeche ueberall gleich aus. Kein hover, denn es fuehrt nirgendwohin. */
.tile-off {
  border-style: dashed;
  border-color: var(--line-2);
  background: transparent;
  color: var(--t3);
}
.tile-off .tile-accent { opacity: 0.35; }
.tile-off .tile-desc { color: var(--t4); }
.tile-state {
  align-self: flex-start;
  margin-top: 0.35rem;
  font-size: var(--fs-chip);
  font-weight: 600;
  color: var(--t3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

/* --- Leerer Zustand ------------------------------------------------------- */
.placeholder {
  color: var(--t3);
  background: var(--panel);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* --- Systemgesundheit ------------------------------------------------------ */
/* Eine Karte je Modul. Faellt eines aus, bleibt seine Karte leer und die
   uebrigen stehen — deshalb ein Raster aus eigenstaendigen Karten und keine
   gemeinsame Tabelle. */
.health {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.health-card { padding: 1.25rem; gap: 0.75rem; }

.health-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.health-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.5rem 0.6rem;
}
.health-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  align-self: center;
}
.health-dot--ok { background: var(--ok); }
.health-dot--error { background: var(--err); }
.health-dot--unmonitored { background: var(--t4); }

.health-name { font-weight: 600; font-size: var(--fs-body); }
.health-status { font-size: var(--fs-chip); font-weight: 600; white-space: nowrap; }
.health-status--ok { color: var(--ok); }
.health-status--error { color: var(--err); }
.health-status--unmonitored { color: var(--t4); }

/* Die Begruendung steht unter der Zeile, ueber die volle Breite. Ohne sie ist
   ein Zustand nur eine Farbe. */
.health-detail {
  grid-column: 2 / -1;
  color: var(--t3);
  font-size: var(--fs-sub);
}

.health-down { color: var(--t3); margin: 0; }

/* Verwaltung in den Modulen — Verweise, keine eigenen Seiten.

   Bewusst schlichter als die Modulkacheln: kein Akzentbalken, keine Farbe je
   Modul. Diese Verweise sind kein Einstieg in die taegliche Arbeit, sondern
   ein Verzeichnis; sie sollen die Kacheln darueber nicht ueberstrahlen. */
.area-lead {
  color: var(--t3);
  font-size: var(--fs-sub);
  margin: -0.35rem 0 0.9rem;
}
/* Die Umgebung eines Verweises muss aus dem Augenwinkel lesbar sein. Drei
   Merkmale tragen sie, nicht eines — die Begruendung steht in
   _module_admin.html.erb.

   Warum die Bernsteinfarbe hier steht und nicht in tokens.css: tokens.css ist
   eine Kopie aus GroupsCAMP, und dort gibt es diese Farbe nicht. Ein Wert, den
   nur der Launcher braucht, gehoert nicht in die Kopie — sonst weicht sie beim
   naechsten Abgleich ab, und niemand weiss mehr, welche Seite recht hat. */
:root {
  --staging: #f59e0b;
}

.env-block {
  position: relative;
  margin-top: 1rem;
  padding: 1.1rem 1rem 1rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--panel);
}
/* Der Abstand zwischen den Umgebungen ist groesser als der zwischen zwei
   Gruppen darin. Sonst laesen sich die Bloecke als eine lange Liste. */
.env-block + .env-block { margin-top: 2rem; }

/* Der obere Rand. Kein overflow:hidden am Block — das schnitte den
   Tastaturfokus der Verweise darin ab. */
.env-block::before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  left: -4px;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.env-block--production { border-left-color: var(--t3); }
.env-block--production::before { background: var(--t3); }

.env-block--staging { border-left-color: var(--staging); }
.env-block--staging::before {
  background: repeating-linear-gradient(
    135deg,
    var(--staging) 0 7px,
    transparent 7px 14px
  );
}

.env-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: var(--fs-panel-title);
  font-weight: 600;
}
.env-name { color: var(--t2); }
.env-block--staging .env-name { color: var(--staging); }
/* Das Wort, das die Folge nennt: Echtdaten gegen Testdaten. */
.env-zusatz {
  font-size: var(--fs-chip);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--t3);
}
.env-block--staging .env-zusatz { color: var(--staging); }

.env-modul {
  margin: 1.25rem 0 0.6rem;
  font-size: var(--fs-sub);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--t4);
}
.env-modul:first-of-type { margin-top: 0; }

/* Ein Tippfehler im Schalter steht da, statt still zu wirken. */
.env-hinweis {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--staging);
  border-radius: var(--radius);
  color: var(--t2);
  font-size: var(--fs-sub);
}

.admin-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}
.admin-link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  /* War var(--r) — ein Token, das es nicht gibt. Die Verweise standen als
     einzige Flaeche der Oberflaeche mit rechten Ecken da. */
  border-radius: var(--radius);
  background: var(--panel-2);
  text-decoration: none;
  color: inherit;
}
.admin-link:hover { border-color: var(--line-2); background: var(--panel); }
.admin-link-name { font-weight: 600; font-size: var(--fs-body); }
.admin-link-desc { color: var(--t3); font-size: var(--fs-sub); }

/* Dieselbe Zuruecknahme wie bei .tile-off: gestrichelt, ohne hover, ohne
   Verweis. Was nicht hinfuehrt, sieht in dieser Oberflaeche ueberall gleich
   aus. */
.admin-link--off {
  border-style: dashed;
  border-color: var(--line-2);
  background: transparent;
  color: var(--t3);
}
.admin-link--off .admin-link-desc { color: var(--t4); }
