/* ==========================================================================
   TANGO · Click prototype
   Layout concept: CD Bayern (Bootstrap-based MinimalCD, square corners, lines
   instead of shadows) pushed forward. Signature motif: geological strata —
   the drill core is the progress indicator, layers stack as work gets done.
   ========================================================================== */

@view-transition { navigation: auto; }

:root {
  /* CD Bayern tokens (from anzeigenportal-django/theme/bayern.css) */
  --by-basis: #526e7f;
  --by-basis-dark: #3f5764;
  --by-basis-85: #6c8492;
  --by-basis-50: #a9b6bf;
  --by-basis-38: #bdc8ce;
  --by-basis-23: #d7dee2;
  --by-basis-18: #e0e5e8;
  --by-gold: #fdc400;
  --by-gold-18: #fff4d1;
  --by-green: #75b726;
  --by-green-ink: #3f6b12;
  --by-green-18: #e6f2d8;
  --by-red: #b61a31;
  --by-red-18: #f2d6da;
  --by-link: #005b9e;
  --by-hinweis: #bd5400;
  --by-geologie: #773120;

  /* Strata palette derived from the geology accent */
  --strata-1: #773120;
  --strata-2: #986219;
  --strata-3: #b98a52;
  --strata-4: #d8c3a0;
  --strata-5: #8e7d6b;

  /* Surfaces and ink */
  --ground: #f2f5f7;
  --surface: #ffffff;
  --surface-quiet: #f7f9fa;
  --line: #dfdfdf;
  --line-strong: var(--by-basis-38);
  --ink: #000000;
  --ink-body: #1c1c1c;
  --ink-soft: #4d4d4d;
  --ink-quiet: #66737b;

  /* Type */
  /* CD Bayern: Roboto only. One family keeps the page calm; hierarchy comes
     from size, weight and white space, not from a second display face. */
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-display: var(--font);
  --font-mono: 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --display-stretch: 100%;

  /* Motion: spring curves via linear() */
  --spring: linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.077, 1.121 24.2%, 1.149 26.5%, 1.159 28.4%, 1.154 30.9%, 1.129 34.4%, 1.051 42.8%, 1.017 47.9%, 0.997 52.6%, 0.991 58.4%, 1.001 75.7%, 1);
  --spring-soft: linear(0, 0.06 3%, 0.24 7.6%, 0.76 17.6%, 0.95 23%, 1.03 28.8%, 1.05 33%, 1.04 39%, 1.005 52%, 0.997 64%, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);

  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --content-max: 1320px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-optical-sizing: auto;
  color: var(--ink-body);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--ink); font-weight: 500; line-height: 1.15; margin: 0; text-wrap: balance; }
h1, h2 { font-family: var(--font); font-weight: 500; letter-spacing: -.005em; }
h1 { letter-spacing: -.015em; line-height: 1.1; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--by-link); text-underline-offset: 3px; }
a:hover { color: #3089e7; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--by-basis); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  view-transition-name: topbar;
}
.topbar__in {
  max-width: var(--content-max); margin: 0 auto;
  padding: 12px var(--gutter-r) 12px var(--gutter-l);
  display: flex; align-items: center; gap: 40px; min-height: 72px;
}
/* The TANGO logo is the only graphic in the bar: everything else is type. */
.brand { display: block; flex: none; view-transition-name: brand; }
.brand img { height: 46px; width: auto; }
.topbar__spacer { flex: 1; }
.lfu { height: 38px; width: auto; }
.nav { display: flex; gap: 28px; align-items: center; }
.nav a, .nav button {
  position: relative; border: 0; background: none; padding: 6px 0; cursor: pointer;
  font-size: 15px; color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--by-geologie); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--spring); }
.nav a:hover { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav .k { display: inline-flex; align-items: center; gap: 10px; }
.nav .k span:last-child { font-size: 12px; color: var(--ink-quiet); border: 1px solid var(--line-strong); padding: 0 6px; line-height: 20px; }
.me { font-size: 15px; color: var(--ink); border: 0; background: none; cursor: pointer; padding: 6px 0; white-space: nowrap; }
@media (max-width: 900px) { .nav a:not([aria-current="page"]) { display: none; } .topbar__in { gap: 20px; } }
@media (max-width: 560px) { .lfu { height: 28px; } .brand img { height: 38px; } .nav { display: none; } }

/* --------------------------------------------------------------------------
   Buttons — square, CD-conform, with physical press feedback
   -------------------------------------------------------------------------- */
.btn {
  --b: var(--by-basis); --f: #fff;
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 22px; border: 1px solid var(--b);
  background: var(--b); color: var(--f); font-weight: 500; font-size: 15px;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: transform .5s var(--spring), background-color .2s, box-shadow .2s;
}
.btn:hover { background: var(--by-basis-dark); border-color: var(--by-basis-dark); }
.btn:active, .btn.is-pressed { transform: scale(.965); transition-duration: .08s; }
.btn--gold { --b: var(--by-gold); --f: #000; }
.btn--gold:hover { background: #f0b900; border-color: #f0b900; }
.btn--ghost { --b: transparent; --f: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-quiet); border-color: var(--by-basis); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn .ripple {
  position: absolute; z-index: -1; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .18; transform: scale(0);
  animation: ripple .6s var(--ease-out) forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.btn .arrow { transition: transform .45s var(--spring); }
.btn:hover .arrow { transform: translateX(4px); }

.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface);
  font-size: 11.5px; color: var(--ink-soft); font-family: var(--font);
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed; z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px 12px 14px;
  background: #1f2a31; color: #fff; font-size: 14px;
  border-left: 3px solid var(--by-gold);
  animation: toast-in .55s var(--spring) both;
}
.toast.out { animation: toast-out .3s var(--ease-out) forwards; }
.toast svg { flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* --------------------------------------------------------------------------
   Prototype ribbon + feedback switch
   -------------------------------------------------------------------------- */
.proto {
  position: fixed; z-index: 90;
  left: calc(16px + env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 0;
  background: var(--surface); border: 1px solid var(--line-strong); font-size: 12.5px;
}
.proto span { padding: 8px 12px; color: var(--ink-quiet); border-right: 1px solid var(--line); }
.proto button { border: 0; background: none; padding: 8px 12px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; color: var(--ink-soft); }
.proto button[aria-pressed="true"] { color: var(--ink); }
.proto button[aria-pressed="true"] .dot { background: var(--by-green); }
.proto button[data-fill] { border-left: 1px solid var(--line); color: var(--by-link); }
.proto .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--by-basis-50); transition: background .2s; }
@media (max-width: 560px) { .proto span { display: none; } }
body:has(.actionbar) .toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.foot { background: var(--by-basis); color: #fff; margin-top: 72px; }
.foot__in {
  max-width: var(--content-max); margin: 0 auto; padding-block: 14px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; font-size: 14px;
}
.foot a { color: #fff; text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot .sp { flex: 1; }
.foot .box { border: 1px solid #fff; padding: 3px 10px; }

/* --------------------------------------------------------------------------
   Shared bits
   -------------------------------------------------------------------------- */
.wrap { max-width: var(--content-max); margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.eyebrow { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-quiet); font-weight: 500; }
.fach { display: inline-flex; align-items: center; gap: 8px; }
.fach::before { content: ""; width: 3px; height: 14px; background: var(--by-geologie); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid currentColor;
}
.pill--draft { color: #6b4e00; background: var(--by-gold-18); border-color: #e7b300; }
.pill--ok { color: var(--by-green-ink); background: var(--by-green-18); border-color: #a9d27a; }
.pill--info { color: var(--by-basis-dark); background: var(--by-basis-18); border-color: var(--by-basis-38); }
.pill--warn { color: #8a3d00; background: #fdeee0; border-color: #f0b98a; }

/* Entry animation for anything marked .rise (visible at rest when motion is off) */
.rise { animation: rise .8s var(--spring-soft) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
  @view-transition { navigation: none; }
}

/* --------------------------------------------------------------------------
   Command palette (⌘K) — shared on all signed-in pages
   -------------------------------------------------------------------------- */
dialog.cmd {
  position: fixed; inset: 0; margin: min(12vh, 120px) auto auto; padding: 0;
  width: min(760px, calc(100vw - 32px)); max-height: min(560px, 76vh);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-body);
  box-shadow: 0 40px 90px -40px rgba(15, 25, 32, .55);
  display: none; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(-12px) scale(.98);
  transition: opacity .2s, transform .5s var(--spring), display .5s allow-discrete, overlay .5s allow-discrete;
}
dialog.cmd[open] { display: flex; opacity: 1; transform: none; }
@starting-style { dialog.cmd[open] { opacity: 0; transform: translateY(-16px) scale(.97); } }
dialog.cmd::backdrop { background: rgba(31, 42, 49, 0); transition: background .3s, display .3s allow-discrete, overlay .3s allow-discrete; }
dialog.cmd[open]::backdrop { background: rgba(31, 42, 49, .42); }
@starting-style { dialog.cmd[open]::backdrop { background: rgba(31, 42, 49, 0); } }
.cmd__bar { display: flex; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line); flex: none; }
.cmd__bar svg { color: var(--ink-quiet); flex: none; }
.cmd__bar input { flex: 1; min-width: 0; height: 64px; border: 0; outline: 0; background: none; font-size: 19px; color: var(--ink); }
.cmd__bar input::placeholder { color: var(--ink-quiet); }
.cmd__esc { font-size: 12px; color: var(--ink-quiet); border: 1px solid var(--line-strong); padding: 0 6px; line-height: 20px; }
.cmd__body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; min-height: 0; flex: 1; }
@media (max-width: 680px) { .cmd__body { grid-template-columns: minmax(0, 1fr); } .cmd__peek { display: none; } }
.cmd__list { list-style: none; margin: 0; padding: 8px 0; overflow-y: auto; min-height: 0; }
.cmd__grp { padding: 14px 20px 6px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-quiet); font-weight: 500; }
.cmd__item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 20px; cursor: pointer; position: relative; }
.cmd__item svg { color: var(--ink-quiet); }
.cmd__item .t { min-width: 0; display: flex; flex-direction: column; }
.cmd__item .t b { font-weight: 400; font-size: 15px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd__item .t small { font-size: 12.5px; color: var(--ink-quiet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd__item .hk { font-size: 12px; color: var(--ink-quiet); }
.cmd__item[aria-selected="true"] { background: var(--surface-quiet); }
.cmd__item[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--by-geologie); }
.cmd__item[aria-selected="true"] svg { color: var(--by-geologie); }
.cmd__item mark { background: none; color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--by-gold); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.cmd__empty { padding: 28px 20px; color: var(--ink-soft); font-size: 14.5px; }
.cmd__peek { border-left: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-quiet); overflow-y: auto; }
.cmd__peek .eyebrow { margin-bottom: -4px; }
.cmd__peek h4 { font-size: 17px; font-weight: 500; }
.cmd__peek dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.cmd__peek dt { color: var(--ink-quiet); }
.cmd__peek dd { margin: 0; color: var(--ink); }
.cmd__peek .swap { animation: swap .35s var(--spring) both; }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } }
.cmd__foot { display: flex; gap: 18px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-quiet); flex: none; }
.cmd__foot span { display: inline-flex; gap: 6px; align-items: center; }
.cmd__foot i { font-style: normal; border: 1px solid var(--line-strong); padding: 0 5px; line-height: 18px; font-size: 11px; }

/* Object symbols (from docs/09-karte.md): Bohrung ● geologie, Geophysik ■ analytik, Sonstige ◆ natur */
.sym { display: inline-block; width: 12px; height: 12px; flex: none; }
.sym--bo { background: #773120; border-radius: 50%; }
.sym--gp { background: #283e85; }
.sym--so { background: #627e1b; transform: rotate(45deg) scale(.85); }


/* --------------------------------------------------------------------------
   Wizard: stepper, step head, sections, action bar — shared by step pages.
   Editorial layout: heading column left, content right, hairlines between.
   -------------------------------------------------------------------------- */
.stepper { display: grid; grid-template-columns: repeat(var(--steps, 5), minmax(0, 1fr)); gap: 8px; padding-block: 36px 0; list-style: none; margin: 0; }
.stepper li { min-width: 0; animation: rise .6s var(--spring-soft) both; animation-delay: calc(var(--i, 0) * 50ms); }
.stepper li.is-leaving { animation: stepout .45s var(--ease-out) forwards; }
@keyframes stepout { to { opacity: 0; transform: translateY(-6px); } }
.stepper a { display: flex; flex-direction: column; gap: 9px; text-decoration: none; color: var(--ink-quiet); min-width: 0; }
.stepper .seg { height: 4px; background: var(--by-basis-18); position: relative; overflow: hidden; }
.stepper .done .seg { background: var(--strata-c, var(--strata-1)); }
.stepper .done .seg { background: var(--by-basis); }
.stepper .now .seg { background: var(--by-basis-38); }
.stepper .now .seg::after { content: ""; position: absolute; inset: 0 50% 0 0; background: var(--by-basis); }
.stepper .lbl { display: flex; gap: 10px; align-items: baseline; font-size: 14px; min-width: 0; }
.stepper .lbl span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper .n { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-quiet); font-weight: 500; }
.stepper small { font-size: 12px; color: var(--ink-quiet); padding-left: 26px; }
.stepper .done a, .stepper .now a { color: var(--ink); }
.stepper .now .lbl { font-weight: 500; }
.stepper .done small { color: var(--by-green-ink); }
.stepper .warn small { color: var(--by-hinweis); }
.stepper a:hover .lbl span:last-child { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
@media (max-width: 760px) { .stepper .lbl span:last-child, .stepper small { display: none; } .stepper .now .lbl span:last-child { display: inline; } }

.stephead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 40px; align-items: end; padding-block: clamp(40px, 5vw, 64px) clamp(28px, 3vw, 40px); }
.stephead h1 { font-size: clamp(30px, 3.4vw, 44px); margin-top: 14px; max-width: 22ch; }
.stephead p { color: var(--ink-soft); font-size: 17px; line-height: 1.6; margin-top: 14px; max-width: 60ch; }
@media (max-width: 760px) { .stephead { grid-template-columns: minmax(0, 1fr); } }
.title { display: none; } /* legacy */

.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-quiet); align-items: center; }
.meta .live { display: inline-flex; gap: 8px; align-items: center; }
.meta .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--by-green); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(117,183,38,.55); } 70% { box-shadow: 0 0 0 7px rgba(117,183,38,0); } 100% { box-shadow: 0 0 0 0 rgba(117,183,38,0); } }
.saved { display: inline-flex; gap: 6px; align-items: center; }
.saved.is-saving svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* White panels on the grey ground: every area that asks something is a
   clearly bounded surface. Information around it stays on the ground. */
.panel { background: var(--surface); border: 1px solid var(--line); padding: clamp(22px, 3vw, 40px); }
.sec { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 24px 64px; padding: clamp(24px, 3.2vw, 44px); background: var(--surface); border: 1px solid var(--line); }
.sec + .sec { margin-top: 16px; }
.sec { transition: border-color .3s; }
.sec.is-help { border-color: var(--by-basis-38); }
.sec__h { display: flex; flex-direction: column; gap: 10px; }
.sec__h .no { font-size: 12px; font-weight: 500; color: var(--ink-quiet); font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.sec__h h2 { font-size: 20px; }
.sec__h p { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); max-width: 34ch; }
.sec__b { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
@media (max-width: 860px) { .sec { grid-template-columns: minmax(0, 1fr); gap: 20px; } }

.actionbar { position: sticky; bottom: 0; z-index: 40; margin-top: 56px; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.actionbar__in { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-block: 12px; }
.actionbar .sp { flex: 1; }
.actionbar .btn--gold.is-ready { animation: nudge 2.6s var(--spring) 1.2s 2; }
@keyframes nudge { 0%, 18%, 100% { transform: none; } 6% { transform: translateX(5px); } 12% { transform: translateX(-2px); } }
.meter { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-soft); }
.meter__ring { --p: 0; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--by-basis) calc(var(--p) * 1%), var(--by-basis-18) 0); display: grid; place-items: center; transition: --p .8s var(--spring-soft); flex: none; }
.meter__ring::before { content: ""; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
.meter b { font-weight: 500; color: var(--ink); }

/* --------------------------------------------------------------------------
   Form atoms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; color: var(--ink); font-weight: 500; min-width: 0; }
.field .opt { font-weight: 400; color: var(--ink-quiet); }
.field input, .field select, .field textarea { height: 48px; border: 1px solid var(--line-strong); border-bottom-color: var(--by-basis-50); padding: 0 14px; background: #fff; border-radius: 0; font-weight: 400; font-size: 15.5px; color: var(--ink); transition: box-shadow .2s, border-color .2s; width: 100%; }
.field textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--by-basis); box-shadow: inset 0 -2px 0 var(--by-basis), 0 0 0 4px rgba(82,110,127,.14); }
.field input.big { height: 58px; font-size: 19px; }
.field .help { font-size: 12.5px; font-weight: 400; color: var(--ink-quiet); }
.field.is-ok input { border-bottom-color: var(--by-green); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.chips legend { font-size: 13.5px; color: var(--ink); font-weight: 500; margin-bottom: 9px; padding: 0; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 14.5px; transition: border-color .2s, background-color .2s, color .2s, transform .5s var(--spring); }
.chip:hover { border-color: var(--by-basis); }
.chip:active { transform: scale(.96); transition-duration: .08s; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--by-basis); color: #fff; border-color: var(--by-basis); }
.chip:has(input:focus-visible) { outline: 2px solid var(--by-basis); outline-offset: 2px; }
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s var(--spring-soft), opacity .3s; opacity: 0; }
.reveal > div { overflow: hidden; min-height: 0; }
.reveal.is-open { grid-template-rows: 1fr; opacity: 1; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 520px) { .two { grid-template-columns: minmax(0, 1fr); } }
.unit { position: relative; }
.unit input { padding-right: 76px; font-variant-numeric: tabular-nums; }
.unit em { position: absolute; right: 14px; bottom: 14px; font-style: normal; font-size: 13px; color: var(--ink-quiet); font-weight: 400; }

/* Square switch (CD: no round corners). */
.switch { position: relative; flex: none; width: 56px; height: 30px; appearance: none; -webkit-appearance: none; margin: 0; cursor: pointer; background: var(--by-basis-38); transition: background-color .25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; transition: transform .5s var(--spring); }
.switch:checked { background: var(--by-basis); }
.switch:checked::after { transform: translateX(26px); }
.switch:active::after { width: 28px; }
.switch:checked:active::after { transform: translateX(22px); }
.switch:focus-visible { outline: 2px solid var(--by-basis); outline-offset: 3px; }

.switchrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 22px 24px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; transition: border-color .25s, background-color .25s; }
.switchrow:hover { border-color: var(--by-basis); }
.switchrow:has(.switch:checked) { border-color: var(--by-basis); box-shadow: inset 4px 0 0 #2077b1; }
.switchrow b { display: flex; gap: 10px; align-items: center; font-size: 17px; font-weight: 500; color: var(--ink); }
.switchrow p { font-size: 14px; color: var(--ink-soft); margin-top: 6px; max-width: 60ch; }

/* Large choice cards (radio). */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; border: 0; padding: 0; margin: 0; }
.choice { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px 22px 20px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; transition: border-color .2s, box-shadow .25s, transform .5s var(--spring); }
.choice:hover { border-color: var(--by-basis); }
.choice:active { transform: scale(.985); transition-duration: .08s; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { font-size: 17px; font-weight: 500; color: var(--ink); padding-right: 36px; }
.choice span { font-size: 14px; color: var(--ink-soft); }
.choice small { font-size: 12.5px; color: var(--ink-quiet); margin-top: auto; padding-top: 8px; }
.choice .tag { position: absolute; top: -10px; left: 18px; font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; background: var(--by-gold); color: #000; padding: 2px 8px; }
.choice .tick { position: absolute; top: 20px; right: 20px; width: 24px; height: 24px; border: 1.5px solid var(--by-basis-50); display: grid; place-items: center; color: #fff; transition: background-color .2s, border-color .2s; }
.choice .tick svg path { stroke-dasharray: 26; stroke-dashoffset: 26; transition: stroke-dashoffset .35s var(--ease-out) .05s; }
.choice:has(input:checked) { border-color: var(--by-basis); box-shadow: inset 0 0 0 1px var(--by-basis); background: #f6f9fb; }
.choice:has(input:checked) .tick { background: var(--by-basis); border-color: var(--by-basis); animation: pop .5s var(--spring); }
.choice:has(input:checked) .tick svg path { stroke-dashoffset: 0; }
.choice:has(input:focus-visible) { outline: 2px solid var(--by-basis); outline-offset: 2px; }
@keyframes pop { from { transform: scale(.5); } }

/* Key/value summary rows. */
.kv { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.kv > div { display: grid; grid-template-columns: minmax(120px, 2fr) minmax(0, 5fr) auto; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: baseline; font-size: 14.5px; }
.kv dt, .kv .k { color: var(--ink-quiet); font-size: 13.5px; }
.kv dd, .kv .v { margin: 0; color: var(--ink); min-width: 0; }
.kv a { font-size: 13px; white-space: nowrap; }
@media (max-width: 560px) { .kv > div { grid-template-columns: minmax(0, 1fr) auto; } .kv .k { grid-column: 1 / -1; } }

/* Status list (documents, completeness). */
.slist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.slist li { display: grid; grid-template-columns: 28px minmax(0, 1fr) 150px 124px; gap: 16px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); transition: background-color .3s; }
.slist .t b { display: block; font-weight: 500; color: var(--ink); font-size: 15px; }
.slist .t small { font-size: 12.5px; color: var(--ink-quiet); }
.slist .ic { width: 28px; height: 28px; display: grid; place-items: center; color: var(--ink-quiet); }
.slist li.is-ok .ic { color: var(--by-green-ink); background: var(--by-green-18); }
.slist li.is-due .ic { color: #fff; background: var(--by-hinweis); }
.slist li.is-na { opacity: .55; }
.slist li.is-flash { background: var(--by-gold-18); }
.slist .btn { width: 100%; }
.slist .pill { justify-self: start; }
@media (max-width: 560px) { .slist li { grid-template-columns: 28px minmax(0, 1fr) auto; } .slist li > .pill { display: none; } }

.note { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-left: 3px solid #2077b1; background: #eef5fa; font-size: 14px; color: #12384f; }
.note svg { flex: none; margin-top: 1px; }
.note--warn { border-left-color: var(--by-hinweis); background: #fff6ec; color: #4a3000; }
.src { font-size: 12.5px; color: var(--ink-quiet); display: flex; gap: 6px; align-items: center; }
.ex { font-size: 11px; padding: 0 6px; border: 1px dashed var(--by-basis-50); color: var(--ink-quiet); font-weight: 400; white-space: nowrap; }
.badge-whg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: #145a88; border: 1px solid #9cc4e0; padding: 1px 7px; letter-spacing: .02em; }
.ib { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink-soft); flex: none; }
.ib:hover { border-color: var(--line-strong); color: var(--ink); }

/* --------------------------------------------------------------------------
   Help — inline disclosures and the contextual help panel.
   Calm blue reference colour, one icon, a clear title, short body, and the
   legal basis as a quiet footer. Opens with a soft height transition.
   -------------------------------------------------------------------------- */
.help { border: 1px solid #cfe0ec; background: #f5f9fc; transition: background-color .25s, border-color .25s; }
/* Closed: a small "? Hilfe" link. Open: the full box. */
.help:not([open]) { align-self: flex-start; background: none; border-color: transparent; }
.help:not([open]) > summary { padding: 4px 0; }
.help:not([open]) > summary .chev { margin-left: 2px; }
.help > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 12px 16px; font-size: 14px; color: var(--by-link); user-select: none; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary .q { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border: 1.5px solid currentColor; border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; }
.help > summary .chev { margin-left: auto; display: grid; color: var(--ink-quiet); transition: transform .4s var(--spring); }
.help[open] > summary .chev { transform: rotate(90deg); }
.help > summary:hover { color: #3089e7; }
.help::details-content { block-size: 0; overflow: hidden; transition: block-size .45s var(--spring-soft), content-visibility .45s allow-discrete; }
.help[open]::details-content { block-size: auto; }
@supports (interpolate-size: allow-keywords) { :root { interpolate-size: allow-keywords; } }
.help__b { padding: 2px 16px 16px 50px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.6; color: #1f3b4f; }
.help__b ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.help__b .law { font-size: 12.5px; color: var(--ink-quiet); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid #dbe8f1; }

/* Contextual help panel: follows the section the user is working in. */
.guide { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--by-basis); }
.guide__h { display: flex; gap: 10px; align-items: center; padding: 18px 22px 0; }
.guide__h .eyebrow { margin-right: auto; }
.guide__c { padding: 14px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.guide__c.is-swap { animation: swap .4s var(--spring) both; }
.guide__c h3 { font-size: 17px; font-weight: 500; }
.guide__c p { font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.guide__c .do { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.guide__c .do li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--ink-body); }
.guide__c .do li svg { color: var(--by-green-ink); margin-top: 1px; }
.guide__c .law { font-size: 12.5px; color: var(--ink-quiet); padding-top: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Inline field hint: a single quiet line with an info dot. */
.hint { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--ink-quiet); font-weight: 400; }
.hint svg { flex: none; margin-top: 2px; color: var(--by-basis); }

/* --------------------------------------------------------------------------
   Menu button + slide-in navigation (left)
   -------------------------------------------------------------------------- */
/* Edge tab ("Zipfel") on the left that opens the navigation. */
.zipfel { position: fixed; z-index: 60; left: 0; top: 50%; transform: translateY(-50%); width: 22px; height: 88px; padding: 0; border: 0; background: var(--by-basis); color: #fff; cursor: pointer; display: grid; place-items: center; transition: width .35s var(--spring), background-color .2s; }
.zipfel:hover, .zipfel:focus-visible { width: 30px; background: var(--by-basis-dark); }
dialog.drawer { position: fixed; inset: 0 auto 0 0; margin: 0; width: min(380px, 88vw); height: 100dvh; max-height: none; max-width: none; padding: 0; border: 0; border-right: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-body); display: none; flex-direction: column; transform: translateX(-100%); transition: transform .5s var(--spring-soft); }
dialog.drawer[open] { display: flex; transform: none; }
dialog.drawer.is-closing { transform: translateX(-100%); transition: transform .26s var(--ease-out); }
@starting-style { dialog.drawer[open] { transform: translateX(-100%); } }
dialog.drawer::backdrop { background: rgba(31, 42, 49, .38); }
.drawer__h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 16px 24px; border-bottom: 1px solid var(--line); min-height: 72px; }
.demo { display: flex; flex-direction: column; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
.demo__row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--ink); cursor: pointer; }
.demo__row .switch { width: 44px; height: 24px; }
.demo__row .switch::after { width: 18px; height: 18px; }
.demo__row .switch:checked::after { transform: translateX(20px); }
.demo__fill { align-self: flex-start; border: 0; background: none; padding: 4px 0; color: var(--by-link); font-size: 14px; cursor: pointer; }
.drawer__nav { display: flex; flex-direction: column; padding: 12px 0; overflow-y: auto; flex: 1; }
.drawer__nav a { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px 24px; text-decoration: none; color: inherit; position: relative; animation: rise .5s var(--spring-soft) both; animation-delay: calc(var(--i) * 35ms + 80ms); }
.drawer__nav a:hover { background: var(--surface-quiet); color: inherit; }
.drawer__nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--by-geologie); }
.drawer__nav .ic { width: 40px; height: 40px; display: grid; place-items: center; background: var(--by-basis-18); color: var(--by-basis-dark); }
.drawer__nav b { display: block; font-weight: 500; color: var(--ink); font-size: 15.5px; }
.drawer__nav small { display: block; font-size: 13px; color: var(--ink-quiet); }
.drawer__nav hr { border: 0; border-top: 1px solid var(--line); margin: 10px 24px; }
.drawer__f { padding: 16px 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-quiet); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drawer__f b { color: var(--ink); font-weight: 500; }

/* Help flyout (hover) and the small "bling" when help appears. */
.helpfly { position: fixed; z-index: 120; background: var(--surface); border: 1px solid var(--line-strong); border-left: 3px solid var(--by-basis); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.6; color: var(--ink-body); box-shadow: 0 18px 40px -24px rgba(31, 42, 49, .45); pointer-events: none; opacity: 0; transform: translateX(-8px); transition: opacity .18s, transform .45s var(--spring); }
.helpfly.is-on { opacity: 1; transform: none; pointer-events: auto; animation: bling .9s var(--ease-out); }
.helpfly ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.helpfly .law { font-size: 12.5px; color: var(--ink-quiet); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
@keyframes bling { 0% { box-shadow: 0 0 0 0 rgba(253, 196, 0, .55), 0 18px 40px -24px rgba(31, 42, 49, .45); } 100% { box-shadow: 0 0 0 10px rgba(253, 196, 0, 0), 0 18px 40px -24px rgba(31, 42, 49, .45); } }
.guide.is-bling { animation: bling .9s var(--ease-out); }
.guide.is-bling .guide__h svg { animation: twinkle .7s var(--spring); color: #c99a00; }
@keyframes twinkle { 0% { transform: scale(.4) rotate(-45deg); } 60% { transform: scale(1.25) rotate(10deg); } 100% { transform: none; } }
.help > summary:hover .q { background: var(--by-link); color: #fff; border-color: var(--by-link); }
.help > summary .q { transition: background-color .2s, color .2s; }
