/* Farben und Formen sind bewusst 1:1 aus der Landingpage uebernommen
   (styles.css dort), damit Dashboard und Website als ein System wirken. */
:root {
  --bg: #071917;
  --bg-soft: #0c211e;
  --surface: #102b27;
  --surface-strong: #143732;
  --accent: #2bcfbc;
  --accent-dark: #061714;
  --text: #f2f7f6;
  --text-soft: #a2b8b4;
  --line: #28504a;
  --danger: #e2836b;
  --radius: 20px;
  --radius-small: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Dezenter Lichtschein wie auf der Landingpage */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 86% 8%, rgba(43, 207, 188, 0.13), transparent 28%),
    radial-gradient(circle at 8% 42%, rgba(43, 207, 188, 0.05), transparent 25%);
}

h1, h2, h3 {
  margin-top: 0;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.035em;
}

a { color: inherit; }

button, input, textarea, select { font: inherit; }

:focus-visible {
  outline: 3px solid rgba(43, 207, 188, 0.45);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Layout ---------- */

.layout { display: flex; min-height: 100vh; }

nav.sidebar {
  width: 244px;
  flex-shrink: 0;
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  background: rgba(10, 31, 28, 0.76);
  display: flex;
  flex-direction: column;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 30px;
  padding: 0 6px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 0 26px rgba(43, 207, 188, 0.18);
}

.brand-copy { display: grid; gap: 1px; }

.brand-name {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-name span { color: var(--accent); }

.brand-tagline {
  color: var(--text-soft);
  font-size: 0.7rem;
}

nav.sidebar a.nav-link {
  display: block;
  padding: 10px 13px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: var(--text-soft);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

nav.sidebar a.nav-link:hover { background: var(--surface); color: var(--text); }

nav.sidebar a.nav-link.active {
  border-color: var(--line);
  background: linear-gradient(145deg, rgba(20, 55, 50, 0.92), rgba(12, 33, 30, 0.92));
  color: var(--text);
  font-weight: 600;
}

nav.sidebar .logout { margin-top: auto; cursor: pointer; }

main {
  flex: 1;
  min-width: 0;
  padding: 34px 40px 60px;
  max-width: 1180px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.page-title {
  margin-bottom: 6px;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.page-intro {
  margin-bottom: 28px;
  color: var(--text-soft);
  font-size: 1rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(43, 207, 188, 0.13);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
  background: #42dfcd;
  box-shadow: 0 16px 34px rgba(43, 207, 188, 0.2);
}

.button:disabled { opacity: 0.6; cursor: progress; transform: none; }

.button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.button-secondary:hover { background: var(--surface); box-shadow: none; }

.button-small { min-height: 38px; padding: 8px 13px; font-size: 0.88rem; }

/* ---------- KPI-Karten ---------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.kpi-card {
  padding: 19px 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 55, 50, 0.92), rgba(12, 33, 30, 0.92));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.kpi-card .label {
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.kpi-card .value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kpi-card .value.accent { color: var(--accent); }

.panel {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 55, 50, 0.92), rgba(12, 33, 30, 0.92));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.panel h2 { font-size: 1.1rem; margin-bottom: 12px; }

.panel .next-termin {
  font-size: 1.15rem;
  font-weight: 600;
}

.panel .next-termin .accent { color: var(--accent); }

/* ---------- Tabellen ---------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 33, 30, 0.72);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; min-width: 680px; }

thead th {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(40, 80, 74, 0.5);
  font-size: 0.91rem;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr.clickable { cursor: pointer; transition: background 140ms ease; }
tbody tr.clickable:hover { background: rgba(20, 55, 50, 0.6); }

td.name { font-weight: 600; }

td.email a { color: var(--accent); text-decoration: none; }
td.email a:hover { text-decoration: underline; }

.truncate {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-soft);
}

.has-note {
  margin-left: 7px;
  color: var(--accent);
  font-size: 0.78rem;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge.aktiv {
  border-color: rgba(43, 207, 188, 0.4);
  background: rgba(43, 207, 188, 0.12);
  color: var(--accent);
}

.badge.storniert {
  border-color: rgba(226, 131, 107, 0.4);
  background: rgba(226, 131, 107, 0.12);
  color: var(--danger);
}

.badge.vergangen {
  border-color: var(--line);
  background: rgba(40, 80, 74, 0.3);
  color: var(--text-soft);
}

.empty-state {
  padding: 34px 20px;
  color: var(--text-soft);
  text-align: center;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 34px 0 13px;
  font-size: 1.05rem;
  font-weight: 600;
}

.section-heading.first { margin-top: 0; }

.count-pill {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---------- Suche ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-input {
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg-soft);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-input::placeholder { color: var(--text-soft); opacity: 0.75; }

.search-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 207, 188, 0.18);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(3, 12, 11, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-overlay.open { display: flex; }

.modal-box {
  width: 100%;
  max-width: 560px;
  max-height: 84vh;
  overflow-y: auto;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 55, 50, 0.98), rgba(10, 28, 26, 0.98));
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}

.modal-box h2 { margin: 0; font-size: 1.3rem; }

.modal-sub { margin: 0 0 18px; color: var(--text-soft); font-size: 0.88rem; }

.close-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.close-btn:hover { background: var(--surface); color: var(--text); }

.modal-box dl { margin: 0; }

.modal-box dt {
  margin-top: 15px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal-box dd {
  margin: 4px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.modal-box dd a { color: var(--accent); }

.note-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.note-section label {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.note-section textarea {
  width: 100%;
  min-height: 108px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg-soft);
  color: var(--text);
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.note-section textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 207, 188, 0.18);
}

.note-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.note-status { color: var(--text-soft); font-size: 0.85rem; min-height: 1.2em; }
.note-status.ok { color: var(--accent); }
.note-status.error { color: var(--danger); }

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.login-box {
  width: 100%;
  max-width: 372px;
  padding: 38px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 55, 50, 0.92), rgba(12, 33, 30, 0.92));
  box-shadow: var(--shadow);
  text-align: center;
}

.login-box .brand-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
}

.login-box h1 {
  margin-bottom: 4px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.login-box h1 span { color: var(--accent); }

.login-box .login-sub {
  margin: 0 0 24px;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--bg-soft);
  color: var(--text);
  text-align: center;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-box input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 207, 188, 0.18);
}

.login-box .button { width: 100%; margin-top: 16px; }

.login-error {
  min-height: 1.3em;
  margin-top: 12px;
  color: var(--danger);
  font-size: 0.86rem;
}

/* ---------- Mobil ---------- */

@media (max-width: 820px) {
  .layout { flex-direction: column; }

  nav.sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 14px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .brand { margin-bottom: 0; margin-right: 10px; }
  .brand-copy { display: none; }
  nav.sidebar a.nav-link { margin-bottom: 0; white-space: nowrap; }
  nav.sidebar .logout { margin-top: 0; margin-left: auto; }

  main { padding: 24px 18px 48px; }
  .truncate { max-width: 180px; }
}
