/* LDAP-Portale · gemeinsames Stylesheet
   Hell und dunkel nach Systemeinstellung, umschaltbar (data-theme auf <html>).
   Kontraste: Text und gedämpfter Text ≥ 4.5:1 auf ihrer Fläche. */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #dcdfe5;
  --border-strong: #c3c8d1;
  --text: #1a1d23;
  --muted: #586070;
  --accent: #5a3fd1;
  --accent-hover: #4a31b5;
  --accent-soft: #efebff;
  --on-accent: #ffffff;
  --ok: #17734a;      --ok-soft: #e3f4ea;
  --warn: #8a5a00;    --warn-soft: #fbf0d9;
  --bad: #b42323;     --bad-soft: #fbe6e6;
  --info: #1f5fa8;    --info-soft: #e4eefa;
  --focus: #5a3fd1;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 33, .06), 0 1px 1px rgba(20, 24, 33, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318;
    --surface: #191c23;
    --surface-2: #1f232b;
    --border: #2d323d;
    --border-strong: #3d4350;
    --text: #e7e9ee;
    --muted: #a2a9b6;
    --accent: #a594ff;
    --accent-hover: #b9abff;
    --accent-soft: #2a2546;
    --on-accent: #15121f;
    --ok: #63d39a;      --ok-soft: #173326;
    --warn: #e6b74f;    --warn-soft: #362a12;
    --bad: #ff8a8a;     --bad-soft: #3a1b1d;
    --info: #7fb4f0;    --info-soft: #172a40;
    --focus: #a594ff;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111318;
  --surface: #191c23;
  --surface-2: #1f232b;
  --border: #2d323d;
  --border-strong: #3d4350;
  --text: #e7e9ee;
  --muted: #a2a9b6;
  --accent: #a594ff;
  --accent-hover: #b9abff;
  --accent-soft: #2a2546;
  --on-accent: #15121f;
  --ok: #63d39a;      --ok-soft: #173326;
  --warn: #e6b74f;    --warn-soft: #362a12;
  --bad: #ff8a8a;     --bad-soft: #3a1b1d;
  --info: #7fb4f0;    --info-soft: #172a40;
  --focus: #a594ff;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }

/* ── Gerüst ─────────────────────────────────────────────── */
.has-nav { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px;
}
.brand-block { padding: 0 10px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.who { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: 7px 10px; border-radius: 6px;
  color: var(--text); font-size: .95rem;
}
.sidebar li a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .ext { color: var(--muted); font-size: .8em; }
.nav-section {
  margin: 16px 10px 4px; color: var(--muted);
  font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); display: flex; gap: 14px; flex-wrap: wrap; }
.topbar, .scrim { display: none; }
.main { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }
.bare .main { max-width: 440px; margin: 0 auto; padding-top: 12vh; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { font-size: .875rem; margin-bottom: 6px; display: block; }

/* ── Flächen ────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: .875rem; }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack > * + * { margin-top: 12px; }

/* ── Meldungen ──────────────────────────────────────────── */
.notice { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.notice-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.notice-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.notice-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice strong { color: inherit; }
.secret { font-family: var(--mono); font-size: 1rem; background: var(--surface); color: var(--text); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); user-select: all; }

/* ── Formulare ──────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 5px; }
.hint { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 8px 10px; min-height: 38px;
}
input:disabled, input[readonly] { background: var(--surface-2); color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 16px; }
.input-row { display: flex; gap: 8px; align-items: flex-start; }
.input-row > input, .input-row > select { flex: 1; }
.multi .input-row + .input-row { margin-top: 6px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 180px; }
form.inline { display: inline; }

/* ── Knöpfe ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .925rem; line-height: 1.2;
  padding: 9px 16px; min-height: 38px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: .85rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; }
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.icon-btn { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 1.1rem; padding: 4px 10px; cursor: pointer; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Tabellen ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th { text-align: left; font-weight: 600; font-size: .825rem; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions-cell { text-align: right; white-space: nowrap; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .85rem; }

/* ── Chips ──────────────────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1.6; }
.chip-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.member { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .875rem; }
.member button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 6px; border-radius: 999px; }
.member button:hover { background: var(--bad-soft); color: var(--bad); }
.member.svc { border-style: dashed; }

/* ── Suche / Werkzeugleiste ─────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 280px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; font-size: .925rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Kennzahlen / Monitor ───────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.stat .label { color: var(--muted); font-weight: 600; font-size: .825rem; margin-bottom: 4px; }
.stat .value { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--bad); }
.status-list { display: flex; flex-wrap: wrap; gap: 6px; }
.status-list .chip { font-weight: 500; }
.server-title { display: flex; align-items: center; gap: 10px; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.switch:last-child { border-bottom: 0; }

/* ── Login ──────────────────────────────────────────────── */
.login-card .card-body { padding: 28px; }
.login-title { text-align: center; margin-bottom: 24px; }
.login-title .brand { font-size: 1.35rem; }
.login-title p { color: var(--muted); margin: 4px 0 0; font-size: .925rem; }

/* ── Schmal ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .has-nav { display: block; }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px;
  }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .4); }
  .main { padding: 20px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  td, th { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ── Kleinteile ─────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.center { text-align: center; }
details > summary { list-style: none; display: inline-block; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 4px; }
.switch label { font-weight: 500; }
.switch .hint { margin-top: 0; }
input.toggle {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 42px; height: 24px; border-radius: 999px; margin: 0; cursor: pointer;
  background: var(--border-strong); position: relative; transition: background .15s;
}
input.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
input.toggle:checked { background: var(--accent); }
input.toggle:checked::after { transform: translateX(18px); }
.input-row select { flex: 0 1 auto; width: auto; }

/* ── Feinschliff nach Screenshots ───────────────────────── */
/* Sidebar-Spalte auch unterhalb des Sticky-Bereichs als Fläche */
@media (min-width: 861px) {
  .has-nav { background: linear-gradient(to right, var(--surface) 239px, var(--border) 239px, var(--border) 240px, var(--bg) 240px); }
  .sidebar { border-right: 0; }
}
td .cell-main { white-space: nowrap; }
.toolbar input[type=search], .card-head > input[type=search] { max-width: 340px; width: 100%; }
.inline-form .field { flex: 0 1 360px; }
.bare .main:has(.account) { max-width: 720px; padding-top: 6vh; }
h1.mono { font-size: 1.35rem; }
.field .check { font-weight: 400; display: flex; }
.check input[type=radio] { accent-color: var(--accent); }
