/* Design nach PM Manager (siehe ../../docs/contracts/design-tokens.json) -
   dieselben Farben/Radien wie Launcher und internes Verwaltungstool. */
:root {
  --navy: #102450;
  --navy-dark: #0b1b3d;
  --navy-light: #1c3468;
  --orange: #f0a72a;
  --orange-dark: #db9520;
  --surface: #f4f6fa;
  --card: #ffffff;
  --border: #e1e6f0;
  --text-secondary: #5b6b85;
  --danger: #c0392b;
  --ok-bg: #e8f5ee;
  --ok-text: #1f7a45;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 13px;
  background: var(--surface);
  color: var(--navy);
}

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--orange); color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.topbar .title { font-size: 15px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar button.ghost {
  background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff;
  border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 12.5px;
}

.container { max-width: 900px; margin: 0 auto; padding: 24px 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 15px; color: var(--navy); }
.card h3 { font-size: 13px; color: var(--navy); margin-bottom: 4px; }
.card .sub { color: var(--text-secondary); font-size: 12px; margin-bottom: 14px; }

label { display: block; font-weight: 600; margin-bottom: 4px; margin-top: 10px; }
input[type="text"], input[type="password"], input[type="email"], textarea, select {
  width: 100%;
  border: 1px solid var(--navy);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--orange); border-color: var(--orange); }

button.primary {
  background: var(--orange);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  margin-top: 14px;
}
button.primary:hover { background: var(--orange-dark); }
button.primary:disabled { opacity: .5; cursor: not-allowed; }

button.small {
  background: var(--orange);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
button.ghost-small {
  background: #fff; border: 1px solid var(--border); color: var(--text-secondary);
  border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}

/* Freiwillige Empfehlung (Zwei-Faktor-Hinweis oben im Dashboard): sichtbar,
   aber keine Warnung - deshalb der orange Rand statt der Fehlerfarbe. */
.card.tipp { border-left: 4px solid var(--orange); }
.tipp-aktionen { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
a.tipp-link {
  background: var(--orange); color: #1a1a1a; text-decoration: none;
  border-radius: 6px; padding: 7px 14px; font-weight: 700; font-size: 12.5px;
}
a.tipp-link:hover { background: var(--orange-dark); }
.tipp-aktionen button.primary { margin-top: 0; }

/* Hinweis-Dialog (Empfehlung zum zweiten Faktor beim Oeffnen eines
   Werkzeugs) - gleiche Machart wie der EULA-Dialog weiter unten. */
.dialog-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 27, 61, .55);
  z-index: 20;
}
.dialog-card {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  max-width: 480px; width: 90%;
  box-shadow: 0 10px 34px rgba(16, 36, 80, .35);
  z-index: 21;
}
.dialog-text { font-size: 13px; line-height: 1.5; margin: 0 0 12px; }

/* QR-Code der Zwei-Faktor-Einrichtung: weisser Rand gehoert zum Code (die
   Kamera braucht die Ruhezone), deshalb kein Innenabstand. */
.mfa-qr img {
  display: block; width: 200px; height: 200px; margin: 8px 0 10px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}

.error { color: var(--danger); margin-top: 10px; font-size: 12.5px; }
.hint { color: var(--text-secondary); font-size: 12px; margin-top: 6px; }
/* Deutlichere Erfolgsrueckmeldung als das dezente .hint-Grau (siehe
   Bug-Meldung "keine Rueckmeldung ob es geklappt hat" bei "Passwort
   aendern" - die Meldung erschien zwar, war aber leicht zu uebersehen). */
.success { color: var(--ok-text); background: var(--ok-bg); border-radius: 6px; padding: 8px 10px; margin-top: 10px; font-size: 12.5px; font-weight: 600; }

.row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-top: 10px;
}
.row .name { flex: 1; }
.row .name b { display: block; font-size: 13.5px; }
.row .name span { display: block; color: var(--text-secondary); font-size: 11.5px; margin-top: 2px; }

.pill {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  background: var(--ok-bg); color: var(--ok-text);
}

.hidden { display: none !important; }

/* Software-Kacheln ("Meine Software") - ersetzt die fruehere schlichte
   .row-Liste durch ein Kachelraster mit Icon-Badge, Lizenz-/Versionszeile,
   Status-Label und (bei lokal installierbaren Produkten) zwei Aktionen
   plus einem einklappbaren Offline-Code-Bereich direkt in der Kachel
   selbst statt in einem globalen Dialog (siehe Design-Vorgabe/Screenshot).
   Web-Tools (product.web_url) behalten bewusst ihren simplen "Oeffnen"-
   Button unveraendert - nur die umgebende Kachel-Optik wird angeglichen. */
.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.software-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.software-card__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.software-card__icon {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
}
.software-card__icon.accent-navy { background: var(--navy); }
.software-card__icon.accent-orange { background: var(--orange); color: #1a1a1a; }
.software-card__titles { flex: 1; min-width: 0; }
.software-card__titles b { display: block; font-size: 13.5px; }
.software-card__titles .meta { display: block; color: var(--text-secondary); font-size: 11.5px; margin-top: 2px; }
.software-card__status {
  flex: none;
  font-size: 11px; font-weight: 700; color: var(--ok-text);
  white-space: nowrap;
}
.software-card__actions { display: flex; gap: 8px; margin-top: 14px; }
.software-card__actions button, .software-card__actions a { flex: 1; text-align: center; }

.btn-outline {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-outline:hover { background: var(--surface); }

.offline-code-panel {
  margin-top: 12px;
  background: var(--navy-dark);
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
}
.offline-code-panel .code {
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .5px;
  word-break: break-all;
}
.offline-code-panel .meta {
  margin-top: 6px;
  font-size: 11px;
  color: #b9c4dd;
}
.offline-code-panel .meta strong { color: #fff; }

pre.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 160px;
  overflow-y: auto;
}

/* Rechtstexte (Impressum/AGB/Datenschutz) - Fliesstext-Aufbereitung fuer
   die sonst nur auf Formulare/Kacheln ausgelegten .card-Inhalte. */
.legal-nav { margin-bottom: 16px; font-size: 12.5px; }
.legal-nav a { color: var(--navy); text-decoration: none; font-weight: 600; }
.legal-nav a:hover { text-decoration: underline; }
.legal h1 { font-size: 18px; margin: 0 0 4px; color: var(--navy); }
.legal .stand { color: var(--text-secondary); font-size: 12px; margin-bottom: 20px; }
.legal h2 { font-size: 14.5px; margin: 26px 0 8px; color: var(--navy); border-top: 1px solid var(--border); padding-top: 18px; }
.legal h2:first-of-type { border-top: none; padding-top: 0; margin-top: 4px; }
.legal h3 { font-size: 13px; margin: 14px 0 4px; color: var(--navy); }
.legal p { line-height: 1.55; margin: 8px 0; }
.legal ul, .legal ol { line-height: 1.55; margin: 8px 0; padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12.5px; }
.legal table th, .legal table td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
.legal table th { background: var(--surface); }
.legal .note {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--orange);
  border-radius: 6px; padding: 10px 12px; font-size: 12px; color: var(--text-secondary); margin: 14px 0;
}

.legal-footer {
  max-width: 900px; margin: 8px auto 30px; padding: 0 20px;
  display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-secondary);
}
.legal-footer a { color: var(--text-secondary); text-decoration: underline; }
.legal-footer a:hover { color: var(--navy); }

/* Ersatz fuer frueher inline gesetzte style="..."-Attribute (Katalogpunkt
   T01 des Sicherheitsaudits). Solange auch nur ein Inline-Style im HTML
   steht, muss die Content-Security-Policy style-src 'unsafe-inline'
   erlauben - und damit genau das, was eine CSP eigentlich verhindern soll:
   vom Angreifer eingeschleustes style-Attribut. Die Regeln stehen bewusst
   am Dateiende, damit sie bei gleicher Spezifitaet (z. B. .container)
   gewinnen, so wie das Inline-Attribut vorher auch. */

/* Schmale Formularseiten (Anmeldung, Passwort zuruecksetzen) */
.container--schmal { max-width: 420px; }

/* Zeile unter dem Anmeldeformular mit den beiden Hilfslinks */
.form-links { margin-top: 10px; display: flex; justify-content: space-between; }
.link-klein { font-size: 12px; color: var(--text-secondary); }

/* Angemeldeter Nutzer in der Kopfzeile */
#whoami { font-size: 12px; opacity: .85; }

/* Ueberschrift ohne Abstand nach oben, wenn sie einen Abschnitt eroeffnet */
.h3-buendig { margin-top: 0; }

/* Abgesetzter Unterabschnitt innerhalb einer Karte (z. B. Zwei-Faktor) */
.abschnitt-trenner { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
#mfa-setup-details { margin-top: 10px; }

/* EULA-Zustimmungsdialog: blockierender Overlay ueber der Seite. Die
   .hidden-Regel (display:none !important) sticht diese Regeln weiterhin,
   der Dialog bleibt also bis zum Einblenden unsichtbar. */
#eula-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 27, 61, .55);
  z-index: 20;
}
#eula-card {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  max-width: 480px; width: 90%;
  box-shadow: 0 10px 34px rgba(16, 36, 80, .35);
  z-index: 21;
}
#eula-text {
  max-height: 180px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 10px; white-space: pre-wrap;
}

/* Betriebsverwaltung ("Mein Betrieb", js/betrieb.js) - nur fuer den
   Master-Account. Zeilen wie .row, dazu eine umbrechende Knopfleiste je
   Konto und eine graue Pill fuer gesperrte/eingeladene Konten. */
.row .aktionen { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
.pill--aus { background: var(--surface); color: var(--text-secondary); }
.pill--master { background: var(--navy); color: #fff; }
.lizenz-zugeteilt { border-color: var(--ok-text); color: var(--ok-text); }

/* Hinweisfenster zu den Passwort-Kriterien (js/formular-hilfen.js): gruener
   Haken oder rotes Kreuz je Kriterium, waehrend der Eingabe. */
.pw-kriterien {
  margin-top: 8px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--orange);
  border-radius: 6px; box-shadow: 0 4px 14px rgba(16, 36, 80, .10);
  font-size: 12.5px;
}
.pw-kriterien-titel { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.pw-kriterien-titel + ul { margin: 4px 0 6px; padding: 0; list-style: none; }
.pw-kriterien ul:last-child { margin-bottom: 0; }
.pw-kriterien li { display: flex; align-items: baseline; gap: 8px; padding: 1px 0; }
.pw-kriterien .pw-zeichen { flex: none; width: 14px; font-weight: 800; text-align: center; }
.pw-kriterien li.ok { color: var(--ok-text); }
.pw-kriterien li.fehlt { color: var(--danger); }
.nur-vorlesen {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
