/* G 107 Prüfungsportal – Caravaning-Akademie · Farbwelt Grau / Orange */
:root {
  /* Blau-Grau als Grundfarbe, Orange für alles Wichtige */
  --anthrazit: #37474f;      /* Blau-Grau dunkel: Kopfzeile, Leisten */
  --anthrazit-2: #455a64;    /* Blau-Grau: Hover */
  --text: #263238;
  --text-2: #546e7a;
  --line: #cfd8dc;
  --line-2: #e3e8eb;
  --surface: #ffffff;
  --bg: #eef2f4;
  --orange: #e07a10;
  --orange-btn: #b85e00;
  --orange-btn-h: #9c5000;
  --orange-soft: #fdf0e1;
  --ok: #2e7d32;
  --ok-soft: #e6f2e7;
  --bad: #c62828;
  --bad-soft: #fae5e5;
  --warn-soft: #fff4e0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(38, 50, 56, .07), 0 2px 8px rgba(38, 50, 56, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--orange-btn); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .6rem; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }

/* ---------- Kopfzeile ---------- */
.topbar {
  background: var(--anthrazit);
  color: #fff;
  border-bottom: 4px solid var(--orange);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  width: 44px; height: 34px; border-radius: 8px; background: var(--orange);
  display: grid; place-items: center; font-weight: 800; font-size: 12px; letter-spacing: -.3px;
}
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand span { display: block; font-size: 12px; color: #cfd8dc; line-height: 1.2; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  color: #eceff1; text-decoration: none; padding: 7px 11px; border-radius: 7px; font-size: 14px;
}
.nav a:hover { background: var(--anthrazit-2); color: #fff; }
.nav a.active { background: var(--orange-btn); color: #fff; }

main { max-width: 1200px; margin: 0 auto; padding: 22px 16px 60px; }
main.narrow { max-width: 620px; }
main.exam-main { max-width: 860px; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card.accent { border-top: 4px solid var(--orange); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--surface); border: 1px solid var(--line-2); border-left: 4px solid var(--orange);
  border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.tile b { display: block; font-size: 1.9rem; line-height: 1.1; }
.tile span { color: var(--text-2); font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 40px;
}
.btn:hover { background: var(--line-2); }
.btn.primary { background: var(--orange-btn); border-color: var(--orange-btn); color: #fff; }
.btn.primary:hover { background: var(--orange-btn-h); }
.btn.dark { background: var(--anthrazit); border-color: var(--anthrazit); color: #fff; }
.btn.dark:hover { background: var(--anthrazit-2); }
.btn.danger { color: var(--bad); border-color: #e7b8b8; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 5px 10px; font-size: 13px; min-height: 30px; }
.btn.big { padding: 14px 24px; font-size: 18px; min-height: 54px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 12px; }
label .hint { font-weight: 400; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], input[type=url], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; font-weight: 400;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 3px solid rgba(224, 122, 16, .35); outline-offset: 1px; border-color: var(--orange);
}
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--orange-btn); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }

/* ---------- Meldungen ---------- */
.flash { border-radius: 8px; padding: 11px 14px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b9dcbb; color: #1f5a22; }
.flash.error { background: var(--bad-soft); border-color: #eab4b4; color: #8e1b1b; }
.flash.warn, .notice { background: var(--warn-soft); border: 1px solid #f1d29f; color: #6b4300; border-radius: 8px; padding: 11px 14px; margin-bottom: 12px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2);
     background: var(--bg); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:hover td { background: #f5f8f9; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.run { background: var(--orange-soft); color: var(--orange-btn); }
.badge.grey { background: var(--line-2); color: var(--text-2); }
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .06em; }
.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; margin-top: 4px; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--orange); }

details.box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-top: 12px; background: #fff; }
details.box summary { cursor: pointer; font-weight: 600; }

/* ---------- Techniker: Einstieg ---------- */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero h1 { font-size: 1.8rem; }
.code-input {
  font-family: ui-monospace, Consolas, monospace !important; font-size: 30px !important; text-align: center;
  letter-spacing: .14em; text-transform: uppercase; padding: 14px !important; border-width: 2px !important;
}
.steps { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before {
  content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--anthrazit);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.person { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 6px 0 16px; }
.person dt { color: var(--text-2); }
.person dd { margin: 0; font-weight: 700; }
.rules { padding-left: 1.2rem; margin: 0 0 14px; }
.rules li { margin-bottom: 6px; }

/* ---------- Techniker: Prüfung ---------- */
.exam-bar {
  position: sticky; top: 0; z-index: 20; background: var(--anthrazit); color: #fff;
  border-bottom: 3px solid var(--orange);
}
.exam-bar-inner { max-width: 860px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.exam-bar .who { font-weight: 700; font-size: 14px; }
.exam-bar .meta { font-size: 13px; color: #cfd8dc; }
.exam-bar .spacer { flex: 1; }
.exam-bar .btn { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.exam-bar .btn:not(.primary) { background: transparent; color: #fff; border-color: #78909c; }
.exam-bar .btn:not(.primary):hover { background: var(--anthrazit-2); }
.progress-line { height: 4px; background: #546e7a; }
.progress-line > i { display: block; height: 100%; background: var(--orange); transition: width .25s; }
.save-state { font-size: 12px; color: #cfd8dc; }
.save-state.err { color: #ffb3a8; font-weight: 700; }

.qcard { background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.qmeta { display: flex; justify-content: space-between; gap: 10px; color: var(--text-2); font-size: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.qmeta .cat { background: var(--line-2); border-radius: 999px; padding: 1px 10px; }
.qtext { font-size: 1.25rem; font-weight: 700; line-height: 1.4; margin: 0 0 6px; }
.qhint { font-size: 14px; color: var(--text-2); margin-bottom: 14px; }
.answer {
  display: flex; gap: 14px; align-items: flex-start; border: 2px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer; font-weight: 400; font-size: 17px; background: #fff;
  transition: border-color .12s, background .12s; user-select: none;
}
.answer:hover { border-color: #90a4ae; }
.answer input { position: absolute; opacity: 0; pointer-events: none; }
.answer .box {
  flex: none; width: 28px; height: 28px; border: 2px solid #78909c; border-radius: 6px; display: grid; place-items: center;
  margin-top: 1px; background: #fff;
}
.answer .letter { flex: none; font-weight: 800; color: var(--text-2); width: 18px; margin-top: 2px; }
.answer.on { border-color: var(--orange); background: var(--orange-soft); }
.answer.on .box { background: var(--orange-btn); border-color: var(--orange-btn); }
.answer.on .box::after { content: ""; width: 8px; height: 14px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.answer:focus-within { outline: 3px solid rgba(224, 122, 16, .35); outline-offset: 1px; }

.qnav { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; margin-top: 16px; }
.qnav #btnFlag { justify-self: center; }
.flag-btn.on { background: var(--warn-soft); border-color: #f1d29f; color: #6b4300; }

.grid-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.grid-nav button {
  height: 42px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font: inherit; font-weight: 700;
  cursor: pointer; color: var(--text); position: relative;
}
.grid-nav button.done { background: var(--anthrazit); border-color: var(--anthrazit); color: #fff; }
.grid-nav button.cur { outline: 3px solid var(--orange); outline-offset: 1px; }
.grid-nav button.flag::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line); }

.modal-bg { position: fixed; inset: 0; background: rgba(38, 50, 56, .6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 12px; max-width: 480px; width: 100%; padding: 22px; border-top: 5px solid var(--orange); }

.result-box { text-align: center; border-radius: 12px; padding: 26px 16px; margin: 10px 0 18px; border: 2px solid; }
.result-box.pass { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.result-box.fail { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.result-box b { display: block; font-size: 2rem; letter-spacing: .03em; }
.result-box span { color: var(--text); font-size: 1.1rem; }

/* ---------- Admin: Fragen ---------- */
.ans-edit { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ans-edit b { color: var(--text-2); text-align: center; }
.ans-edit input[type=text] { margin: 0; }
.ans-edit .check { margin: 0; font-size: 14px; white-space: nowrap; }
.qlist-text { max-width: 640px; }
.ans-mini { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.ans-mini li.ok { color: var(--ok); font-weight: 600; }
.row-error td { background: var(--bad-soft) !important; }
.row-warn td { background: var(--warn-soft) !important; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters label { margin: 0; }
.filters select, .filters input { min-width: 170px; }

footer.foot { text-align: center; color: var(--text-2); font-size: 12px; padding: 20px 16px 30px; }
footer.foot a { color: var(--text-2); }

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .card, .qcard { padding: 16px; }
  .qtext { font-size: 1.1rem; }
  .answer { font-size: 16px; padding: 12px; }
  .nav { margin-left: 0; }
  .exam-bar .meta { display: none; }
  .qnav { grid-template-columns: 1fr 1fr; }
  .qnav #btnFlag { grid-column: 1 / -1; grid-row: 1; justify-self: stretch; }
}

@media print {
  .topbar, .nav, .btn, .exam-bar, footer.foot, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}
