:root {
  --rotary-blue: #00246C;
  --rotary-blue-light: #123a8c;
  --rotary-blue-pale: #eef1f8;
  --rotary-gold: #FEBD11;
  --rotary-gold-dark: #d99e00;
  --ink: #1b2333;
  --ink-soft: #5a6272;
  --paper: #fbfbfa;
  --line: #e3e6ee;
  --success: #1e7a3d;
  --danger: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, Segoe UI, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  color: var(--rotary-blue);
  margin: 0 0 .4em 0;
  letter-spacing: -0.01em;
}

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

/* ---------- Topbar ---------- */
.topbar {
  background: var(--rotary-blue);
  border-bottom: 3px solid var(--rotary-gold);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 32px;
  padding: 10px 24px;
}
.brand-logo { height: 40px; display: block; }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a {
  color: #cfd9f2; padding: 10px 14px; border-radius: 8px;
  font-weight: 500; font-size: 14px;
}
.mainnav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; color: #fff; }
.mainnav a.active { background: var(--rotary-gold); color: var(--rotary-blue); font-weight: 600; }

.usermenu { position: relative; }
.usergreeting {
  color: #fff; font-size: 14px; font-weight: 500; cursor: pointer;
  padding: 8px 12px; border-radius: 8px; display: inline-block;
}
.usergreeting:hover { background: rgba(255,255,255,0.1); }
.usermenu-dropdown {
  display: none; position: absolute; right: 0; top: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); min-width: 170px; overflow: hidden;
  z-index: 20;
}
.usermenu:hover .usermenu-dropdown { display: block; }
.usermenu-dropdown a {
  display: block; padding: 10px 14px; color: var(--ink); font-size: 14px;
}
.usermenu-dropdown a:hover { background: var(--rotary-blue-pale); text-decoration: none; }

/* ---------- Layout ---------- */
.page {
  max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px;
  min-height: 70vh;
}
.page-auth {
  max-width: 420px; padding-top: 8vh;
  min-height: 90vh;
}
.footer {
  text-align: center; color: var(--ink-soft); font-size: 12.5px;
  padding: 24px; border-top: 1px solid var(--line);
}

/* ---------- Flash ---------- */
.flash-stack { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 12px 16px; border-radius: var(--radius); font-size: 14px;
  border: 1px solid transparent;
}
.flash-success { background: #eaf6ee; color: var(--success); border-color: #c7e9d1; }
.flash-danger { background: #fbebea; color: var(--danger); border-color: #f3cdc9; }
.flash-warning { background: #fff7e0; color: #8a6100; border-color: #f5e2a0; }
.flash-info { background: var(--rotary-blue-pale); color: var(--rotary-blue); border-color: #d6ddf3; word-break: break-all; }

/* ---------- Cards ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 20px;
}
.card-title-row {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}

/* signature element: gold underline flourish beneath section headings */
.section-heading {
  position: relative; padding-bottom: 10px; margin-bottom: 20px;
}
.section-heading::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 46px; height: 4px; background: var(--rotary-gold); border-radius: 2px;
}

/* ---------- Dashboard widgets ---------- */
.hero-greeting {
  font-family: 'Fraunces', serif; font-size: 30px; color: var(--rotary-blue);
  margin-bottom: 4px;
}
.hero-sub { color: var(--ink-soft); margin-bottom: 28px; font-size: 15px; }

.widget-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 30px; }
.widget {
  background: linear-gradient(155deg, var(--rotary-blue) 0%, var(--rotary-blue-light) 100%);
  color: #fff; border-radius: var(--radius); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.widget::before {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; border: 10px solid rgba(254,189,17,0.18);
}
.widget-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; margin-bottom: 6px; }
.widget-value { font-size: 22px; font-weight: 600; font-family: 'Fraunces', serif; }
.widget-sub { font-size: 12.5px; opacity: 0.85; margin-top: 4px; }
.widget-icon { font-size: 26px; }

@media (max-width: 800px) {
  .widget-row { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 8px 14px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .mainnav a { padding: 9px 12px; font-size: 13.5px; }
  .brand-logo { height: 32px; }
  .page { padding: 18px 14px 40px; }
  .card { padding: 16px 16px; }
  .hero-greeting { font-size: 24px; }
  .card-title-row { flex-wrap: wrap; gap: 10px; align-items: flex-start; }
  .card-title-row > div[style*="display:flex"] { width: 100%; }
  .card-title-row .btn { flex: 1; text-align: center; }

  /* Tabellen horizontal scrollbar statt Layout-Bruch */
  .card { overflow-x: auto; }
  table.data { min-width: 560px; }

  .choice-toggle { flex-direction: column; }
  .choice-toggle label { padding: 14px 16px; }
  .q-numbered { padding: 14px 16px; }

  .usergreeting { font-size: 13px; padding: 6px 8px; }
  .usermenu-dropdown { right: -10px; }

  input, select, textarea, button, .btn { font-size: 16px; } /* verhindert Zoom auf iOS */
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .widget { padding: 16px; }
  .open-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .open-item-action { width: 100%; }
  .open-item-action .btn { flex: 1; }
  div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-soft); border-bottom: 2px solid var(--line); padding: 8px 10px;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.data tr:hover td { background: var(--rotary-blue-pale); }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=datetime-local], input[type=date], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; margin-bottom: 16px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--rotary-blue); box-shadow: 0 0 0 3px rgba(0,36,108,0.12);
}
.field-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.field-row input[type=checkbox] { width: auto; margin: 0; }
.field-row label { margin: 0; font-weight: 500; }

.btn {
  display: inline-block; padding: 10px 20px; border-radius: 8px; font-weight: 600;
  font-size: 14px; cursor: pointer; border: none; text-align: center;
}
.btn-primary { background: var(--rotary-blue); color: #fff; }
.btn-primary:hover { background: var(--rotary-blue-light); text-decoration: none; color: #fff; }
.btn-gold { background: var(--rotary-gold); color: var(--rotary-blue); }
.btn-gold:hover { background: var(--rotary-gold-dark); text-decoration: none; color: var(--rotary-blue); }
.btn-outline { background: transparent; border: 1.5px solid var(--rotary-blue); color: var(--rotary-blue); }
.btn-outline:hover { background: var(--rotary-blue-pale); text-decoration: none; }
.btn-danger { background: #fbebea; color: var(--danger); border: 1.5px solid #f3cdc9; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-entwurf { background: #eee; color: #666; }
.badge-freigegeben { background: #eaf6ee; color: var(--success); }
.badge-abgeschlossen { background: var(--rotary-blue-pale); color: var(--rotary-blue); }
.badge-secret { background: #fff0e6; color: #b35c00; }
.badge-notread { background: #eee; color: #777; }
.badge-viewed { background: #fff7e0; color: #8a6100; }

/* ---------- Login ---------- */
.login-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 40px 36px; box-shadow: 0 20px 50px rgba(0,36,108,0.08);
}
.login-logo { display: block; margin: 0 auto 24px; height: 68px; }
.login-title { text-align: center; margin-bottom: 26px; }
.login-title h1 { font-size: 22px; margin-bottom: 4px; }
.login-title p { color: var(--ink-soft); font-size: 13.5px; margin: 0; }
.login-links { text-align: center; margin-top: 6px; font-size: 13.5px; }

.open-item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.open-item:last-child { border-bottom: none; }
.open-item-title { font-weight: 600; font-size: 15.5px; color: var(--ink); margin-bottom: 3px; }
.open-item-action { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* ---------- Teilnahme-Formular (klar & barrierearm) ---------- */
.choice-toggle { display: flex; gap: 12px; margin-bottom: 22px; }
.choice-toggle label {
  flex: 1; display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 16px 18px; border: 2px solid var(--line); border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.choice-toggle input[type=radio] { width: 20px; height: 20px; margin: 0; }
.choice-toggle label:has(input:checked) { border-color: var(--rotary-blue); background: var(--rotary-blue-pale); }
.choice-toggle label.choice-nein:has(input:checked) { border-color: #b3261e; background: #fbebea; }

.q-numbered {
  border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; background: #fff;
}
.q-numbered .q-title { font-size: 16px; font-weight: 600; color: var(--rotary-blue); margin-bottom: 12px; }
.q-numbered .q-num {
  display: inline-flex; align-items:center; justify-content:center; width: 26px; height: 26px;
  background: var(--rotary-blue); color: #fff; border-radius: 50%; font-size: 13px; margin-right: 8px;
}
.radio-list { display: flex; flex-direction: column; gap: 10px; }
.radio-list label {
  display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; font-size: 15px;
  padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer;
}
.radio-list input[type=radio], .radio-list input[type=checkbox] { width: 19px; height: 19px; margin: 0; }
.radio-list label:has(input:checked) { border-color: var(--rotary-blue); background: var(--rotary-blue-pale); }
.big-input { font-size: 16px; padding: 12px 14px; }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.divider { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.question-block {
  border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px;
  background: var(--rotary-blue-pale);
}
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  background: var(--rotary-blue-pale); color: var(--rotary-blue); padding: 5px 12px;
  border-radius: 100px; font-size: 13px;
}
