:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #eeeeeb;
  --text: #17181a;
  --text-2: #5f6368;
  --text-3: #8a8f96;
  --line: #e2e2de;
  --accent: #0b57d0;
  --accent-text: #ffffff;
  --ok: #1a7f4b;
  --ok-bg: #e6f4ec;
  --warn: #9a6200;
  --warn-bg: #fbf1dc;
  --err: #b3261e;
  --err-bg: #fbe9e7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1b1c1f;
    --surface-2: #232529;
    --text: #ececea;
    --text-2: #a7abb2;
    --text-3: #6f747c;
    --line: #2c2e33;
    --accent: #6ea8ff;
    --accent-text: #0b1526;
    --ok: #5fd49a;
    --ok-bg: #16301f;
    --warn: #f0b64a;
    --warn-bg: #33270f;
    --err: #ff8a80;
    --err-bg: #3a1512;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; font-weight: 600; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 640px; }

/* Navigation */
.nav { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 16px; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand small { font-weight: 500; color: var(--text-3); margin-left: 8px; font-size: .8rem; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a { color: var(--text-2); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav-links a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--surface-2); }
.nav-links form { display: inline; }
.nav-links button.linklike { background: none; border: 0; color: var(--text-2); padding: 8px 12px; border-radius: 8px; font: inherit; font-weight: 500; font-size: .95rem; cursor: pointer; }
.nav-links button.linklike:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 640px) {
  .nav-links a, .nav-links button.linklike { padding: 8px 8px; font-size: .9rem; }
  .brand small { display: none; }
}

main { padding: 32px 0 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--err); }
.btn-sm { padding: 6px 12px; font-size: .875rem; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid .card, .grid-2 .card, .steps .card, .grid-2 > .stack > .card:first-child { margin-top: 0; }
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

/* Project tiles */
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; color: inherit; box-shadow: var(--shadow); transition: transform .08s ease, border-color .08s ease; }
.tile:hover { text-decoration: none; border-color: var(--text-3); transform: translateY(-1px); }
.tile .k { font-weight: 600; font-size: 1.1rem; }
.tile .b { color: var(--text-2); margin-top: 2px; min-height: 1.5em; }
.tile .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: .875rem; color: var(--text-3); }
.tile-new { border-style: dashed; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-weight: 500; min-height: 120px; box-shadow: none; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; letter-spacing: .01em; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s-neu { color: var(--text-3); }
.pill.s-eingegangen { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pill.s-in_bearbeitung { color: var(--warn); background: var(--warn-bg); }
.pill.s-rueckfrage { color: var(--err); background: var(--err-bg); }
.pill.s-fertig { color: var(--ok); background: var(--ok-bg); }
.pill.s-archiviert { color: var(--text-3); }

/* Stepper */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 8px 0 4px; }
.step { position: relative; text-align: center; padding-top: 22px; font-size: .875rem; color: var(--text-3); }
.step::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--line); }
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step::after { content: ""; position: absolute; top: 2px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); box-sizing: border-box; }
.step.done { color: var(--text-2); }
.step.done::before { background: var(--ok); }
.step.done::after { background: var(--ok); border-color: var(--ok); }
.step.current { color: var(--text); font-weight: 600; }
.step.current::after { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.step.current.alert::after { background: var(--err); border-color: var(--err); box-shadow: 0 0 0 4px color-mix(in srgb, var(--err) 20%, transparent); }
.step.skipped { color: var(--text-3); }
.step.skipped::before { background: var(--ok); }
.step.skipped::after { border-color: var(--ok); }
.step.pending-line::before { background: var(--line); }
@media (max-width: 480px) { .step { font-size: .75rem; } }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-info { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-err { background: var(--err-bg); color: var(--err); }
.alert a { color: inherit; text-decoration: underline; }

/* Forms */
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 6px; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 16px; }
.field .hint { font-size: .8rem; color: var(--text-3); margin-top: 4px; }
.row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; }
.inline-form { display: inline; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-weight: 600; color: var(--text-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; white-space: nowrap; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.file-list .name { overflow-wrap: anywhere; }
.file-list .meta { color: var(--text-3); font-size: .85rem; white-space: nowrap; }

/* Dropzone */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 36px 20px; text-align: center; color: var(--text-2); background: var(--surface); transition: border-color .1s, background .1s; }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.dropzone strong { color: var(--text); font-size: 1.05rem; display: block; margin-bottom: 4px; }
.dropzone .btns { margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dropzone input[type=file] { display: none; }
.upload-list { list-style: none; margin: 12px 0 0; padding: 0; }
.upload-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.upload-list .top { display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; }
.upload-list .top .st { color: var(--text-3); font-size: .85rem; white-space: nowrap; }
.upload-list .top .st.err { color: var(--err); }
.upload-list .top .st.ok { color: var(--ok); }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.upload-summary { margin-top: 12px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { color: var(--text-3); white-space: nowrap; }
.timeline .who { color: var(--text-3); font-size: .8rem; margin-left: 6px; }
@media (max-width: 480px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } .file-list li { flex-direction: column; gap: 2px; } .file-list .meta { white-space: normal; } }

/* Site */
.hero { padding: 48px 0 24px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 18ch; letter-spacing: -.02em; }
.hero .lead { font-size: 1.2rem; color: var(--text-2); max-width: 56ch; }
.hero .actions { margin-top: 24px; }
.section { padding: 40px 0 0; }
.section h2 { font-size: 1.5rem; margin-bottom: 20px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.steps .card .n { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 50%; background: var(--text); color: var(--bg); font-weight: 700; font-size: .9rem; margin-bottom: 12px; }
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 32px; }
@media (max-width: 640px) { .features { grid-template-columns: 1fr; } }
.features div { padding: 12px 0; border-top: 1px solid var(--line); }
.features strong { display: block; margin-bottom: 2px; }
.features span { color: var(--text-2); font-size: .95rem; }
.cta { margin-top: 48px; padding: 32px; border-radius: 16px; background: var(--text); color: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.cta h2 { color: inherit; margin: 0; }
.cta .btn { background: var(--bg); color: var(--text); border-color: transparent; }
footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--text-3); font-size: .875rem; }
footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
footer a { color: var(--text-2); margin-right: 16px; }
.legal h2 { margin-top: 1.4em; font-size: 1.15rem; }
.todo { background: var(--warn-bg); color: var(--warn); padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* Admin */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.kpi .l { color: var(--text-2); font-size: .85rem; }
.kpi a { color: inherit; display: block; }
.kpi a:hover { text-decoration: none; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--err); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; margin-left: 4px; line-height: 20px; }
.auth-box { max-width: 420px; margin: 40px auto; }
.auth-box .card { padding: 28px; }
.linkbox { word-break: break-all; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
details.note { margin-top: 8px; }
details.note summary { cursor: pointer; color: var(--text-2); font-size: .9rem; }
.status-actions { display: grid; gap: 10px; }
.status-actions form { display: contents; }
.rf-box { background: var(--err-bg); border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); border-radius: var(--radius); padding: 16px 20px; }
.rf-box h3 { color: var(--err); }
.rf-box p { white-space: pre-wrap; margin-bottom: 0; }
.ok-box { background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); border-radius: var(--radius); padding: 16px 20px; }
.ok-box h3 { color: var(--ok); }

/* Skip-Link (Tastaturbedienung) */
.skip { position: fixed; top: -80px; left: 0; background: var(--accent); color: var(--accent-text); padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100; transition: top .1s; }
.skip:focus { top: 0; }

/* Logo in der Kopfzeile */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand .logo { height: 30px; width: auto; max-width: 220px; display: block; }
@media (max-width: 640px) {
  .brand .logo { height: 24px; max-width: 132px; }
  .nav .container { gap: 8px; }
  .nav-links { gap: 0; }
  .nav-links .btn.btn-sm { padding: 6px 10px; }
}
@media (max-width: 380px) { .brand .logo { max-width: 100px; } }

/* Wer wir sind + Personen */
.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; gap: 28px; } }
.about-text p { color: var(--text-2); max-width: 62ch; }
.about-text h2 { margin-bottom: .6em; }
.about-people { display: grid; gap: 20px; }
.person { margin: 0; display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; }
.person img, .person-ph { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.person figcaption strong { display: block; font-size: 1.05rem; }
.person .role { color: var(--text-2); font-size: .9rem; display: block; margin-top: 2px; }
.person figcaption p { margin: 8px 0 0; }
.admin-hint { font-size: .8rem; color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 8px; display: inline-block; margin-top: 8px; }
.admin-hint a { color: inherit; text-decoration: underline; }

/* Bildverwaltung im Admin */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.media-item { display: flex; flex-direction: column; gap: 6px; }
.media-item strong { margin-top: 4px; }
.media-item p { margin: 0; }
.media-prev { height: 120px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.media-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.media-form input[type=file] { font-size: .85rem; max-width: 100%; }
.save-bar { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
@media (max-width: 640px) { .save-bar .btn { width: 100%; } }
/* Dateiauswahl in deutscher Beschriftung */
.filepick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filepick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.filepick .name { font-size: .82rem; color: var(--text-3); overflow-wrap: anywhere; flex: 1; min-width: 0; }
.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.audit-tabelle td { font-size: .85rem; }
.ev { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.ev.warn { background: var(--warn-bg); color: var(--warn); }
.ev.bad { background: var(--err-bg); color: var(--err); }
.ev.good { background: var(--ok-bg); color: var(--ok); }
