:root {
  --bg: #f4f7f7;
  --panel: #ffffff;
  --line: #d8e4e2;
  --text: #173533;
  --muted: #5f7c79;
  --teal: #0f6d68;
  --teal-dark: #0a5450;
  --teal-soft: #e7f3f1;
  --ok: #1f7a55;
  --ok-soft: #eaf7f1;
  --warn: #b26b00;
  --warn-soft: #fff6e5;
  --err: #c0392b;
  --err-soft: #fdf0ee;
  --shadow: 0 8px 24px rgba(13,47,45,.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth ─────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef5f4 0%, var(--bg) 100%);
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: .02em;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.auth-card h1 { margin: 0 0 20px; font-size: 22px; }
.auth-hint { color: var(--muted); font-size: 14px; margin: -12px 0 18px; line-height: 1.5; }

/* ── Formulare ────────────────────────────────────────────────────────── */
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field input, .field select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  background: #fff;
  transition: border-color .15s;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--teal);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────────────────────────────── */
button, .btn { font: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: .15s ease;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-soft { background: var(--teal-soft); color: var(--teal-dark); border: 1px solid #cfe6e2; }
.btn-soft:hover { background: #d8eeeb; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.alert-error { background: var(--err-soft); color: var(--err); border: 1px solid #f5cac6; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #cce7da; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-angebot { background: #e8f4ff; color: #1a5ca8; border-color: #bed7f5; }
.badge-vertrag { background: #f0eeff; color: #4a2ea0; border-color: #cfc8f5; }
.badge-ok, .badge-status-unterzeichnet { background: var(--ok-soft); color: var(--ok); border-color: #cce7da; }
.badge-warn, .badge-status-ausstehend { background: var(--warn-soft); color: var(--warn); border-color: #efd7ad; }
.badge-muted, .badge-status-abgelehnt { background: #f3f3f3; color: #888; border-color: #ddd; }

/* ── Karten & Tabellen ────────────────────────────────────────────────── */
.section-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.section-card h2 { margin: 0 0 16px; font-size: 17px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-header h2 { margin: 0; }
.section-highlight { border-color: #cce7da; background: #f7fcf9; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px; font-weight: 700; border-bottom: 2px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f7fbfb; }

.empty-note {
  padding: 20px;
  border-radius: var(--radius);
  background: #f7fbfb;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ── Detailansicht ────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
.detail-list dd { margin: 0; }

/* ── Formular-Layout ──────────────────────────────────────────────────── */
.form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 600px;
}

.form-hint { font-size: 13px; color: var(--muted); margin-bottom: 18px; line-height: 1.5; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ── Stats ────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card.stat-warn { border-color: #efd7ad; background: var(--warn-soft); }
.stat-card.stat-ok { border-color: #cce7da; background: var(--ok-soft); }
.stat-value { font-size: 34px; font-weight: 800; color: var(--teal-dark); }
.stat-card.stat-warn .stat-value { color: var(--warn); }
.stat-card.stat-ok .stat-value { color: var(--ok); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Filter ───────────────────────────────────────────────────────────── */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-form select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 14px; background: #fff; cursor: pointer; }

/* ── Page header ──────────────────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { margin: 0; font-size: 24px; }
