/* ==========================================================================
   Klar – account area (/konto), design 2027 "Le Plan"
   App-like: a sticky section rail on the left (a pill bar on small screens), sections switched by #hash,
   white cards on the drafting canvas, pastel tiles for the numbers, lime only where speech becomes text.
   Values come from tokens.css only; the shared chrome (k-*) from chrome.css. docs/DESIGN.md §6.
   ========================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-top) + var(--nav-h) + var(--s-6)); }
body.konto {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--canvas); color: var(--ink);
  font: var(--w-regular) var(--fs-body)/var(--lh-text) var(--font-sans); letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
body.konto main { flex: 1; position: relative; isolation: isolate; }
/* The drafting grid behind the whole account, fading out towards the bottom. Decorative. */
body.konto main::before {
  content: ""; position: absolute; inset: 0 0 auto; height: min(1100px, 100%); z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid-line) var(--hair), transparent var(--hair)), linear-gradient(90deg, var(--grid-line) var(--hair), transparent var(--hair));
  background-size: var(--grid-cell) var(--grid-cell); background-position: calc(var(--page-x) - 1px) -1px;
  -webkit-mask-image: linear-gradient(#000 0, #000 30%, transparent 100%); mask-image: linear-gradient(#000 0, #000 30%, transparent 100%);
}
::selection { background: var(--selection); color: var(--on-accent); }
a { color: inherit; }
.konto main img, .konto main svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.k-sr, .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.skip { position: absolute; left: var(--s-4); top: -100px; z-index: var(--z-toast); padding: 10px 16px; border-radius: var(--r-pill); background: var(--ink); color: var(--canvas); text-decoration: none; font-weight: var(--w-medium); }
.skip:focus { top: var(--s-3); }

/* One focus language everywhere on the page: ink ring + lime halo (lime ring + dark halo at night). */
:where(.konto main, .dlg, .toasts) :focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-halo);
}
:where(.konto main) :focus:not(:focus-visible) { outline: none; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--ink); vertical-align: 1px; margin-right: 8px; }

/* Drafting-frame corner dots */
.corner { position: absolute; width: 6px; height: 6px; background: var(--grid-dot); pointer-events: none; }
.corner--tl { top: 12px; left: 12px; } .corner--tr { top: 12px; right: 12px; }
.corner--bl { bottom: 12px; left: 12px; } .corner--br { bottom: 12px; right: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: var(--hair) solid transparent; border-radius: var(--r-pill); cursor: pointer; text-decoration: none; white-space: nowrap;
  font-size: var(--fs-small); font-weight: var(--w-medium); line-height: 1.1;
  transition: background-color var(--dur-s) var(--ease-out), border-color var(--dur-s) var(--ease-out), color var(--dur-s) var(--ease-out), transform var(--dur-m) var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.btn .k-glyph { width: 16px; height: 16px; }
.btn:active { transform: scale(.97); }
.btn--ink { background: var(--ink); color: var(--canvas); }
.btn--ink:hover { background: color-mix(in srgb, var(--ink) 86%, var(--canvas)); }
.btn--accent, .btn--signal { background: var(--accent); color: var(--on-accent); border-color: color-mix(in srgb, var(--klar-black) 14%, transparent); }
.btn--accent:hover, .btn--signal:hover { background: var(--klar-lime-light); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--field); }
.btn--ghost:hover { background: var(--canvas-2); border-color: var(--ink); }
.btn--danger { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 55%, transparent); }
.btn--danger:hover { color: var(--negative); border-color: var(--negative); background: color-mix(in srgb, var(--negative) 8%, transparent); }
.btn--danger-fill { background: var(--negative); color: var(--paper); }
.btn--danger-fill:hover { background: color-mix(in srgb, var(--negative) 86%, var(--ink)); }
.btn--small { min-height: 36px; padding: 0 14px; font-size: var(--fs-micro); }
.btn--big { min-height: 56px; font-size: var(--fs-body); }
.btn--block { width: 100%; }
.btn[aria-busy="true"], .btn:disabled { opacity: .62; cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkbtn { padding: 6px 2px; border: 0; background: none; color: var(--ink-2); font-size: var(--fs-small); cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 4px; }
.linkbtn:hover { color: var(--ink); text-decoration-color: currentColor; }
.linkbtn:disabled { opacity: .5; cursor: default; }

/* ---------- Form controls ---------- */
.form { display: grid; gap: var(--s-4); }
.input { display: grid; gap: 6px; position: relative; min-width: 0; }
.input > span, .select--labelled > span { font-size: var(--fs-micro); font-weight: var(--w-medium); color: var(--ink-2); }
.input > span small { font-weight: var(--w-regular); color: var(--ink-3); font-size: inherit; }
.input input, .input textarea, .select select {
  width: 100%; min-height: 44px; padding: 10px 14px; border: var(--hair) solid var(--field); border-radius: var(--r-s);
  background: var(--paper); color: var(--ink); font-size: var(--fs-body);
  transition: border-color var(--dur-s) var(--ease-out), box-shadow var(--dur-s) var(--ease-out);
}
.input textarea { min-height: 96px; resize: vertical; line-height: var(--lh-text); }
.input input::placeholder, .input textarea::placeholder { color: var(--ink-3); opacity: 1; }
.input input:hover, .input textarea:hover, .select select:hover { border-color: var(--ink-3); }
.input input:focus-visible, .input textarea:focus-visible, .select select:focus-visible { border-color: var(--ink); outline: 2px solid var(--focus); outline-offset: 1px; box-shadow: 0 0 0 5px var(--focus-halo); }
.input--pw input { padding-right: 96px; }
.input__toggle {
  position: absolute; right: 6px; bottom: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-pill);
  background: var(--canvas-2); color: var(--ink); font-size: var(--fs-micro); font-weight: var(--w-medium); cursor: pointer;
}
.select { position: relative; display: inline-grid; gap: 6px; min-width: 0; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; font-size: var(--fs-small); min-width: 180px; }
.select::after {
  content: ""; position: absolute; right: 16px; bottom: 18px; width: 8px; height: 8px; pointer-events: none;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg);
}
.form__hint { font-size: var(--fs-micro); color: var(--ink-3); line-height: 1.45; }
.form__error { font-size: var(--fs-small); color: var(--negative); font-weight: var(--w-medium); line-height: 1.4; }
.form__error:empty { display: none; }
.form__fine { font-size: var(--fs-micro); color: var(--ink-3); line-height: 1.5; }
.form__fine a { color: var(--ink); }
.form__link { justify-self: center; }
.form__row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.counter { margin-top: 6px; font-size: var(--fs-micro); color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }

/* Segmented control: canvas-2 track, the active option a white pill (thumb moved by konto.js where present).
   State cue ≥ 3 : 1 in both modes (WCAG 1.4.11, A11Y-1): a 1.5 px --ink-3 ring around the active pill (≥ 4.9 : 1
   against canvas-2 and paper, light and dark) plus semibold text. data-label (konto.js) reserves the bold width. */
.segmented {
  position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--r-pill); background: var(--canvas-2);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  position: relative; z-index: 1; flex: none; height: 36px; padding: 0 16px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-2); font-size: var(--fs-small); font-weight: var(--w-medium); cursor: pointer; white-space: nowrap;
  transition: color var(--dur-s) var(--ease-out), background-color var(--dur-s) var(--ease-out);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked="true"] { color: var(--ink); font-weight: var(--w-semibold); }
.segmented button[data-label]::after { content: attr(data-label); display: block; height: 0; overflow: hidden; visibility: hidden; font-weight: var(--w-semibold); }
.segmented__thumb {
  position: absolute; z-index: 0; top: 4px; left: 4px; height: 36px; border-radius: var(--r-pill); background: var(--paper); box-shadow: var(--shadow-float), 0 0 0 1.5px var(--ink-3);
  transition: transform var(--dur-m) var(--ease-klar), width var(--dur-m) var(--ease-klar);
}
.segmented--plain button[aria-checked="true"] { background: var(--paper); box-shadow: 0 1px 2px rgb(11 11 11 / .08), 0 0 0 1.5px var(--ink-3); }
.segmented--s button { height: 30px; padding: 0 12px; font-size: var(--fs-micro); }
.segmented--s .segmented__thumb { height: 30px; }
.segmented--chips { background: transparent; padding: 0; gap: 6px; flex-wrap: wrap; overflow: visible; }
.segmented--chips button { height: 34px; border: var(--hair) solid var(--rule-2); font-size: var(--fs-micro); }
.segmented--chips button[aria-checked="true"] { background: var(--ink); color: var(--canvas); border-color: var(--ink); box-shadow: none; }

/* Switch: field outline when off, lime with a black knob when on. */
.switch {
  position: relative; flex: none; width: 52px; height: 30px; padding: 0; cursor: pointer;
  border: 1.5px solid var(--field); border-radius: var(--r-pill); background: transparent;
  transition: background-color var(--dur-s) var(--ease-out), border-color var(--dur-s) var(--ease-out);
}
.switch__knob {
  position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--field);
  transition: transform var(--dur-m) var(--ease-spring), background-color var(--dur-s) var(--ease-out);
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--klar-black); }
.switch[aria-checked="true"] .switch__knob { transform: translateX(22px); background: var(--klar-black); }
.switch:focus-visible { border-radius: var(--r-pill); }

/* ---------- Loading ---------- */
.loading { display: grid; place-items: center; min-height: 70vh; }
/* Signed in, server unreachable (UX-3): the session stays, one button tries again. */
.offline { display: grid; justify-items: start; align-content: center; gap: var(--s-4); max-width: 560px; min-height: 70vh; margin: 0 auto; padding: calc(var(--nav-top) + var(--nav-h) + var(--s-6)) var(--page-x) var(--s-8); }
.offline__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); }
.loading__mark { display: flex; align-items: center; gap: 6px; height: 48px; }
.loading__mark i { display: block; width: 8px; border-radius: 4px; background: var(--ink); animation: bar 1.1s var(--ease-soft) infinite; }
.loading__mark i:nth-child(1) { height: 22px; } .loading__mark i:nth-child(2) { height: 40px; animation-delay: .1s; }
.loading__mark i:nth-child(3) { height: 30px; animation-delay: .2s; } .loading__mark i:nth-child(4) { height: 16px; animation-delay: .3s; }
.loading__mark b { width: 14px; height: 14px; margin-left: 4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--ink); }
@keyframes bar { 50% { transform: scaleY(.45); } }

.nojs { max-width: 720px; margin: 0 auto; padding: calc(var(--nav-top) + var(--nav-h) + var(--s-9)) var(--page-x) var(--s-9); display: grid; gap: var(--s-4); }
.nojs h1 { font-size: var(--fs-h2); font-weight: var(--w-medium); line-height: var(--lh-heading); letter-spacing: var(--track-h2); }

/* ==========================================================================
   Sign in / sign up
   ========================================================================== */
.auth {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 480px); gap: clamp(32px, 6vw, 112px); align-items: center;
  max-width: var(--max); margin: 0 auto; min-height: 100vh;
  padding: calc(var(--nav-top) + var(--nav-h) + var(--s-8)) var(--page-x) var(--s-9);
}
.auth__kicker { display: flex; align-items: center; margin-bottom: var(--s-5); }
.auth__title { font-size: var(--fs-display); font-weight: var(--w-medium); line-height: var(--lh-display); letter-spacing: var(--track-display); text-wrap: balance; }
.auth__title span { background: linear-gradient(transparent 58%, var(--accent-soft) 0); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.auth__points { list-style: none; margin: var(--s-7) 0 0; padding: 0; display: grid; gap: 0; max-width: 520px; border-top: var(--hair) solid var(--rule-2); }
.auth__points li { display: flex; align-items: center; gap: var(--s-4); padding: 14px 0; border-bottom: var(--hair) solid var(--rule-2); color: var(--ink-2); font-size: var(--fs-small); }
.auth__points b { color: var(--ink); font-weight: var(--w-semibold); }
.auth__points .k-glyph { width: 22px; height: 22px; color: var(--ink); }
.auth__fine { margin-top: var(--s-5); font-size: var(--fs-micro); color: var(--ink-3); max-width: 440px; }

/* Six tiles of the mosaic – the building blocks of language, the mark in the middle. */
.mosaic { display: grid; grid-template-columns: repeat(3, 64px); grid-auto-rows: 64px; gap: 0; margin-top: var(--s-7); }
.mosaic__t { width: 64px; height: 64px; }
.mosaic__mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); }
.mosaic__mark img { width: 34px; height: 34px; }
@media (prefers-reduced-motion: no-preference) {
  .mosaic > * { animation: tile-in var(--dur-l) var(--ease-klar) both; }
  .mosaic > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); } .mosaic > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
  .mosaic > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); } .mosaic > :nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
  .mosaic > :nth-child(6) { animation-delay: calc(var(--stagger) * 5); }
}
@keyframes tile-in { from { opacity: 0; transform: scale(.6) rotate(-12deg); } }

.auth__card {
  position: relative; padding: clamp(28px, 3vw, 44px); border-radius: var(--r-xl); background: var(--paper);
  border: var(--hair) solid var(--rule); box-shadow: var(--shadow-lift);
}
.auth__card > [data-pane] { display: grid; gap: var(--s-5); }
.auth__tabs { width: 100%; }
.auth__tabs button { flex: 1; }
.pane__title { font-size: var(--fs-h3); font-weight: var(--w-medium); line-height: var(--lh-heading); letter-spacing: var(--track-h3); }
.pane__text { color: var(--ink-2); }
.pane__text b { color: var(--ink); }
.pane__actions, .pane__done { display: grid; gap: var(--s-3); }
.pane__icon {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; font-size: var(--fs-h3); font-weight: var(--w-semibold);
  background: var(--canvas-2); color: var(--ink);
}
.pane__icon[data-kind="ok"] { background: var(--accent); color: var(--on-accent); }
.pane__icon[data-kind="warn"] { background: var(--tile-coral); color: var(--on-tile); }
.pane__icon:empty { display: none; }
.intent { padding: var(--s-4) var(--s-5); border-radius: var(--r-m); background: var(--accent); color: var(--on-accent); display: grid; gap: 4px; }
.intent__label { font-size: var(--fs-label); font-weight: var(--w-medium); letter-spacing: var(--track-label); text-transform: uppercase; }
.intent__plan { font-weight: var(--w-semibold); font-size: var(--fs-body); }
.intent__note { font-size: var(--fs-micro); line-height: 1.45; }
.intent__note:empty { display: none; }
.intent[data-download-intent] { background: var(--tile-sky); color: var(--on-tile); }
.intent[data-farewell] { background: var(--tile-sage); color: var(--on-tile); }

@media (max-width: 899px) {
  .auth { grid-template-columns: 1fr; min-height: 0; align-items: start; padding-top: calc(var(--nav-top) + var(--nav-h) + var(--s-6)); gap: var(--s-7); }
  .auth__card { order: -1; border-radius: var(--r-l); }
  .auth__title { font-size: var(--fs-h2); }
}

/* ==========================================================================
   Account shell: section rail + content
   ========================================================================== */
.acct {
  display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: clamp(24px, 3.4vw, 56px); align-items: start;
  max-width: var(--max); margin: 0 auto; padding: calc(var(--nav-top) + var(--nav-h) + var(--s-6)) var(--page-x) var(--s-10);
}
.side { position: sticky; top: calc(var(--nav-top) + var(--nav-h) + var(--s-5)); display: grid; gap: var(--s-5); }
.side__who {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--s-3); align-items: center;
  padding: var(--s-4); border-radius: var(--r-l); background: var(--paper); border: var(--hair) solid var(--rule);
}
.side__avatar {
  grid-row: span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-weight: var(--w-semibold); font-size: var(--fs-body);
}
.side__id { min-width: 0; }
.side__name { font-weight: var(--w-semibold); font-size: var(--fs-small); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__mail { font-size: var(--fs-micro); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__plan { grid-column: 2; }
.side__plan .k-tag:empty { display: none; }
.side__nav { display: grid; gap: 2px; }
.side__link {
  position: relative; display: flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: 0 var(--s-4);
  border-radius: var(--r-pill); color: var(--ink-2); text-decoration: none; font-size: var(--fs-small); font-weight: var(--w-medium);
  transition: background-color var(--dur-s) var(--ease-out), color var(--dur-s) var(--ease-out);
}
.side__link .k-glyph { width: 18px; height: 18px; flex: none; }
.side__link:hover { color: var(--ink); background: color-mix(in srgb, var(--paper) 60%, transparent); }
.side__link[aria-current="page"] { color: var(--ink); background: var(--paper); box-shadow: 0 1px 2px rgb(11 11 11 / .06), 0 0 0 var(--hair) var(--rule); }
.side__link[aria-current="page"]::after {
  content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--klar-black);
}
.side__foot { display: grid; gap: 4px; padding: var(--s-4) var(--s-4) 0; border-top: var(--hair) solid var(--rule-2); }
.side__foot a { font-size: var(--fs-micro); color: var(--ink-3); text-decoration: none; padding: 4px 0; }
.side__foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.acct__main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }

@media (max-width: 959px) {
  .acct { grid-template-columns: minmax(0, 1fr); padding-top: calc(var(--nav-top) + var(--nav-h) + var(--s-3)); gap: var(--s-5); }
  .side { top: calc(var(--nav-top) + var(--nav-h) + var(--s-2)); z-index: var(--z-sticky); gap: 0; margin: 0 calc(-1 * var(--page-x)); }
  .side__who, .side__foot { display: none; }
  .side__nav {
    display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
    padding: 6px var(--page-x); background: color-mix(in srgb, var(--canvas) 82%, transparent);
    -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass);
    border-block: var(--hair) solid var(--rule);
  }
  .side__nav::-webkit-scrollbar { display: none; }
  .side__link { flex: none; min-height: 40px; padding: 0 14px; scroll-snap-align: center; white-space: nowrap; }
  .side__link[aria-current="page"]::after { display: none; }
  .side__link[aria-current="page"] { background: var(--ink); color: var(--canvas); box-shadow: none; }
}

/* ---------- Section ---------- */
.sec { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); min-width: 0; scroll-margin-top: calc(var(--nav-top) + var(--nav-h) + var(--s-8)); }
.sec__head { position: relative; display: grid; gap: var(--s-3); padding-bottom: var(--s-5); margin-bottom: var(--s-2); border-bottom: var(--hair) solid var(--rule-2); }
/* plan marks at both ends of the rule */
.sec__head::before, .sec__head::after { content: ""; position: absolute; bottom: -3.5px; width: 6px; height: 6px; background: var(--grid-dot); }
.sec__head::before { left: 0; } .sec__head::after { right: 0; }
.sec__index { display: flex; gap: var(--s-3); align-items: center; }
.sec__index span { font-variant-numeric: tabular-nums; color: var(--ink); }
.sec__title { font-size: var(--fs-h2); font-weight: var(--w-medium); line-height: var(--lh-heading); letter-spacing: var(--track-h2); text-wrap: balance; }
/* Headings take focus only as a reading position (tabindex="-1"): no ring, it is no control (A11Y-3). */
.sec__title:focus, .sec__title:focus-visible, .pane__title[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.sec__lede { max-width: var(--measure); color: var(--ink-2); font-size: var(--fs-lead); line-height: 1.35; letter-spacing: var(--track-lead); text-wrap: pretty; }
.sec__meta { display: block; margin-top: calc(-1 * var(--s-3)); color: var(--ink-2); font-size: var(--fs-small); }
.sec__meta:empty { display: none; }
.sec__note { color: var(--ink-3); font-size: var(--fs-small); max-width: var(--measure); }
.sec__note a { color: var(--ink); }
.sec__save {
  position: absolute; right: 0; top: 0; display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px;
  border-radius: var(--r-pill); font-size: var(--fs-micro); font-weight: var(--w-medium); background: var(--paper); border: var(--hair) solid var(--rule);
}
.sec__save:empty { display: none; }
.sec__save::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--field); }
.sec__save[data-state="saved"]::before { background: var(--accent); box-shadow: 0 0 0 1px var(--klar-black); }
.sec__save[data-state="error"] { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 45%, transparent); }
.sec__save[data-state="error"]::before { background: var(--negative); }
.sec__save[data-state="saving"]::before { animation: pulse 1s var(--ease-soft) infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: no-preference) {
  .sec.is-entering { animation: sec-in var(--dur-s) var(--ease-out) both; }
}
@keyframes sec-in { from { opacity: 0; transform: translateY(8px); } }
.anchor { position: relative; top: calc(-1 * var(--s-9)); }

/* ---------- Cards ---------- */
.card {
  position: relative; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); align-content: start;
  padding: clamp(20px, 2.2vw, 32px); border-radius: var(--r-l); background: var(--paper); border: var(--hair) solid var(--rule);
}
.card__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-3) var(--s-4); }
.card__head > div:not(.segmented) { display: grid; gap: 4px; min-width: 0; }
.card__title { font-size: var(--fs-h4); font-weight: var(--w-semibold); line-height: var(--lh-snug); letter-spacing: var(--track-h3); }
.card__sub { font-size: var(--fs-small); color: var(--ink-3); line-height: 1.45; max-width: var(--measure); text-wrap: pretty; }
.card__sub:empty { display: none; }
.card .k-hand { margin-bottom: 2px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-4); }
.grid > .card--chart { grid-column: span 8; }
.grid > .card--ctx { grid-column: span 4; }
.grid > .card--stage { grid-column: span 8; }
.grid > .card--next { grid-column: span 4; }
.grid > .card--recent { grid-column: 1 / -1; }
.grid--abo > .card--billing { grid-column: span 7; }
.grid--abo > .card:not(.card--billing) { grid-column: span 5; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
@media (max-width: 1199px) {
  .grid > .card--chart, .grid > .card--ctx, .grid > .card--stage, .grid > .card--next, .grid--abo > .card--billing, .grid--abo > .card:not(.card--billing) { grid-column: 1 / -1; }
  .split { grid-template-columns: minmax(0, 1fr); }
}

/* Settings rows: label left, control right, hairline between. */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-6); padding: var(--s-4) 0; border-top: var(--hair) solid var(--rule); }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row__text { display: grid; gap: 2px; min-width: 0; max-width: 520px; }
.row__title { font-weight: var(--w-medium); }
.row__sub { font-size: var(--fs-small); color: var(--ink-3); line-height: 1.45; }
.row__ctl { flex: none; max-width: 100%; min-width: 0; }
@media (max-width: 639px) {
  .row { flex-direction: column; align-items: stretch; }
  .row__ctl { display: flex; }
  .row__ctl:has(.switch) { position: absolute; right: 0; }
  .row:has(.switch) { position: relative; padding-right: 64px; }
  .row__ctl .select, .row__ctl .select select { width: 100%; min-width: 0; }
}

/* ---------- Notices ---------- */
.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); padding: var(--s-4) var(--s-5);
  border-radius: var(--r-l); background: var(--tile-apricot); color: var(--on-tile);
}
.notice p { flex: 1 1 280px; font-size: var(--fs-small); line-height: 1.45; }
.notice__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--klar-black); flex: none; }
.notice .btn--ghost { border-color: var(--klar-black); color: var(--on-tile); }
.notice .btn--ghost:hover { background: color-mix(in srgb, var(--klar-white) 35%, transparent); }
.notice--info { background: var(--tile-sky); }
.settings-error { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-radius: var(--r-l); background: var(--paper); border: var(--hair) solid color-mix(in srgb, var(--negative) 45%, transparent); }
.settings-error p { flex: 1 1 240px; color: var(--negative); font-size: var(--fs-small); font-weight: var(--w-medium); }
[data-needs-settings][aria-busy="true"] { opacity: .5; pointer-events: none; }

/* ==========================================================================
   01 Übersicht
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.kpi {
  position: relative; overflow: hidden; isolation: isolate; display: grid; align-content: space-between; gap: var(--s-5);
  min-height: 184px; padding: var(--s-5); border-radius: var(--r-m); color: var(--on-tile);
}
.kpi:nth-child(1) { background: var(--tile-lime); }
.kpi:nth-child(2) { background: var(--tile-sky); }
.kpi:nth-child(3) { background: var(--tile-apricot); }
.kpi:nth-child(4) { background: var(--tile-sage); }
.kpi__shape { position: absolute; z-index: -1; right: -18px; bottom: -18px; width: 104px; height: 104px; color: color-mix(in srgb, var(--klar-black) 9%, transparent); }
.kpi__label { font-size: var(--fs-label); font-weight: var(--w-medium); letter-spacing: var(--track-label); text-transform: uppercase; }
.kpi__value { font-size: var(--fs-h2); font-weight: var(--w-medium); line-height: .95; letter-spacing: var(--track-h2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi__value--long { font-size: var(--fs-h3); letter-spacing: var(--track-h3); line-height: 1.05; }
.kpi__hint { font-size: var(--fs-micro); line-height: 1.4; max-width: 30ch; }
@media (max-width: 1199px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi { min-height: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .kpis.is-new .kpi { animation: tile-up var(--dur-l) var(--ease-klar) both; }
  .kpis.is-new .kpi:nth-child(2) { animation-delay: var(--stagger); } .kpis.is-new .kpi:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
  .kpis.is-new .kpi:nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
}
@keyframes tile-up { from { opacity: 0; transform: translateY(16px); } }

/* Chart */
.chart { position: relative; height: 220px; }
.card--chart { grid-template-rows: auto minmax(220px, 1fr) auto; }
.card--chart .chart { height: 100%; min-height: 220px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart__grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__bar { fill: var(--ink); transform-box: fill-box; transform-origin: bottom; }
.chart__col.is-today .chart__bar { fill: var(--accent); stroke: var(--klar-black); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart__hit { fill: transparent; }
.chart__col { outline: none; cursor: default; }
.chart__col:hover .chart__bar, .chart__col:focus .chart__bar { fill: var(--accent-ink); }
.chart__col:focus-visible .chart__hit { fill: var(--accent-soft); }
/* x-axis: HTML under the stretched SVG (its 26 px bottom padding), never squashed (VIS-1). */
.chart__axis { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; pointer-events: none; }
.chart__x { position: absolute; bottom: 2px; transform: translateX(-50%); color: var(--ink-3); font-size: var(--fs-label); line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart__x--end { right: 0; transform: none; }
.chart__tip {
  position: absolute; top: -6px; width: 160px; padding: 6px 10px; border-radius: var(--r-s); background: var(--stage); color: var(--stage-ink);
  font-size: var(--fs-micro); text-align: center; pointer-events: none; box-shadow: var(--shadow-float);
}
.chart__total { font-size: var(--fs-small); color: var(--ink-3); }
.chart__total b { color: var(--ink); font-weight: var(--w-semibold); }
@media (prefers-reduced-motion: no-preference) {
  .chart.is-new .chart__bar { animation: grow var(--dur-l) var(--ease-klar) both; animation-delay: calc(var(--i, 0) * 12ms); }
}
@keyframes grow { from { transform: scaleY(0); } }

.ctxbars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.ctxbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--s-3); align-items: baseline; }
.ctxbars__row { display: contents; font-size: var(--fs-small); }
.ctxbars__row b { font-variant-numeric: tabular-nums; font-weight: var(--w-semibold); }
.ctxbars__track { grid-column: 1 / -1; height: 10px; border-radius: var(--r-pill); background: var(--canvas-2); overflow: hidden; }
.ctxbars__track i { display: block; height: 100%; border-radius: inherit; background: var(--ink); transform-origin: left; }
.ctxbars li:first-child .ctxbars__track i { background: var(--accent); box-shadow: inset 0 0 0 1px var(--klar-black); }
.ctxbars small { grid-column: 1 / -1; font-size: var(--fs-micro); color: var(--ink-3); margin-top: -2px; }

/* Download: the dark stage */
.card--stage {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; align-content: center; gap: var(--s-5) var(--s-6);
  background: var(--stage); color: var(--stage-ink); border-color: var(--stage-rule); overflow: hidden;
  background-image: radial-gradient(circle at center, var(--stage-chip) 1px, transparent 1.5px); background-size: 12px 12px;
}
.card--stage.is-highlight { box-shadow: 0 0 0 3px var(--accent); }
.stage__copy { display: grid; gap: var(--s-2); }
.stage__hand { color: var(--klar-lime); }
.stage__title { font-size: var(--fs-h3); font-weight: var(--w-medium); line-height: var(--lh-heading); letter-spacing: var(--track-h3); }
.stage__sub { color: var(--stage-ink-2); font-size: var(--fs-small); }
.stage__sub [data-download-version] { display: inline-block; margin-left: 4px; padding: 0 8px; border-radius: var(--r-pill); border: var(--hair) solid var(--stage-rule); color: var(--stage-ink); font-variant-numeric: tabular-nums; }
.stage__dl { display: grid; gap: var(--s-2); }
.stage__error { grid-column: 1 / -1; color: var(--klar-coral); }
.dl {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); width: 100%; min-height: 64px; padding: 10px 16px;
  border: var(--hair) solid var(--stage-rule); border-radius: var(--r-m); background: var(--stage-2); color: var(--stage-ink); text-align: left; cursor: pointer;
  transition: background-color var(--dur-s) var(--ease-out), transform var(--dur-m) var(--ease-spring), border-color var(--dur-s) var(--ease-out);
}
.dl span { display: grid; gap: 2px; min-width: 0; }
.dl b { font-weight: var(--w-semibold); font-size: var(--fs-small); }
.dl small { color: var(--stage-ink-2); font-size: var(--fs-micro); }
.dl__icon { width: 22px; height: 22px; }
.dl__arrow { width: 18px; height: 18px; transition: transform var(--dur-m) var(--ease-spring); }
.dl:hover { border-color: var(--stage-ink-2); }
.dl:hover .dl__arrow { transform: translateY(2px); }
.dl.is-primary { background: var(--klar-lime); color: var(--klar-black); border-color: var(--klar-lime); }
.dl.is-primary small { color: var(--klar-black); }
.dl:focus-visible { outline: 2px solid var(--klar-lime); outline-offset: 3px; box-shadow: 0 0 0 6px var(--stage); }
@media (max-width: 719px) { .card--stage { grid-template-columns: minmax(0, 1fr); } }

.quick { list-style: none; margin: 0; padding: 0; display: grid; }
.quick a {
  display: flex; align-items: center; gap: var(--s-3); min-height: 52px; padding: 0 2px; border-top: var(--hair) solid var(--rule);
  text-decoration: none; font-size: var(--fs-small); font-weight: var(--w-medium);
}
.quick li:first-child a { border-top: 0; }
.quick a .k-glyph { width: 18px; height: 18px; }
.quick__go { margin-left: auto; transition: transform var(--dur-m) var(--ease-spring); }
.quick a:hover .quick__go { transform: translateX(4px); }

.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.recent li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-3) 0; border-top: var(--hair) solid var(--rule); }
.recent li:first-child { border-top: 0; padding-top: 0; }
.recent time { font-size: var(--fs-micro); color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 3px; }
.recent p { font-size: var(--fs-small); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent b { font-weight: var(--w-semibold); color: var(--ink); margin-right: 6px; }

/* ==========================================================================
   02 Profil
   ========================================================================== */
.inline-form { display: grid; gap: var(--s-4); }
.inline-form--row { grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; }
.inline-form--row .form__error { grid-column: 1 / -1; }
.inline-form--row > .btn { min-height: 44px; }
.input--grow { min-width: 0; }
@media (max-width: 639px) { .inline-form--row { grid-template-columns: minmax(0, 1fr); } .inline-form--row .select select { width: 100%; } }
.email-now { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-m); background: var(--canvas); }
.email-now__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--tile-sky); color: var(--on-tile); }
.email-now__icon .k-glyph { width: 18px; height: 18px; }
.email-now__addr { font-weight: var(--w-semibold); overflow-wrap: anywhere; min-width: 0; flex: 1 1 200px; }
/* Tags in the account at the label size (12 px, DS-1) – chrome.css sets 10 px for the shared parts. */
.konto .k-tag { height: auto; min-height: 22px; font-size: var(--fs-label); }
.k-tag[data-state="ok"] { background: var(--accent); color: var(--on-accent); border-color: var(--klar-black); }
.k-tag[data-state="warn"] { background: var(--tile-apricot); color: var(--on-tile); border-color: var(--klar-black); }
.pending { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-m); border: 1.5px dashed var(--field); }
.pending__text { flex: 1 1 260px; font-size: var(--fs-small); color: var(--ink-2); }
.pending__text b { color: var(--ink); }
.card > .btn { justify-self: start; }

/* ==========================================================================
   03 Diktat & Stil
   ========================================================================== */
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.level {
  position: relative; display: grid; align-content: start; gap: 6px; padding: var(--s-5); text-align: left; cursor: pointer;
  border: var(--hair) solid var(--rule-2); border-radius: var(--r-m); background: var(--paper); color: var(--ink);
  transition: border-color var(--dur-s) var(--ease-out), background-color var(--dur-s) var(--ease-out), transform var(--dur-m) var(--ease-spring);
}
.level:hover { border-color: var(--ink-3); }
.level b { font-size: var(--fs-h4); font-weight: var(--w-semibold); letter-spacing: var(--track-h3); }
.level > span:not(.level__dot):not(.level__sample) { font-size: var(--fs-small); color: var(--ink-2); line-height: 1.45; }
.level__dot { position: absolute; top: var(--s-5); right: var(--s-5); width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--field); }
.level__sample { margin-top: var(--s-2); padding-top: var(--s-3); border-top: var(--hair) dashed var(--rule-2); font-size: var(--fs-micro); color: var(--ink-3); line-height: 1.45; }
.level[aria-checked="true"] { background: var(--accent); border-color: var(--klar-black); color: var(--on-accent); }
.level[aria-checked="true"] > span:not(.level__dot), .level[aria-checked="true"] .level__sample { color: var(--on-accent); }
.level[aria-checked="true"] .level__sample { border-top-color: color-mix(in srgb, var(--klar-black) 30%, transparent); }
.level[aria-checked="true"] .level__dot { border-color: var(--klar-black); background: radial-gradient(circle, var(--klar-black) 0 4px, transparent 4.5px); }
@media (max-width: 799px) { .levels { grid-template-columns: minmax(0, 1fr); } }

.tones { list-style: none; margin: 0; padding: 0; display: grid; }
.tone {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon text sel" ". prev prev"; gap: var(--s-2) var(--s-4); align-items: center;
  padding: var(--s-4) 0; border-top: var(--hair) solid var(--rule);
}
.tone:first-child { border-top: 0; padding-top: 0; }
.tone__icon { grid-area: icon; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-s); background: var(--canvas-2); }
.tone:nth-child(1) .tone__icon { background: var(--tile-coral); color: var(--on-tile); }
.tone:nth-child(2) .tone__icon { background: var(--tile-sky); color: var(--on-tile); }
.tone:nth-child(3) .tone__icon { background: var(--tile-apricot); color: var(--on-tile); }
.tone:nth-child(4) .tone__icon { background: var(--tile-lilac); color: var(--on-tile); }
.tone:nth-child(5) .tone__icon { background: var(--tile-sage); color: var(--on-tile); }
.tone__icon .k-glyph { width: 20px; height: 20px; }
.tone__text { grid-area: text; min-width: 0; }
.tone__name { font-weight: var(--w-medium); }
.tone__ex { font-size: var(--fs-micro); color: var(--ink-3); }
.tone__select { grid-area: sel; }
.tone__select select { min-width: 170px; }
.tone__preview { grid-area: prev; font-size: var(--fs-small); color: var(--ink-2); line-height: 1.5; padding: var(--s-3) var(--s-4); border-radius: var(--r-s); background: var(--canvas); }
.tone__preview:empty { display: none; }
.tone__preview del { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--tile-coral); text-decoration-thickness: 2px; }
.tone__preview ins { text-decoration: none; color: var(--ink); background: linear-gradient(transparent 55%, var(--accent-soft) 0); }
.tone__preview .arrow { display: inline-block; margin: 0 6px; color: var(--ink-3); }
@media (prefers-reduced-motion: no-preference) {
  .tone__preview.is-new ins { animation: mark-in var(--dur-l) var(--ease-klar) both; }
}
@keyframes mark-in { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
.tone__preview ins { background-repeat: no-repeat; background-size: 100% 100%; }
@media (max-width: 639px) {
  .tone { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon text" "sel sel" "prev prev"; }
  .tone__select, .tone__select select { width: 100%; }
}

.apps { list-style: none; margin: 0; padding: 0; display: grid; }
.apps:empty { display: none; }
.apps li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-top: var(--hair) solid var(--rule); }
.apps li:first-child { border-top: 0; padding-top: 0; }
.apps__name { font-weight: var(--w-medium); overflow-wrap: anywhere; }
.apps__name small { display: block; font-weight: var(--w-regular); color: var(--ink-3); font-size: var(--fs-micro); }
.apps .select select { width: 16rem; min-width: 0; max-width: 100%; }
.apps__empty { color: var(--ink-3); font-size: var(--fs-small); }
@media (max-width: 639px) { .apps li { grid-template-columns: minmax(0, 1fr) auto; } .apps .select { grid-column: 1 / -1; grid-row: 2; } .apps .select select { width: 100%; min-width: 0; } }
.iconbtn {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0; border: var(--hair) solid transparent; border-radius: 50%;
  background: transparent; color: var(--ink-2); cursor: pointer; transition: background-color var(--dur-s) var(--ease-out), color var(--dur-s) var(--ease-out);
}
.iconbtn .k-glyph { width: 16px; height: 16px; }
.iconbtn:hover { background: var(--canvas-2); color: var(--ink); }
.iconbtn--danger:hover { color: var(--negative); }

.link-row {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-l);
  border: 1.5px dashed var(--rule-2); text-decoration: none; color: var(--ink);
}
.link-row span { display: grid; gap: 2px; }
.link-row small { font-size: var(--fs-micro); color: var(--ink-3); }
.link-row .k-glyph { width: 20px; height: 20px; flex: none; }
.link-row__go { margin-left: auto; transition: transform var(--dur-m) var(--ease-spring); }
.link-row:hover { border-color: var(--ink); }
.link-row:hover .link-row__go { transform: translateX(4px); }

/* ==========================================================================
   04 Wörterbuch & Textbausteine
   ========================================================================== */
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2) var(--s-3); align-items: center; padding: var(--s-3) 0; border-top: var(--hair) solid var(--rule); }
.list__main { display: grid; gap: 2px; min-width: 0; }
.list__term { font-weight: var(--w-semibold); overflow-wrap: anywhere; }
.list__sub { font-size: var(--fs-micro); color: var(--ink-3); overflow-wrap: anywhere; }
.list__trigger { display: inline-flex; justify-self: start; padding: 2px 10px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: var(--fs-micro); font-weight: var(--w-semibold); }
.list__text { font-size: var(--fs-small); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.list__actions { display: flex; gap: 2px; }
.list__empty { padding: var(--s-5) 0 0; color: var(--ink-3); font-size: var(--fs-small); border-top: var(--hair) solid var(--rule); }
.list .inline-form { grid-column: 1 / -1; padding: var(--s-3); border-radius: var(--r-m); background: var(--canvas); }
@media (prefers-reduced-motion: no-preference) { .list > li.is-new { animation: tile-up var(--dur-m) var(--ease-out) both; } }

.search {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: var(--hair) solid var(--field);
  border-radius: var(--r-pill); background: var(--paper); flex: 1 1 260px; min-width: 0;
}
.search .k-glyph { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.search input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; outline: none; font-size: var(--fs-small); }
.search:focus-within { border-color: var(--ink); outline: 2px solid var(--focus); outline-offset: 1px; box-shadow: 0 0 0 5px var(--focus-halo); }
.search input:focus-visible { outline: none; box-shadow: none; }
.search--list { flex: none; }

/* ==========================================================================
   05 Verlauf
   ========================================================================== */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.toolbar .btn--danger { margin-left: auto; }
.history { display: grid; gap: var(--s-3); }
.history__day { position: sticky; top: calc(var(--nav-top) + var(--nav-h) + var(--s-3)); z-index: 1; justify-self: start; margin-top: var(--s-4); padding: 4px 12px; border-radius: var(--r-pill); background: var(--ink); color: var(--canvas); font-size: var(--fs-label); font-weight: var(--w-medium); letter-spacing: var(--track-label); text-transform: uppercase; }
@media (max-width: 959px) { .history__day { top: calc(var(--nav-top) + var(--nav-h) + 64px); } }
.history__empty { padding: var(--s-8) var(--s-5); text-align: center; color: var(--ink-3); border: 1.5px dashed var(--rule-2); border-radius: var(--r-l); }
.entry { display: grid; gap: var(--s-3); padding: var(--s-5); border-radius: var(--r-l); background: var(--paper); border: var(--hair) solid var(--rule); transition: opacity var(--dur-m) var(--ease-out), transform var(--dur-m) var(--ease-out); }
.entry.is-gone { opacity: 0; transform: translateX(16px); }
.entry.is-fresh { box-shadow: 0 0 0 2px var(--accent); }
.entry__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s-3); font-size: var(--fs-micro); color: var(--ink-3); }
.entry__time { color: var(--ink); font-weight: var(--w-semibold); font-variant-numeric: tabular-nums; }
.entry__app { color: var(--ink); font-weight: var(--w-medium); }
.entry__nums { font-variant-numeric: tabular-nums; }
.entry__cost { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-pill); background: var(--tile-sky); color: var(--on-tile); font-weight: var(--w-medium); }
.chip--line { background: transparent; border: var(--hair) solid var(--rule-2); color: var(--ink-2); }
.entry__text { font-size: var(--fs-body); line-height: var(--lh-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.entry__text i { font-style: normal; color: var(--ink-3); }
.entry__note { font-size: var(--fs-small); color: var(--negative); }
.entry__sent { font-size: var(--fs-micro); color: var(--ink-3); }
.entry__sent a { color: var(--ink-2); }
.entry__diff { padding: var(--s-4); border-radius: var(--r-m); background: var(--canvas); line-height: 1.75; font-size: var(--fs-small); overflow-wrap: anywhere; }
.entry__diff del { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--tile-coral); text-decoration-thickness: 2px; }
.entry__diff ins { text-decoration: none; background: var(--accent-soft); border-radius: 3px; padding: 0 2px; }
.entry__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.entry__actions button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: var(--hair) solid var(--rule-2); border-radius: var(--r-pill);
  background: transparent; color: var(--ink); font-size: var(--fs-micro); font-weight: var(--w-medium); cursor: pointer;
}
.entry__actions button:hover { background: var(--canvas-2); border-color: var(--ink-3); }
.entry__actions button[aria-expanded="true"] { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.entry__actions [data-act="delete"] { margin-left: auto; color: var(--negative); }
.rewrite { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-m); background: var(--canvas); }
.rewrite .select select { min-width: 150px; }
.rewrite__hint { flex-basis: 100%; font-size: var(--fs-micro); color: var(--ink-3); }

/* ==========================================================================
   06 Geräte
   ========================================================================== */
.sessions { list-style: none; margin: 0; padding: 0; display: grid; }
.session { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: var(--s-4) 0; border-top: var(--hair) solid var(--rule); }
.session:first-child { border-top: 0; padding-top: 0; }
.session__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-m); background: var(--tile-steel); color: var(--on-tile); }
.session__icon .k-glyph { width: 22px; height: 22px; }
.session.is-current .session__icon { background: var(--accent); }
.session__main { display: grid; gap: 2px; min-width: 0; }
.session__name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: var(--w-semibold); overflow-wrap: anywhere; }
.session__meta { font-size: var(--fs-micro); color: var(--ink-3); }
.sessions__empty { color: var(--ink-3); font-size: var(--fs-small); }
@media (prefers-reduced-motion: no-preference) { .session.is-gone { opacity: 0; transform: translateX(16px); transition: opacity var(--dur-m) var(--ease-out), transform var(--dur-m) var(--ease-out); } }
@media (max-width: 559px) { .session { grid-template-columns: auto minmax(0, 1fr); } .session > .btn { grid-column: 2; justify-self: start; } }

/* ==========================================================================
   07 Abo & Zahlung
   ========================================================================== */
.plan {
  position: relative; display: grid; gap: var(--s-3); padding: clamp(28px, 3.5vw, 56px); border-radius: var(--r-xl);
  background: var(--tile-lime); color: var(--on-accent); overflow: hidden; isolation: isolate;
}
.plan::after {
  content: ""; position: absolute; z-index: -1; right: -40px; bottom: -60px; width: 240px; height: 240px; border-radius: 50% 50% 0 0;
  background: color-mix(in srgb, var(--klar-black) 8%, transparent);
}
.plan .corner { background: var(--klar-black); }
.plan__label { color: var(--on-accent); }
.plan__name { font-size: var(--fs-display); font-weight: var(--w-medium); line-height: var(--lh-display); letter-spacing: var(--track-display); }
.plan__sub { font-size: var(--fs-lead); letter-spacing: var(--track-lead); max-width: var(--measure); }
.plan__meta { font-size: var(--fs-small); max-width: var(--measure); }
.plan__meta:empty { display: none; }
.billing__body { display: grid; gap: var(--s-4); }
.balance { display: grid; gap: 2px; padding: var(--s-4) var(--s-5); border-radius: var(--r-m); background: var(--canvas); }
.balance__label { font-size: var(--fs-micro); color: var(--ink-3); }
.balance__value { font-size: var(--fs-h3); font-weight: var(--w-medium); letter-spacing: var(--track-h3); font-variant-numeric: tabular-nums; }
.billing__h { display: grid; gap: 2px; font-weight: var(--w-semibold); margin-top: var(--s-2); }
.billing__h small { font-weight: var(--w-regular); color: var(--ink-3); font-size: var(--fs-micro); }
.billing__note { font-size: var(--fs-small); color: var(--ink-2); padding-left: var(--s-3); border-left: 3px solid var(--accent); }
.billing__cancel a { font-size: var(--fs-small); }
.pro-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.packs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.pack {
  display: grid; gap: 2px; padding: var(--s-4); border: var(--hair) solid var(--rule-2); border-radius: var(--r-m); background: var(--paper); color: var(--ink);
  text-align: left; cursor: pointer; transition: border-color var(--dur-s) var(--ease-out), background-color var(--dur-s) var(--ease-out), transform var(--dur-m) var(--ease-spring);
}
.pack b { font-size: var(--fs-h4); font-weight: var(--w-semibold); font-variant-numeric: tabular-nums; }
.pack span { font-size: var(--fs-micro); color: var(--ink-3); }
.pack:hover { border-color: var(--ink); background: var(--accent); color: var(--on-accent); }
.pack:hover span { color: var(--on-accent); }
@media (max-width: 479px) { .packs-grid { grid-template-columns: minmax(0, 1fr); } }
.founder { display: grid; gap: var(--s-2); padding: var(--s-5); border-radius: var(--r-m); background: var(--tile-sky); color: var(--on-tile); font-size: var(--fs-small); }
.founder__title { font-weight: var(--w-semibold); font-size: var(--fs-body); }
.ledger { list-style: none; margin: 0; padding: 0; display: grid; }
.ledger li { display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) 0; border-top: var(--hair) solid var(--rule); font-size: var(--fs-small); }
.ledger li:first-child { border-top: 0; padding-top: 0; }
.ledger span { display: grid; gap: 2px; min-width: 0; }
.ledger small { color: var(--ink-3); font-size: var(--fs-micro); }
.ledger b { font-variant-numeric: tabular-nums; font-weight: var(--w-semibold); white-space: nowrap; }
.ledger .pos { color: var(--positive); }
.ledger__empty { color: var(--ink-3); }
.cancel-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-radius: var(--r-l); border: 1.5px dashed var(--rule-2); }
.cancel-row p { font-size: var(--fs-small); color: var(--ink-2); flex: 1 1 280px; }
.cancel-row b { color: var(--ink); }
.is-highlight { animation: none; }

/* ==========================================================================
   08 Datenschutz & Daten
   ========================================================================== */
.data__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.tilebtn {
  display: grid; justify-items: start; gap: 4px; padding: var(--s-5); border: var(--hair) solid var(--rule-2); border-radius: var(--r-m);
  background: var(--canvas); color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color var(--dur-s) var(--ease-out), background-color var(--dur-s) var(--ease-out), transform var(--dur-m) var(--ease-spring);
}
.tilebtn .k-glyph { width: 24px; height: 24px; margin-bottom: var(--s-3); }
.tilebtn b { font-weight: var(--w-semibold); }
.tilebtn small { font-size: var(--fs-micro); color: var(--ink-3); }
.tilebtn:hover { border-color: var(--ink); background: var(--paper); }
.tilebtn:active { transform: scale(.98); }
@media (max-width: 559px) { .data__actions { grid-template-columns: minmax(0, 1fr); } }
.card--danger { border-color: color-mix(in srgb, var(--negative) 35%, transparent); }
.delete-form { display: grid; gap: var(--s-4); padding: var(--s-5); border-radius: var(--r-m); background: color-mix(in srgb, var(--negative) 7%, var(--paper)); }
.delete-form > p { font-size: var(--fs-small); color: var(--ink-2); max-width: var(--measure); }
.delete-form .form__error { color: var(--negative); }

/* ==========================================================================
   Dialog & toasts
   ========================================================================== */
.dlg {
  width: min(460px, calc(100vw - 32px)); padding: 0; border: var(--hair) solid var(--rule); border-radius: var(--r-xl);
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lift);
}
.dlg::backdrop { background: rgb(11 11 11 / .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dlg__body { display: grid; gap: var(--s-4); padding: clamp(24px, 4vw, 36px); margin: 0; }
.dlg__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--tile-coral); color: var(--on-tile); font-weight: var(--w-semibold); font-size: var(--fs-h3); }
.dlg__icon:empty { display: none; }
.dlg__title { font-size: var(--fs-h3); font-weight: var(--w-medium); line-height: var(--lh-heading); letter-spacing: var(--track-h3); }
.dlg__text { color: var(--ink-2); font-size: var(--fs-small); }
.dlg__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-2); }
.dlg :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-halo); }
@media (prefers-reduced-motion: no-preference) {
  .dlg[open] { animation: dlg-in var(--dur-m) var(--ease-klar); }
}
@keyframes dlg-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.toasts { position: fixed; z-index: var(--z-toast); left: 50%; bottom: max(var(--s-5), env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: var(--s-2); justify-items: center; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 12px 18px; border-radius: var(--r-pill);
  background: var(--stage); color: var(--stage-ink); font-size: var(--fs-small); font-weight: var(--w-medium); box-shadow: var(--shadow-float);
  opacity: 0; transform: translateY(12px) scale(.96); transition: opacity var(--dur-s) var(--ease-out), transform var(--dur-m) var(--ease-spring);
}
.toast::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--stage-ink-2); }
.toast--ok::before { background: var(--klar-lime); }
.toast--error::before { background: var(--klar-coral); }
.toast.is-on { opacity: 1; transform: none; }

/* ---------- Reduced motion: every state is the calm end state ---------- */
@media (prefers-reduced-motion: reduce) {
  .konto *, .konto *::before, .konto *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; }
  .loading__mark i { animation: none; }
}
/* Narrow screens: a segmented control in a settings row takes the full width and may wrap instead of scrolling. */
@media (max-width: 639px) {
  .row__ctl .segmented { width: 100%; flex-wrap: wrap; border-radius: var(--r-m); overflow: visible; }
  .row__ctl .segmented button { flex: 1 1 auto; padding: 0 12px; }
}
/* Signed in on a phone the pill holds brand, theme and „Abmelden“: the brand already leads to the website. */
@media (max-width: 479px) {
  .konto .k-nav__back { display: none; }
}
@media (max-width: 359px) {
  .konto .k-nav__section { display: none; }
  .konto .k-nav__bar { gap: var(--s-2); }
}
