:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --ink: #171717;
  --ink-soft: oklch(40% 0.005 250);
  --line: oklch(92% 0.005 250);
  --line-strong: oklch(86% 0.005 250);
  --accent: oklch(48% 0.18 145);
  --accent-soft: oklch(95% 0.04 145);
  --warn: oklch(68% 0.16 50);
  --shadow-sm: 0 1px 0 rgba(23,23,23,.04), 0 1px 3px rgba(23,23,23,.05);
  --shadow-md: 0 1px 0 rgba(23,23,23,.04), 0 6px 24px -8px rgba(23,23,23,.12);
  --radius: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "cv11";
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; font-weight: 600; text-decoration: none; }
.brand-logo { height: 36px; width: auto; display: block; }
.brand-text { font-size: 14px; letter-spacing: -0.01em; color: var(--ink-soft); }
.user { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-name { font-weight: 500; font-size: 14px; }
.user-email { font-size: 12px; color: var(--ink-soft); }

.page { max-width: 980px; margin: 0 auto; padding: 56px 32px 96px; }

.hero h1 {
  font-family: "Instrument Sans", "Geist", serif;
  font-size: clamp(32px, 4.4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
}
.lede { color: var(--ink-soft); font-size: 17px; max-width: 640px; margin: 0 0 40px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  display: flex; flex-direction: column; min-height: 180px;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card:active { transform: translateY(0); }
.card--soon { opacity: .55; cursor: not-allowed; }
.card--soon:hover { transform: none; box-shadow: var(--shadow-sm); }

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-num { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: oklch(95% 0.005 250); color: var(--ink-soft); letter-spacing: 0.02em;
}
.card h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.25; }
.card p { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; flex: 1; }
.card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.empfaenger { color: var(--ink-soft); }
.cta { color: var(--accent); font-weight: 500; }

.recent { margin-top: 56px; }
.recent h3 { font-size: 14px; font-weight: 500; color: var(--ink-soft); letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 12px; }
.recent-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.recent-list li {
  display: grid; grid-template-columns: 1fr auto 110px;
  gap: 16px; align-items: center; padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.recent-list li:last-child { border-bottom: 0; }
.recent-typ { font-weight: 500; }
.recent-zeit { color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.recent-status { font-size: 12px; padding: 3px 9px; border-radius: 999px; text-align: center; }
.status-eingereicht { background: var(--accent-soft); color: var(--accent); }

.formhead { margin-bottom: 36px; }
.back { font-size: 14px; color: var(--ink-soft); display: inline-block; margin-bottom: 16px; }
.back:hover { color: var(--ink); }
.formhead h1 {
  font-family: "Instrument Sans", "Geist", serif;
  font-size: 36px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 6px;
}

.form {
  background: var(--surface); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 22px;
}
.row { display: flex; flex-direction: column; gap: 6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 500; color: var(--ink-soft); letter-spacing: 0.01em; }
input[type=text], input[type=date], input[type=number], input[type=email], textarea {
  font: inherit; color: var(--ink);
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); width: 100%;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, textarea:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px oklch(92% 0.02 145); }
input[readonly] { background: oklch(98% 0.005 250); color: var(--ink-soft); }
.help { font-size: 12px; color: var(--ink-soft); }

.sig-row { gap: 10px; }
.sig-tabs { display: inline-flex; background: oklch(96% 0.005 250); padding: 4px; border-radius: 8px; gap: 2px; margin-bottom: 4px; }
.sig-tab {
  font: inherit; cursor: pointer; padding: 8px 14px; border: 0; background: transparent;
  color: var(--ink-soft); font-size: 13px; font-weight: 500; border-radius: 6px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.sig-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.sig-tab:hover:not(.active) { color: var(--ink); }
.sig-wrap { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 10px; }
#signature-pad { display: block; width: 100%; height: 240px; background: oklch(99% 0.003 250); border-radius: 6px; touch-action: none; cursor: crosshair; }
.sig-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; gap: 12px; }
.sig-actions .help { margin: 0; }
.sig-preview { margin-top: 12px; }
.sig-preview img { max-height: 120px; max-width: 100%; background: oklch(99% 0.003 250); border-radius: 6px; padding: 8px; box-shadow: var(--shadow-sm); }
input[type=file] { padding: 8px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface); width: 100%; }

.actions { display: flex; align-items: center; gap: 16px; padding-top: 12px; }
.btn-primary, .btn-ghost {
  font: inherit; cursor: pointer; padding: 12px 20px; border-radius: 8px;
  font-weight: 500; transition: all .2s var(--ease); border: 1px solid transparent;
}
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { background: oklch(28% 0.005 250); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.hint { color: var(--ink-soft); font-size: 13px; }

.success { text-align: center; padding: 60px 20px; }
.success .check {
  width: 64px; height: 64px; margin: 0 auto 24px;
  background: var(--accent); color: var(--surface);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 600;
}
.success h1 {
  font-family: "Instrument Sans", "Geist", serif;
  font-size: 36px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 8px;
}
.success .meta { display: inline-grid; grid-template-columns: auto auto; gap: 8px 24px; margin: 32px 0; text-align: left; }
.success .meta dt { color: var(--ink-soft); font-size: 13px; }
.success .meta dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.success .actions { justify-content: center; }

.foot {
  text-align: center; color: var(--ink-soft); font-size: 13px;
  padding: 24px; border-top: 1px solid var(--line);
}
.dot { margin: 0 8px; }

@media (max-width: 640px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .topbar { padding: 14px 18px; }
  .page { padding: 32px 18px 64px; }
  .form { padding: 22px; }
  .recent-list li { grid-template-columns: 1fr; gap: 4px; }
}

/* ===== Topbar nav ===== */
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav-link {
  font-size: 14px; color: var(--ink-soft); padding: 6px 10px; border-radius: 6px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.topnav-link:hover { background: oklch(96% 0.005 250); color: var(--ink); }

/* ===== Auth ===== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 32px 18px;
}
.auth-card {
  width: 100%; max-width: 440px; padding: 40px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-md);
  text-align: left;
}
.auth-logo { height: 56px; width: auto; display: block; margin-bottom: 28px; }
.auth-card h1 {
  font-family: "Instrument Sans", "Geist", serif;
  font-size: 28px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 8px;
}
.auth-card .lede { font-size: 15px; margin: 0 0 24px; }
.auth-card .check {
  width: 56px; height: 56px; margin-bottom: 20px;
  background: var(--accent); color: var(--surface); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 600;
}
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-form button { padding: 13px 18px; }
.auth-error {
  padding: 10px 14px; margin-bottom: 16px;
  background: oklch(95% 0.04 50); color: var(--warn);
  border-radius: 8px; font-size: 14px;
}

/* ===== Anhänge ===== */
.anhang-wrap { display: flex; flex-direction: column; gap: 8px; }
.anhang-liste { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }
.anhang-liste li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: oklch(98% 0.005 250); border-radius: 8px;
  font-size: 14px;
}
.anhang-name { font-weight: 500; }
.anhang-meta { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ===== Genehmigen-Seite ===== */
.genehmigen-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: start;
}
.sec-title {
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin: 24px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.g-left .sec-title:first-child, .g-right .sec-title:first-child { margin-top: 0; }
.meta-table { width: 100%; border-collapse: collapse; }
.meta-table td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.meta-table td.k { color: var(--ink-soft); width: 40%; }
.meta-table td.v { font-weight: 500; }
.pdf-frame {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-top: 8px;
}
.pdf-frame iframe { width: 100%; height: 600px; border: 0; display: block; }

.entscheidung-radio { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.radio-card {
  display: flex; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  cursor: pointer; transition: all .2s var(--ease);
}
.radio-card:hover { border-color: var(--ink); }
.radio-card input { margin-top: 4px; flex-shrink: 0; }
.radio-card input:checked ~ .rc-body { color: var(--ink); }
.radio-card:has(input:checked) { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.radio-card--reject:has(input:checked) { border-color: var(--warn); }
.rc-body { display: flex; flex-direction: column; gap: 2px; }
.rc-body strong { font-size: 14px; font-weight: 600; }
.rc-body span { font-size: 13px; color: var(--ink-soft); }

@media (max-width: 900px) {
  .genehmigen-grid { grid-template-columns: 1fr; }
  .pdf-frame iframe { height: 400px; }
}

/* ===== Dashboard ===== */
.filter-bar {
  display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
  background: var(--surface); padding: 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-field span { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.filter-bar input, .filter-bar select { padding: 9px 12px; }
.filter-bar .btn-primary, .filter-bar .btn-ghost { padding: 9px 16px; }

.summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 28px;
}
.kpi {
  background: var(--surface); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label {
  font-size: 12px; color: var(--ink-soft); letter-spacing: 0.04em;
  text-transform: uppercase; font-weight: 500;
}
.kpi-value {
  font-family: "Instrument Sans", serif;
  font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.lehrer-row { grid-template-columns: 1fr 2fr 100px !important; }
.dash-row { grid-template-columns: 1fr 1.4fr auto 110px 60px !important; }
.recent-name { color: var(--ink-soft); font-size: 13px; }
.status-genehmigt { background: oklch(95% 0.04 145); color: var(--accent); }
.status-abgelehnt { background: oklch(95% 0.06 30); color: oklch(50% 0.18 30); }
.req { color: oklch(56% 0.18 30); font-style: normal; }

/* ===== Demo-Login-Page ===== */
.auth-card { max-width: 520px; }
.kicker {
  display: inline-block;
  font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
  padding: 4px 10px; background: var(--accent-soft); border-radius: 999px;
}
.demo-flow {
  display: flex; flex-direction: column; gap: 10px;
  margin: 28px 0;
  padding: 18px; background: oklch(98% 0.005 250); border-radius: 12px;
}
.step { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 26px; height: 26px;
  background: var(--ink); color: var(--surface);
  border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.step > div { display: flex; flex-direction: column; gap: 2px; }
.step strong { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.step span { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.auth-foot {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: 12px; text-align: center;
}
