/* ═══════════════════════════════════════════════════════════
   mesonic Schulungsportal – Shared Styles
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.bunny.net/css2?family=Barlow+Condensed:wght@400;700;900&family=Barlow:ital,wght@0,300;0,400;0,500;0,600;1,300&family=Open+Sans:wght@400;600;700;800&display=swap');

/* ─── Custom Properties ────────────────────────────────────── */
:root {
  --rot:        #b81c22;
  --dunkelrot:  #8a1419;
  --hellrot:    #f8eded;
  --schwarz:    #1c1c1c;
  --grau:       #f6f6f4;
  --mittelgrau: #e4e4e1;
  --weiss:      #ffffff;
  --gruen:      #1e7e34;
  --hellgruen:  #eaf6ed;
  --radius:     3px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.08);
  --shadow:     0 2px 12px rgba(0,0,0,.1);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);
  --nav-h:      68px;
  --transition: .18s ease;
}

/* ─── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  color: var(--schwarz);
  background: var(--grau);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--rot); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Typography ───────────────────────────────────────────── */
h1,h2,h3,h4,h5 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .02em;
}

/* ─── Nav ──────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--weiss);
  border-bottom: 3px solid var(--rot);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 500;
  box-shadow: var(--shadow-sm);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo img { height: 36px; }
.nav-logo-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--schwarz);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav-logo-text em { color: var(--rot); font-style: normal; }
.nav-right { display: flex; align-items: center; gap: .75rem; }
.nav-firm {
  font-size: .82rem;
  font-weight: 600;
  color: #888;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ─── Page wrapper ─────────────────────────────────────────── */
.page-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main {
  flex: 1;
  margin-top: var(--nav-h);
  padding: 2.5rem 2rem;
  max-width: 1260px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  /* override top margin for nav */
  padding-top: calc(var(--nav-h) + 2.5rem);
}
.main-narrow {
  flex: 1;
  padding: calc(var(--nav-h) + 2.5rem) 1.5rem 2.5rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.main-full {
  flex: 1;
  padding-top: var(--nav-h);
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: .6rem 1.5rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform .1s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
}
.btn-primary {
  background: var(--rot);
  color: var(--weiss);
  border-color: var(--rot);
}
.btn-primary:hover:not(:disabled) {
  background: var(--dunkelrot);
  border-color: var(--dunkelrot);
  box-shadow: 0 4px 14px rgba(184,28,34,.35);
}
.btn-outline {
  background: transparent;
  color: var(--rot);
  border-color: var(--rot);
}
.btn-outline:hover:not(:disabled) {
  background: var(--hellrot);
}
.btn-ghost {
  background: transparent;
  color: #666;
  border-color: var(--mittelgrau);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--rot);
  color: var(--rot);
}
.btn-success {
  background: var(--gruen);
  color: var(--weiss);
  border-color: var(--gruen);
}
.btn-success:hover:not(:disabled) {
  background: #155724;
  border-color: #155724;
}
.btn-danger {
  background: transparent;
  color: #c0392b;
  border-color: #c0392b;
}
.btn-danger:hover:not(:disabled) { background: #fdf0ef; }
.btn-sm { font-size: .78rem; padding: .4rem 1rem; letter-spacing: 1.5px; }
.btn-lg { font-size: 1rem; padding: .8rem 2rem; letter-spacing: 2.5px; }
.btn-block { width: 100%; }

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--weiss);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-red-top { border-top: 4px solid var(--rot); }
.card-body { padding: 1.5rem; }
.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--mittelgrau);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header h2, .card-header h3 { font-size: 1.25rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--mittelgrau);
  background: var(--grau);
}

/* ─── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: .4rem;
}
.form-control {
  width: 100%;
  padding: .72rem 1rem;
  border: 2px solid var(--mittelgrau);
  border-radius: var(--radius);
  font-family: 'Barlow', sans-serif;
  font-size: .95rem;
  color: var(--schwarz);
  background: var(--weiss);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--rot);
  box-shadow: 0 0 0 3px rgba(184,28,34,.12);
}
.form-control::placeholder { color: #bbb; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}
textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.5; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ─── Alerts / Messages ────────────────────────────────────── */
.alert {
  display: none;
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  line-height: 1.5;
  border-left: 4px solid;
  margin-bottom: 1rem;
}
.alert.visible { display: block; }
.alert-error   { background: var(--hellrot); color: #7b1218; border-color: var(--rot); }
.alert-success { background: var(--hellgruen); color: #145523; border-color: var(--gruen); }
.alert-info    { background: #e8f4fd; color: #1a4a6b; border-color: #2980b9; }

/* ─── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
thead th {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #888;
  padding: .8rem 1rem;
  border-bottom: 2px solid var(--mittelgrau);
  background: var(--grau);
  text-align: left;
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--mittelgrau);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #faf9f7; }
tbody td { padding: .8rem 1rem; vertical-align: middle; }
.td-actions { display: flex; gap: .4rem; align-items: center; }

/* ─── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .73rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-red    { background: var(--hellrot); color: var(--rot); }
.badge-green  { background: var(--hellgruen); color: var(--gruen); }
.badge-gray   { background: var(--mittelgrau); color: #666; }
.badge-blue   { background: #e8f4fd; color: #1a4a6b; }
.badge-admin  {
  background: var(--schwarz);
  color: var(--weiss);
  font-size: .7rem;
  letter-spacing: .1em;
}

/* ─── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--mittelgrau);
  margin-bottom: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .85rem 1.6rem;
  border: none;
  background: none;
  cursor: pointer;
  color: #999;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition);
}
.tab-btn:hover { color: var(--schwarz); }
.tab-btn.active { color: var(--rot); border-bottom-color: var(--rot); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Modal ────────────────────────────────────────────────── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(28,28,28,.55);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-bg.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--weiss);
  border-top: 4px solid var(--rot);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px) scale(.97);
  transition: transform .2s;
}
.modal-bg.open .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 680px; }
.modal-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--mittelgrau);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 { font-size: 1.35rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: #aaa;
  padding: .25rem .4rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--schwarz); background: var(--grau); }
.modal-body { padding: 1.5rem; }
.modal-foot {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--mittelgrau);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* ─── Spinner ──────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: var(--weiss);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}
.spinner-dark {
  border-color: rgba(184,28,34,.2);
  border-top-color: var(--rot);
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: #aaa;
  font-weight: 300;
}
.loading-block .spinner { width: 32px; height: 32px; border-width: 3px; }

/* ─── Progress bar ─────────────────────────────────────────── */
.progress-track {
  background: var(--mittelgrau);
  border-radius: 100px;
  height: 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--rot);
  border-radius: 100px;
  transition: width .4s ease;
}

/* ─── Score Circle ─────────────────────────────────────────── */
.score-ring-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.score-ring { transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--mittelgrau); stroke-width: 10; }
.score-ring-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1),
              stroke .3s ease;
  stroke-dasharray: 408.41; /* 2*π*65 */
  stroke-dashoffset: 408.41;
}

/* ─── Confetti ─────────────────────────────────────────────── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
}
@keyframes confetti-drop {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(900deg); opacity: 0; }
}

/* ─── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: #bbb;
}
.empty-icon { font-size: 2.8rem; margin-bottom: .75rem; }

/* ─── Utility ──────────────────────────────────────────────── */
.text-red    { color: var(--rot) !important; }
.text-green  { color: var(--gruen) !important; }
.text-gray   { color: #888 !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-bold     { font-weight: 600; }
.fw-light    { font-weight: 300; }
.font-cond   { font-family: 'Barlow Condensed', sans-serif; }
.mt-05 { margin-top: .35rem; }
.mt-1  { margin-top: .6rem; }
.mt-2  { margin-top: 1.2rem; }
.mt-3  { margin-top: 2rem; }
.mb-1  { margin-bottom: .6rem; }
.mb-2  { margin-bottom: 1.2rem; }
.mb-3  { margin-bottom: 2rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ─── Footer ───────────────────────────────────────────────── */
.footer {
  background: var(--schwarz);
  color: #666;
  text-align: center;
  padding: 1rem 2rem;
  font-size: .78rem;
  font-weight: 300;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.footer a { color: #888; }

/* ─── Certificate Print (Layout nach mesonic-Vorlage) ─────────────────────── */
#certPrint { display: none; }
@page { size: A4 portrait; margin: 0; }

@media print {
  body > *:not(#certPrint) { display: none !important; }
  #certPrint {
    display: block !important;
    font-family: 'Open Sans', 'Barlow', Arial, sans-serif;
    color: #1c1c1c;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .cert-page {
    position: relative;
    width: 21cm;
    min-height: 29.7cm;
    padding: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Wasserzeichen ✓ in der Bildmitte, sehr blass */
  .cert-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: 28cm;
    color: #d8d4cf;
    opacity: .35;
    line-height: 1;
    transform: translateX(-1cm) translateY(-.4cm);
    pointer-events: none;
    z-index: 0;
    letter-spacing: -.08em;
  }

  /* Header: roter Banner links, mesonic-Logo rechts */
  .cert-head {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 1.2cm 0 0;
    margin-bottom: 1.2cm;
  }
  .cert-head-banner {
    background: #b81c22;
    color: #fff;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: .78rem;
    letter-spacing: .14em;
    padding: .55cm 1.4cm .55cm 1.2cm;
    border-bottom-right-radius: 1.1cm;
    line-height: 1;
  }
  .cert-head-logo img {
    display: block;
    width: 4.4cm;
    height: auto;
    margin-top: .35cm;
  }

  /* Hauptbereich — startet bewusst zwei Absätze unter dem Header,
     damit Inhalt mittig zwischen Banner und Footer steht. */
  .cert-main {
    position: relative;
    z-index: 2;
    padding: 1.6cm 1.6cm 0;
    flex: 1 0 auto;
  }
  .cert-greeting {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    font-size: 1.15rem;
    color: #1c1c1c;
    margin: 0 0 .55cm 0;
  }
  .cert-rule {
    border: none;
    border-top: 1.2pt solid #b81c22;
    margin: 0;
  }
  .cert-firm {
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: 2.7rem;
    color: #b81c22;
    text-align: center;
    margin: .55cm 0;
    line-height: 1.05;
    word-break: break-word;
  }
  .cert-intro {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    font-size: 1.08rem;
    line-height: 1.55;
    color: #1c1c1c;
    margin: .85cm 0 0 0;
  }

  .cert-badge-block {
    margin: .9cm 0 .55cm 0;
    text-align: center;
  }
  .cert-badge-block img {
    display: block;
    margin: 0 auto;
    max-width: 11cm;
    max-height: 4.2cm;
    width: auto;
    height: auto;
  }
  .cert-year-line {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #1c1c1c;
    margin-top: .35cm;
    letter-spacing: .02em;
  }

  .cert-body {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.55;
    color: #1c1c1c;
    margin: .55cm 0 0 0;
  }

  /* Unterzeichner */
  .cert-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.6cm;
    margin-top: 1.6cm;
  }
  .cert-sign-name {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #1c1c1c;
    margin-bottom: .05cm;
  }
  .cert-sign-role {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    font-size: .9rem;
    color: #1c1c1c;
  }

  /* Footer mit Adressen + Logo */
  .cert-foot {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr 4.5cm;
    gap: .8cm;
    align-items: end;
    padding: 1cm 1.6cm 1.1cm;
    margin-top: auto;
  }
  .cert-address {
    font-family: 'Open Sans', sans-serif;
    font-size: .68rem;
    line-height: 1.55;
    color: #1c1c1c;
  }
  .cert-address strong {
    font-weight: 700;
  }
  .cert-foot-logo {
    text-align: right;
  }
  .cert-foot-logo img {
    display: inline-block;
    width: 4.2cm;
    height: auto;
  }
}

/* ─── Responsive Table: Card-Layout auf Smartphones ─────────────────────
   Tabellen mit Klasse .responsive-table werden auf ≤540px zu Karten-Listen.
   Jede <td> braucht ein data-label-Attribut mit dem Spaltenheader.
   Zeilen mit Klasse .detail-row (aufklappbare Detailzeilen) sind ausgenommen. */
@media (max-width: 540px) {
  .responsive-table,
  .responsive-table tbody { display: block; }
  .responsive-table thead { display: none; }

  .responsive-table tr:not(.detail-row) {
    display: block;
    margin-bottom: .85rem;
    border: 1px solid #ece5dd;
    border-radius: 12px;
    padding: .7rem .9rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(77,56,39,.05);
  }
  .responsive-table .detail-row {
    display: block;
    margin-bottom: .85rem;
  }
  .responsive-table .detail-row > td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
  }

  /* Jede Datenzelle = label + wert nebeneinander */
  .responsive-table td:not([colspan]) {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: .3rem 0;
    border: none;
    font-size: .88rem;
    gap: .5rem;
    min-height: 0;
  }
  .responsive-table td:not([colspan])::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9a908a;
    flex-shrink: 0;
    min-width: 72px;
    padding-top: .15rem;
  }
  .responsive-table td[data-label=""]:not([colspan]) { display: none; }

  /* Action-Buttons in Karten untereinander */
  .responsive-table .td-actions {
    flex-direction: column;
    align-items: stretch;
    gap: .4rem;
    width: 100%;
  }
  .responsive-table .td-actions .btn { width: 100%; justify-content: center; }
}

/* ─── Admin Tab-Nav: scrollbar auf kleinen Screens ───────────────────────
   Verhindert Umbruch der Tab-Buttons durch horizontales Scrollen. */
@media (max-width: 660px) {
  .tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 12px;
    padding: .35rem;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; padding: .7rem .9rem; font-size: .82rem; }
}

/* ─── Modal: Mobile-Anpassungen ──────────────────────────────────────── */
@media (max-width: 540px) {
  .modal-bg { padding: .5rem; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; border-top-width: 3px; max-height: 95vh; }
  .modal-head { padding: 1rem 1.1rem; }
  .modal-body { padding: 1rem 1.1rem; }
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .main { padding: calc(var(--nav-h) + 1.5rem) 1rem 1.5rem; }
}
@media (max-width: 600px) {
  .nav { padding: 0 1rem; }
  .nav-firm { display: none; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .tabs { gap: 0; }
  .tab-btn { padding: .8rem 1.1rem; font-size: .85rem; }
  .main { padding-left: .75rem; padding-right: .75rem; }
}

/* ─── Mobile / WebApp / iOS Safe-Areas ─────────────────────────────────────── */

/* iOS Safe-Area: bei Standalone-Modus oben/unten Platz für Notch / Home-Bar.
   Deckt alle Nav-Varianten ab: .nav (App-Seiten), .login-nav (index.html),
   .nav-simple (passwort-*.html), .nav-login (register.html) */
@supports (padding: max(0px)) {
  .nav,
  .login-nav,
  .nav-simple,
  .nav-login {
    padding-left:  max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
    padding-top:   env(safe-area-inset-top);
  }
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Tablets / kleine Desktops */
@media (max-width: 768px) {
  /* Form-Inputs auf 16px → kein Auto-Zoom auf iOS bei Fokus */
  .form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px;
    padding: .85rem 1rem;
  }
  .form-label {
    font-size: .9rem;
  }
  /* Touch-Targets: mindestens 44px Höhe */
  .btn {
    min-height: 44px;
    padding: .8rem 1.4rem;
  }
  .btn-sm {
    min-height: 40px;
    padding: .55rem 1rem;
  }
  /* Tap-Highlight zähmen */
  a, button, .answer-card {
    -webkit-tap-highlight-color: rgba(184,28,34,.12);
  }
}

/* Smartphones */
@media (max-width: 540px) {
  body {
    /* iOS verhindert Bounce-Scroll bei -webkit-overflow-scrolling */
    -webkit-text-size-adjust: 100%;
  }
  .nav {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .nav-firm {
    max-width: 160px;
    font-size: .8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Volle Breite-Buttons im Login & Register sind großzügiger */
  .btn-block {
    min-height: 50px;
    font-size: 1rem;
  }
}

/* ─── Prüfungsmodus: Sticky Bottom-Bar auf Smartphone ───────────────────────
   Macht den "Weiter →" Button im exam.html auch auf kleinen Bildschirmen
   immer mit dem Daumen erreichbar. */
@media (max-width: 640px) {
  .exam-wrap {
    padding-bottom: 6rem !important;
  }
  .exam-shell {
    padding: 1.1rem 1rem 1rem !important;
    min-height: auto !important;
  }
  .exam-shell-head {
    margin-bottom: .9rem;
  }
  .exam-focus-note {
    display: none;
  }
  .question-text {
    font-size: clamp(1.25rem, 5.5vw, 1.7rem) !important;
  }
  .answer-card {
    padding: 1.1rem 1rem !important;
    font-size: 1rem !important;
    min-height: 56px;
  }
  .answer-letter {
    width: 34px !important;
    height: 34px !important;
    font-size: 1rem !important;
  }
  .exam-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom)) !important;
    background: rgba(255,255,255,.96);
    border-top: 1px solid rgba(28,28,28,.08);
    box-shadow: 0 -8px 24px rgba(77,56,39,.08);
    backdrop-filter: blur(12px);
    z-index: 200;
  }
  .exam-bottom .btn {
    flex-shrink: 0;
    min-width: 140px;
  }
  .exam-hint {
    flex: 1;
    font-size: .82rem;
    margin-right: .8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* PWA-Standalone: kleines visuelles Refinement, wenn als App installiert */
@media (display-mode: standalone) {
  body {
    /* Kein Browser-Chrome → bisschen mehr Atmosphäre */
    background-attachment: fixed;
  }
}
