/**
 * mgmt.css
 *
 * @company     FUX IT GMBH
 * @author      Helmut FUX
 * @copyright   (c) 2026 - FUX IT GMBH - Alle Rechte vorbehalten
 *
 * @description Ergänzungen zu fxarchive.css, die nur die echte Admin-GUI braucht (Formular-Fehler,
 *              Meldungen, 2FA-Einrichtung, Abmelde-Knopf als Formular). Farben ausschließlich über die
 *              Variablen aus fxarchive.css (--accent, --reject …), damit das Erscheinungsbild einheitlich bleibt.
 */

/* Meldungen nach dem Speichern (Flash) */
.flash { margin-bottom: 14px; }

/* Abmelden ist ein Formular (POST mit CSRF-Schutz), soll aber wie ein Menüpunkt aussehen */
.rail-form { margin: 0; display: contents; }
.rail-form .rail-btn { border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }

/* Schmale Karte für einfache Formulare */
.card.narrow { max-width: 560px; }

/* Formular-Fehler je Feld */
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--reject); }
.field .error-text { color: var(--reject); font-size: 12.5px; }

/* 2FA: ein Eingabefeld für den ganzen Code, gut lesbar */
.otp-single { font-family: var(--mono); font-size: 22px; letter-spacing: .35em; text-align: center; padding: 10px; }
.qr-box { text-align: center; margin: 6px 0 14px; }
.qr-box svg { display: inline-block; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); width: 210px; height: auto; }
code.secret { font-size: 15px; letter-spacing: .05em; word-break: break-all; }
.steps { padding-left: 18px; margin: 0 0 6px; font-size: 13.5px; line-height: 1.6; }

/* Formular in einer Tabellenzeile oder Kopfzeile (z. B. Löschen-Knopf) */
.inline-form { display: inline; margin: 0; }

/* Einstellungs-Tabelle: Abweichung (Checkbox) + Steuerelement + geerbter Wert */
.settings-group { margin-bottom: 16px; }
.setting .inherit { font-size: 12px; color: var(--text-2); }
.setting.overridden { background: var(--accent-light); }
.setting .override { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.setting input[type=number] { width: 100px; }
.setting select { min-width: 180px; }
.setting .unit { color: var(--text-2); font-size: 12.5px; }
.setting .ref { font-size: 11px; color: var(--text-2); margin-left: 6px; }

/* Definitionsliste (Detailseiten) */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.facts dt { color: var(--text-2); font-size: 12.5px; }
dl.facts dd { margin: 0; }

/* Leerer Zustand einer Liste */
.empty { padding: 28px 16px; text-align: center; color: var(--text-2); }

/* Blättern */
.pager-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-size: 12.5px; color: var(--text-2); }

/* JSON-/Konfigurationsanzeige */
pre.code { margin: 0; padding: 14px; background: #0F1318; color: #D5DBE3; border-radius: var(--radius); font-family: var(--mono); font-size: 12px; overflow: auto; max-height: 520px; }

/* Kachel als Link (Übersicht) */
a.link-card { color: inherit; text-decoration: none; display: block; }
a.link-card:hover { border-color: #C9CED6; }

/* Einstellung mit ungültiger Eingabe */
.setting.has-error { background: var(--reject-bg); }
.setting .name label { font-weight: 500; }

/* Benutzermenü rechts oben (<details>, wie im R+H Bau Manager) */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; border-radius: var(--radius); padding: 4px 6px; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--ground); }
.user-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-menu .user-chev { width: 15px; height: 15px; color: var(--text-2); transition: transform .15s; }
.user-menu[open] .user-chev { transform: rotate(180deg); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; z-index: 70;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(20, 24, 31, .16); padding: 6px;
}
.user-dropdown-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none;
  font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left;
}
.user-dropdown-item:hover { background: var(--ground); text-decoration: none; }
.user-dropdown-item svg { width: 16px; height: 16px; color: var(--text-2); }
.user-dropdown-item.danger { color: var(--reject); }
.user-dropdown-item.danger svg { color: var(--reject); }
.user-dropdown .inline-form { display: block; }

/* Vorschau einer Mail als reiner Text (nie fremdes HTML) */
pre.mail-text { white-space: pre-wrap; word-break: break-word; font-family: var(--sans, inherit); font-size: 13px; line-height: 1.5; margin: 0; }
tr.m td.c-subj a { color: inherit; text-decoration: none; }

/* LDAP-Felder der Domain */
fieldset.ldap-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0 0 14px; }
fieldset.ldap-box legend { font-size: 12.5px; color: var(--text-2); padding: 0 6px; }

/* --- Druck (Berichte als PDF speichern): nur der Inhalt, ohne Menü, Kopfleiste, Formulare und Knöpfe ----------- */
@media print {
  .rail, .topbar, .no-print, .flash, .toast-area, .btn { display: none !important; }
  .app, .main, .content { display: block !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  .card { break-inside: avoid; box-shadow: none !important; border-color: #ccc !important; }
  a { color: inherit; text-decoration: none; }
}

/* Auswahl in Werkzeugleisten (z. B. Berichte: Domain, Zeitraum, Datum) nicht über die ganze Breite */
.toolbar select, .toolbar input[type=date] { width: auto; }

/* Message-Trace (MailCleaner-Stil): Zeile aufklappbar, Stufen mit Protokollzeilen */
tr.trace-row { cursor: pointer; }
tr.trace-row:hover td { background: #FFF7ED; }
tr.trace-row.open td { background: #FFF7ED; border-bottom-color: transparent; }
tr.trace-row .chev { display: inline-block; transition: transform .15s; color: var(--text-2); }
tr.trace-row.open .chev { transform: rotate(90deg); }
tr.trace-detail > td { background: #FBFBFC; padding: 10px 14px 14px; }
.stage { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin-top: 8px; }
.stage > b { font-size: 12.5px; color: var(--text-2); text-align: right; padding-top: 2px; }
.stage pre { margin: 0; font-size: 11.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-all; background: #fff;
    border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; max-height: 260px; overflow: auto; }
.rcpt-list { display: flex; flex-direction: column; gap: 2px; }
.trace-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
.trace-filter label { font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 3px; }
.trace-filter .actions { display: flex; align-items: flex-end; gap: 8px; }
.pages { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pages a, .pages span.cur { min-width: 30px; text-align: center; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; }
.pages span.cur { background: #C2410C; border-color: #C2410C; color: #fff; font-weight: 600; }
.pages span.gap { border: 0; color: var(--text-2); }
.logtable td { vertical-align: top; }
mark { background: #FDE68A; color: inherit; padding: 0 1px; }
[data-copy].copied { outline: 2px solid #15803D; }

.trace-filter .span-2 { grid-column: span 2; }
.trace-table .addr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; display: block; }
.trace-table td.addr { display: table-cell; }
.trace-table td { vertical-align: top; }
@media (max-width: 760px) { .trace-filter .span-2 { grid-column: auto; } }

/* Seite „Lernen“: Stand-Balken und Ablagefläche */
.learn-meter { display: grid; grid-template-columns: 130px 1fr 70px; gap: 6px 10px; align-items: center; margin: 8px 0 4px; font-size: 12.5px; }
.learn-meter b { text-align: right; }
.learn-meter .bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.learn-meter .bar i { display: block; height: 100%; }
.learn-meter .bar i.spam { background: #B91C1C; }
.learn-meter .bar i.ham { background: #15803D; }
.dropzone { display: flex; align-items: center; gap: 14px; padding: 22px 16px; border: 2px dashed var(--line); border-radius: 10px;
    cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.dropzone > svg { width: 28px; height: 28px; color: #C2410C; flex: none; }
.dropzone .dropzone-files { display: block; margin-top: 4px; }
[data-dropzone].dragging .dropzone, .dropzone:hover { border-color: #C2410C; background: #FFF7ED; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) { .learn-meter { grid-template-columns: 110px 1fr 56px; } }

/* Einrichtungsblatt drucken: nur der Inhalt */
.sheet h3 { font-size: 14px; margin: 0 0 6px; }
.sheet ol { margin: 0; padding-left: 20px; line-height: 1.7; }
@media print {
    .rail, .topbar, .no-print, .flash, header { display: none !important; }
    body, .main, main { background: #fff !important; padding: 0 !important; margin: 0 !important; }
    .card { box-shadow: none !important; border: 0 !important; }
}

/* =====================================================================================
   fxARCHIVE – Ergänzungen (Kennzahlen, Balken, Mailbrowser, Einrichtungsschritte)
   ===================================================================================== */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpis .kpi { background: var(--surface, #fff); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi-label { display: block; color: var(--text-2); font-size: 12.5px; }
.kpi b { display: block; font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.warn { border-color: #FDE68A; background: var(--quar-bg); }
.kpi.danger { border-color: #FCA5A5; background: var(--reject-bg); }
form.toolbar { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface, #fff); margin-bottom: 12px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bars .bar span { display: block; width: 100%; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; }
.bars .bar small { font-size: 10.5px; color: var(--text-2); margin-top: 4px; }
.mail-frame { width: 100%; height: 60vh; min-height: 360px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.mail-meta dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.mail-meta dt { color: var(--text-2); font-size: 12.5px; }
.mail-meta dd { margin: 0; word-break: break-word; }
nav.tabs a { padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; }
nav.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.card > nav.tabs { padding: 0 12px; margin-bottom: 0; }
ul.attachments { list-style: none; padding: 0; margin: 0; }
ul.attachments li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.mail-list td.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-list .att { margin-left: 4px; font-size: 12px; }
.search-form .advanced summary { cursor: pointer; color: var(--text-2); margin-top: 10px; font-size: 13px; }
ol.steps { padding-left: 20px; margin: 0; }
ol.steps li { margin-bottom: 14px; }
ol.steps pre.code { margin-top: 6px; white-space: pre-wrap; }
table.settings td { vertical-align: top; }

/* --- Systemübersicht am Dashboard (ADR 0003): Knoten, Füllstände, Kurven ----------------------- */
.node-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.node-head h3 { margin: 0; font-size: 15px; }
.meter-row { display: grid; grid-template-columns: 8em 1fr 7em; align-items: center; gap: 8px; font-size: 12.5px; margin: 5px 0; }
.meter-row > span:last-child { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.meter { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.meter.warn > span { background: var(--quar); }
.meter.danger > span { background: var(--reject); }
.spark { width: 100%; height: 40px; display: block; margin-top: 6px; }
.spark polyline { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .cpu { stroke: var(--accent); }
.spark .mem { stroke: var(--grey); }
.legend { font-size: 11.5px; color: var(--text-2); display: flex; gap: 12px; }
.legend i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin: 0; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .meter-row { grid-template-columns: 6.5em 1fr 6em; } }

/* --- Dashboard gestalten (übernommen aus dem R+H Bau Manager): ziehen, ein-/ausschalten, Uhr, Wetter ---- */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.dash-el { display: flex; flex-direction: column; min-width: 0; }
.dash-el.full { grid-column: 1 / -1; }
.dash-el > .card { flex: 1; }
.dash-el.is-hidden { display: none; }
.dash-el-bar { display: none; }
.dash-editbar p { margin: 0 0 10px; }
.dash-editbar p svg { width: 15px; height: 15px; vertical-align: -3px; }
body.dash-editing .dash-el { padding: 8px; border: 2px dashed var(--accent-border); border-radius: 12px; background: var(--surface); cursor: grab; }
body.dash-editing .dash-el.is-hidden { display: flex; opacity: .45; }
body.dash-editing .dash-el.dragging { opacity: .35; }
body.dash-editing .dash-el-bar { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; font-size: 13.5px; }
body.dash-editing .dash-el a, body.dash-editing .dash-el .card { pointer-events: none; }
.dash-grip { color: var(--text-2); display: inline-flex; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* Dashboard: Datum und Uhrzeit, kompakt */
.dash-clock .card-body, .dash-weather .card-body { padding: 12px 16px; }
.dash-clock .card-body { display: flex; flex-direction: column; justify-content: center; gap: 2px; height: 100%; }
.dash-clock-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dash-time { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* Dashboard: Wetter, kompakt (templates/dashboard/weather.php) */
.wx { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.wx svg { width: 14px; height: 14px; vertical-align: -2px; }
.wx-now { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wx-ico { display: inline-flex; color: var(--accent); }
.wx .wx-ico svg { width: 26px; height: 26px; }
.wx .wx-ico.sm svg { width: 16px; height: 16px; }
.wx-temp { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.wx-src { white-space: nowrap; }
.wx-days { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.wx-day { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.wx-rain { color: var(--text-2); font-size: 12px; }
.wx-rain.wet { color: #1d4ed8; font-weight: 600; }
.dash-date { color: var(--text-2); }
.dash-el .node { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.dash-quick .btn { flex: 0 0 auto; }
.logo-mark .brand-logo { width: 100%; height: 100%; object-fit: contain; display: block; }

/* --- Darstellung: fertige Themes zur Auswahl (system/theme.php) ---------------------------------------- */
.theme-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.theme-preset { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.theme-preset.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.theme-preset .btn { align-self: flex-start; }
.theme-swatch { display: flex; gap: 6px; padding: 10px; border-radius: var(--radius-sm); }
.theme-swatch span { width: 26px; height: 26px; border-radius: 6px; }
