/* ═══════════════════════════════════════════════════════════════
   Patenbogen SRG Chiem — Stylesheet v2
   Mobile-first · Light + Dark Mode
═══════════════════════════════════════════════════════════════ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Brand – BFV Blau + Gold */
  --navy:      #1a2e52;
  --navy-dark: #0f1d36;
  --navy-mid:  #243a6a;
  --gold:      #c9a540;
  --gold-light:#f0d878;
  --gold-dim:  #a0802a;
  --blue:      #2563eb;
  --blue-light:#dbeafe;

  /* Light Mode */
  --bg:         #f0f2f7;
  --surface:    #ffffff;
  --surface-2:  #f8f9fc;
  --border:     #e4e7ef;
  --border-2:   #d0d5e3;
  --text-1:     #111827;
  --text-2:     #4b5563;
  --text-3:     #9ca3af;
  --input-bg:   #ffffff;
  --focus-ring: rgba(37,99,235,.18);
  --shadow-xs:  0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.07);
  --shadow-md:  0 4px 16px rgba(0,0,0,.09);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.12);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
}

[data-theme="dark"] {
  --bg:        #0d1117;
  --surface:   #161b27;
  --surface-2: #1e2535;
  --border:    #2a3347;
  --border-2:  #384260;
  --text-1:    #f0f4ff;
  --text-2:    #8b96b3;
  --text-3:    #4b5675;
  --input-bg:  #1e2535;
  --focus-ring:rgba(96,165,250,.2);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --blue-light:#1e3a5f;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text-1);
  transition: background .25s, color .25s;
  min-height: 100dvh;
}

/* ════════════════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy);
  box-shadow: 0 2px 20px rgba(0,0,0,.35);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  max-width: 720px;
  margin: 0 auto;
}

.header-logo-wrap {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  padding: 3px;
  box-shadow: 0 0 0 2px var(--gold);
}
.header-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }

.header-text { flex: 1; min-width: 0; }
.header-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-sub {
  font-size: 11px;
  color: var(--gold-light);
  opacity: .85;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Theme toggle */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,.18); }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* Admin link pill */
.admin-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-light);
  text-decoration: none;
  border: 1px solid rgba(201,165,64,.4);
  border-radius: 20px;
  padding: 5px 12px;
  white-space: nowrap;
  transition: all .15s;
}
.admin-link:hover { background: rgba(201,165,64,.15); }

/* Progress bar */
.progress-wrap {
  height: 3px;
  background: rgba(255,255,255,.1);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width .35s ease;
}

/* ════════════════════════════════════════════════════════════
   HERO BANNER
════════════════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(160deg, var(--navy-dark) 0%, var(--navy-mid) 60%, #2a4a8a 100%);
  padding: 36px 20px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #fff;
  padding: 5px;
  margin: 0 auto 16px;
  box-shadow: 0 0 0 3px var(--gold), 0 8px 24px rgba(0,0,0,.35);
  position: relative;
}
.hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.hero h1 {
  font-size: clamp(1.3rem, 4.5vw, 1.9rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 10px;
  position: relative;
}
.hero p {
  font-size: 14px;
  color: rgba(255,255,255,.65);
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}

/* ════════════════════════════════════════════════════════════
   SECTION NAV (horizontal pill tabs)
════════════════════════════════════════════════════════════ */
.section-nav-wrap {
  position: sticky;
  top: 65px;   /* header height */
  z-index: 100;
  background: var(--bg);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.section-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  max-width: 720px;
  margin: 0 auto;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  flex-shrink: 0;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .15s;
  white-space: nowrap;
}
.section-nav a:hover { border-color: var(--gold); color: var(--gold-dim); }
.section-nav a.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--gold-light);
}

/* ════════════════════════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════════════════════════ */
.main-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ════════════════════════════════════════════════════════════
   FORM SECTION CARD
════════════════════════════════════════════════════════════ */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow .2s;
}
.form-section:focus-within {
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.section-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-header h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: .01em;
}

/* Body grid – single col mobile, 2-col ≥540px */
.section-body {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 540px) {
  .section-body { grid-template-columns: 1fr 1fr; }
  .field-full   { grid-column: 1 / -1; }
}

/* Subtitle row */
.field-subtitle {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold-dim);
  padding: 6px 0 2px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

/* ── Field wrap ───────────────────────────────────────────── */
.field-wrap { display: flex; flex-direction: column; gap: 5px; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .01em;
}
.required-star { color: #ef4444; }

.field-input {
  width: 100%;
  padding: 10px 13px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  /* Larger tap target on mobile */
  min-height: 44px;
  -webkit-appearance: none;
}
.field-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.field-input::placeholder { color: var(--text-3); }

.field-textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

.field-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Star Rating Input ───────────────────────────────────────── */
.star-rating-input { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.star-input-btn {
  background: none; border: none; font-size: 32px; cursor: pointer;
  color: var(--border-2); transition: color .1s, transform .1s;
  padding: 0 2px; line-height: 1;
}
.star-input-btn.filled  { color: var(--gold); }
.star-input-btn.hover   { color: var(--gold-light, #f0d878); transform: scale(1.15); }
.star-rating-input.readonly .star-input-btn { cursor: default; pointer-events: none; }

.field-date { cursor: pointer; }
.field-date::-webkit-calendar-picker-indicator {
  opacity: .5;
  cursor: pointer;
  filter: invert(var(--date-invert, 0));
}
[data-theme="dark"] { --date-invert: 1; }

/* Checkbox */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  min-height: 44px;
  transition: border-color .15s;
}
.checkbox-wrap:focus-within { border-color: var(--navy); }
.field-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--navy);
  cursor: pointer;
}
.checkbox-label { font-size: 14px; color: var(--text-1); cursor: pointer; }

/* Conditional sub-fields */
.conditional-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 4px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  animation: slideDown .18s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (min-width: 540px) {
  .conditional-fields { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════════════════
   SUBMIT BUTTON BAR
════════════════════════════════════════════════════════════ */
.form-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 50;
  margin: 0 -16px;
}
.form-actions.visible { display: flex; }

/* ════════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  color: var(--gold-light);
  border-color: var(--navy);
}
.btn-primary:hover:not(:disabled) {
  background: var(--navy-dark);
  box-shadow: 0 4px 14px rgba(26,46,82,.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-gold {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  font-weight: 700;
}
.btn-gold:hover:not(:disabled) { background: var(--gold-dim); }

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

.btn-sm  { padding: 7px 14px; font-size: 12px; min-height: 36px; }
.btn-lg  { padding: 14px 32px; font-size: 15px; min-height: 50px; }
.btn-full { width: 100%; }

/* ════════════════════════════════════════════════════════════
   SUCCESS MODAL
════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  padding: 0;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 24px 36px;
  width: 100%;
  max-width: 520px;
  text-align: center;
  animation: sheetUp .3s cubic-bezier(.22,1,.36,1);
}
/* On larger screens → centered card */
@media (min-width: 560px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: var(--r-xl); padding: 40px 32px; animation: popIn .25s ease; }
}
@keyframes sheetUp  { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes popIn    { from { opacity: 0; transform: scale(.94); } to { opacity: 1; } }

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-2);
  margin: 0 auto 24px;
}
@media (min-width: 560px) { .modal-handle { display: none; } }

.modal-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.modal h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal p  { font-size: 14px; color: var(--text-2); margin-bottom: 28px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }

/* ════════════════════════════════════════════════════════════
   TOAST
════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid #ef4444;
  box-shadow: var(--shadow-lg);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  max-width: min(calc(100vw - 32px), 460px);
  width: max-content;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
.toast[hidden] { display: none; }
.toast-close { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 16px; padding: 2px; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════
   STATES
════════════════════════════════════════════════════════════ */
.loading-state, .error-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-2);
}
.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════════════ */
.app-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 24px 16px;
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════════════
   ════════════════════════════════════════════════════════════
   ADMIN PANEL
   ════════════════════════════════════════════════════════════
════════════════════════════════════════════════════════════ */
.admin-layout {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.admin-sidebar {
  width: 228px;
  background: var(--navy-dark);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo-img {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  box-shadow: 0 0 0 2px var(--gold);
  flex-shrink: 0;
}
.sidebar-logo-img img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-logo-text .site-name { font-size: 13px; font-weight: 700; color: #fff; }
.sidebar-logo-text .site-sub  { font-size: 11px; color: var(--gold-light); opacity: .7; }

.sidebar-nav { padding: 10px 8px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #8b9fc2;
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: all .14s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: rgba(201,165,64,.15); color: var(--gold-light); }
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
}
.sidebar-user { font-weight: 600; color: #c4cedf; margin-bottom: 8px; }

/* ── Admin Main ──────────────────────────────────────────── */
.admin-main { flex: 1; overflow: auto; background: var(--bg); min-width: 0; }

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}
.admin-topbar h1 { font-size: 17px; font-weight: 700; }
.admin-page { padding: 24px; max-width: 1060px; }

/* ── Stat Grid ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--navy); }
[data-theme="dark"] .stat-card .stat-value { color: var(--gold-light); }
.stat-card .stat-label { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* ── Panel ───────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-header h2 { font-size: 14px; font-weight: 700; }
.panel-body { padding: 20px; }

/* ── Table ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-2); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background:#dcfce7; color:#15803d; }
.badge-red    { background:#fee2e2; color:#dc2626; }
.badge-yellow { background:#fef9c3; color:#a16207; }
.badge-blue   { background:#dbeafe; color:#1d4ed8; }
.badge-gray   { background:var(--surface-2); color:var(--text-2); border:1px solid var(--border); }

.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.grade-6 { background:#16a34a; }   /* 6 / 5★ = beste  – grün      */
.grade-5 { background:#65a30d; }   /* 5 / 4★        – hellgrün   */
.grade-4 { background:#ca8a04; }   /* 4 / 3★        – gelb       */
.grade-3 { background:#ea580c; }   /* 3 / 2★        – orange     */
.grade-2 { background:#dc2626; }   /* 2 / 1★        – rot        */
.grade-1 { background:#991b1b; }   /* 1 = schlechteste – dunkelrot*/
.grade-null { background:#94a3b8; }

/* ── Admin Form ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 40px;
  width: 100%;
  -webkit-appearance: none;
}
/* Checkboxes inside form-group must not get input styles */
.form-group input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  min-height: unset !important;
  padding: 0 !important;
  -webkit-appearance: checkbox !important;
  appearance: checkbox !important;
  border: none !important;
  box-shadow: none !important;
  accent-color: var(--navy);
  cursor: pointer;
  flex-shrink: 0;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Login ───────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy-dark) 0%, var(--navy-mid) 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: #fff;
  padding: 5px;
  margin: 0 auto 14px;
  display: block;
  box-shadow: 0 0 0 3px var(--gold);
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-card h1 { text-align:center; font-size:20px; font-weight:800; margin-bottom:4px; }
.login-card .sub { text-align:center; font-size:13px; color:var(--text-2); margin-bottom:28px; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display:flex; gap:3px; background:var(--surface-2); padding:4px; border-radius:var(--r-sm); margin-bottom:18px; }
.tab-btn {
  flex:1; padding:8px; font-family:var(--font); font-size:13px; font-weight:600;
  border:none; border-radius:calc(var(--r-sm) - 2px);
  background:transparent; color:var(--text-2); cursor:pointer; transition:all .15s;
}
.tab-btn.active { background:var(--surface); color:var(--text-1); box-shadow:var(--shadow-xs); }
.tab-panel { display:none; }
.tab-panel.active { display:block; }

/* ── Search ──────────────────────────────────────────────── */
.search-bar { display:flex; gap:8px; align-items:center; }
.search-input {
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--input-bg);
  color: var(--text-1);
  outline: none;
  width: 200px;
  min-height: 36px;
}
.search-input:focus { border-color: var(--navy); }

/* ── JSON Editor ─────────────────────────────────────────── */
.json-editor {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.65;
  min-height: 420px;
  resize: vertical;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.alert-success { background:#dcfce7; color:#15803d; border:1px solid #bbf7d0; }
.alert-error   { background:#fee2e2; color:#dc2626; border:1px solid #fecaca; }
.alert[hidden] { display:none; }

/* ── Responsive Admin ────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar { display:none; }
  .admin-page    { padding: 16px; }
  .admin-topbar  { padding: 12px 16px; }
}

/* ════════════════════════════════════════════════════════════
   VISUAL FORM EDITOR
════════════════════════════════════════════════════════════ */

/* Section card */
.editor-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s;
}
.editor-section:focus-within { box-shadow: var(--shadow-sm); }

.editor-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--navy-dark), var(--navy-mid));
  color: #fff;
}
.editor-sec-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(201,165,64,.35);
  color: var(--gold-light);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.editor-sec-title {
  flex: 1;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 5px 10px;
  outline: none;
  min-width: 0;
}
.editor-sec-title::placeholder { color: rgba(255,255,255,.4); }
.editor-sec-title:focus { border-color: var(--gold); }
.editor-sec-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Editor buttons */
.edbtn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
  flex-shrink: 0;
}
.edbtn:hover:not(:disabled) { background: rgba(255,255,255,.22); color: #fff; }
.edbtn:disabled { opacity: .35; cursor: not-allowed; }
.edbtn-danger:hover:not(:disabled) { background: rgba(239,68,68,.3); }
.edbtn-edit { background: rgba(37,99,235,.25); }
.edbtn-edit:hover:not(:disabled) { background: rgba(37,99,235,.5); }

/* Field rows */
.editor-fields { display: flex; flex-direction: column; }
.editor-field-row {
  border-bottom: 1px solid var(--border);
}
.editor-field-row:last-child { border-bottom: none; }
.field-row-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  transition: background .1s;
}
.field-row-inner:hover { background: var(--surface-2); }
.field-row-grip {
  color: var(--text-3);
  font-size: 16px;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}
.field-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.field-row-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}
.field-row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.field-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--blue-light);
  color: var(--blue);
  white-space: nowrap;
}
.field-tag-gold { background: #fef3c7; color: #92400e; }
.field-tag-gray { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.field-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
/* Make field-row edbtn dark-themed */
.field-row-inner .edbtn {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.field-row-inner .edbtn:hover:not(:disabled) { background: var(--border); color: var(--text-1); }
.field-row-inner .edbtn-danger:hover:not(:disabled) { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.field-row-inner .edbtn-edit:hover:not(:disabled)   { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }

/* Add row */
.editor-add-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* Field modal backdrop override */
#fieldModal { align-items: center; padding: 20px; }

/* ── Conditional field rows ──────────────────────────────── */
.cond-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.cond-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.cond-subfields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cond-subfield-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
/* Sub-field inputs – reset -webkit-appearance for selects too */
.cond-subfield-row select,
.cond-subfield-row input,
.cond-row select {
  -webkit-appearance: auto !important;
  appearance: auto !important;
}
