/* EUP Status – minimalistisches Design-System */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F1F4F8;
  --border: #E3E7ED;
  --border-strong: #CBD3DE;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;

  --primary: #0F172A;
  --primary-hover: #1E293B;
  --on-primary: #FFFFFF;
  --ring: #2563EB;
  --ring-soft: rgba(37, 99, 235, .18);

  --done: #16A34A;
  --done-text: #15803D;
  --done-soft: #E7F7EC;
  --progress: #D97706;
  --progress-text: #B45309;
  --progress-soft: #FEF3DC;
  --open: #94A3B8;
  --open-text: #475569;
  --open-soft: #EEF1F5;
  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --danger-soft: #FDECEC;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .25);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1020;
    --surface: #111827;
    --surface-2: #1A2233;
    --border: #232D3F;
    --border-strong: #334155;
    --text: #F1F5F9;
    --text-2: #CBD5E1;
    --muted: #94A3B8;

    --primary: #F1F5F9;
    --primary-hover: #FFFFFF;
    --on-primary: #0B1020;
    --ring: #60A5FA;
    --ring-soft: rgba(96, 165, 250, .25);

    --done: #22C55E;
    --done-text: #4ADE80;
    --done-soft: rgba(34, 197, 94, .14);
    --progress: #F59E0B;
    --progress-text: #FBBF24;
    --progress-soft: rgba(245, 158, 11, .14);
    --open: #64748B;
    --open-text: #CBD5E1;
    --open-soft: rgba(148, 163, 184, .14);
    --danger: #EF4444;
    --danger-hover: #F87171;
    --danger-soft: rgba(239, 68, 68, .14);

    --shadow-sm: none;
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);

    color-scheme: dark;
  }
}

/* ---------- Basis ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }

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

.icon { flex: none; display: block; }

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

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark { width: 26px; height: 26px; }
.brand-sub { color: var(--muted); font-weight: 450; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.stamp {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: 550 14px/1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}

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

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-ghost { border-color: var(--border); color: var(--text-2); background: var(--surface); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-block { width: 100%; height: 44px; }

.btn[aria-busy="true"]::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

@keyframes spin { to { transform: rotate(360deg); } }

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

.field { display: grid; gap: 6px; }

.field > label, .label {
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
}

.field .hint { font-size: 12.5px; color: var(--muted); }

.input, select.input, textarea.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 400 15px/1.4 var(--font);
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea.input {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

select.input {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.input::placeholder { color: var(--muted); opacity: .8; }

.input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--ring-soft);
}

.form-stack { display: grid; gap: 16px; }

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

/* ---------- Status-Elemente ---------- */

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.s-open { --s: var(--open); --s-text: var(--open-text); --s-soft: var(--open-soft); }
.s-progress { --s: var(--progress); --s-text: var(--progress-text); --s-soft: var(--progress-soft); }
.s-done { --s: var(--done); --s-text: var(--done-text); --s-soft: var(--done-soft); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--s-soft);
  color: var(--s-text);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.pill .dot { width: 6px; height: 6px; background: var(--s); }

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

/* ---------- Dashboard: Zusammenfassung ---------- */

.page { flex: 1; padding-top: 40px; padding-bottom: 56px; }

.summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 24px 56px;
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.summary-figure { display: grid; gap: 4px; }

.big {
  font-size: clamp(3rem, 7vw, 4.75rem);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.big small { font-size: .45em; font-weight: 600; letter-spacing: -0.02em; color: var(--muted); margin-left: 4px; }

.summary-label { font-size: 15px; color: var(--muted); }
.summary-label strong { color: var(--text); font-weight: 600; }

.summary-bar { display: grid; gap: 14px; padding-bottom: 4px; }

.bar {
  display: flex;
  gap: 3px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}

.bar span {
  height: 100%;
  background: var(--s);
  transition: flex-basis .4s ease;
}

.bar span:first-child { border-radius: 999px 0 0 999px; }
.bar span:last-child { border-radius: 0 999px 999px 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--text-2);
}

.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend .dot { background: var(--s); }
.legend b { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Dashboard: Werkzeugleiste ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 360px;
}

.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search .input { padding-left: 38px; }

.toolbar select.input { width: auto; min-width: 180px; }

/* ---------- Dashboard: Board ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.col-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--s);
}

.col-head .icon { color: var(--s); }
.col-head h2 { font-size: 15px; font-weight: 650; }

.count {
  margin-left: auto;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--s-soft);
  color: var(--s-text);
  font: 600 12px/22px var(--font);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.cards {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.card h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.card .note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.card .chip { margin-top: 12px; }

.times {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 14px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
}

.times > div { display: contents; }
.times dt { color: var(--muted); }
.times dd { margin: 0; color: var(--text-2); font-variant-numeric: tabular-nums; }

.empty {
  padding: 24px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---------- Dashboard: Verlauf ---------- */

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 56px 0 12px;
}

.section-title h2 { font-size: 17px; font-weight: 650; }

.log {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.log li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  font-size: 14px;
}

.log li + li { border-top: 1px solid var(--border); }
.log time { color: var(--muted); font-size: 13px; }

.log-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.log-text b { font-weight: 600; overflow-wrap: anywhere; }
.log-arrow { color: var(--muted); }

.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 24px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

.footer {
  padding-top: 24px;
  padding-bottom: 32px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Admin ---------- */

.auth {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 48px 16px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.auth-card .brand-mark { width: 36px; height: 36px; margin-bottom: 20px; }
.auth-card h1 { font-size: 22px; font-weight: 650; }
.auth-card .lead { margin: 6px 0 24px; color: var(--muted); font-size: 14px; }

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.auth-back:hover { color: var(--text); }

.admin-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

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

.panel-pad { padding: 20px; }

.panel-sticky { position: sticky; top: 88px; }

.panel h2 { font-size: 16px; font-weight: 650; margin-bottom: 16px; }

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.list-head .search { flex: 1 1 200px; max-width: 280px; }

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font: 550 13px/1 var(--font);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.tab .n { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }

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

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 16px 20px;
}

.row + .row { border-top: 1px solid var(--border); }

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

.row-title h3 { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

.row .note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.row-times {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.row-times span b { font-weight: 450; }
.row-times time { font-variant-numeric: tabular-nums; color: var(--text-2); }

.row-actions { display: flex; align-items: center; gap: 8px; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font: 550 13px/1 var(--font);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--s-soft); color: var(--s-text); }
.seg button .dot { background: var(--s); }

.list-empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Dialog & Toast ---------- */

dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }

dialog[open] { animation: pop .18s ease-out; }

@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0 24px;
}

.dialog-head h2 { font-size: 17px; font-weight: 650; }
.dialog-body { padding: 16px 24px 24px; }

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

.loading {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ---------- Responsiv ---------- */

@media (max-width: 1024px) {
  .admin-grid { grid-template-columns: 1fr; }
  .panel-sticky { position: static; }
}

@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; gap: 32px; }
  .summary { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; gap: 12px; }
  .row-actions { flex-wrap: wrap; }
  .list-head .search { max-width: none; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .page { padding-top: 28px; }
  .stamp { display: none; }
  .log li { grid-template-columns: 1fr; gap: 4px; }
  .toolbar select.input { flex: 1 1 100%; }
  .search { max-width: none; }
  .auth-card { padding: 24px; }
  .brand-sub { display: none; }
  .topbar-meta { gap: 8px; }
  .topbar .btn:has(.btn-text) { width: 40px; padding: 0; }
  .btn-text {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
  }
  .row { padding: 16px; }
  .list-head { padding: 16px; }
  .seg { flex: 1 1 auto; }
  .seg button { flex: 1; justify-content: center; padding: 0 6px; font-size: 12.5px; }
  .seg button .dot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
