/* Cockpit-Ergänzungen zu app.css.
 *
 * app.css kommt unverändert aus dem Monolithen und bringt Farben, Typografie,
 * Panels, Pills und Buttons mit. Was dort fehlt, sind genau die Bauteile eines
 * Arbeitsbildschirms: Stepper, Tabellen, Tabs, Diff. Die werden hier gebaut —
 * ausschließlich aus den vorhandenen Tokens, damit beide Oberflächen eine
 * Handschrift behalten.
 *
 * Zweiter Zweck: app.css ist für Übersichtsseiten gestaltet, die man dreimal am
 * Tag ansieht (Radius 28, Panel-Schatten, drei Farbverläufe im Hintergrund).
 * Ein Copywriter sitzt acht Stunden darin. Deshalb unten eine dichtere Variante
 * für die Arbeitsflächen, plus die Fokus- und Motion-Regeln, die in app.css
 * fehlen (prefers-reduced-motion kommt dort null mal vor, focus-visible einmal).
 */

:root {
  --work-radius: 14px;
  --work-gap: 14px;
  --work-pad: 18px;
  --ink-soft: rgba(11, 18, 32, 0.62);
  --diff-add-bg: rgba(45, 143, 111, 0.16);
  --diff-add-ink: #1c6b51;
  --diff-del-bg: rgba(229, 35, 34, 0.13);
  --diff-del-ink: #a4201f;
}

/* --- Zugänglichkeit, die in app.css fehlt --------------------------------- */

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--ci-red);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Grundgerüst ---------------------------------------------------------- */

.ck-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 22px 64px;
}

.ck-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
}

.ck-topbar .ck-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.ck-topbar .ck-brand img { height: 26px; width: auto; }

.ck-topbar nav { display: flex; gap: 4px; }

.ck-topbar nav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.ck-topbar nav a:hover { background: rgba(11, 18, 32, 0.06); color: var(--ink); }
.ck-topbar nav a[aria-current="page"] { background: var(--ci-navy); color: #fff; }

.ck-spacer { flex: 1; }
.ck-who { color: var(--muted-2); font-size: 0.86rem; }

/* Arbeitsflächen: dichter als die Übersichts-Panels aus app.css. */
.ck-panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--work-radius);
  padding: var(--work-pad);
  box-shadow: var(--shadow-md);
}

.ck-panel + .ck-panel { margin-top: var(--work-gap); }

.ck-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ck-panel-head h2 { font-size: 1.02rem; letter-spacing: -0.01em; }
.ck-sub { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

.ck-grid-2 { display: grid; gap: var(--work-gap); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ck-grid-3 { display: grid; gap: var(--work-gap); grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .ck-grid-2, .ck-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* --- Stepper: der Briefing-Status IST der Fortschritt --------------------- */

.ck-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 0;
  margin: 0;
  list-style: none;
}

.ck-stepper li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--muted-2);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.ck-stepper li[data-state="done"] { color: var(--success); border-color: var(--success-soft); background: var(--success-soft); }
.ck-stepper li[data-state="active"] { color: #fff; background: var(--ci-navy); border-color: var(--ci-navy); font-weight: 650; }
.ck-stepper li[data-state="blocked"] { color: var(--danger); background: var(--accent-soft); border-color: var(--accent-soft); }

/* --- Zustandsanzeige: aktuell / veraltet / Hinweis ------------------------ */

.ck-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.ck-state::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.ck-state[data-tone="ok"] { color: var(--success); background: var(--success-soft); }
.ck-state[data-tone="warn"] { color: #8a6100; background: rgba(214, 158, 46, 0.16); }
.ck-state[data-tone="bad"] { color: var(--danger); background: var(--accent-soft); }
/* Neutral ist eigen: „übersprungen, weil schon einer lief" ist kein Fehler.
 * Rot dargestellt lässt es Leute erneut drücken und verschlimmert genau die
 * Gleichzeitigkeit, die die Ursache war. */
.ck-state[data-tone="neutral"] { color: var(--muted); background: rgba(11, 18, 32, 0.06); }

.ck-metric { display: flex; flex-direction: column; gap: 3px; }
.ck-metric .ck-metric-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.ck-metric .ck-metric-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); }

/* --- Tabelle -------------------------------------------------------------- */

.ck-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ck-table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.ck-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ck-table tbody tr:hover { background: rgba(11, 18, 32, 0.03); }
.ck-table a { color: var(--ink); font-weight: 600; }
.ck-num { font-variant-numeric: tabular-nums; text-align: right; }

/* --- Tabs ----------------------------------------------------------------- */

.ck-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--work-gap); }
.ck-tabs a {
  padding: 9px 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.ck-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ci-red); }

/* --- Empfehlungen: Angebot, nicht Anweisung ------------------------------- */

.ck-rec {
  border: 1px solid var(--line);
  border-radius: var(--work-radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}
.ck-rec + .ck-rec { margin-top: 10px; }
.ck-rec h3 { font-size: 0.96rem; margin-bottom: 5px; }
.ck-rec .ck-why { color: var(--muted); font-size: 0.85rem; line-height: 1.55; }
.ck-rec .ck-evidence { margin-top: 8px; font-size: 0.8rem; color: var(--muted-2); }
.ck-rec .ck-evidence li { list-style: none; padding: 2px 0; }

/* Herkunftsmarke an vorbelegten Feldern. Verschwindet, sobald angefasst. */
.ck-from-rec { position: relative; }
.ck-from-rec::after {
  content: "aus Empfehlung";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  background: rgba(11, 18, 32, 0.05);
  padding: 2px 7px;
  border-radius: 999px;
  pointer-events: none;
}
.ck-from-rec[data-touched="1"]::after { display: none; }

/* --- Diff ----------------------------------------------------------------- */

.ck-diff-section { margin-bottom: 18px; }
.ck-diff-section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin-bottom: 7px;
}
.ck-diff-rows { display: flex; flex-direction: column; gap: 3px; }

.ck-diff-row {
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 0.92rem;
  line-height: 1.62;
  border-left: 3px solid transparent;
}
.ck-diff-row[data-op="equal"] { color: var(--ink-soft); }
.ck-diff-row[data-op="insert"] { background: var(--diff-add-bg); border-left-color: var(--diff-add-ink); }
.ck-diff-row[data-op="delete"] { background: var(--diff-del-bg); border-left-color: var(--diff-del-ink); text-decoration: line-through; text-decoration-color: rgba(164, 32, 31, 0.5); }
.ck-diff-row[data-op="replace"] { background: rgba(11, 18, 32, 0.035); border-left-color: var(--ci-blue); }

/* Wortweise: das ist der Grund für den ganzen Diff. */
.ck-diff-row ins { background: var(--diff-add-bg); color: var(--diff-add-ink); text-decoration: none; padding: 1px 3px; border-radius: 4px; font-weight: 600; }
.ck-diff-row del { background: var(--diff-del-bg); color: var(--diff-del-ink); padding: 1px 3px; border-radius: 4px; }

/* Listen zweispaltig: unabhängige Einträge nebeneinander, nicht ineinander. */
.ck-diff-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 780px) { .ck-diff-pair { grid-template-columns: 1fr; } }

/* --- Editor --------------------------------------------------------------- */

.ck-editor-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.ck-editor-field > span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  font-weight: 700;
}
.ck-editor-field textarea,
.ck-editor-field input,
.ck-editor-field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.6;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}
.ck-editor-field textarea { min-height: 92px; }
.ck-hint { font-size: 0.78rem; color: var(--muted-2); }

.ck-savebar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}
.ck-saved { font-size: 0.82rem; color: var(--muted); }

/* --- Meldungen ------------------------------------------------------------ */

.ck-msg {
  border-radius: var(--work-radius);
  padding: 12px 15px;
  margin-bottom: var(--work-gap);
  font-size: 0.9rem;
  line-height: 1.55;
  border: 1px solid var(--line);
}
.ck-msg[data-tone="ok"] { background: var(--success-soft); border-color: rgba(45, 143, 111, 0.3); color: #1c6b51; }
.ck-msg[data-tone="bad"] { background: var(--accent-soft); border-color: rgba(229, 35, 34, 0.3); color: #8d1c1b; }
.ck-msg[data-tone="warn"] { background: rgba(214, 158, 46, 0.14); border-color: rgba(214, 158, 46, 0.35); color: #7a5600; }
.ck-msg[data-tone="info"] { background: rgba(154, 182, 202, 0.16); border-color: rgba(154, 182, 202, 0.4); }
.ck-msg strong { display: block; margin-bottom: 3px; }
.ck-msg .ck-next { display: block; margin-top: 5px; color: inherit; opacity: 0.85; }

.ck-fake-banner {
  background: repeating-linear-gradient(45deg, rgba(214, 158, 46, 0.18), rgba(214, 158, 46, 0.18) 10px, rgba(214, 158, 46, 0.28) 10px, rgba(214, 158, 46, 0.28) 20px);
  color: #6b4a00;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ck-empty {
  text-align: center;
  padding: 34px 20px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}
.ck-empty strong { display: block; color: var(--ink); margin-bottom: 5px; font-size: 1rem; }

/* --- Suche ---------------------------------------------------------------- */

.ck-search { display: flex; gap: 10px; align-items: stretch; }
.ck-search input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 13px 16px;
  font: inherit;
  font-size: 1.02rem;
  background: #fff;
}
.ck-search-hero { max-width: 620px; margin: 44px auto 0; }
.ck-search-hero h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin-bottom: 7px; }

/* Nicht blockierender Laufhinweis. Das Vollbild-Overlay aus app.css bleibt der
 * Skript-Generierung vorbehalten, wo Weiterarbeiten ohnehin sinnlos ist. */
.ck-inline-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.ck-inline-progress::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ci-navy);
  animation: ck-spin 0.8s linear infinite;
}
@keyframes ck-spin { to { transform: rotate(360deg); } }

/* --- Korrekturen aus dem ersten Durchlauf -------------------------------- */

/* app.css unterstreicht Links global. Ein Anker, der als Button auftritt, darf
 * nicht unterstrichen sein - sonst sieht jede Aktion aus wie ein Textlink. */
a.primary-button,
a.ghost-button,
.ck-topbar a.ghost-button,
.ck-rec a.primary-button,
.ck-rec a.ghost-button {
  text-decoration: none;
}

a.primary-button:hover,
a.ghost-button:hover { text-decoration: none; }

/* Die Anmeldeseite laeuft auf dem dunklen auth-shell-Hintergrund, dessen
 * Textfarbe (#f4f7fb) in das weisse Panel durchschlaegt: die Ueberschrift stand
 * praktisch unlesbar hell auf weiss. Das Panel setzt seine Schriftfarbe selbst. */
body.auth-shell .ck-panel,
body.auth-shell .ck-panel h1,
body.auth-shell .ck-panel p,
body.auth-shell .ck-panel span,
body.auth-shell .ck-panel label {
  color: var(--ink);
}
body.auth-shell .ck-panel .ck-sub,
body.auth-shell .ck-panel .ck-editor-field > span { color: var(--muted); }

/* Auf dunklem Grund braucht das Beispieldaten-Band eigene Farben, sonst steht
 * dunkles Gelb auf dunklem Blau. */
body.auth-shell .ck-fake-banner {
  background: rgba(214, 158, 46, 0.92);
  color: #2b1d00;
}
