:root {
  --red: #d6332e;
  --yellow: #f2c200;
  --green: #3aa856;
  --blue: #2f6db0;
  --ink: #1f2733;
  --muted: #6b7686;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 35, 60, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  /* Hintergrundfarben (z. B. gefuellter "bewusst"-Punkt, Farb-Badges) auch im
     PDF-/Druck-Export erhalten – sonst lassen Browser sie standardmaessig weg. */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.container { max-width: 960px; margin: 0 auto; padding: 28px 18px 80px; }

h1 { font-size: 2rem; margin: 0 0 .4rem; }
h2 { font-size: 1.35rem; margin: 0 0 .6rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.lead { font-size: 1.1rem; }

/* Cards */
.card, .card-soft {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card { max-width: 640px; margin: 6vh auto 0; }
.card-soft { box-shadow: none; margin: 14px 0; }
.center { text-align: center; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 10px; padding: 11px 20px; border: 1px solid transparent;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:disabled { background: #b9c6d6; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.ghost:disabled { opacity: .4; cursor: not-allowed; }

/* Intro */
.field { display: block; margin: 18px 0; font-weight: 600; }
.field input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; font: inherit;
}

/* Questionnaire */
.progress { height: 7px; background: #e9eef5; border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.progress .bar { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .3s ease; }
.section-tag { color: var(--blue); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; margin: 0 0 4px; }
.context { margin-bottom: 16px; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
}
.option.sel-most { border-color: var(--green); background: #f0faf3; }
.option.sel-least { border-color: #d8a; background: #fdf2f5; }
.option.sel-most.sel-least { background: #f6f4f0; }
.opt-text { flex: 1; }
.opt-btns { display: flex; gap: 6px; flex-shrink: 0; }
.pick { font: inherit; font-size: .8rem; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; white-space: nowrap; }
.pick.most:hover { border-color: var(--green); color: var(--green); }
.pick.least:hover { border-color: #c66; color: #c66; }
.option.sel-most .pick.most { background: var(--green); color: #fff; border-color: var(--green); }
.option.sel-least .pick.least { background: #d36; color: #fff; border-color: #d36; }
.nav { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; }
.counter { color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 10px; }

/* Spinner */
.spinner { width: 42px; height: 42px; border: 4px solid #dde5ef; border-top-color: var(--blue); border-radius: 50%; margin: 10px auto 18px; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
.result-head { text-align: center; margin: 6px 0 18px; }
.result-head .type { font-size: 1.4rem; font-weight: 700; color: var(--blue); margin: .2rem 0; }

.disc-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 24px; }
.disc-cell { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 6px; }
.disc-letter { width: 40px; height: 40px; line-height: 40px; border-radius: 50%; color: #fff; font-weight: 800; margin: 0 auto 8px; }
.disc-pct { font-size: 1.3rem; font-weight: 700; }
.disc-name { color: var(--muted); font-size: .85rem; }

.grid-charts { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin: 8px 0 16px; }
.chart { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.chart figcaption { text-align: center; font-weight: 700; font-size: .85rem; margin-bottom: 4px; color: var(--ink); }
.chart svg { width: 100%; height: auto; }
.bar-val { font-size: 12px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.bar-pct { font-size: 11px; text-anchor: middle; fill: var(--muted); }
.bar-lbl { font-size: 10px; text-anchor: middle; fill: var(--muted); }
.axis { stroke: #cbd5e1; stroke-width: 1.5; }
.grid { stroke: #e9eef5; stroke-width: 1; stroke-dasharray: 3 3; }

.flow { font-size: .82rem; padding: 6px 4px; }
/* 4 Spalten: Name | bewusst% | Pfeil | weniger-bewusst%. Kopf- und Datenzeile
   teilen exakt dasselbe Raster, damit die Prozente sauber unter den Titeln stehen. */
.flow-head { display: grid; grid-template-columns: 1.7em 1fr 1.4em 1fr; gap: 6px; color: var(--muted); font-size: .7rem; text-align: center; margin-bottom: 8px; }
.flow-row { display: grid; grid-template-columns: 1.7em 1fr 1.4em 1fr; gap: 6px; align-items: center; padding: 3px 0; }
.flow-name { font-weight: 600; text-align: left; }
.flow-num { font-variant-numeric: tabular-nums; text-align: center; color: var(--muted); }
.flow-arrow { text-align: center; font-weight: 700; }
.flow-arrow.up { color: var(--green); }
.flow-arrow.down { color: var(--red); }
.flow-arrow.flat { color: #b8c0cc; }

.grid-wheel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; margin: 6px 0 18px; }
.wheel-lbl { font-size: 10px; fill: var(--ink); font-weight: 600; }
.wheel-legend { display: flex; gap: 16px; justify-content: center; font-size: .8rem; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; }
.dot.solid { background: #111; }
.dot.hollow { background: #fff; border: 2px solid #111; }
.opposite h3 { margin-top: 0; }

.grid-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0; }
.card-soft ul { margin: 0; padding-left: 18px; }
.card-soft li { margin: 4px 0; }
.text p { margin: 0; }

.result-foot { margin-top: 26px; text-align: center; }
.actions { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }

@media (max-width: 720px) {
  .grid-charts, .grid-wheel, .grid-lists, .disc-strip { grid-template-columns: 1fr; }
  .option { flex-direction: column; align-items: stretch; }
  .opt-btns { justify-content: flex-end; }
}

/* Top bar + Sprachflaggen */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--blue); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.flags { display: flex; gap: 4px; }
.flag { font-size: 1.25rem; line-height: 1; background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; cursor: pointer; filter: grayscale(0.6); opacity: .7; }
.flag:hover { opacity: 1; }
.flag.active { filter: none; opacity: 1; border-color: var(--line); background: #fff; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }
.link:hover { color: var(--ink); }

/* Persönliche Angaben */
.personal { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 16px 0; }
.personal legend { font-weight: 700; padding: 0 6px; color: var(--ink); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field select { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.small { font-size: .85rem; }
.btn.big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 4px; }
.section-intro { margin: 0 0 12px; font-size: .9rem; }

/* Login */
.login-card { max-width: 420px; }
.login-card form { margin-top: 8px; }
.error { color: var(--red); font-weight: 600; margin: 6px 0; }

/* D/I/S/C-Säulen */
.disc-cols { margin: 8px 0 18px; }
.col-pct { font-size: 14px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.col-letter { font-size: 22px; font-weight: 800; text-anchor: middle; }
.col-name { font-size: 11px; text-anchor: middle; fill: var(--muted); }

/* Typenbezeichnung */
.type-badge { display: inline-block; font-size: 1.25rem; font-weight: 700; color: #fff; background: var(--blue); padding: 6px 16px; border-radius: 999px; margin: .3rem 0; }

/* Energiefluss-Box */
.flow-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.flow-cap { text-align: center; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }

/* Protokoll (Analysen-Logbuch + Login-Log) */
.logbook { margin-top: 6px; }
.log-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 8px; flex-wrap: wrap; }
.log-head h2 { margin: 0; }
.log-count { color: var(--muted); font-size: .85rem; }
.log-table { width: 100%; border-collapse: collapse; font-size: .86rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.log-table th, .log-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.log-table th { color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; background: #fafbfd; white-space: nowrap; }
.log-table tbody tr:last-child td { border-bottom: none; }
.log-table tbody tr:hover { background: #f7f9fc; }
.log-empty { color: var(--muted); padding: 14px 2px; }
.log-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-clickable { cursor: pointer; }
.log-clickable:hover { background: #eef4fc; }
.log-open { color: var(--blue); font-weight: 700; white-space: nowrap; font-size: .82rem; }
.log-hint { color: var(--muted); font-size: .82rem; margin: 0 0 10px; }

/* Selbst-Spiegelung (Trefferbewertung + Anpassung) */
.feedback h3 { margin-top: 0; }
.fit-scale { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.fit-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 700; cursor: pointer; transition: background .12s ease; }
.fit-btn:hover { border-color: var(--blue); color: var(--blue); }
.fit-btn.sel { background: var(--blue); color: #fff; border-color: var(--blue); }
.fit-end { color: var(--muted); font-size: .8rem; }
.fit-msg { min-height: 1.1em; margin: 4px 0 0; color: var(--green); font-weight: 600; }
.fit-adjust { margin-top: 12px; }
.fit-adjust summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.fit-adjust-body { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 10px; }
.fit-adjust-body .field { margin: 0; flex: 1; min-width: 150px; }

/* Print */
@media print {
  body { background: #fff; }
  .topbar, .actions, .result-foot .btn, .logout, .flags, .feedback { display: none; }
  .card-soft, .chart, .disc-cell { break-inside: avoid; box-shadow: none; }
  /* Gefuellten "bewusst"-Punkt und Farb-Badges im PDF zwingend einfaerben. */
  .dot.solid, .dot.hollow, .disc-letter, .type-badge, .log-pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
