/* SmartLine Cockpit
   Design system adopted from the Schichtplaner reference: light canvas, DM Sans,
   blue brand with near-black primaries, hairlines drawn as inset shadows rather
   than borders, fully round controls, and a 250px rail that slides in on phones. */

:root {
  /* --- palette --- */
  --color-canvas:       #fff;
  --color-surface:      #f7f8fa;
  --color-surface-soft: #f2f3f5;
  --color-hairline:     #e5e7eb;
  --color-hairline-soft:#eaecf0;

  --color-ink:      #0a0a0a;
  --color-charcoal: #222;
  --color-slate:    #45515e;
  --color-steel:    #5f5f5f;
  --color-stone:    #8e8e93;
  --color-muted:    #a8aab2;

  --color-brand:      #1456f0;
  --color-brand-mid:  #3b82f6;
  --color-brand-deep: #1d4ed8;
  --color-brand-700:  #17437d;
  --color-brand-200:  #bfdbfe;

  --color-coral:      #ff5530;
  --color-purple:     #a855f7;
  --color-success:    #1ba673;
  --color-success-bg: #e8ffea;
  --color-danger:     #d45656;
  --color-danger-ink: #a33636;
  --color-warn:       #b0430f;
  --color-warn-bg:    #fff4e5;
  --accent-soft:      #e7edfe;

  /* --- type --- */
  --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* --- shape --- */
  --radius-xs: 4px;  --radius-sm: 6px;  --radius-md: 8px;
  --radius-lg: 12px; --radius-xl: 16px; --radius-xxl: 20px; --radius-xxxl: 24px;

  /* Borders are inset shadows: they never take part in the box model. */
  --haarlinie:       inset 0 0 0 1px var(--color-hairline);
  --haarlinie-weich: inset 0 0 0 1px var(--color-hairline-soft);
  --schatten-flach:  0 1px 2px #0a0a0a0a, 0 8px 24px -10px #0a0a0a17;
  --schatten-hoch:   0 2px 6px #0a0a0a0d, 0 22px 48px -16px #0a0a0a29;

  --ease-fluid: cubic-bezier(.32,.72,0,1);
  --ease-snap:  cubic-bezier(.34,1.56,.64,1);

  --leiste: 250px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: var(--leiste) minmax(0, 1fr);
  /* min-height only, never height: a fixed body height would cap the grid row at
     one screen — and a sticky element can never stick past its own grid area, so
     the rail would scroll away on any longer page. */
  min-height: 100dvh;
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}
body.blank { display: block; background: var(--color-surface); }

button, .btn, .chip, a, label.haken { touch-action: manipulation; -webkit-tap-highlight-color: #1456f01f; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 24px; letter-spacing: -.03em; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--color-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; border-radius: 6px; }

/* Keyboard users land here first; visible only while focused. */
.sprungmarke {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  padding: 10px 16px; border-radius: 9999px;
  background: var(--color-ink); color: #fff; font-size: 14px; font-weight: 600;
  transform: translateY(-160%); transition: transform .2s var(--ease-fluid);
}
.sprungmarke:focus { transform: none; text-decoration: none; }

code {
  font-family: var(--font-mono); font-size: .86em;
  padding: .12em .4em; border-radius: var(--radius-xs);
  background: var(--color-surface-soft); box-shadow: var(--haarlinie-weich);
  overflow-wrap: anywhere;
}

.num  { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.gut, .up      { color: var(--color-success); }
.schlecht, .down { color: var(--color-danger-ink); }
.warn  { color: var(--color-warn); }
.muted { color: var(--color-steel); }

/* ---------------- sidebar ---------------- */
.seitenleiste {
  position: sticky; top: 0; align-self: start; z-index: 30;
  display: flex; flex-direction: column; gap: 6px;
  height: 100dvh; overflow: hidden auto; overscroll-behavior: contain;
  padding: max(18px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: var(--color-canvas);
  box-shadow: inset -1px 0 0 var(--color-hairline);
}
.marke { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 4px 8px 16px; }
.logo {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 13px; color: #fff; font-size: 19px;
  background-image: linear-gradient(140deg, var(--color-ink) 0%, #2b3340 100%);
  box-shadow: 0 6px 16px -6px #0a0a0a99, inset 0 1px 1px #ffffff2e;
}
.marke-text { display: flex; flex-direction: column; min-width: 0; }
.marke-text strong { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.marke-text span { font-size: 11.5px; color: var(--color-steel); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-gruppe { display: flex; flex-direction: column; gap: 1px; }
.nav-gruppe + .nav-gruppe { margin-top: 14px; }
.nav-titel {
  padding: 0 12px 6px; font-size: 10px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--color-slate);
}
.nav-punkt {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: var(--radius-lg);
  background: none; color: var(--color-slate);
  font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
  transition: background .22s var(--ease-fluid), color .22s var(--ease-fluid), transform .3s var(--ease-fluid);
}
.nav-punkt svg {
  flex: none; width: 18px; height: 18px; opacity: .8;
  fill: none; stroke: currentColor; stroke-width: 1.4px;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-punkt > span:not(.badge) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-punkt:hover { background: var(--color-surface); color: var(--color-ink); text-decoration: none; }
.nav-punkt:active { transform: scale(.985); }
.nav-punkt.aktiv {
  background: var(--color-ink); color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px #0a0a0a29, 0 10px 22px -12px #0a0a0ab3;
}
.nav-punkt.aktiv svg { opacity: 1; }
.nav-fuss { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
/* nowrap is what makes the ellipsis work; without it the address just wraps. */
.nav-konto { padding: 0 12px; font-size: 11.5px; color: var(--color-stone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- off-canvas (phone) ---------------- */
.hamburger { display: none; }
.hamburger span {
  position: absolute; left: 13px; width: 16px; height: 1.5px; border-radius: 2px;
  background: var(--color-ink);
  transition: transform .42s var(--ease-fluid), opacity .2s var(--ease-fluid);
}
.hamburger span:nth-child(1) { top: 15px; }
.hamburger span:nth-child(2) { top: 20.5px; }
.hamburger span:nth-child(3) { top: 26px; }
body.menue-offen .hamburger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
body.menue-offen .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(.3); }
body.menue-offen .hamburger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
.leisten-schleier { display: none; }

/* ---------------- page frame ---------------- */
.inhalt { min-width: 0; display: flex; flex-direction: column; }
.seitenkopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 26px; background: #f7f8faf2;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: inset 0 -1px 0 var(--color-hairline);
}
.seitenkopf-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.seitenkopf-text p { font-size: 12.5px; color: var(--color-steel); }
.seitenkopf-werkzeuge { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.rumpf { padding: 20px 26px 60px; display: flex; flex-direction: column; gap: 18px; }
/* The page header is sticky, so anything scrolled to needs clearance under it. */
.rumpf :is(h2, h3, input, select, textarea, .karte) { scroll-margin-top: 96px; }

/* ---------------- buttons ---------------- */
.btn {
  --btn-bg: var(--color-canvas);
  --btn-fg: var(--color-ink);
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 9px 18px; border: 0; border-radius: 9999px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.4;
  white-space: nowrap; cursor: pointer; box-shadow: var(--haarlinie);
  transition: transform .28s var(--ease-fluid), box-shadow .28s var(--ease-fluid),
              background .2s var(--ease-fluid), color .2s var(--ease-fluid);
}
.btn:hover { background: var(--color-surface-soft); box-shadow: inset 0 0 0 1px #d8dbe1; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { --btn-bg: var(--color-ink); --btn-fg: #fff; box-shadow: 0 1px 2px #0a0a0a29, 0 8px 20px -8px #0a0a0a66; }
.btn.primary:hover { --btn-bg: var(--color-charcoal); box-shadow: 0 2px 4px #0a0a0a2e, 0 14px 28px -10px #0a0a0a73; }
.btn.marke { --btn-bg: var(--color-brand); --btn-fg: #fff; box-shadow: 0 1px 2px #1456f03d, 0 10px 24px -10px #1456f099; }
.btn.marke:hover { --btn-bg: var(--color-brand-deep); }
.btn.ghost { --btn-bg: transparent; color: var(--color-slate); box-shadow: none; }
.btn.ghost:hover { background: #0a0a0a0b; color: var(--color-ink); box-shadow: none; }
.btn.danger { --btn-bg: var(--color-danger); --btn-fg: #fff; box-shadow: 0 8px 20px -10px #d45656b3; }
.btn.danger:hover { --btn-bg: #c04747; }
.btn.danger-ghost { --btn-bg: transparent; color: var(--color-danger-ink); box-shadow: inset 0 0 0 1px #d4565652; }
.btn.danger-ghost:hover { background: #d4565614; box-shadow: inset 0 0 0 1px #d4565680; }
.btn.klein { padding: 6px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-reihe { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-reihe form { display: contents; }

/* ---------------- surfaces ---------------- */
.karte {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px; border-radius: var(--radius-xl);
  background: var(--color-canvas); box-shadow: var(--haarlinie), var(--schatten-flach);
}
/* A form that lives inside a card must not draw a second card around itself. */
.karte.nackt { padding: 0; background: none; box-shadow: none; }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.karte-titel-zeile { display: flex; align-items: center; gap: 7px; }
.karte-titel { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.etikett { font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--color-slate); }

.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kachel {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; border-radius: var(--radius-xl);
  background: var(--color-canvas); box-shadow: var(--haarlinie-weich), var(--schatten-flach);
}
/* Block, not flex: a longer label must wrap and keep the question mark right
   behind the last word instead of parking it at the end of the row. */
.kachel .k-titel {
  display: block; margin-bottom: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--color-slate);
}
.kachel b { font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kachel span.k-sub { font-size: 11.5px; color: var(--color-steel); font-variant-numeric: tabular-nums; }
.kachel.gut b { color: var(--color-success); }
.kachel.schlecht b { color: var(--color-danger-ink); }
.kachel.achtung b { color: var(--color-warn); }
/* After the state colours on purpose: a missing value is never good, bad or
   a warning — it is simply absent, and must not borrow their colour. */
.kachel b.leer-wert, .posi b.leer-wert { color: var(--color-muted); font-weight: 400; }

/* ---------------- pills & badges ---------------- */
.marker {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--color-surface-soft); color: var(--color-slate);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.marker.laeuft { background: var(--color-success-bg); color: #0f6b4a; }
.marker.laeuft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-success); }
.marker.fehler  { background: #fdeaea; color: var(--color-danger-ink); }
.marker.achtung { background: var(--color-warn-bg); color: #8a4b00; }
.marker.blau    { background: var(--accent-soft); color: var(--color-brand-700); }
.marker.lila    { background: #f3e8ff; color: #6b21a8; }
.marker.long    { background: var(--color-success-bg); color: #0f6b4a; }
.marker.short   { background: #fdeaea; color: var(--color-danger-ink); }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; margin-left: 7px; padding: 0 6px;
  border-radius: 9999px; background: var(--color-surface-soft); color: var(--color-slate);
  font-size: 11px; font-weight: 600;
}
.nav-punkt.aktiv .badge { background: #ffffff2e; color: #fff; }

/* ---------------- forms ---------------- */
.feld { display: flex; flex-direction: column; gap: 6px; }
.feld > label { font-size: 13px; font-weight: 500; color: var(--color-slate); }
.hinweis { font-size: 12px; line-height: 1.45; color: var(--color-steel); }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 0; border-radius: var(--radius-md);
  background: var(--color-canvas); color: var(--color-ink);
  font: inherit; font-size: 15px;
  box-shadow: var(--haarlinie);
  transition: box-shadow .2s var(--ease-fluid);
}
input:hover, select:hover, textarea:hover { box-shadow: inset 0 0 0 1px #d8dbe1; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--color-brand-deep); }
input::placeholder { color: var(--color-stone); }
input.mono { font-family: var(--font-mono); font-size: 14px; }
select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-repeat: no-repeat; background-position: right 13px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%235f5f5f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.gitter2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.gitter3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kopierfeld { display: flex; gap: 8px; align-items: stretch; }
.kopierfeld input { flex: 1; min-width: 0; }

/* ---------------- messages ---------------- */
.meldung {
  display: flex; gap: 10px; padding: 12px 16px; border-radius: var(--radius-lg);
  font-size: 14px; line-height: 1.5;
}
.meldung-ok    { background: var(--color-success-bg); color: #0f6b4a; box-shadow: inset 0 0 0 1px #1ba67333; }
.meldung-error { background: #fdeaea; color: var(--color-danger-ink); box-shadow: inset 0 0 0 1px #d4565633; }
.notiz {
  padding: 12px 16px; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: 3px solid var(--color-warn); background: var(--color-warn-bg);
  color: #8a4b00; font-size: 13.5px; line-height: 1.5;
}
.notiz-blau { border-left-color: var(--color-brand); background: var(--accent-soft); color: var(--color-brand-700); }
.notiz-rot  { border-left-color: var(--color-danger); background: #fdeaea; color: var(--color-danger-ink); }
.notiz a { color: inherit; text-decoration: underline; }

/* ---------------- tables ---------------- */
/* The two radial gradients are pinned to the scroll container and the two linear
   ones scroll with the content, so a shadow appears only on the side that still
   has content hidden. Without it a cut-off column looks like a broken table. */
.tw {
  overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  border-radius: var(--radius-lg); box-shadow: var(--haarlinie);
  background:
    linear-gradient(90deg, var(--color-canvas) 40%, #ffffff00) left center / 36px 100% no-repeat,
    linear-gradient(90deg, #ffffff00, var(--color-canvas) 60%) right center / 36px 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, #0a0a0a38, #0a0a0a00) left center / 18px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, #0a0a0a38, #0a0a0a00) right center / 18px 100% no-repeat,
    var(--color-canvas);
  background-attachment: local, local, scroll, scroll, scroll;
}
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
.tbl th {
  position: sticky; top: 0; z-index: 2; text-align: left; white-space: nowrap;
  padding: 10px 14px; background: var(--color-canvas);
  font-size: 10.5px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  color: var(--color-slate); box-shadow: inset 0 -1px 0 var(--color-hairline);
}
.tbl td { padding: 11px 14px; vertical-align: middle; color: var(--color-slate); box-shadow: inset 0 -1px 0 var(--color-hairline-soft); }
.tbl tr:last-child td { box-shadow: none; }
.tbl td.stark { color: var(--color-ink); font-weight: 500; }
.tbl td.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.leer { padding: 28px 16px; text-align: center; color: var(--color-stone); font-size: 13.5px; }

/* ---------------- ladder ---------------- */
.leiter { display: flex; flex-direction: column; gap: 5px; }
.leiter-kopf { display: flex; justify-content: space-between; margin-bottom: 8px; }
.sprosse { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; }
.sprosse-n { font-family: var(--font-mono); font-size: 10.5px; color: var(--color-stone); }
.sprosse-b { position: relative; height: 16px; border-radius: var(--radius-xs); background: var(--color-surface-soft); overflow: hidden; }
.sprosse-b > i { position: absolute; inset: 0 auto 0 0; display: block; border-radius: var(--radius-xs); }
.sprosse.gefuellt .sprosse-b > i { background: var(--color-brand); }
.sprosse.offen .sprosse-b { background: transparent; box-shadow: inset 0 0 0 1px var(--color-hairline); }
.sprosse.offen .sprosse-b > i { background: repeating-linear-gradient(90deg, var(--color-hairline) 0 3px, transparent 3px 7px); }
.sprosse-p { min-width: 66px; text-align: right; font-family: var(--font-mono); font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--color-slate); }
.sprosse.offen .sprosse-p { color: var(--color-stone); }

/* ---------------- position ---------------- */
.posgitter { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 16px; }
.posi { display: flex; flex-direction: column; gap: 1px; }
.posi > span, .posi > .posi-t { font-size: 10px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--color-slate); }
.posi > .posi-t { display: block; }
.posi > b { font-size: 15px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------------- chart ---------------- */
.diagramm svg { display: block; width: 100%; height: auto; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9999px; background: var(--color-surface-soft); }
.seg button {
  padding: 6px 14px; border: 0; border-radius: 9999px; background: none;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--color-steel); cursor: pointer;
  transition: background .3s var(--ease-fluid), color .2s var(--ease-fluid), box-shadow .3s var(--ease-fluid);
}
.seg button:hover { color: var(--color-ink); }
.seg button.on { background: var(--color-canvas); color: var(--color-ink); font-weight: 600; box-shadow: var(--schatten-flach); }

/* ---------------- wallet ---------------- */
.aufladen { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.aufladen .feld { flex: 1; min-width: 160px; }
.aufladen .btn { min-height: 44px; }
/* The plus that sits next to the balance on the overview. */
.plus {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  margin-left: 6px; border-radius: 50%; vertical-align: middle;
  background: var(--color-brand); color: #fff;
  font-size: 15px; font-weight: 600; line-height: 1;
  box-shadow: 0 1px 2px #1456f03d, 0 6px 14px -8px #1456f099;
  transition: background .18s var(--ease-fluid), transform .25s var(--ease-snap);
}
.plus:hover { background: var(--color-brand-deep); text-decoration: none; }
.plus:active { transform: scale(.9); }

/* ---------------- language switch ---------------- */
.sprachwahl {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 9999px; background: var(--color-surface-soft);
}
.sprachwahl button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border: 0; border-radius: 9999px;
  background: none; color: var(--color-steel); cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1;
  transition: background .22s var(--ease-fluid), color .2s var(--ease-fluid), box-shadow .22s var(--ease-fluid);
}
.sprachwahl button:hover { color: var(--color-ink); }
.sprachwahl button.on {
  background: var(--color-canvas); color: var(--color-ink);
  box-shadow: var(--schatten-flach);
}
/* Windows has no flag glyphs and falls back to the two letters — so the code is
   always shown as well, and the flag is decoration rather than the only signal. */
.sprachwahl .flagge { font-size: 14px; line-height: 1; }
.sprachwahl .kuerzel { letter-spacing: .04em; }
.sprachwahl.im-kopf { margin-left: auto; }
.sprachwahl.in-leiste { display: none; }
.sprachwahl.zentriert { align-self: center; }

/* ---------------- help bubbles ---------------- */
/* The panel is positioned against the card, never against the tiny button —
   that is what keeps it from hanging off the edge on a phone. */
.karte, .kacheln { position: relative; }

.hilfe { display: inline-block; vertical-align: middle; position: static; }
.k-titel .hilfe, .posi-t .hilfe, .feld > label .hilfe { margin-left: 5px; }
.hilfe > summary {
  display: inline-grid; place-items: center; width: 17px; height: 17px;
  border-radius: 50%; list-style: none; cursor: pointer; user-select: none;
  background: var(--color-surface-soft); color: var(--color-slate);
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  line-height: 1; letter-spacing: 0; text-transform: none;
  transition: background .18s var(--ease-fluid), color .18s var(--ease-fluid);
}
.hilfe > summary::-webkit-details-marker { display: none; }
.hilfe > summary::marker { content: ""; }
.hilfe > summary:hover { background: var(--accent-soft); color: var(--color-brand); }
.hilfe[open] > summary { background: var(--color-brand); color: #fff; }
.hilfe > summary:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

.hilfe-text {
  position: absolute; left: 16px; right: 16px; z-index: 40;
  margin-top: 9px; padding: 15px 17px;
  display: flex; flex-direction: column; gap: 9px;
  border-radius: var(--radius-lg); background: var(--color-canvas);
  box-shadow: var(--haarlinie), var(--schatten-hoch);
  /* The button often sits inside an uppercase label — reset everything. */
  font-size: 13.5px; font-weight: 400; line-height: 1.55;
  letter-spacing: normal; text-transform: none; color: var(--color-slate);
  text-align: left;
}
/* Written specifically enough to beat the tile state colours (.kachel.achtung b
   and friends), which would otherwise tint the explanation's heading. */
.kachel .hilfe-text > b, .posi .hilfe-text > b, .hilfe-text > b {
  font-size: 14.5px; font-weight: 600; color: var(--color-ink); letter-spacing: -.01em;
}
.hilfe-beispiel {
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--color-brand-700); font-size: 13px;
}
.hilfe-beispiel > span {
  display: block; margin-bottom: 3px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--color-brand);
}
@media (prefers-reduced-motion: no-preference) {
  .hilfe[open] .hilfe-text { animation: hilfe-ein .18s var(--ease-fluid); }
  @keyframes hilfe-ein { from { opacity: 0; transform: translateY(-5px); } }
}

/* ---------------- steps, qr, log ---------------- */
.schritte { counter-reset: s; display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
/* The number is positioned, not a grid column. A grid here would turn every
   inline <b> inside the step into its own cell and shatter the sentence. */
.schritte > li {
  counter-increment: s; position: relative; padding-left: 38px;
  font-size: 14px; line-height: 1.5; color: var(--color-slate);
}
.schritte > li::before {
  content: counter(s); position: absolute; left: 0; top: 1px;
  display: grid; place-items: center; width: 24px; height: 24px;
  border-radius: 9999px; background: var(--accent-soft); color: var(--color-brand);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
}
.schritte b { color: var(--color-ink); font-weight: 600; }

/* Same rhythm as .schritte, but a plain marker — for lists that are not a sequence. */
.liste { display: flex; flex-direction: column; gap: 13px; margin: 0; padding: 0; list-style: none; }
.liste > li {
  position: relative; padding-left: 24px;
  font-size: 14px; line-height: 1.5; color: var(--color-slate);
}
.liste > li::before {
  content: ""; position: absolute; left: 5px; top: .58em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--color-brand-200);
}
.liste b { color: var(--color-ink); font-weight: 600; }

.qrbox { width: 208px; height: 208px; padding: 12px; border-radius: var(--radius-xl); background: #fff; box-shadow: var(--haarlinie), var(--schatten-flach); }
.qrbox svg { display: block; width: 100%; height: 100%; }
.qrbox svg path { fill: #0a0a0a; }

.logbox {
  max-height: 62vh; overflow: auto; padding: 14px 16px; border-radius: var(--radius-lg);
  background: var(--color-canvas); box-shadow: var(--haarlinie);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; color: var(--color-slate);
}
.trenner { height: 1px; margin: 2px 0; border: 0; background: var(--color-hairline); }

/* ---------------- auth pages ---------------- */
.authwrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 28px 16px; background: var(--color-surface); }
.authcard { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.authkopf { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.authkopf .logo { width: 46px; height: 46px; font-size: 23px; border-radius: 15px; }
.authkopf strong { font-size: 19px; font-weight: 600; letter-spacing: -.03em; }
.authkopf p { font-size: 13px; color: var(--color-steel); }
.codefeld { font-family: var(--font-mono); font-size: 22px; letter-spacing: .3em; text-align: center; }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  body { grid-template-columns: minmax(0, 1fr); font-size: 14.5px; }

  .hamburger {
    position: fixed; z-index: 60; display: inline-flex;
    top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left));
    width: 42px; height: 42px; padding: 0; border: 0; border-radius: 9999px;
    background: #ffffffdb; cursor: pointer;
    box-shadow: var(--haarlinie), var(--schatten-flach);
    transition: left .44s var(--ease-fluid), background .3s var(--ease-fluid);
  }
  .seitenleiste {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 58;
    width: min(288px, 84vw); transform: translateX(-102%);
    box-shadow: var(--schatten-hoch);
    transition: transform .44s var(--ease-fluid);
  }
  body.menue-offen .seitenleiste { transform: none; }
  html.menue-offen, body.menue-offen { overflow: hidden; }
  body.menue-offen .hamburger { left: calc(min(288px, 84vw) - 54px); background: var(--color-canvas); }

  .leisten-schleier {
    position: fixed; inset: 0; z-index: 56; display: block;
    background: #0a0a0a57; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    animation: schleier-ein .3s var(--ease-fluid) backwards;
  }
  .leisten-schleier[hidden] { display: none; }
  @keyframes schleier-ein { from { opacity: 0; } }

  .nav-punkt { padding: 11px 12px; font-size: 15px; }
  .seitenkopf { padding: 14px 16px 14px 68px; }
  .rumpf { padding: 16px 16px 60px; }
  h1 { font-size: 20px; }
  .kachel b { font-size: 22px; }
  .seitenkopf-werkzeuge { width: 100%; margin-left: 0; }
  .seitenkopf-werkzeuge .btn { flex: 1; }
  /* On a phone the header is already crowded — the switch moves into the drawer. */
  .sprachwahl.im-kopf { display: none; }
  .sprachwahl.in-leiste { display: inline-flex; align-self: flex-start; margin: 0 12px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
