/* ── CSS Custom Properties ────────────────────────────────────────────────── */
:root {
  --color-primary:        #c0392b;
  --color-primary-dark:   #922b21;
  --color-primary-light:  #e74c3c;
  --color-bg:             #f5f6f8;
  --color-surface:        #ffffff;
  --color-text:           #1a1d23;
  --color-text-muted:     #6b7280;
  --color-border:         #d1d5db;
  --color-border-focus:   #c0392b;

  --color-warn-bg:        #fef9c3;
  --color-warn-border:    #f59e0b;
  --color-warn-text:      #713f12;
  --color-err-bg:         #fee2e2;
  --color-err-border:     #ef4444;
  --color-err-text:       #7f1d1d;
  --color-ok-bg:          #dcfce7;
  --color-ok-border:      #22c55e;
  --color-ok-text:        #14532d;

  --radius:               8px;
  --radius-sm:            4px;
  --shadow:               0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --max-width:            740px;
  --transition:           0.15s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 1.5rem;
  border-bottom: 3px solid var(--color-primary-dark);
}
header h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
header .subtitle { font-size: 0.82rem; opacity: 0.82; margin-top: 0.15rem; }

/* ── Main ────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  padding: 2rem 1rem 3rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

main.admin-main {
  max-width: 960px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* ── Admin Nav ───────────────────────────────────────────────────────────── */
.admin-nav {
  background: #1e293b;
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.admin-nav .nav-title { font-weight: 700; font-size: 0.95rem; }
.admin-nav .nav-links { font-size: 0.875rem; }
.admin-nav a { color: #94a3b8; text-decoration: none; }
.admin-nav a:hover { color: #fff; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--color-border);
}
.info-card { border-left: 4px solid var(--color-primary); }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin-bottom: 1.25rem;
  font-size: 0.925rem;
}
.alert p + p { margin-top: 0.4rem; }
.alert strong { display: block; margin-bottom: 0.3rem; font-size: 0.95rem; }

.alert-warning {
  background: var(--color-warn-bg);
  border-color: var(--color-warn-border);
  color: var(--color-warn-text);
}
.alert-danger {
  background: var(--color-err-bg);
  border-color: var(--color-err-border);
  color: var(--color-err-text);
}
.alert-success {
  background: var(--color-ok-bg);
  border-color: var(--color-ok-border);
  color: var(--color-ok-text);
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
}

.optional { font-weight: 400; color: var(--color-text-muted); font-size: 0.82rem; }
.required-mark { color: var(--color-primary); }

input[type="text"],
input[type="password"],
textarea,
select {
  display: block;
  width: 100%;
  padding: 0.575rem 0.875rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, .15);
}
textarea { resize: vertical; min-height: 160px; }

.char-count {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: 0.3rem;
}
.field-note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

/* ── Radio-Gruppe ────────────────────────────────────────────────────────── */
.radio-group { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}
.radio-option:hover { background: var(--color-bg); border-color: var(--color-primary-light); }
.radio-option input[type="radio"] { margin: 0; accent-color: var(--color-primary); }

.urgency-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-niedrig { background: #16a34a; }
.dot-mittel  { background: #ea580c; }
.dot-hoch    { background: #dc2626; }

/* Honeypot: visuell und für AT komplett ausgeblendet */
.hp-field { display: none !important; visibility: hidden !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), opacity var(--transition);
  text-align: center;
}
.btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover  { background: var(--color-primary-dark); }
.btn-secondary { background: #e5e7eb; color: var(--color-text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger   { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.82rem; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2em 0.65em;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Dringlichkeit */
.badge-niedrig { background: #dcfce7; color: #14532d; }
.badge-mittel  { background: #ffedd5; color: #7c2d12; }
.badge-hoch    { background: #fee2e2; color: #7f1d1d; }

/* Status */
.badge-status-neu             { background: #dbeafe; color: #1e3a8a; }
.badge-status-in-bearbeitung  { background: #fef9c3; color: #713f12; }
.badge-status-erledigt        { background: #dcfce7; color: #14532d; }
.badge-status-archiviert      { background: #f3f4f6; color: #374151; }

/* ── Tabelle ─────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  font-size: 0.875rem;
}
thead th {
  padding: 0.75rem 0.875rem;
  text-align: left;
  font-weight: 700;
  background: #f8fafc;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody td { padding: 0.75rem 0.875rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

.message-preview { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ── Filter-Leiste ───────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.875rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar select { min-width: 160px; }

/* ── Seitentitel ─────────────────────────────────────────────────────────── */
.page-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.25rem; }
.page-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-title-row .page-title { margin-bottom: 0; }

/* ── Detail-Metadaten ────────────────────────────────────────────────────── */
dl.detail-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}
dl.detail-meta dt { font-weight: 600; color: var(--color-text-muted); }
dl.detail-meta dd { margin: 0; word-break: break-word; }

.section-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.message-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── Danger Zone ─────────────────────────────────────────────────────────── */
.danger-zone { border-color: #fca5a5; }
.danger-label { color: #dc2626; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-card { max-width: 420px; margin: 3rem auto 0; }
.login-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }

/* ── Danke-Seite ─────────────────────────────────────────────────────────── */
.thanks-card { text-align: center; padding: 2.5rem 1.5rem; }
.thanks-icon {
  font-size: 3rem;
  color: #16a34a;
  margin-bottom: 0.75rem;
  line-height: 1;
}
.thanks-card h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }

/* ── Leerer Zustand ──────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--color-text-muted); }
.empty-state p { font-size: 1.05rem; }

/* ── Telegram-Status ─────────────────────────────────────────────────────── */
.tg-ok    { color: #16a34a; font-weight: 600; }
.tg-error { color: #dc2626; font-weight: 600; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--color-text-muted); font-size: 0.875rem; }
.text-center  { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  header h1 { font-size: 1.15rem; }
  main { padding: 1.25rem 0.875rem 2.5rem; }
  .card { padding: 1.125rem; }
  .btn { width: 100%; display: block; }
  .btn + .btn { margin-top: 0.5rem; }
  .radio-group { flex-direction: column; }
  .filter-bar { flex-direction: column; }
  .filter-bar select { min-width: 100%; }
  .admin-nav { flex-direction: column; text-align: center; }
  .page-title-row { flex-direction: column; align-items: flex-start; }
  dl.detail-meta { grid-template-columns: 1fr; }
  dl.detail-meta dt { margin-top: 0.5rem; }
}

@media (min-width: 641px) {
  .btn { display: inline-block; width: auto; }
}
