/* KARAI Cockpit – CSS-Grundlage (AP-01)
   Farben und Schrift aus karai-website/assets/css/site.css, Bausteine aus den Mockups (docs/konzept/05).
   Regeln: mobile-first; jedes Bedienelement mindestens 44 px hoch (--touch); kein waagrechtes Scrollen ab 320 px;
   keine Inline-Stile (CSP). */

@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --navy: #0B1733; --navy-2: #12224A; --navy-line: #24356A; --on-navy: #EEF2FA; --on-navy-2: #A9B5D3;
  --paper: #F5F7FB; --paper-2: #EEF1F7; --white: #FFFFFF;
  --ink: #0B1733; --ink-2: #48536F; --ink-3: #59647F; --line: #DEE3EE; --line-2: #C9D1E2;
  --violet: #7B2FF7; --blue: #0B6CF2; --cyan: #0AA2FF; --link: #0A5FD8;
  --ok: #1E8A5C; --ok-bg: #E3F5EC; --warn: #8A5A00; --warn-bg: #FFF2D6; --bad: #B4233C; --bad-bg: #FDE6EA; --info-bg: #E6F0FF;
  --f-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --touch: 44px;
  --r: 12px; --r-sm: 10px;
  --abstand: 14px;
  --shadow: 0 1px 2px rgba(11, 23, 51, .06), 0 14px 36px -18px rgba(11, 23, 51, .28);
  color-scheme: light; accent-color: var(--blue);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-2) var(--paper); }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--f-sans); -webkit-font-smoothing: antialiased; caret-color: var(--blue); }
::selection { background: rgba(11, 108, 242, .18); color: var(--ink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.25rem; } h2 { font-size: 1.0625rem; } h3 { font-size: 0.9375rem; }
p { margin: 0; text-wrap: pretty; overflow-wrap: anywhere; }
a { color: var(--link); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--white); color: var(--ink); padding: 10px 14px; border-radius: 8px; min-height: var(--touch); display: inline-flex; align-items: center; }
.skip:focus { top: 8px; }

/* ---------- Rahmen ---------- */
.testband { background: var(--warn-bg); color: var(--warn); font-size: 0.8125rem; font-weight: 500; text-align: center; padding: 6px 12px; overflow-wrap: anywhere; }
.kopf { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.marke { display: inline-flex; align-items: center; gap: 10px; min-height: var(--touch); color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -0.02em; }
.marke .logo { width: 30px; height: 30px; flex: none; }
.inhalt { width: 100%; max-width: 1100px; margin: 0 auto; padding: var(--abstand); display: grid; gap: var(--abstand); }

/* ---------- Bausteine ---------- */
.panel { background: var(--white); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); min-width: 0; }
.panel-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 16px 6px; }
.panel-kopf > :first-child { margin-right: auto; }
.panel-inhalt { padding: 6px 16px 16px; }
.meldung { padding: 18px 16px; display: grid; gap: 12px; }
.stapel { display: grid; gap: 12px; }
.zeile { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.hinweis { font-size: 0.875rem; color: var(--ink-3); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 0; font-size: 0.9375rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; background: var(--paper-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--link); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch); padding: 0 18px; border: 0; border-radius: var(--r-sm); font-weight: 500; font-size: 0.9375rem; text-decoration: none; cursor: pointer; transition: transform 140ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease; }
.btn:active { transform: scale(0.97); }
.btn-primary { color: #fff; background: var(--blue); box-shadow: 0 1px 1px rgba(11, 23, 51, .2), 0 8px 18px -10px rgba(11, 108, 242, .8); }
.btn-primary:hover { background: #075CD4; }
.btn-line { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-line:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.btn-danger { background: var(--white); color: var(--bad); box-shadow: inset 0 0 0 1px #F0B7C2; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.feld { display: grid; gap: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); flex: 1 1 200px; min-width: 0; }
.eingabe { width: 100%; min-height: var(--touch); padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: var(--white); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 1rem; color: var(--ink); }
.eingabe:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.eingabe:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue); }

@media (min-width: 900px) {
  .kopf { padding: 10px 24px; }
  .inhalt { padding: 22px 24px 32px; gap: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- AP-02: Anmeldung, Konto ---------- */
.kopf-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.kopf-nav form { margin: 0; }
.kopf-link { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.btn-klein { padding: 0 14px; font-size: 0.875rem; }
.schmal { width: 100%; max-width: 440px; margin: 0 auto; }
.formular { display: grid; gap: 14px; }
.formular .feld { flex: none; }
.otp-eingabe { font: 600 1.375rem var(--f-mono); letter-spacing: .3em; text-align: center; }
.meldung-fehler { padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-bg); color: var(--bad); font-size: 0.9375rem; }
.meldung-ok { padding: 10px 12px; border-radius: var(--r-sm); background: var(--ok-bg); color: var(--ok); font-size: 0.9375rem; }
.meldung-info { padding: 10px 12px; border-radius: var(--r-sm); background: var(--info-bg); color: var(--ink); font-size: 0.9375rem; }
.qr { width: 100%; max-width: 220px; aspect-ratio: 1; background: #fff; padding: 6px; border-radius: var(--r-sm); box-shadow: 0 0 0 1px var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.geheimnis { font: 500 1rem var(--f-mono); letter-spacing: .04em; overflow-wrap: anywhere; padding: 10px 12px; background: var(--paper-2); border-radius: var(--r-sm); }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px; background: var(--paper-2); border-radius: var(--r-sm); font: 500 1rem var(--f-mono); list-style: none; margin: 0; }
.einmal { font: 600 1.25rem var(--f-mono); letter-spacing: .06em; text-align: center; padding: 14px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn); overflow-wrap: anywhere; }
.haken { display: flex; align-items: center; gap: 10px; min-height: var(--touch); font-size: 0.9375rem; cursor: pointer; }
.haken input { width: 22px; height: 22px; margin: 0; flex: none; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.liste > li:first-child { border-top: 0; }
.liste .t { flex: 1 1 200px; min-width: 0; }
.liste .t b { display: block; font-weight: 500; }
.liste .t span { display: block; font-size: 0.875rem; color: var(--ink-3); }
.liste form { margin: 0; }
details.aufklapp > summary { min-height: var(--touch); display: flex; align-items: center; cursor: pointer; font-weight: 500; color: var(--link); }
.raster { display: grid; gap: var(--abstand); }
@media (min-width: 900px) { .raster.zwei { grid-template-columns: 1fr 1fr; align-items: start; } }
pre.post { white-space: pre-wrap; overflow-wrap: anywhere; font: 0.8125rem/1.5 var(--f-mono); background: var(--paper-2); padding: 10px 12px; border-radius: var(--r-sm); margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.marke span { white-space: nowrap; }
.kopf-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; display: inline-block; line-height: var(--touch); }
@media (max-width: 380px) { .marke span { display: none; } }

/* ---------- AP-04: Organisationen, Kontakte, Verlauf ---------- */
.linkbtn { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 4px; color: var(--link); text-underline-offset: 3px; }
.liste .t b { overflow-wrap: anywhere; }
.liste .t b a { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--touch); max-width: 100%; }
.liste .t b a:hover { color: var(--link); text-decoration: underline; }
.liste .t span { overflow-wrap: anywhere; }
.feld-kurz { flex: 0 1 120px; }
.formular .zeile > .feld { flex: 1 1 160px; }
.formular .zeile > .feld-kurz { flex: 0 1 120px; }
textarea.eingabe { min-height: 6rem; resize: vertical; line-height: 1.45; }
fieldset.gruppe { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
fieldset.gruppe + fieldset.gruppe { padding-top: 14px; border-top: 1px solid var(--line); }
fieldset.gruppe legend { padding: 0 0 4px; font-weight: 600; font-size: 0.9375rem; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch); padding: 0 14px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 0.9375rem; font-weight: 500; color: var(--ink); cursor: pointer; }
.chip input { width: 20px; height: 20px; margin: 0; flex: none; }
.chip:has(input:checked) { background: var(--info-bg); box-shadow: inset 0 0 0 1px var(--blue); }
.chip:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.meldung-warn { padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--ink); font-size: 0.9375rem; display: grid; gap: 6px; }
.punkte { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.punkte li { overflow-wrap: anywhere; }
.punkte a { display: inline-flex; align-items: center; min-height: var(--touch); }
.kirow { display: grid; gap: 10px; padding: 12px; border-radius: var(--r-sm); background: var(--paper); font-size: 0.9375rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { display: grid; gap: 2px; font-size: 0.9375rem; padding-left: 12px; border-left: 2px solid var(--line); }
.timeline .tl-kopf { font-size: 0.8125rem; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.timeline .tl-text { overflow-wrap: anywhere; }
.trenner { padding-top: 14px; border-top: 1px solid var(--line); }
@media (min-width: 600px) { .timeline li { grid-template-columns: 9.5rem 1fr; gap: 12px; } .kirow { grid-template-columns: 1fr auto; align-items: start; } }

/* ---------- AP-05: Opportunities (Kanban nach Mockup 05: Handy = Liste mit Stufen-Reitern, ab 900 px fünf Spalten) ---------- */
a.chip { text-decoration: none; }
a.chip[aria-current] { background: var(--navy); color: var(--on-navy); box-shadow: none; }
a.chip .num { font-size: 0.75rem; opacity: .8; }
.umschalter, .stufen-reiter { display: flex; flex-wrap: wrap; gap: 6px; }
.board { display: grid; gap: 10px; min-width: 0; }
.spalte { display: none; gap: 10px; align-content: start; min-width: 0; }
.spalte.aktiv { display: grid; }
.spalte > h2 { display: none; }
.karten { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.opp { background: var(--white); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); padding: 12px 14px; display: grid; gap: 6px; min-width: 0; }
.opp b { font-weight: 500; overflow-wrap: anywhere; }
.opp b a { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--touch); max-width: 100%; }
.opp b a:hover { color: var(--link); text-decoration: underline; }
.opp .meta, .opp .next { font-size: 0.8125rem; color: var(--ink-3); overflow-wrap: anywhere; }
.opp .next { color: var(--ink-2); }
.opp .pills { display: flex; flex-wrap: wrap; gap: 6px; }
.opp .aktionen { display: flex; flex-wrap: wrap; gap: 8px; }
.opp .aktionen form { margin: 0; }
.opp .aktionen .btn { white-space: normal; text-align: center; }
.panel-kopf .pill + .pill { margin-left: 0; }
@media (min-width: 900px) {
  .stufen-reiter { display: none; }
  .board { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; }
  .spalte, .spalte.aktiv { display: grid; background: var(--paper-2); border-radius: var(--r); padding: 10px; min-height: 240px; }
  .spalte > h2 { display: flex; justify-content: space-between; gap: 6px; font-size: 0.8125rem; color: var(--ink-2); padding: 2px 4px 4px; }
}

/* ---------- AP-06: Projekte, Wochenstand, Pendenzen ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.gruen { background: var(--ok); } .dot.gelb { background: #C98A00; } .dot.rot { background: var(--bad); }
.ikon { width: 20px; height: 20px; flex: none; }
.ws { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.ws:first-of-type { border-top: 0; padding-top: 0; }
.ws-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ws-kopf h3 { margin-right: auto; }
.ws-raster { display: grid; gap: 10px; }
.ws h4 { margin: 0 0 4px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.ws .punkte { font-size: 0.9375rem; }
@media (min-width: 600px) { .ws-raster { grid-template-columns: 1fr 1fr; } }
.liste.pendenzen > li { display: grid; grid-template-columns: var(--touch) minmax(0, 1fr); align-items: start; gap: 4px 12px; }
.liste.pendenzen > li > .t:first-child { grid-column: 1 / -1; }
.liste.pendenzen .pills { grid-column: 2; }
.liste.pendenzen > li > .t:first-child + .pills { grid-column: 1 / -1; }
@media (min-width: 600px) { .liste.pendenzen > li { grid-template-columns: var(--touch) minmax(0, 1fr) auto; } .liste.pendenzen .pills { grid-column: 3; justify-content: flex-end; max-width: 16rem; } .liste.pendenzen > li > .t:first-child + .pills { grid-column: 3; } .liste.pendenzen > li > .t:first-child { grid-column: 1 / 3; } }
.abhaken { display: inline-flex; align-items: center; justify-content: center; width: var(--touch); height: var(--touch); min-height: var(--touch); flex: none; padding: 0; border: 0; border-radius: 50%; background: transparent; color: transparent; cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--line-2); transition: background 160ms var(--ease-out), box-shadow 160ms var(--ease-out), color 160ms var(--ease-out); }
.abhaken:hover { box-shadow: inset 0 0 0 2px var(--blue); color: var(--blue); }
.abhaken[aria-pressed="true"] { background: var(--ok); box-shadow: none; color: var(--white); }
.pendenz.erledigt .t b, .pendenz.erledigt .t b a { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.pendenz { scroll-margin-top: 16px; }
.chip .dot { margin-left: -2px; }
.liste.pendenzen .pill, .ws-kopf .pill { white-space: normal; overflow-wrap: anywhere; }
/* ---------- AP-07: Cockpit (Startseite) und Suche ---------- */
.kopf-suche { display: inline-flex; align-items: center; justify-content: center; width: var(--touch); height: var(--touch); flex: none; border-radius: 50%; color: var(--ink); }
.kopf-suche:hover { background: var(--paper-2); }
.cockpit-kopf { display: grid; gap: 12px; padding: 4px 2px 0; }
.cockpit-kopf h1 { font-size: 1.375rem; }
.suchform { display: flex; gap: 8px; min-width: 0; }
.suchform .eingabe { flex: 1 1 auto; min-width: 0; }
.suchform .btn { flex: none; }
.spalte-stapel { display: grid; gap: var(--abstand); align-content: start; min-width: 0; }
.cockpit .liste > li { align-items: start; }
.cockpit .liste:not(.pendenzen) > li > .pills { flex: 0 1 auto; }
@media (min-width: 900px) {
  .cockpit-kopf { grid-template-columns: 1fr minmax(18rem, 28rem); align-items: end; }
  .raster.zwei.cockpit { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; }
  .spalte-stapel { gap: 18px; }
}
/* Kopf mit Lupe (AP-07): Markenname erst ab 480 px, damit Lupe, Kurzname und Abmelden ohne seitliches Scrollen Platz haben. */
@media (max-width: 479px) { .marke span { display: none; } }
.kopf-nav { min-width: 0; }
/* Datumsfeld (z. B. «Stufe ändern» auf der Opportunity) darf schmaler werden als seine Standardbreite in Chrome: kein seitliches Scrollen (AP-07). */
input.eingabe[type="date"] { min-width: 0; max-width: 100%; }
/* Pipeline auf schmalen Bildschirmen: Bezeichnung über dem Betrag statt zwei enge Spalten (AP-07). */
@media (max-width: 479px) { .kv.kv-schmal { grid-template-columns: 1fr; gap: 0; } .kv.kv-schmal dd { margin-bottom: 10px; } }
.formular .zeile > .feld-kurz:has(input[type="date"]) { flex: 0 1 150px; }
