/*
  Kikoń UI – gemeinsame Bausteine (Version 1, 22.11.2026). Braucht tokens/kikon.css davor und components/kikon-ui.js danach.
  Kein Build-Schritt. Namen beginnen mit k- (Komponente) oder is- (Zustand).
  Grundregel: Die BAUSTEIN-KACHEL (Kerbe oben, Nase unten) ist die Formensprache für alles, was man antippt oder auswählt
  (Schaltflächen, Umschalter, Steuerkreuz, Aufgaben). Karten und Felder bleiben ruhig rechteckig (Ecke 14 px).
*/

/* ---------- Grund ---------- */
.k-body {
  margin: 0; min-height: 100vh;
  background: var(--k-blue); color: var(--k-cream);
  font-family: var(--k-font); font-weight: var(--k-w-light); line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.k-body::before {                       /* Blaupausen-Raster wie im App-Symbol */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--k-grid) 1px, transparent 1px), linear-gradient(90deg, var(--k-grid) 1px, transparent 1px);
  background-size: 48px 48px; background-position: center top;
}
.k-body.is-ink { background: var(--k-ink); }                  /* dichte Werkzeug-Oberflächen (Face Tracker, Messtool) */
.k-body.is-ink::before { display: none; }
.k-body *, .k-body *::before, .k-body *::after { box-sizing: border-box; }
.k-body a { color: var(--k-gold); }
.k-body h1, .k-body h2, .k-body h3 { font-weight: var(--k-w-regular); color: var(--k-gold); margin: 0; line-height: 1.2; }
.k-body [hidden] { display: none !important; }
.k-num { font-family: var(--k-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.k-eyebrow { font-size: .78rem; letter-spacing: var(--k-track-eyebrow); text-transform: uppercase; color: var(--k-gold-soft); }
.k-rule { width: 56px; height: 1px; margin: 0 auto; background: linear-gradient(90deg, transparent, var(--k-gold-deep), transparent); }
.k-i { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.k-i.is-fill { fill: currentColor; stroke: none; }

/* ---------- Fokus (immer sichtbar) ---------- */
.k-body :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--k-focus); outline-offset: 3px; }

/* ---------- Baustein-Kachel ---------- */
.k-brick { position: relative; display: block; text-decoration: none; color: inherit; font: inherit; }
.k-brick > svg.k-shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.k-brick > svg.k-shape path {
  fill: var(--k-surface); stroke: var(--k-gold-deep); stroke-width: 1.5; vector-effect: non-scaling-stroke;
  transition: fill var(--k-t) var(--k-ease), stroke var(--k-t) var(--k-ease);
}
.k-brick > .k-in { position: absolute; inset: 14% 8% 16%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.k-brick[style*="--c"] > svg.k-shape path { stroke: var(--c); }           /* Gruppenfarbe als Rand */
.k-brick.is-fill > svg.k-shape path { fill: var(--c, var(--g-ablauf)); stroke: var(--k-gold-deep); }
.k-brick.is-fill { color: var(--on, var(--k-cream)); }
.k-brick.is-dashed > svg.k-shape path { stroke-dasharray: 6 5; stroke: var(--k-gold); }

/* Kachel als Schaltfläche */
button.k-brick, a.k-brick.is-action { cursor: pointer; background: none; border: 0; padding: 0; min-width: var(--k-touch); min-height: var(--k-touch);
  transition: transform 90ms var(--k-ease); }
button.k-brick:hover > svg.k-shape path, a.k-brick.is-action:hover > svg.k-shape path { fill: rgba(15, 42, 71, .86); stroke: var(--k-gold); }
button.k-brick:active { transform: translateY(1px) scale(.985); }
.k-brick.is-on > svg.k-shape path { fill: rgba(240, 194, 122, .2); stroke: var(--k-gold); stroke-width: 2; }
.k-brick.is-on { color: var(--k-gold); }
.k-brick:disabled, .k-brick[aria-disabled="true"] { opacity: .5; cursor: default; }
.k-brick .k-label { font-size: .86rem; font-weight: var(--k-w-regular); letter-spacing: .06em; line-height: 1.15; }
.k-brick .k-sub { font-size: .74rem; opacity: .8; letter-spacing: .04em; }

/* Raster aus Kacheln (Steuerkreuz, Umschalter, Aufgaben) */
.k-tiles { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.k-tiles > * { aspect-ratio: var(--ratio, 1.25); min-height: 52px; }
.k-tiles .span2 { grid-column: span 2; aspect-ratio: auto; }
.k-tiles .span3 { grid-column: span 3; aspect-ratio: auto; }
.k-tiles.is-flat > * { aspect-ratio: auto; min-height: 56px; }      /* flache Tasten (Text) */

/* Auswahl-Kachel (Radio): <label class="k-brick k-choice"><input type="radio"><span class="k-in">…</span></label> */
label.k-choice { cursor: pointer; }
label.k-choice > input { position: absolute; opacity: 0; pointer-events: none; }
label.k-choice:has(input:checked) > svg.k-shape path { fill: rgba(240, 194, 122, .2); stroke: var(--k-gold); stroke-width: 2; }
label.k-choice:has(input:checked) { color: var(--k-gold); }
label.k-choice:has(input:focus-visible) { outline: 2px solid var(--k-focus); outline-offset: 3px; border-radius: 12px; }
label.k-choice:hover > svg.k-shape path { stroke: var(--k-gold); }

/* ---------- Knöpfe (Textknöpfe außerhalb von Kachelrastern) ---------- */
.k-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--k-touch);
  padding: 11px 22px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  font: inherit; font-weight: var(--k-w-regular); letter-spacing: var(--k-track-btn);
  background: linear-gradient(180deg, #f3cf8f, var(--k-gold-deep)); color: #1a1205;
  transition: filter var(--k-t) var(--k-ease), transform 90ms var(--k-ease);
}
.k-btn:hover { filter: brightness(1.06); }
.k-btn:active { transform: translateY(1px); }
.k-btn.is-ghost { background: transparent; color: var(--k-gold); border: 1px solid var(--k-gold-deep); }
.k-btn.is-ghost:hover { background: rgba(240, 194, 122, .1); filter: none; }
.k-btn.is-block { width: 100%; }
.k-btn:disabled, .k-btn[aria-disabled="true"] { opacity: .55; cursor: default; }

/* ---------- Karte / Abschnitt ---------- */
.k-card { background: var(--k-surface); border: 1px solid var(--k-line); border-radius: var(--k-r); padding: 16px; backdrop-filter: blur(8px); }
.k-card.is-accent { border-left: 4px solid var(--c, var(--k-gold-deep)); }
.k-card > h2, .k-card > .k-h { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; font-size: .8rem; letter-spacing: var(--k-track-label);
  text-transform: uppercase; color: var(--k-gold); font-weight: var(--k-w-regular); }
.k-card > h2 em { margin-left: auto; font-style: normal; text-transform: none; letter-spacing: .04em; color: var(--k-cream-dim); font-size: .8rem; }
.k-hint { color: var(--k-cream-dim); font-size: .82rem; line-height: 1.45; margin-top: 10px; }

/* ---------- Kopf ---------- */
.k-header { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--k-line);
  background: rgba(9, 28, 51, .72); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.k-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; letter-spacing: .28em; text-transform: uppercase; font-size: .85rem; color: var(--k-cream); }
.k-brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.k-brand small { display: block; letter-spacing: .2em; color: var(--k-gold-soft); font-size: .68rem; margin-top: 2px; }
.k-spacer { flex: 1; }

/* ---------- Marken, Chips, Punkte ---------- */
.k-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 18px; font-size: .8rem; letter-spacing: .08em; white-space: nowrap; color: var(--k-cream);
  background: var(--kb-chip) center / 100% 100% no-repeat; border: 0; min-height: 32px; justify-content: center; }          /* kleiner Baustein, kein Pillen-Rund */
.k-chip.is-gold { color: var(--k-gold); }
.k-chip.is-glass { background-image: var(--kb-chip); }
.k-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--k-bad); flex: none; }
.k-dot.is-ok { background: var(--k-ok); box-shadow: 0 0 0 4px rgba(46, 154, 78, .22); }
.k-dot.is-busy { background: var(--k-warn); animation: k-pulse 1.1s infinite; }
@keyframes k-pulse { 50% { opacity: .35; } }
.k-ok { color: var(--k-ok-text); } .k-warn { color: var(--k-warn-text); } .k-bad { color: var(--k-bad-text); } .k-info { color: var(--k-info-text); }

/* ---------- Felder ---------- */
.k-field { display: block; margin-top: 12px; color: var(--k-cream-dim); font-size: .8rem; letter-spacing: .06em; }
.k-field input[type=text], .k-field input[type=password], .k-field input[type=number], .k-field select {
  width: 100%; margin-top: 6px; min-height: var(--k-touch); padding: 10px 12px; border-radius: var(--k-r-s);
  border: 1px solid var(--k-line-strong); background: var(--k-ink-deep); color: var(--k-cream); font: inherit; font-weight: var(--k-w-regular); }
.k-field input:focus { border-color: var(--k-gold); }
.k-field input::placeholder { color: rgba(244, 234, 216, .5); }

/* ---------- Messwerte ---------- */
.k-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.k-stat { padding: 10px 12px; border-radius: var(--k-r-s); background: var(--k-surface-2); border: 1px solid var(--k-line); }
.k-stat dt { color: var(--k-cream-dim); font-size: .74rem; letter-spacing: var(--k-track-label); text-transform: uppercase; display: flex; gap: 6px; align-items: center; }
.k-stat dd { margin: 4px 0 0; font-size: 1.1rem; color: var(--k-cream); font-weight: var(--k-w-regular); }
.k-stat.is-wide { grid-column: span 2; }
.k-meter { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 8px; }
.k-meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--k-gold-deep), var(--k-gold)); }

/* ---------- Aufklapper ---------- */
.k-card details summary { cursor: pointer; color: var(--k-cream-dim); font-size: .82rem; margin-top: 14px; list-style: none; display: flex; align-items: center; gap: 6px; }
.k-card details summary::-webkit-details-marker { display: none; }
.k-card details[open] summary .k-chev { transform: rotate(180deg); }
.k-chev { transition: transform var(--k-t) var(--k-ease); }

/* ---------- Eintritt (sparsam, nur beim Laden) ---------- */
@keyframes k-rise { from { opacity: .001; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.k-rise { animation: k-rise .6s var(--k-ease) both; }
