:root {
  --bg: #0f1419;
  --panel: #1a2330;
  --panel-2: #222e3e;
  --line: #2d3a4d;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --primary: #2f81f7;
  --primary-dark: #1f6feb;
  --green: #2ea043;
  --red: #e5534b;
  --amber: #d29922;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.hidden { display: none !important; }
a { color: var(--primary); }

/* ---- Buttons ---- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: rgba(229,83,75,.12); }
.btn.small { padding: 4px 9px; font-size: 13px; }

/* ---- Auth ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { margin: 0 0 20px; text-align: center; font-size: 24px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1; padding: 10px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }

input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
.msg { text-align: center; margin-top: 14px; font-size: 14px; min-height: 20px; }
.msg.error { color: var(--red); }
.msg.ok { color: var(--green); }
.auth-foot { text-align: center; margin: 18px 0 0; font-size: 13px; }
.auth-foot a { color: var(--muted); }
.auth-foot a:hover { color: var(--primary); }

/* ---- Footer ---- */
.app-foot {
  text-align: center; padding: 20px; margin-top: 12px;
  border-top: 1px solid var(--line); font-size: 13px;
}
.app-foot a { color: var(--muted); }
.app-foot a:hover { color: var(--primary); }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 60px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 600; font-size: 18px; white-space: nowrap; }
#nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav-link {
  padding: 8px 14px; border-radius: var(--radius);
  cursor: pointer; color: var(--muted); border: none; background: none; font-size: 14px;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { background: var(--primary); color: #fff; }
.user-box { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
#user-name { font-size: 14px; color: var(--muted); }

/* Hamburger-Button – nur auf schmalen Bildschirmen sichtbar */
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--line); color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
  padding: 6px 10px; border-radius: var(--radius);
}

/* ---- Content ---- */
main { padding: 24px; max-width: 1000px; margin: 0 auto; }
h2 { margin-top: 0; }
h3 { margin: 22px 0 6px; font-size: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--panel-2); }

.badge { padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.green { background: rgba(46,160,67,.18); color: #4ac26b; }
.badge.amber { background: rgba(210,153,34,.18); color: #e3b341; }
.badge.red { background: rgba(229,83,75,.18); color: #ff7b72; }
.badge.blue { background: rgba(47,129,247,.18); color: #79c0ff; }
.pill { display:inline-block; background: var(--panel-2); border:1px solid var(--line); padding: 1px 8px; border-radius: 12px; font-size: 12px; margin: 1px; }

/* ---- Kalender ---- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; color: var(--muted); font-size: 12px; padding: 4px; font-weight: 600; }
.cal-cell {
  min-height: 84px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; font-size: 12px; overflow: hidden;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--primary); }
.cal-num { font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.cal-ev { border-radius: 5px; padding: 2px 5px; margin-bottom: 3px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.match { background: rgba(47,129,247,.25); color: #cfe3ff; }
.cal-ev.option { background: rgba(46,160,67,.22); color: #aff0bf; }
.cal-ev.block { background: rgba(229,83,75,.22); color: #ffc9c4; }

.empty-state { text-align: center; color: var(--muted); padding: 30px; }

/* ---- Dropdown (Aktionsmenü) ---- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; min-width: 190px; z-index: 40;
  display: none; flex-direction: column; gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.dropdown.open .dropdown-menu { display: flex; }
.dropdown-menu .btn { width: 100%; text-align: left; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; width: 100%; max-width: 460px; max-height: 90vh; overflow:auto;
}
.modal h3 { margin-top: 0; }
.modal .row { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 12px 20px; border-radius: var(--radius); z-index: 100; font-size: 14px;
}
.toast.ok { border-color: var(--green); }
.toast.error { border-color: var(--red); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  main { padding: 16px; }
  .cal-cell { min-height: 56px; }

  /* Mobiles Menü: Nur Logo + Hamburger sichtbar, Rest eingeklappt. */
  .nav-toggle { display: block; margin-left: auto; }
  #nav, .user-box { display: none; width: 100%; }
  .topbar.nav-open #nav {
    display: flex; flex-direction: column; gap: 4px;
    border-top: 1px solid var(--line); padding-top: 10px;
  }
  .topbar.nav-open .nav-link { text-align: left; width: 100%; }
  .topbar.nav-open .user-box {
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    border-top: 1px solid var(--line); padding-top: 10px;
  }
  .topbar.nav-open #user-name { padding: 2px 0; }
}
