/* econio conduit - schlichtes, funktionales Verwaltungs-UI */
* { box-sizing: border-box; }
body {
  margin: 0; color: #1b2733; background: #f4f6f8;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }
h1 { font-size: 1.5rem; margin: 0.4em 0 0.6em; }
h2 { font-size: 1.15rem; margin: 1.6em 0 0.5em; }
a { color: #0b5fa5; }
code { background: #e9edf1; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.muted { color: #6b7887; }
.error-text { color: #b3261e; font-size: 0.88em; }
.spacer { flex: 1; }

/* Navigation */
nav {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: #16324f; color: #fff; padding: 10px 20px;
}
nav a { color: #cfe0ef; text-decoration: none; }
nav a:hover { color: #fff; }
nav .brand { font-weight: 700; letter-spacing: 0.3px; margin-right: 8px; }
nav .who { color: #9fb6ca; }
nav a.nav-admin { color: #f2c14e; }
nav a.nav-admin:hover { color: #ffdb8a; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 6px; margin: 12px 0; }
.flash.ok { background: #e2f2e5; color: #1e5c2a; border: 1px solid #bcdec4; }
.flash.err { background: #fbe4e2; color: #8f221c; border: 1px solid #eec3c0; }
.flash.warn { background: #fdf3d8; color: #6d5410; border: 1px solid #ecd9a0; }

/* Notice (dauerhafter Hinweis, z. B. DATEV-Token-Verwaltung) */
.notice { background: #eaf2f9; color: #114a7c; border: 1px solid #cfe0ef; border-radius: 6px; padding: 10px 14px; margin: 12px 0; }
.notice a { font-weight: 600; }

/* Badges */
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 10px;
  font-size: 0.8em; font-weight: 600; white-space: nowrap;
}
.st-aktiv { background: #d9efdc; color: #1e5c2a; }
.st-abgelaufen { background: #f8d7d5; color: #8f221c; }
.st-getrennt { background: #e4e8ec; color: #5a6673; }
.typ-langzeit { background: #dbe9f8; color: #114a7c; }
.typ-kurzzeit { background: #f2e4f8; color: #5f2478; }
/* Status-Punkt (Verbindungsseiten): grün = aktiv, rot = nicht aktiv */
.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; background: #c0392b;
}
.dot.aktiv { background: #2e9e4a; }
.env-sandbox { background: #fdf3d8; color: #6d5410; }
.env-prod { background: #f8d7d5; color: #8f221c; }

/* Tabellen */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #dde3e9; border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
th { background: #f8fafb; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.4px; color: #5a6673; }
tr:last-child td { border-bottom: none; }
/* Scrollende Tabelle mit stehender Kopfzeile (Protokolle): Hoehe an das
   Browserfenster gebunden, Kopfzeile bleibt oben sichtbar */
.scroll-table { max-height: calc(100vh - 240px); min-height: 240px; overflow-y: auto; }
.scroll-table th {
  position: sticky; top: 0; z-index: 1;
  /* border-bottom verschwindet bei sticky + border-collapse -> Linie per Schatten */
  box-shadow: inset 0 -1px 0 #dde3e9;
}
/* Protokolle: URL und Meldung vollstaendig anzeigen, an beliebiger Stelle umbrechen */
.msg-cell { max-width: 360px; font-size: 0.85em; color: #b3261e; overflow-wrap: anywhere; white-space: normal; }
.url-cell { max-width: 520px; font-size: 0.85em; font-family: ui-monospace, Consolas, "Courier New", monospace;
            overflow-wrap: anywhere; word-break: break-all; white-space: normal; }
/* Aktionszellen bleiben echte Tabellenzellen (kein display:flex auf <td>: das
   verschiebt die Zelle und ihre Trennlinie gegenueber der Zeile); Inhalt in
   einer Zeile, Elemente mittig zueinander ausgerichtet */
.actions { white-space: nowrap; }
.actions > * { vertical-align: middle; }
.actions > * + * { margin-left: 4px; }
.actions form { margin-top: 0; margin-bottom: 0; display: inline-flex; align-items: center; gap: 6px; }
.actions a.btn, .actions form button { margin: 0; padding: 5px 12px; }
/* Icon-Buttons in Tabellen (Verbindungen): quadratisch, Tooltip via title */
.icon-btn, .actions form.inline button.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; margin: 0;
  border: 1px solid #c3ccd5; border-radius: 6px; background: #fff; color: #0b5fa5;
  cursor: pointer; text-decoration: none; line-height: 1;
}
.icon-btn:hover, .actions form.inline button.icon-btn:hover { background: #eaf2f9; border-color: #0b5fa5; }
.icon-btn.danger, .actions form.inline button.icon-btn.danger { color: #b3261e; }
.icon-btn.danger:hover, .actions form.inline button.icon-btn.danger:hover { background: #f9e3e1; border-color: #b3261e; }
.icon-btn.off, .actions form.inline button.icon-btn.off { color: #9aa5b1; border-color: #dde3e9; }
.icon-btn.off:hover, .actions form.inline button.icon-btn.off:hover { color: #0b5fa5; border-color: #0b5fa5; background: #eaf2f9; }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Filterleiste (Protokolle) */
/* alles in EINER Zeile: die uebrigen Felder behalten ihre Breite, das Suchfeld
   nimmt den Rest und schrumpft bei Platzmangel (min 120px) */
.filter-bar { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.filter-bar label { margin: 0; flex: 0 0 auto; }
.filter-bar label:first-child { flex: 1 1 120px; min-width: 120px; }
.filter-bar input[type=text], .filter-bar input[type=datetime-local], .filter-bar select { width: 100%; min-width: 0; }
.filter-bar select { width: auto; }
.filter-bar button, .filter-bar .btn { margin: 0; }
.filter-bar button.icon-btn, .filter-bar a.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; margin: 0;
  border: 1px solid #c3ccd5; border-radius: 6px; background: #fff; color: #0b5fa5;
  cursor: pointer; text-decoration: none; line-height: 1;
}
.filter-bar button.icon-btn:hover, .filter-bar a.icon-btn:hover { background: #eaf2f9; border-color: #0b5fa5; }
/* Filter aktiv: invertiert (blauer Grund, weisses Icon) */
.filter-bar button.icon-btn.active { background: #0b5fa5; border-color: #0b5fa5; color: #fff; }
.filter-bar button.icon-btn.active:hover { background: #094b83; border-color: #094b83; color: #fff; }
.filter-bar .icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Ja/Nein-Spalten (Aktiv, Freischaltung): zentriert, Haken gruen, Kreuz grau */
th.flag, td.flag { text-align: center; }
td.flag .yes { color: #1e7d4a; font-weight: 600; }
td.flag .no { color: #9aa5b1; font-weight: 600; }

/* Aufklappbare Mandanten je Verbindung */
.expander {
  display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 2px 8px 2px 4px;
  border: 1px solid transparent; border-radius: 6px; background: none; color: #0b5fa5;
  cursor: pointer; font: inherit;
}
.expander:hover { background: #eaf2f9; border-color: #c3ccd5; }
.expander svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.expander.open svg { transform: rotate(90deg); }
.sub-row td { background: #f8fafb; padding: 8px 16px 12px 44px; border-bottom: 1px solid #dde3e9; }
.sub-table { width: 100%; background: #fff; border: 1px solid #dde3e9; border-radius: 6px; }
.sub-table th { font-size: 0.78em; }
.sub-table td, .sub-table th { padding: 6px 12px; }
.sub-hint { margin: 6px 0 0; font-size: 0.85em; }

/* Cards (Dashboard) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid #dde3e9; border-radius: 8px; padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kv td { border: none; padding: 2px 8px 2px 0; }
.kv td:first-child { color: #6b7887; width: 40%; }

/* Formulare */
.forms-row { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 20px; }
.panel { background: #fff; border: 1px solid #dde3e9; border-radius: 8px; padding: 16px 20px; flex: 1; min-width: 320px; }
label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 0.9em; }
input[type=text], input[type=password], input[type=datetime-local], select {
  width: 100%; padding: 7px 10px; border: 1px solid #c3ccd5; border-radius: 6px;
  font: inherit; background: #fff;
}
button, .btn {
  display: inline-block; margin-top: 8px; padding: 6px 14px; border: 1px solid #0b5fa5;
  background: #0b5fa5; color: #fff; border-radius: 6px; cursor: pointer;
  font: inherit; font-size: 0.9em; text-decoration: none;
}
button:hover, .btn:hover { background: #094b83; }
.inline { display: inline; }
.inline button { margin-top: 0; padding: 3px 10px; background: #fff; color: #0b5fa5; }
.inline button:hover { background: #eaf2f9; }
.inline input[type=password] { width: auto; padding: 3px 8px; }
/* Einstellungen: Werte wie Client-IDs (32 Zeichen) und URLs muessen vollstaendig
   sichtbar sein - feste Mindestbreite, Monospace; die Tabelle scrollt bei Bedarf
   horizontal (.table-wrap). */
.settings-table td.value { min-width: 440px; }
.settings-table td.save-cell { white-space: nowrap; width: 1%; }
.settings-table td.value form { display: block; }
.settings-table input[type=text], .settings-table input[type=password], .settings-table select {
  display: block; width: 100%; min-width: 42ch;
  font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 0.95em;
  padding: 5px 8px;
}
button.linklike {
  background: none; border: none; color: #cfe0ef; cursor: pointer;
  padding: 0; margin: 0; font: inherit; text-decoration: underline;
}
main button.linklike { color: #0b5fa5; }
nav button.linklike { text-decoration: none; }
nav button.linklike:hover { color: #fff; background: none; }

/* Login */
.login-box {
  max-width: 360px; margin: 10vh auto 0; background: #fff; padding: 30px 34px;
  border: 1px solid #dde3e9; border-radius: 10px; text-align: center;
}
.login-box h1 { margin: 0; color: #16324f; }
.login-box form { text-align: left; margin-top: 18px; }
.login-box button { width: 100%; margin-top: 16px; }

/* Sicherheits-Release 16.09.2026: Auto-Logout-Warnung, Kontosperre, Login-Protokoll */
.idle-warn { position: sticky; top: 8px; z-index: 20; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.idle-warn button.linklike { margin-left: 10px; font-weight: 600; }
.badge.lock { background: #fbe4e2; color: #8f221c; border: 1px solid #eec3c0; }
.actions form button.linklike { padding: 0; }
table.compact td, table.compact th { padding: 4px 8px; font-size: 0.92em; }
table.compact td.ua { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-table-sm { max-height: 60vh; }   /* Anmeldeprotokoll unterhalb der Benutzerliste */
table.compact .yes { color: #1e7d4a; font-weight: 600; }
table.compact .no { color: #8f221c; font-weight: 600; }
tr.login-gesperrt td, tr.login-rate-limit td { background: #fff5f4; }
