/* KVB Admin-Portal – Anlehnung an das Material-Design von Synapse-Admin */
:root {
  --indigo: #283593;
  --indigo-dark: #1a237e;
  --indigo-light: #e8eaf6;
  --bg: #f4f5f9;
  --paper: #ffffff;
  --text: #1f2333;
  --muted: #6b7186;
  --line: #e3e5ee;
  --ok: #2e7d32;
  --warn: #ed6c02;
  --err: #c62828;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 64, .12), 0 1px 2px rgba(16, 24, 64, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 500; }
a { color: inherit; text-decoration: none; }

/* --- Anmeldung --- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a237e 0%, #283593 55%, #3949ab 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--paper);
  border-radius: 10px; padding: 28px 26px 24px; text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.login-avatar {
  width: 54px; height: 54px; border-radius: 50%; margin: -54px auto 14px;
  background: var(--indigo); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.login-avatar.warn { background: var(--warn); }
.login-card h1 { font-size: 19px; margin-bottom: 2px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.hint { color: var(--muted); font-size: 12px; text-align: left; margin: -4px 0 12px; }

.field { display: block; text-align: left; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=search], select {
  width: 100%; padding: 9px 11px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--indigo); outline-offset: -1px; border-color: transparent; }

/* --- Schaltflächen --- */
.btn {
  border: 0; border-radius: 6px; padding: 8px 15px; font: 500 13px/1.4 inherit;
  cursor: pointer; letter-spacing: .2px; white-space: nowrap;
}
.btn.primary { background: var(--indigo); color: #fff; }
.btn.primary:hover { background: var(--indigo-dark); }
.btn.ghost { background: transparent; color: var(--indigo); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--indigo-light); }
.btn.danger { background: var(--err); color: #fff; }
.btn.danger:hover { filter: brightness(.92); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.mini { padding: 4px 9px; font-size: 12px; }
.icon-btn {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  padding: 6px; border-radius: 50%; display: flex; align-items: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, .15); }

/* --- Kopfzeile --- */
.appbar {
  height: 56px; background: var(--indigo); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow);
}
.appbar-title { font-size: 16px; font-weight: 500; }
.spacer { flex: 1; }
.server-chip {
  font-size: 12px; background: rgba(255, 255, 255, .16); padding: 3px 10px;
  border-radius: 12px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--indigo);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.usermenu { position: relative; }
.dropdown {
  position: absolute; right: 0; top: 44px; background: var(--paper); color: var(--text);
  min-width: 190px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
  overflow: hidden; z-index: 30;
}
.dropdown-head { padding: 10px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.dropdown-item {
  display: block; width: 100%; text-align: left; padding: 10px 14px;
  background: none; border: 0; font: inherit; cursor: pointer;
}
.dropdown-item:hover { background: var(--indigo-light); }

/* --- Rahmen --- */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 216px; flex: none; background: var(--paper); border-right: 1px solid var(--line);
  padding: 12px 8px; position: sticky; top: 56px; height: calc(100vh - 56px);
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 6px; color: var(--muted); cursor: pointer; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--indigo-light); color: var(--indigo); font-weight: 500; }
.content { flex: 1; padding: 22px 24px 60px; min-width: 0; }
.view-title { font-size: 21px; margin-bottom: 16px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head .view-title { margin: 0; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.search { width: 220px; }

/* --- Karten --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; }
.card-body { padding: 16px 18px; }
.card-body.no-pad { padding: 0; }
.stat { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat .value { font-size: 24px; font-weight: 500; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.alert-ok { border-left: 4px solid var(--ok); }
.stat.alert-warn { border-left: 4px solid var(--warn); }
.stat.alert-err { border-left: 4px solid var(--err); }

/* --- Tabellen --- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: #fafbfe; white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fafbff; }
td.actions { white-space: nowrap; text-align: right; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 11px; font-size: 11px; font-weight: 600; }
.badge.admin { background: var(--indigo-light); color: var(--indigo); }
.badge.off { background: #fdecea; color: var(--err); }
.badge.on { background: #e8f5e9; color: var(--ok); }
.badge.grey { background: #eceef4; color: var(--muted); }

.bar { height: 6px; border-radius: 3px; background: #eceef4; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.err { background: var(--err); }
.bar-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* --- Meldungen --- */
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert.error { background: #fdecea; color: var(--err); }
.alert.warn { background: #fff4e5; color: #7a4100; }
.alert.info { background: var(--indigo-light); color: var(--indigo-dark); }
.ok-line { color: var(--ok); margin: 0; }
.footnote { color: var(--muted); font-size: 12px; }

/* --- Dialoge --- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 24, 48, .5);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal { background: var(--paper); border-radius: 10px; width: 100%; max-width: 460px; box-shadow: 0 16px 48px rgba(0, 0, 0, .3); max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { padding: 16px 20px; font-size: 17px; font-weight: 500; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.check input { width: auto; }

#toast-area { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #26293d; color: #fff; padding: 11px 18px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); font-size: 13px; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

.only-mobile { display: none; }
@media (max-width: 820px) {
  .only-mobile { display: flex; }
  .sidebar { position: fixed; z-index: 25; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .content { padding: 16px 12px 50px; }
  .appbar-title { font-size: 14px; }
  .server-chip { display: none; }
  .search { width: 150px; }
}
