/* Hüter – Design: Mitternachtsblau, Silber, Azur */
:root {
  --bg: #070b12;
  --bg2: #0b111b;
  --panel: #101826;
  --panel2: #152033;
  --line: #27364d;
  --text: #e4ebf5;
  --muted: #8c9bb0;
  --accent: #1f6fb5;
  --accent-d: #134a7c;
  --accent-l: #3b9be8;
  --gold: #9fb4cf;
  --gold-l: #e3ebf7;
  --ok: #4f9a63;
  --warn: #d09a2b;
  --font-head: 'Cinzel', 'Trajan Pro', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
[data-theme="smaragd"] { --accent: #1f8a64; --accent-d: #14603f; --accent-l: #3bc794; --bg: #060d0b; --bg2: #0a1411; --panel: #0f1c18; --panel2: #14271f; --line: #25423a; }
[data-theme="gold"] { --accent: #a8802f; --accent-d: #6e5319; --accent-l: #d7ab4f; --gold: #e6c982; --gold-l: #f4dfa7; --bg: #0b0a07; --bg2: #11100b; --panel: #181610; --panel2: #201d14; --line: #3a3322; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(31,111,181,.14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(159,180,207,.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); letter-spacing: .06em; margin: 0; font-weight: 600; }
a { color: var(--gold); }
::selection { background: var(--accent); color: #fff; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--bg2), #05080d);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.sidebar::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, var(--gold), var(--accent-d) 40%, transparent); opacity: .55; pointer-events: none; }
.brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px 18px; border-bottom: 1px solid var(--line); }
.brand svg, .brand img { width: 46px; height: 46px; flex: none; }
.brand .t { font-family: var(--font-head); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-l); line-height: 1.1; font-size: 16px; }
.brand .s { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.nav { padding: 10px 10px 16px; flex: 1; }
.nav h4 { margin: 18px 12px 6px; font: 600 11px var(--font-body); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); opacity: .8; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0; border-radius: 4px; color: var(--text); text-decoration: none; border-left: 3px solid transparent; transition: background .15s, border-color .15s; }
.nav a:hover { background: var(--panel); }
.nav a.active { background: linear-gradient(90deg, rgba(31,111,181,.28), transparent); border-left-color: var(--accent-l); color: #fff; }
.nav a .ic { width: 20px; text-align: center; color: var(--gold); font-size: 16px; }
.userbox { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-d); border: 1px solid var(--gold); display: grid; place-items: center; font-family: var(--font-head); color: var(--gold-l); flex: none; }
.userbox .n { font-weight: 600; font-size: 14px; line-height: 1.2; }
.userbox .r { font-size: 12px; color: var(--muted); }
.userbox button { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 20; }
.topbar .t { font-family: var(--font-head); letter-spacing: .12em; color: var(--gold-l); text-transform: uppercase; }
.content { padding: 30px 36px 60px; max-width: 1400px; width: 100%; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); position: relative; }
.pagehead::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 120px; height: 2px; background: var(--accent-l); }
.pagehead h1 { font-size: 26px; text-transform: uppercase; color: var(--gold-l); }
.pagehead p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Bausteine ---------- */
.card { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; }
.card h3 { font-size: 14px; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; letter-spacing: .14em; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent-l); }
.stat .v { font: 700 34px var(--font-head); color: #fff; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.cols2 { grid-template-columns: 1.4fr 1fr; }
.banner { border: 1px solid var(--gold); border-left-width: 4px; background: linear-gradient(90deg, rgba(31,111,181,.22), rgba(159,180,207,.05)); border-radius: 6px; padding: 18px 22px; margin-bottom: 18px; }
.banner h2 { color: var(--gold-l); font-size: 20px; margin-bottom: 6px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar .grow { flex: 1; min-width: 180px; }

table { width: 100%; border-collapse: collapse; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
th { text-align: left; font: 600 11px var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid rgba(39,54,77,.55); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: rgba(31,111,181,.1); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; color: var(--gold-l); white-space: nowrap; }
.muted { color: var(--muted); }
.empty { padding: 34px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--panel2); color: var(--text); white-space: nowrap; }
.b-offen, .b-hoch, .b-beurlaubt, .b-laufend { color: #f0c36a; border-color: #6e5319; background: rgba(208,154,43,.12); }
.b-dringend, .b-suspendiert, .b-abgebrochen { color: #ff8b8f; border-color: #7a0f15; background: rgba(224,52,60,.14); }
.b-geplant { color: #8cc4f5; border-color: var(--accent-d); background: rgba(59,155,232,.12); }
.b-niedrig, .b-normal, .b-ausser-dienst, .b-abgesagt { color: var(--muted); }
.b-im-dienst, .b-abgeschlossen, .b-erledigt { color: #8fd3a0; border-color: #2f6a41; background: rgba(79,154,99,.13); }
.b-hub { color: var(--gold-l); border-color: var(--gold); background: rgba(159,180,207,.12); }
.b-lokal { color: var(--muted); }
.b-aktiv { color: #8fd3a0; border-color: #2f6a41; background: rgba(79,154,99,.13); }
.b-gesperrt, .b-vom-hub-gesperrt { color: #ff8b8f; border-color: #7a0f15; background: rgba(224,52,60,.14); }

/* ---------- Formulare & Buttons ---------- */
input, select, textarea {
  width: 100%; background: #0a1019; color: var(--text); border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 11px; font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(159,180,207,.15); }
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-bottom: 5px; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.formgrid .full { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; padding: 10px; background: #0a1019; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.checks input { width: auto; }

.btn { background: var(--accent); color: #fff; border: 1px solid var(--accent-l); border-radius: 4px; padding: 9px 16px; font: 600 13px var(--font-body); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--gold); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold); }
.btn.danger { background: transparent; color: #ff8b8f; border-color: #7a0f15; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Modal, Toast, Login ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(3px); display: grid; place-items: start center; overflow-y: auto; padding: 5vh 16px; z-index: 50; }
.modal { width: min(720px, 100%); background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--gold); border-radius: 6px; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal header h2 { font-size: 18px; color: var(--gold-l); text-transform: uppercase; }
.modal .x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.modal .body { padding: 20px 22px; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin-bottom: 14px; }
.kv dt { color: var(--gold); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding-top: 2px; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--panel2); border: 1px solid var(--gold); border-left: 4px solid var(--ok); padding: 11px 16px; border-radius: 4px; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.toast.err { border-left-color: var(--accent-l); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: min(420px, 100%); text-align: center; padding: 36px 32px; background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--gold); border-radius: 6px; box-shadow: 0 30px 80px rgba(0,0,0,.7); position: relative; }
.login .box svg, .login .box img { width: 92px; height: 92px; margin-bottom: 8px; filter: drop-shadow(0 0 18px rgba(31,111,181,.55)); }
.login h1 { font-size: 26px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-l); }
.login p.sub { color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-size: 12px; margin: 6px 0 24px; }
.login form { text-align: left; }
.login .btn { width: 100%; padding: 12px; }
.err-msg { color: #ff8b8f; min-height: 20px; margin: 0 0 8px; font-size: 14px; }

.rule { border: 1px solid var(--line); border-left: 3px solid var(--accent-l); border-radius: 4px; padding: 14px 16px; margin-bottom: 12px; background: var(--panel); }
.rule .rh { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.rule .rh .mono { font-size: 15px; }
.rule .rh h3 { font-size: 15px; text-transform: none; letter-spacing: .04em; color: var(--text); margin: 0; }
.rule .strafe { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--gold-l); font-size: 14px; }
.catname { font: 700 16px var(--font-head); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 26px 0 12px; display: flex; align-items: center; gap: 12px; }
.catname::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
h3.sub { font-size: 14px; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); margin: 18px 0 10px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.inline-add { display: flex; gap: 8px; margin-top: 10px; }
.inline-add select { flex: 1; min-width: 0; }
.inline-add .btn { white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid rgba(39,54,77,.55); display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.ann h4 { margin: 0 0 2px; color: var(--gold-l); font-family: var(--font-head); letter-spacing: .05em; }
.ann p { margin: 0; white-space: pre-wrap; }
.ann small { color: var(--muted); }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 280px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 60px #000; }
  .topbar { display: flex; }
  .content { padding: 20px 16px 50px; }
  .cols2 { grid-template-columns: 1fr; }
  .formgrid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}
