/* Layout: Kopfzeile mit Kennzahlen, darunter Filterleiste und eine dichte Projekttabelle; Bearbeiten in einer Seitenleiste rechts. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --fg: #19212d;
  --muted: #5d6a7c;
  --line: #dfe4ea;
  --accent: #d4521c;
  --accent-soft: #fbe9df;
  --accent-fg: #ffffff;
  --ok: #1f7a4d; --ok-soft: #e1f3e9;
  --warn: #9a6200; --warn-soft: #fdf0d3;
  --crit: #b42318; --crit-soft: #fde7e4;
  --info: #2457a6; --info-soft: #e3ecfa;
  --shadow: 0 10px 40px rgba(22, 32, 48, .16);
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11151b; --surface: #181e26; --surface-2: #20272f; --fg: #e5e9ef; --muted: #95a1b2; --line: #2a333e;
  --accent: #f07a3e; --accent-soft: #3a2418; --accent-fg: #1a0e07;
  --ok: #5fd29a; --ok-soft: #173326; --warn: #f2bd55; --warn-soft: #3a2e14; --crit: #ff8a7d; --crit-soft: #3d1c19; --info: #8db4f5; --info-soft: #1b2a44;
  --shadow: 0 10px 40px rgba(0,0,0,.5); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #11151b; --surface: #181e26; --surface-2: #20272f; --fg: #e5e9ef; --muted: #95a1b2; --line: #2a333e;
  --accent: #f07a3e; --accent-soft: #3a2418; --accent-fg: #1a0e07;
  --ok: #5fd29a; --ok-soft: #173326; --warn: #f2bd55; --warn-soft: #3a2e14; --crit: #ff8a7d; --crit-soft: #3d1c19; --info: #8db4f5; --info-soft: #1b2a44;
  --shadow: 0 10px 40px rgba(0,0,0,.5); color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 20px 20px 48px; display: flex; flex-direction: column; gap: 18px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

header.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
header.top h1 { font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
header.top p { margin: 2px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: var(--r); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--crit); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
button.kpi:hover { border-color: var(--muted); }
.kpi.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kpi .n { font-family: var(--font-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi.alert .n { color: var(--crit); }

.versions { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.versions .head { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; }
.vbar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; gap: 2px; }
.vbar button { border: 0; padding: 0 6px; min-width: 28px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; color: #fff; text-align: left; overflow: hidden; white-space: nowrap; }
.vbar button.dim { opacity: .35; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { flex: 1 1 260px; min-width: 0; position: relative; }
.search input { width: 100%; padding: 9px 12px 9px 34px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sel { padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); user-select: none; }

.tablebox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1060px; }
th, td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; display: inline-flex; gap: 4px; align-items: center; }
th button.on { color: var(--fg); }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.dom { font-weight: 600; max-width: 260px; }
td.dom .sub { display: block; font-weight: 400; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.note { color: var(--muted); max-width: 240px; font-size: 13px; }
td.note span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stripe { width: 4px; padding: 0; }
.stripe i { display: block; width: 4px; height: 30px; border-radius: 2px; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.mute { background: var(--surface-2); color: var(--muted); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.on { border-color: transparent; background: var(--info-soft); color: var(--info); }
.tag.svc.on { background: var(--accent-soft); color: var(--accent); }
.tag.bak.on { background: var(--ok-soft); color: var(--ok); }
.ver { font-family: var(--font-mono); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ver b { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.date small { display: block; color: var(--muted); font-size: 11.5px; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty strong { color: var(--fg); font-size: 15px; }
.foot { color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Drawer & modal */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 20, .38); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 21; box-shadow: var(--shadow); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.drawer header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-family: var(--font-display); font-size: 19px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.drawer .body { overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.drawer footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
legend { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); margin-bottom: 10px; padding: 0; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f.full { grid-column: 1 / -1; }
.f label { font-size: 12.5px; font-weight: 600; }
.f input, .f select, .f textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); width: 100%; }
.f textarea { min-height: 76px; resize: vertical; }
.toggles { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.tg { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; user-select: none; cursor: pointer; }
.tg:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.meta { color: var(--muted); font-size: 12.5px; }
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--crit); font-weight: 600; }

.modal { position: fixed; z-index: 21; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(820px, calc(100% - 32px)); max-height: calc(100% - 48px); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.modal .body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal header h2 { font-family: var(--font-display); margin: 0; font-size: 19px; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal textarea { width: 100%; min-height: 140px; font-family: var(--font-mono); font-size: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.mapgrid { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.mapgrid table { min-width: 0; }
.mapgrid td, .mapgrid th { padding: 6px 8px; font-size: 12.5px; position: static; }
.mapgrid select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); max-width: 170px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 8px; z-index: 40; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

@media (max-width: 640px) {
  .wrap { padding: 14px 16px 40px; }
  header.top h1 { font-size: 22px; }
  fieldset { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: .6; } }
}

/* Basis (eigenständige Seite) */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
.who { color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 8px; }
.who a { color: var(--muted); }

/* Änderungsprotokoll */
.log { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.log li { font-size: 12.5px; border-left: 2px solid var(--line); padding-left: 10px; }
.log li b { font-weight: 600; }
.log .chg { color: var(--muted); display: block; overflow-wrap: anywhere; }
.conflict { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 10px 12px; font-weight: 600; display: flex; flex-direction: column; gap: 8px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-family: var(--font-display); font-size: 22px; margin: 0; }
.login p { margin: 0; color: var(--muted); }
.login .err { color: var(--crit); font-weight: 600; }
.login .btn { justify-content: center; padding: 10px; }

/* Dashboard */
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ph { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ph h2 { font-family: var(--font-display); font-size: 16px; margin: 0; }
.ph .btn { padding: 2px 6px; font-size: 12.5px; color: var(--accent); }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.plist li + li { border-top: 1px solid var(--line); }
.plist button { width: 100%; border: 0; background: none; padding: 7px 2px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; text-align: left; align-items: center; }
.plist button:hover { background: var(--surface-2); }
.plist .d { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .s { grid-column: 1; color: var(--muted); font-size: 12px; }
.plist .r { grid-row: 1 / span 2; grid-column: 2; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.plist .when { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600; }
.plist .empty-li { padding: 14px 2px; color: var(--muted); }
.kbars { display: flex; flex-direction: column; gap: 10px; }
.kbars button { border: 0; background: none; padding: 2px 0; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.kbars .kl { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; gap: 8px; }
.kbars .kl span:last-child { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.kbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); gap: 1px; }
.kbar i, .lg { display: block; }
.kbar .svc, .lg.svc { background: var(--accent); }
.kbar .bak, .lg.bak { background: var(--ok); }
.kbar .none, .lg.none { background: var(--line); }
.legend { display: inline-flex; gap: 5px; align-items: center; font-size: 11.5px; color: var(--muted); }
.lg { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-left: 4px; }

/* Betreuer, Hosting */
.seg small { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 2px; }
.chip { border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 10px; font-weight: 600; font-size: 12.5px; }
.who-btn { border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 2px 9px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.who-btn.set { border-style: solid; border-color: transparent; background: var(--info-soft); color: var(--info); font-weight: 600; }
.who-btn:hover { border-color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.hacc { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.hacc .mono b { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.hacc small { font-size: 11px; }
.hosting { display: flex; flex-direction: column; gap: 10px; }
.hstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hstats div { display: flex; flex-direction: column; }
.hstats b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.hstats span { color: var(--muted); font-size: 12px; }
.vbar.small { height: 22px; }
.openacc { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.oa { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: center; font-size: 12.5px; }
.oa .ob { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oa select, .oa .btn { grid-column: span 1; font-size: 12px; padding: 4px 8px; }
.oa select { border: 1px solid var(--line); border-radius: 6px; background: var(--bg); min-width: 0; }
.kbars button.dim { opacity: .4; }
.accs { display: flex; flex-direction: column; gap: 8px; }
.accbox { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.acchead { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.acchead .btn { padding: 2px 6px; font-size: 12px; color: var(--crit); }
.accbox dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 12.5px; }
.accbox dt { color: var(--muted); }
.accbox dd { margin: 0; overflow-wrap: anywhere; }

/* Ansichten & Hosting-Spalten */
.viewtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: -8px; flex-wrap: wrap; }
.viewtabs button { border: 0; background: none; padding: 8px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: var(--font-display); font-size: 15px; }
.viewtabs button.on { color: var(--fg); border-bottom-color: var(--accent); }
.viewtabs small { font-family: var(--font-body); font-weight: 500; color: var(--muted); font-size: 12px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num button { justify-content: flex-end; }
.hcol { display: flex; flex-direction: column; gap: 4px; }
td.num .hcol { align-items: flex-end; }
.hl { min-height: 22px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.phpv { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.phpv b { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
table.acc-table { min-width: 1200px; }
td .sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
td.desc { max-width: 260px; }
td.nowrap, .nowrap { white-space: nowrap; }
.plink { font-weight: 600; }
tr.gone td { opacity: .55; }
.acc-table tbody tr:not([data-id]) { cursor: default; }
.flist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.flist button { width: 100%; border: 0; background: none; padding: 5px 4px; border-radius: 6px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left; font-size: 12.5px; }
.flist button:hover { background: var(--surface-2); }
.flist button.on { background: var(--accent-soft); }
.flist .fn { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flist .fc { font-weight: 600; font-variant-numeric: tabular-nums; }
td .sub.mono { white-space: nowrap; font-size: 11px; }

.mono.acc { font-weight: 600; color: var(--fg); }
table { min-width: 1240px; }

.addrow { display: flex; gap: 8px; }
.addrow input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-family: var(--font-mono); font-size: 13px; }
.movehint { margin: 0; font-size: 12.5px; color: var(--warn); font-weight: 600; }
