/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:     #0D1B2A;
  --mid:      #162436;
  --light:    #1e3048;
  --border:   rgba(255,255,255,0.07);
  --gold:     #C9A84C;
  --gold-l:   #E8C97A;
  --white:    #F7F4EF;
  --muted:    #8A9BAE;
  --blue:     #4A90D9;
  --green:    #4CAF6E;
  --radius:   10px;
  --sidebar:  220px;
}

[hidden] { display: none !important; }

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  background: var(--navy);
  color: var(--white);
  line-height: 1.5;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-l); }
button { font-family: inherit; cursor: pointer; }

/* ─── Login ─────────────────────────────────────────────────── */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201,168,76,0.08) 0%, transparent 70%), var(--navy);
}

.login__box {
  width: 100%;
  max-width: 360px;
  background: var(--mid);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
}

.login__mark {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
}

.login__mark svg { width: 100%; height: 100%; }

.login__title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.05em;
}

.login__sub {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.2rem;
  margin-bottom: 2rem;
}

.login__field {
  text-align: left;
  margin-bottom: 1rem;
}

.login__field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
  letter-spacing: 0.04em;
}

.login__field input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: 6px;
  color: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  transition: border-color 180ms;
}

.login__field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.10);
}

.login__field input::placeholder { color: rgba(138,155,174,0.45); }

.login__error {
  font-size: 0.8rem;
  color: #e07070;
  margin-bottom: 0.75rem;
  text-align: left;
}

.login__btn {
  width: 100%;
  background: var(--gold);
  border: none;
  border-radius: 999px;
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  margin-top: 0.5rem;
  transition: background 180ms, opacity 180ms;
}

.login__btn:hover { background: var(--gold-l); }
.login__btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Dashboard Layout ──────────────────────────────────────── */
.dash {
  display: flex;
  min-height: 100vh;
}

.dash__sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: var(--mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.dash__logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.25rem;
  margin-bottom: 2rem;
}

.dash__logo svg {
  width: 1.8rem;
  height: 1.8rem;
  flex-shrink: 0;
}

.dash__logo span {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.dash__nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.dash__nav-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
  padding: 0.6rem 0.75rem;
  text-align: left;
  transition: background 150ms, color 150ms;
  width: 100%;
}

.dash__nav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}

.dash__nav-btn--active {
  background: rgba(201,168,76,0.10);
  color: var(--gold);
}

.dash__back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  transition: color 150ms, background 150ms;
  width: 100%;
}

.dash__back:hover {
  color: var(--white);
  background: rgba(255,255,255,0.04);
}

.dash__logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  transition: color 150ms, background 150ms;
  width: 100%;
}

.dash__logout:hover {
  color: var(--white);
  background: rgba(255,255,255,0.04);
}

.dash__main {
  flex: 1;
  padding: 2rem;
  overflow: auto;
  min-width: 0;
}

/* ─── Stats ─────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat {
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.stat__num {
  display: block;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.1;
}

.stat__num--gold  { color: var(--gold); }
.stat__num--blue  { color: var(--blue); }
.stat__num--green { color: var(--green); }

.stat__label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 0.3rem;
}

/* ─── View header ───────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.view-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
}

.filter-select {
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}

.filter-select:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ─── Table ─────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead tr {
  background: var(--mid);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr {
  background: rgba(255,255,255,0.01);
  transition: background 120ms;
}

.data-table tbody tr:hover { background: rgba(255,255,255,0.04); }

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem !important;
  font-size: 0.85rem;
}

/* ─── Status badges ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  white-space: nowrap;
}

.badge--offen {
  background: rgba(201,168,76,0.12);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.35);
}

.badge--in_bearbeitung {
  background: rgba(74,144,217,0.12);
  color: var(--blue);
  border: 1px solid rgba(74,144,217,0.35);
}

.badge--abgeschlossen {
  background: rgba(76,175,110,0.12);
  color: var(--green);
  border: 1px solid rgba(76,175,110,0.35);
}

/* ─── Details button ────────────────────────────────────────── */
.detail-btn {
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 6px;
  color: var(--gold);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
  white-space: nowrap;
}

.detail-btn:hover {
  background: rgba(201,168,76,0.16);
  border-color: var(--gold);
}

/* ─── Lead Modal ────────────────────────────────────────────── */
.lead-modal {
  position: fixed;
  inset: 0;
  width: min(720px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  margin: auto;
  background: var(--mid);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  color: var(--white);
  box-shadow: 0 24px 64px rgba(0,0,0,0.65);
}

.lead-modal::backdrop {
  background: rgba(7,15,24,0.80);
  backdrop-filter: blur(4px);
}

.lead-modal__inner {
  padding: 1.75rem 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 3rem);
}

.lead-modal__close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: color 150ms;
}

.lead-modal__close:hover { color: var(--gold); }

.lead-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-right: 2rem;
}

.lead-modal__name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--white);
}

.lead-modal__date {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.lead-modal__mailto {
  flex-shrink: 0;
  background: rgba(201,168,76,0.10);
  border: 1px solid rgba(201,168,76,0.30);
  border-radius: 6px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  transition: background 150ms;
  white-space: nowrap;
}

.lead-modal__mailto:hover {
  background: rgba(201,168,76,0.18);
  color: var(--gold-l);
}

.lead-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 560px) {
  .lead-modal__grid { grid-template-columns: 1fr; }
}

/* Answer rows */
.lead-modal__answers {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.answer-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.answer-row__label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.answer-row__val {
  font-size: 0.88rem;
  color: var(--white);
  word-break: break-word;
}

/* Actions */
.lead-modal__actions {
  display: flex;
  flex-direction: column;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.35rem;
}

.field-select,
.field-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(201,168,76,0.14);
  border-radius: 6px;
  color: var(--white);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 0.8rem;
  transition: border-color 180ms;
}

.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.10);
}

.field-textarea {
  resize: vertical;
  min-height: 7rem;
}

.save-btn {
  background: var(--gold);
  border: none;
  border-radius: 999px;
  color: var(--navy);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  align-self: flex-start;
  transition: background 180ms;
}

.save-btn:hover { background: var(--gold-l); }

.save-confirm {
  font-size: 0.78rem;
  color: var(--green);
  margin-top: 0.5rem;
}

.delete-btn {
  display:      flex;
  align-items:  center;
  gap:          0.4rem;
  background:   transparent;
  border:       1px solid rgba(220, 60, 60, 0.35);
  border-radius: 999px;
  color:        rgba(220, 60, 60, 0.7);
  font-family:  inherit;
  font-size:    0.78rem;
  font-weight:  500;
  margin-top:   2rem;
  padding:      0.5rem 1.25rem;
  align-self:   flex-start;
  cursor:       pointer;
  transition:   background 180ms, color 180ms, border-color 180ms;
}

.delete-btn:hover {
  background:   rgba(220, 60, 60, 0.12);
  border-color: rgba(220, 60, 60, 0.7);
  color:        rgb(220, 60, 60);
}

.delete-btn:disabled {
  opacity: 0.5;
  cursor:  not-allowed;
}

/* ─── Analytics Chart ───────────────────────────────────────── */
.chart-wrap {
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem 0.5rem;
}

#viewsChart {
  width: 100%;
  display: block;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dash { flex-direction: column; }

  .dash__sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .dash__logo { margin-bottom: 0; }

  .dash__nav {
    flex-direction: row;
    flex: none;
  }

  .dash__logout { width: auto; margin-left: auto; }

  .dash__main { padding: 1rem; }

  .stats-row { grid-template-columns: repeat(3, 1fr); }
}
