/* PPU-Dashboard – President Protective Unit
   Dunkles Marine-Blau mit goldenem Akzent. Alle Farben als Tokens. */
:root {
  --bg: #0b1220;
  --bg-2: #0f1a2e;
  --panel: #131f36;
  --panel-2: #182743;
  --line: #24365a;
  --text: #e6ebf5;
  --muted: #92a0bd;
  --gold: #c9a227;
  --gold-2: #e3c25a;
  --ok: #3ba55d;
  --warn: #f0c040;
  --bad: #d9534f;
  --info: #5865f2;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .9em; }
code { background: var(--bg-2); padding: .1em .35em; border-radius: 5px; border: 1px solid var(--line); }
small, .muted { color: var(--muted); }

/* ── Layout ─────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #0d172a, #0a1324); border-right: 1px solid var(--line);
  padding: 1.2rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .7rem; padding: .2rem .4rem 1.2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.brand .seal { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold) 60%, #7a5f12); color: #0b1220;
  font-weight: 800; letter-spacing: .02em; box-shadow: 0 0 0 3px rgba(201, 162, 39, .25); }
.brand b { display: block; font-size: 1.05rem; }
.brand small { display: block; font-size: .75rem; }
.nav-group { margin: 1rem .4rem .35rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav a { display: flex; gap: .6rem; align-items: center; padding: .55rem .7rem; border-radius: 9px; color: var(--text); }
.nav a:hover { background: var(--panel); text-decoration: none; }
.nav a.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--gold); }
.sidebar .me { margin-top: 1.5rem; padding: .8rem; border-top: 1px solid var(--line); display: flex; gap: .6rem; align-items: center; }
.me img { width: 34px; height: 34px; border-radius: 50%; }
.main { padding: 1.6rem 2rem 4rem; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.topbar .title { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.btn.menu-toggle { display: none; }

/* ── Bausteine ──────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.card > h2:first-child { display: flex; align-items: center; gap: .5rem; }
.grid { display: grid; gap: 1rem; }
.grid.k { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: block; color: var(--text); }
.kpi:hover { border-color: var(--gold); text-decoration: none; }
.kpi .v { font-size: 1.9rem; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem;
  background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: #8de0a6; border-color: rgba(59, 165, 93, .5); }
.badge.bad { color: #f2a3a0; border-color: rgba(217, 83, 79, .5); }
.badge.warn { color: #f5d77c; border-color: rgba(240, 192, 64, .5); }
.badge.gold { color: var(--gold-2); border-color: rgba(201, 162, 39, .5); }
.alert { padding: .8rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); margin-bottom: 1rem; }
.alert.bad { border-color: rgba(217, 83, 79, .6); background: rgba(217, 83, 79, .08); }
.alert.warn { border-color: rgba(240, 192, 64, .6); background: rgba(240, 192, 64, .07); }
.alert.ok { border-color: rgba(59, 165, 93, .6); background: rgba(59, 165, 93, .07); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }

/* ── Formulare ──────────────────────────────────────────── */
label { display: block; font-weight: 600; font-size: .88rem; margin: .7rem 0 .3rem; }
label .hint, .hint { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
input[type=text], input[type=number], input[type=search], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  padding: .55rem .7rem; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(201, 162, 39, .5); border-color: var(--gold); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; margin: .55rem 0; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 180px; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: .5rem .95rem; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--gold); text-decoration: none; }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #0b1220; border-color: var(--gold); }
.btn.danger { background: rgba(217, 83, 79, .15); border-color: rgba(217, 83, 79, .6); color: #f6b6b3; }
.btn.ok { background: rgba(59, 165, 93, .15); border-color: rgba(59, 165, 93, .6); color: #a6e6b9; }
.btn.small { padding: .25rem .6rem; font-size: .82rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--text); font-size: .88rem; }
.tabs a.active { border-color: var(--gold); color: var(--gold-2); }

/* Picker (Rollen/Kanäle) */
.picker { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 9px; padding: .35rem; min-height: 42px; }
.picker select { flex: 1 1 160px; width: auto; border: none; background: transparent; padding: .25rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: .15rem .3rem .15rem .6rem; font-size: .85rem; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.chip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .2rem; }
.chip.unknown { border-style: dashed; color: var(--muted); }

/* Editor-Zeilen (Rangleiter, Katalog) */
.editor .erow { display: grid; grid-template-columns: 2rem 1.3fr .6fr 2fr auto; gap: .5rem; align-items: center;
  padding: .5rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .45rem; background: var(--bg-2); }
.editor.katalog .erow { grid-template-columns: 1fr 140px auto auto auto; }
.editor .num { color: var(--gold-2); font-weight: 700; text-align: center; }
.editor .ctl { display: flex; gap: .25rem; }

/* Personensuche */
.person-search { position: relative; }
.person-results { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; margin-top: .25rem; max-height: 280px; overflow-y: auto; box-shadow: var(--shadow); }
.person-results div { display: flex; gap: .6rem; align-items: center; padding: .45rem .7rem; cursor: pointer; }
.person-results div:hover { background: var(--panel); }
.person-results img { width: 26px; height: 26px; border-radius: 50%; }
.person-picked { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; }
.person-picked img { width: 30px; height: 30px; border-radius: 50%; }

/* Zeitleiste */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: .2rem 0 1rem 1.2rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .55rem; width: 12px; height: 12px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--gold); }
.timeline .meta { color: var(--muted); font-size: .82rem; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }

/* Toast */
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; max-width: min(460px, calc(100vw - 2rem)); }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px;
  padding: .75rem 1rem; box-shadow: var(--shadow); animation: slide .2s ease-out; }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast ul { margin: .3rem 0 0; padding-left: 1.1rem; }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Landing */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(ellipse at top, #17284a 0%, var(--bg) 60%); }
.landing .box { width: min(440px, 100%); text-align: center; }
.landing .seal { width: 92px; height: 92px; margin: 0 auto 1rem; font-size: 1.6rem; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; padding: .7rem 1.3rem; font-size: 1rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .btn.menu-toggle { display: inline-flex; }
  .main { padding: 1rem 16px 4rem; }
  .editor .erow, .editor.katalog .erow { grid-template-columns: 1fr; }
  .editor .num { text-align: left; }
}
