:root {
  --bg: #f4f5f7; --surface: #fff; --text: #1d2330; --muted: #6b7385; --line: #e2e5ea;
  --accent: #e57000; --accent-ink: #fff;
  --ok: #1f8a4c; --ok-bg: #e3f4ea; --info: #2463c4; --info-bg: #e5eefb;
  --warn: #9a6200; --warn-bg: #fdf1dc; --err: #c0392b; --err-bg: #fbe6e3;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d; --surface: #1c2028; --text: #e6e8ec; --muted: #8e96a6; --line: #2c313b;
    --ok-bg: #173826; --ok: #5fd08f; --info-bg: #1b2b46; --info: #7fb0ff;
    --warn-bg: #3a2c12; --warn: #f0b75a; --err-bg: #43201c; --err: #ff8a7a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--info); cursor: pointer; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--err); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 20px; }

/* Shell */
.topbar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 10px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 650; display: flex; gap: 8px; align-items: center; }
.topbar nav a { margin-right: 4px; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.topbar nav a.active, .topbar nav a:hover { background: var(--bg); }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.head h2 { margin: 0; font-size: 20px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 8px; }

/* Buttons & Forms */
button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--err); }
button.ghost { background: transparent; }
button.small { padding: 4px 9px; font-size: 12.5px; }
label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 6px; width: 100%; }
label.check input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0; }
legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.grid2, .grid3 { display: grid; gap: 10px; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* Tabellen */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button + button { margin-left: 4px; }
.mini { font-size: 12.5px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--bg); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }

/* Kontingente */
.quotas { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.quota { padding: 14px; }
.quota-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.bar div { height: 100%; background: var(--info); transition: width .3s; }
.bar div.hot { background: var(--accent); }
.notice { background: var(--info-bg); color: var(--info); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }

/* Modals */
.overlay { position: fixed; inset: 0; background: rgb(0 0 0 / .4); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal { width: min(560px, 100%); display: grid; gap: 12px; max-height: 90vh; overflow-y: auto; }
.modal.wide { width: min(900px, 100%); }
.modal h3 { margin: 0; }
.log { background: #0f1115; color: #d6dae2; padding: 12px; border-radius: 6px; max-height: 60vh; overflow: auto;
  font-size: 12px; white-space: pre-wrap; margin: 0; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--surface);
  padding: 10px 16px; border-radius: 8px; z-index: 20; max-width: 420px; }

/* Cluster-Ansicht */
.stack { display: grid; gap: 20px; }
.stack h3 { font-size: 15px; margin: 0 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; display: grid; gap: 6px; align-content: start; }
.tile-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tile-value { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12.5px; color: var(--muted); }
.meter { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; flex: 1; min-width: 60px; }
.meter > div { height: 100%; background: var(--info); border-radius: 3px; transition: width .4s; }
.meter > div.high { background: var(--warn); }
.meter > div.crit { background: var(--err); }
.meter-row { display: flex; align-items: center; gap: 8px; }
.meter-row .mono { min-width: 48px; text-align: right; }
th.w-meter { min-width: 180px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.stack > *, .cols > * { min-width: 0; }  /* Tabellen scrollen in ihrem Container statt die Seite zu verbreitern */
.st { font-size: 11px; }
td:has(.st) { white-space: nowrap; }
.topbar nav > span { display: flex; flex-wrap: wrap; gap: 2px; }
.st.off { color: var(--muted); }
.head.sub { margin-bottom: 8px; }
.head.sub h3 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--bg); font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
label.inline select { width: auto; padding: 4px 8px; }
.st.ok { color: var(--ok); } .st.warn { color: var(--warn); } .st.err { color: var(--err); }
.err-text { color: var(--err); } .warn-text { color: var(--warn); }
.notice.err { background: var(--err-bg); color: var(--err); }
.ceph-summary { display: grid; gap: 8px; padding: 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv > span:first-child { color: var(--muted); }
.check { font-size: 12.5px; }

@media (max-width: 640px) {
  .cols { grid-template-columns: 1fr; }
  th.w-meter { min-width: 140px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}
