/* =============================================================================
   eng.st — Baukasten 2.0 base stylesheet
   The product's visual language: warm off-white ground (#f6f7fb), ink text,
   a single blue accent (#2b5bff), Source Sans 3, soft rounded cards.
   Everything is driven by CSS variables so a project theme can retune it.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,400;0,600;0,700;0,900;1,400&display=swap');

:root {
  --bg:            #f6f7fb;
  --surface:       #ffffff;
  --surface-sunk:  #f4f6fd;
  --surface-alt:   #eef1fb;
  --text:          #0b1020;
  --muted:         #737c92;
  --muted-strong:  #57607a;

  --primary:       #2b5bff;
  --primary-hover: #1a3fd6;
  --primary-active:#1636b8;
  --primary-tint:  #e7ecff;
  --primary-tint-2:#d9e2ff;

  --success:       #17714a;
  --success-tint:  #e8f7ef;
  --danger:        #b3261e;
  --danger-tint:   #fff0ee;
  --warning:       #9a6a00;
  --warning-tint:  #fff5e0;

  --border:        #e6e9f2;
  --border-strong: #d5dae8;

  --radius:        18px;
  --radius-sm:     12px;
  --radius-lg:     24px;
  --pill:          999px;

  --shadow-sm:  0 1px 2px rgba(11,16,32,.06), 0 1px 1px rgba(11,16,32,.04);
  --shadow-md:  0 6px 18px -8px rgba(11,16,32,.20);
  --shadow-lg:  0 22px 50px -22px rgba(11,16,32,.40);

  --font: 'Source Sans 3', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
}

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { margin: 0 0 var(--sp-3); line-height: 1.14; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 32px; font-weight: 900; }
h2 { font-size: 24px; font-weight: 800; }
h3 { font-size: 19px; }
h4 { font-size: 16px; }
p  { margin: 0 0 var(--sp-3); }
a  { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { display: block; max-width: 100%; }
small { font-size: 12px; }
::selection { background: var(--primary-tint-2); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }

.muted   { color: var(--muted); }
.muted-2 { color: var(--muted-strong); }
.tiny    { font-size: 12px; }
.mono    { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.center  { text-align: center; }
.nowrap  { white-space: nowrap; }
.grow    { flex: 1; }
.hidden  { display: none !important; }

/* --- layout helpers --- */
.stack   > * + * { margin-top: var(--sp-4); }
.stack-2 > * + * { margin-top: var(--sp-2); }
.stack-6 > * + * { margin-top: var(--sp-6); }
.row  { display: flex; align-items: center; gap: var(--sp-3); }
.row-wrap { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.between { justify-content: space-between; }
.grid { display: grid; gap: var(--sp-4); }
.container { width: min(1100px, 100% - 40px); margin-inline: auto; }
.container-narrow { width: min(720px, 100% - 32px); margin-inline: auto; }

/* --- buttons --- */
.btn {
  --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 14px; line-height: 1;
  padding: 10px 16px; border-radius: var(--pill); cursor: pointer;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd); text-decoration: none;
  transition: background .14s ease, border-color .14s ease, transform .04s ease, box-shadow .14s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: #fff; box-shadow: 0 8px 18px -10px var(--primary); }
.btn-primary:hover { --btn-bg: var(--primary-hover); color:#fff; }
.btn-primary:active { --btn-bg: var(--primary-active); }
.btn-secondary { --btn-bg: var(--surface); --btn-bd: var(--border-strong); }
.btn-secondary:hover { --btn-bg: var(--surface-alt); }
.btn-ghost { --btn-fg: var(--muted-strong); }
.btn-ghost:hover { --btn-bg: var(--surface-alt); color: var(--text); }
.btn-danger { --btn-bg: var(--danger-tint); --btn-fg: var(--danger); }
.btn-danger:hover { --btn-bg: #ffe0dc; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; width: 38px; height: 38px; }

/* --- forms --- */
.field { display: block; }
.field > label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--muted-strong); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 11px 13px; transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; background: var(--surface);
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint);
}
.input.is-error, .textarea.is-error { background: var(--danger-tint); border-color: var(--danger); }
.textarea { min-height: 108px; resize: vertical; }
.select { appearance: none; 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='%23737c92' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-sunk); border-radius: var(--pill); padding: 4px; gap: 2px; }
.seg label { padding: 7px 14px; border-radius: var(--pill); font-size: 13px; font-weight: 600; color: var(--muted-strong); cursor: pointer; white-space: nowrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:hover { color: var(--text); }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.seg-accent label:has(input:checked) { background: var(--primary); color: #fff; }

/* checkbox / radio rows */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--primary); flex: none; }
.check .check-body small { display: block; color: var(--muted); font-weight: 400; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 42px; height: 24px; border-radius: var(--pill); background: var(--border-strong); transition: background .16s ease; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .16s ease; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* --- cards --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-6); box-shadow: var(--shadow-sm); }
.card-flat { box-shadow: none; }
.card-sunk { background: var(--surface-sunk); border-color: transparent; }
.card-pad-sm { padding: var(--sp-4); }

/* --- tags / badges --- */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: .01em; padding: 4px 10px; border-radius: var(--pill); background: var(--surface-alt); color: var(--muted-strong); }
.tag-primary { background: var(--primary-tint); color: var(--primary-hover); }
.tag-success { background: var(--success-tint); color: var(--success); }
.tag-danger  { background: var(--danger-tint); color: var(--danger); }
.tag-warning { background: var(--warning-tint); color: var(--warning); }
.tag-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* --- tables --- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-sunk); }
.table tbody tr:last-child td { border-bottom: 0; }

/* --- flashes --- */
.flashes { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-md); border-left: 4px solid var(--muted); font-size: 14px; animation: flashIn .2s ease; }
.flash-success { border-left-color: var(--success); }
.flash-error   { border-left-color: var(--danger); }
.flash-info    { border-left-color: var(--primary); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } }

/* --- dialog --- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11,16,32,.42); display: grid; place-items: center; padding: 20px; z-index: 150; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--sp-6); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: var(--sp-2); }

/* --- misc --- */
.divider { height: 1px; background: var(--border); }
.kicker { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; color: var(--primary); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-tint); color: var(--primary-hover); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.progress { height: 8px; background: var(--surface-alt); border-radius: var(--pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: var(--pill); transition: width .3s ease; }
.empty { text-align: center; padding: var(--sp-12) var(--sp-6); color: var(--muted); }

/* global legal footer — one dark card used on every page (admin, participant, landing) */
.eng-foot { width: min(1040px, 100% - 40px); margin: 24px auto 0; padding-bottom: 40px; }
.eng-foot-in { background: #0b1020; border-radius: 22px; padding: 22px clamp(20px, 3vw, 28px); display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.eng-foot-brand { display: flex; flex-direction: column; gap: 8px; }
.eng-foot-brand a { color: #fff; display: inline-flex; }
.eng-foot-copy { font-size: 13px; color: #9aa3bd; }
.eng-foot nav { display: flex; flex-wrap: wrap; gap: 6px; }
.eng-foot nav a { border-radius: 999px; padding: 10px 16px; font-size: 14px; font-weight: 600; color: #e6e9f5; display: inline-flex; align-items: center; gap: 6px; }
.eng-foot nav a:hover { background: rgba(255,255,255,.1); color: #fff; }

/* legacy light footer (kept for any page not yet migrated) */
.site-foot { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); margin-top: auto; }
.site-foot-in { width: min(1100px, 100% - 40px); margin-inline: auto; padding: 20px 0; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-foot .foot-logo { color: var(--text); display: inline-flex; opacity: .8; }
.site-foot .foot-logo:hover { opacity: 1; }
.site-foot .foot-links { display: flex; gap: 18px; flex-wrap: wrap; margin-right: auto; }
.site-foot .foot-links a { color: var(--muted-strong); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.site-foot .foot-links a:hover { color: var(--primary); }
.site-foot .foot-copy { font-size: 13px; }
/* on the public dark hero pages the footer stays light (its own surface) */

/* Melden button in a fixed corner (public) */
.melden-fab { position: fixed; right: 14px; bottom: 14px; z-index: 90; box-shadow: var(--shadow-md); }
.empty svg { width: 40px; height: 40px; opacity: .4; margin-bottom: var(--sp-3); }
