/* ==========================================================================
   Referenten-Portal - Designgrundlage
   Hell als Standard, Dunkel folgt der Systemeinstellung.
   ========================================================================== */

:root {
  --bg: #f4f5f7;
  --bg-accent: #eceef2;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --ink: #0b1220;
  --ink-soft: #33405a;
  --muted: #5a6478;
  --line: #e3e6ec;
  --line-strong: #cfd5e0;
  --accent: #2b59d8;
  --accent-hover: #1f47b8;
  --accent-soft: #eef2fe;
  --ok: #12805c;
  --ok-soft: #e6f5ef;
  --warn: #a15c07;
  --warn-soft: #fdf3e3;
  --danger: #c02b2b;
  --danger-soft: #fdeded;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.05), 0 1px 3px rgba(11, 18, 32, 0.04);
  --shadow-md: 0 4px 12px rgba(11, 18, 32, 0.06), 0 2px 4px rgba(11, 18, 32, 0.04);
  --shadow-lg: 0 18px 40px rgba(11, 18, 32, 0.10), 0 4px 12px rgba(11, 18, 32, 0.05);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b11;
    --bg-accent: #0d121b;
    --surface: #121824;
    --surface-soft: #171e2c;
    --ink: #eaeef6;
    --ink-soft: #c2cbdb;
    --muted: #8f9bb0;
    --line: #232b3a;
    --line-strong: #333e52;
    --accent: #7d9bff;
    --accent-hover: #98afff;
    --accent-soft: #172038;
    --ok: #4ecfa0;
    --ok-soft: #10261f;
    --warn: #e3ac5c;
    --warn-soft: #2a2013;
    --danger: #ff8080;
    --danger-soft: #2c1618;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1rem 0; }
p:last-child { margin-bottom: 0; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }
.hidden { display: none !important; }

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

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.shell-wide {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 20px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.card-body { padding: 24px; }
.card-body-tight { padding: 16px 24px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-accent);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.btn-primary:hover {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--line-strong);
  background: var(--surface);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 8px 10px;
}
.btn-ghost:hover {
  background: var(--bg-accent);
  color: var(--ink);
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.85rem;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-block { width: 100%; }

/* ------------------------------------------------------------ Formulare -- */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.checkbox-row label {
  margin-bottom: 0;
  font-weight: 500;
}
.checkbox-row input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* --------------------------------------------------------------- Badges -- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-accent);
  color: var(--muted);
  white-space: nowrap;
}

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* -------------------------------------------------------------- Hinweise -- */

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 0.92rem;
  margin-bottom: 20px;
}
.alert-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert strong { font-weight: 700; }

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

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

table.data th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

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

table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-soft); }

/* ------------------------------------------------------- Fortschritt ----- */

.progress {
  height: 6px;
  background: var(--bg-accent);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
  width: 0;
}

.progress-bar.is-done { background: var(--ok); }

/* =========================================================================
   Referenten-Seite
   ========================================================================= */

.portal-header {
  margin-bottom: 28px;
}

.portal-header h1 {
  margin: 10px 0 8px;
}

.portal-lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

/* Terminkarte mit farbigem Rand als optischer Anker */
.appointment {
  position: relative;
  overflow: hidden;
}

.appointment::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.appointment-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 560px) {
  .appointment-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.date-block {
  text-align: center;
  min-width: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.date-block .month {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.date-block .day {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.date-block .weekday {
  font-size: 0.8rem;
  color: var(--muted);
}

.time-large {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.countdown {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.countdown.is-live {
  background: var(--ok-soft);
  color: var(--ok);
}

.countdown.is-past {
  background: var(--bg-accent);
  color: var(--muted);
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------ Checkliste -- */

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist li {
  border-bottom: 1px solid var(--line);
}
.checklist li:last-child { border-bottom: none; }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 4px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.check-item input {
  appearance: none;
  -webkit-appearance: none;
  width: 21px;
  height: 21px;
  margin: 1px 0 0 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.check-item input:checked {
  background: var(--ok);
  border-color: var(--ok);
}

/* Haken als reines CSS-Element, damit keine Bilddatei noetig ist */
.check-item input:checked::after {
  content: "";
  position: absolute;
  left: 6.5px;
  top: 2.5px;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-item span {
  font-size: 0.96rem;
  line-height: 1.5;
}

.check-item input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* ----------------------------------------------------------- Upload-Zone -- */

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  background: var(--surface-soft);
  transition: border-color 0.18s ease, background 0.18s ease;
  cursor: pointer;
}

.dropzone:hover,
.dropzone:focus-within {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  color: var(--muted);
}

.dropzone.is-dragging .dropzone-icon,
.dropzone:hover .dropzone-icon { color: var(--accent); }

.dropzone h3 { margin-bottom: 6px; }

.upload-list {
  list-style: none;
  margin: 20px 0 0 0;
  padding: 0;
}

.upload-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface);
}

.upload-item:last-child { margin-bottom: 0; }

.upload-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.upload-name {
  font-weight: 600;
  font-size: 0.92rem;
  word-break: break-word;
  line-height: 1.4;
}

.upload-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.upload-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.upload-item.is-complete { border-color: var(--ok); background: var(--ok-soft); }
.upload-item.is-error { border-color: var(--danger); background: var(--danger-soft); }

.file-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================================
   Admin
   ========================================================================= */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 60px;
}

.brand {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-right: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 2px;
  align-items: center;
  flex: 1;
  overflow-x: auto;
}

.nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.nav a:hover {
  background: var(--bg-accent);
  color: var(--ink);
  text-decoration: none;
}

.nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover { color: var(--ink); text-decoration: none; }

.tabs a.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

/* Link-Feld mit Kopierknopf */
.copy-field {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.copy-field input {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: var(--surface-soft);
}

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

.empty h3 {
  color: var(--ink);
  margin-bottom: 8px;
}

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

.login-card {
  width: 100%;
  max-width: 400px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.timeline li {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.timeline li:last-child { border-bottom: none; }

.timeline-time {
  color: var(--muted);
  font-size: 0.82rem;
  min-width: 122px;
  flex-shrink: 0;
}

footer.portal-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .shell, .shell-wide { padding: 20px 16px 60px; }
  .card-body { padding: 18px; }
  .card-head { padding: 16px 18px; }
  table.data th, table.data td { padding: 11px 12px; }
}

@media print {
  .topbar, .btn, .dropzone { display: none; }
  body { background: #ffffff; }
  .card { box-shadow: none; border-color: #ccc; }
}
