/* ═══ Arti an Last Crumb angeglichen (12.11.2026) ═══════════════════════════
   Wird nach arti.css geladen und überstimmt deren ältere Regeln. Wo Last Crumb einen
   Baustein hat, nutzt das Markup dessen Klassen (ff-btn, ff-notice, ff-nav …). Wo das
   Markup bewusst Arti-eigen bleibt — weil JavaScript, Turbo Streams oder laufende Jobs
   daran hängen —, übernimmt es hier die Werte des passenden Last-Crumb-Bausteins.
   Nur Tokens aus vendor/last-crumb/dist/tokens.css, keine Hex-Werte (GUIDE.md, Regel 2).
   Was Last Crumb fehlt oder später umgebaut wird, steht im Artifact „Offene Last-Crumb-Punkte“:
   https://claude.ai/artifact/DZuKYB1mvWN6SfPv5srwYN */

/* ── Dialoge (Job) — Werte von .ff-modal ──────────────────────────────────
   Der <dialog> füllt weiter das Fenster, die Karte ist .arti-modal-box: „Klick daneben
   schließt“ (job-dialog#close) hängt an dieser Aufteilung. Das Gedächtnis ist seit
   13.11.2026 ein eigenes Pop-up (.arti-memfull in arti.css). */
.arti-modal::backdrop { background: var(--scrim-modal); }
.arti-modal { color: var(--text-primary); }
.arti-modal-box {
  width: var(--ff-modal-width, 560px); max-width: calc(100vw - 2 * var(--sp-4)); max-height: calc(100dvh - 2 * var(--sp-8));
  padding: var(--sp-6); border: 1px solid transparent; border-radius: var(--radius-xl);
  background: var(--bg-surface); box-shadow: var(--shadow-modal); font-family: var(--font-sans);
}
.arti-job-box { --ff-modal-width: 720px; }   /* .ff-modal--l: mehrteiliges Formular */
.arti-modal-head {
  align-items: center; gap: var(--sp-3); margin: calc(var(--sp-6) * -1) calc(var(--sp-6) * -1) var(--sp-5);
  padding: var(--sp-3) var(--sp-6); border-bottom: 1px solid var(--border-default);
}
.arti-modal-title { font-size: var(--fs-card-title); font-weight: 600; line-height: 1.25; letter-spacing: normal; color: var(--text-primary); }
.arti-modal-lead { font-size: var(--fs-body); line-height: 1.5; color: var(--text-muted); }
.arti-modal-lead strong { color: var(--text-heading); }
.arti-modal-actions {
  gap: var(--sp-2); margin: var(--sp-6) calc(var(--sp-6) * -1) calc(var(--sp-6) * -1);
  padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border-default); background: var(--bg-subtle);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.arti-job-form .arti-modal-actions { position: sticky; bottom: calc(var(--sp-6) * -1); background: var(--bg-subtle); }
.arti-modal-head .arti-editor-eyebrow { font-size: var(--fs-caption); color: var(--text-secondary); font-weight: 400; }   /* .ff-modal__meta */

/* ── Formularfelder — Werte von .ff-input / .ff-field ──────────────────────
   Die Felder der Job-Maske, der Umfang-Karte, der Jobs- und Ticket-Seite behalten ihr
   Markup (Stimulus-Targets), sehen aber aus wie .ff-input. */
:is(.arti-job-field, .arti-scope-field, .arti-ticket-filters, .arti-sched-form, .arti-sched-clientpick, .arti-sched-blocks)
  :is(select, textarea, input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=search]),
.arti-job-search, .arti-scope-search, .arti-modal-text, .arti-client-search {
  min-height: var(--h-input); padding: 0 var(--sp-3); border: 1px solid var(--border-control); border-radius: var(--radius-md);
  background: var(--bg-surface); box-shadow: var(--shadow-input-inset); color: var(--text-primary);
  font: 400 var(--fs-body) var(--font-sans); outline: none;
}
:is(.arti-job-field, .arti-scope-field, .arti-sched-form, .arti-sched-blocks) textarea, .arti-modal-text {
  min-height: 96px; padding: 10px var(--sp-3); line-height: 1.5;
}
:is(.arti-job-field, .arti-scope-field, .arti-ticket-filters, .arti-sched-form, .arti-sched-clientpick, .arti-sched-blocks)
  :is(select, textarea, input):focus-visible,
.arti-job-search:focus-visible, .arti-scope-search:focus-visible, .arti-modal-text:focus-visible, .arti-client-search:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 0; border-color: var(--focus-ring); box-shadow: var(--shadow-input-inset);
}
.arti-job-field > span, .arti-job-field > legend, .arti-scope-field > span, .arti-sched-clientpick label {
  font: 500 var(--fs-control)/1.3 var(--font-sans); color: var(--text-heading);   /* .ff-field__label */
}
.arti-job-hint, .arti-scope-hint { font-size: var(--fs-caption); line-height: 1.4; color: var(--text-secondary); }   /* .ff-field__hint */

/* Segment (Ausführen als, Wochentage) — Werte von .ff-segment */
.arti-job-seg { padding: 2px; gap: 2px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-subtle); }
.arti-job-segopt span { border-radius: var(--radius-sm); font-size: var(--fs-control); color: var(--text-secondary); }
.arti-job-segopt input:checked + span { background: var(--bg-surface); color: var(--text-primary); font-weight: 500; box-shadow: 0 0 0 1px var(--border-default); }
/* Gewählte Tage im Job-Dialog (Versandtage, Bestellplan) hellgrün statt weiß — sonst kaum vom
   Rest zu unterscheiden (Wunsch 13.11.2026). Minzblau aus der Marke, Schrift Meeresblau (≈ 8:1, in beiden Themes gleich). */
.arti-job-weekdays .arti-job-segopt input:checked + span { background: var(--brand-minzblau); color: var(--brand-meeresblau); box-shadow: 0 0 0 1px var(--brand-seegruen); }
.arti-job-segopt input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: -2px; }

/* Schalter (Job aktiv) — Werte von .ff-switch */
.arti-job-switch { width: 36px; height: 20px; background: var(--border-control); }
.arti-job-switch::after { width: 16px; height: 16px; box-shadow: none; }
.arti-job-toggle input:checked ~ .arti-job-switch { background: var(--action-primary); }
.arti-job-toggle input:checked ~ .arti-job-switch::after { transform: translateX(16px); }
.arti-job-toggle input:focus-visible ~ .arti-job-switch { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.arti-job-toggle strong { color: var(--text-heading); }
.arti-job-toggle small { color: var(--text-secondary); }

/* ── Unterseiten (Jobs, Berichte, Tickets) ─────────────────────────────────
   Seitenkopf, Tabelle, Pills und Leerzustand kommen aus Last Crumb (Markup). */
.arti-editor .ff-page-header { margin-bottom: var(--sp-4); }
.arti-sched-back { margin-bottom: var(--sp-2); }
.ff-table.arti-sched-table, .ff-table.arti-reports-table { margin-top: var(--sp-3); }
:is(.arti-sched-table, .arti-reports-table) td { font-size: var(--fs-body); color: var(--text-primary); }
/* Jobname und Auftrag dürfen umbrechen (.ff-table setzt nowrap); vorher über
   .arti-schedules .arti-result-table td:first-child (Copilot-Review #213). */
.arti-sched-table td:first-child { white-space: normal; min-width: 260px; max-width: 520px; }
.arti-sched-sub, .arti-sched-next { font-size: var(--fs-caption); color: var(--text-secondary); }
.arti-sched-name strong { color: var(--text-heading); font-weight: 500; }
.arti-sched-status { display: inline-flex; margin-inline-start: var(--sp-1); text-decoration: none; }
.arti-reports-group-title { color: var(--text-heading); font-size: var(--fs-section, 16px); font-weight: 500; }
.arti-reports-group-title .ff-icon { color: var(--text-secondary); }
/* Aktiv-Schalter der Jobs-Tabelle: ein Formular-Button (PATCH), sieht aus wie .ff-switch. */
.arti-sched-toggle { width: 36px; height: 20px; padding: 2px; border: 0; border-radius: var(--radius-pill); background: var(--border-control); }
.arti-sched-toggle.is-on { background: var(--action-primary); }
.arti-sched-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.arti-sched-toggle .arti-sched-knob { width: 16px; height: 16px; background: var(--bg-surface); box-shadow: none; }
.arti-sched-toggle.is-on .arti-sched-knob { transform: translateX(16px); }
/* Tickets: Liste als Karten (Last Crumb hat keine Ticket-Liste — Abgleich I4). */
.arti-ticket { border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--bg-surface); color: var(--text-primary); }
.arti-ticket:hover { background: var(--bg-hover); border-color: var(--border-row); }
.arti-ticket-meta { color: var(--text-secondary); font-size: var(--fs-caption); }
.arti-ticket-go { color: var(--text-link); font-weight: 500; }

/* ── Chat — Werte der Chat-Klassen von Last Crumb (.ff-chat, Muster „Arti-Panel“) ──
   Frage- und Antwortblasen baut arti_controller.js beim Streamen selbst; deshalb
   bleiben Markup und Klassen, die Optik kommt von .ff-chat__message--question /
   --answer, .ff-chat__busy und .ff-chat__composer. */
.arti-bubble.arti-user {
  max-width: 85%; padding: calc(var(--sp-2) + 2px) var(--sp-3);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs) var(--radius-lg);
  background: var(--bg-selected); color: var(--text-primary); box-shadow: none;
  font-size: var(--fs-body); line-height: 1.5; overflow-wrap: anywhere;
}
.arti-bubble.arti-assistant, .arti-bubble.arti-greeting { color: var(--text-primary); font-size: var(--fs-body); line-height: 1.6; }
.arti-assistant p { font-size: var(--fs-body); line-height: 1.6; margin: 0 0 var(--sp-3); }
.arti-assistant strong { color: var(--text-heading); font-weight: 600; }
.arti-assistant h1, .arti-assistant h2 { font-size: var(--fs-section); font-weight: 600; line-height: 1.3; color: var(--text-heading); margin: var(--sp-5) 0 var(--sp-2); }
.arti-assistant h3 { font-size: var(--fs-card-title); font-weight: 600; letter-spacing: normal; color: var(--text-heading); margin: var(--sp-4) 0 var(--sp-2); }
.arti-assistant h4, .arti-assistant h5 { font-size: var(--fs-body); font-weight: 600; color: var(--text-heading); }
.arti-assistant li::marker { color: var(--text-secondary); }
.arti-assistant code { background: var(--bg-subtle); border: 1px solid var(--border-default); border-radius: var(--radius-xs); color: var(--text-primary); font-family: var(--font-mono); font-size: .9em; }
.arti-assistant blockquote { background: var(--bg-subtle); border: 0; border-left: 3px solid var(--border-selected); border-radius: var(--radius-sm); color: var(--text-primary); }
/* Tabellen in Antworten und Ergebnissen — Werte von .ff-table */
.arti-assistant table, .arti-result-table table {
  border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: none; background: var(--bg-surface); font-size: var(--fs-body);
}
.arti-assistant th, .arti-result-table th {
  background: var(--bg-subtle); color: var(--text-secondary); font-size: var(--fs-caption); font-weight: 500; letter-spacing: normal;
  border-bottom: 1px solid var(--border-row);
}
.arti-assistant td, .arti-result-table td { border-bottom: 1px solid var(--border-default); color: var(--text-primary); }
.arti-assistant tbody tr:hover, .arti-result-table tbody tr:hover { background: var(--bg-hover); }
.arti-assistant td.delta, .arti-result-table td.delta { color: var(--text-heading); font-weight: 600; }
/* Fehler als Antwort: Werte von .ff-notice--error (Muster „Arti-Panel“: Fehler). */
.arti-bubble.arti-error { background: var(--status-error-bg); border: 1px solid var(--status-error-border); border-radius: var(--radius-md); color: var(--status-error-fg); box-shadow: none; }

/* Arbeitsanzeige („ARTI denkt …“) — .ff-chat__busy / .ff-spinner */
.arti-thinking, .arti-activity { color: var(--text-secondary); font-size: var(--fs-body); }
.arti-activity-elapsed, .arti-activity-note { color: var(--text-secondary); font-size: var(--fs-caption); }
.arti-spinner { border: 2px solid var(--border-default); border-top-color: var(--action-primary); }

/* „Vorgehen“ (eingeklappte Schritte) — Werte von .ff-accordion */
.arti-steps-summary { color: var(--text-secondary); font-size: var(--fs-control); font-weight: 500; }
.arti-steps-summary::before { color: var(--text-secondary); }
.arti-steps-body { border-left: 2px solid var(--border-default); }
.arti-steps-item { color: var(--text-muted); font-size: var(--fs-control); }

/* Aktionszeile unter der Antwort: Buttons sind .ff-btn--ghost --sm (Markup). */
.arti-turn-actions { gap: var(--sp-1) var(--sp-2); }
.arti-turn-actions .ff-btn--ghost { color: var(--text-secondary); }

/* Eingabe — Werte von .ff-chat__composer: Feld mit Rahmen, Senden als Primär-Icon-Button S. */
.arti-composer-inner {
  border: 1px solid var(--border-control); border-radius: var(--radius-lg); background: var(--bg-surface);
  box-shadow: var(--shadow-input-inset); gap: var(--sp-1); padding: var(--sp-2); align-items: flex-end;
}
.arti-composer-inner:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring); }
/* Eine Linie (Nicole, 17.11.2026): Feld, Cursor und alle Buttons sind einzeilig genau
   32 px (--h-button-s) hoch und haben oben und unten denselben Abstand zum Rahmen. Wird
   das Feld mehrzeilig, bleiben die Buttons unten stehen. */
#arti-input {
  color: var(--text-primary); font: 400 var(--fs-body)/20px var(--font-sans);
  padding: 6px var(--sp-2); min-height: var(--h-button-s); margin: 0;
}
/* iOS zoomt bei Feldern unter 16 px beim Antippen hinein — mobil wie bisher 16 px (Copilot-Review #213). */
@media (max-width: 640px) { #arti-input { font-size: 16px; } }
#arti-input::placeholder { color: var(--text-disabled); }
#arti-send, #arti-stop {
  width: var(--h-button-s); height: var(--h-button-s); border-radius: var(--radius-md); box-shadow: none;
}
#arti-send { background: var(--action-primary); color: var(--text-on-action); }
#arti-send:hover:not(:disabled) { background: var(--action-primary-hover); }
#arti-send:disabled { background: var(--bg-pressed); color: var(--text-disabled); opacity: 1; }
#arti-stop { background: var(--text-heading); }
#arti-stop:hover:not(:disabled) { background: var(--text-primary); }
/* Anhängen (+) und Diktat: Ghost-Icon-Buttons; die Aufnahme bleibt als Status rot. */
#arti-attach-plus, #arti-mic { width: var(--h-button-s); height: var(--h-button-s); border-radius: var(--radius-md); color: var(--text-secondary); }
#arti-attach-plus:hover, #arti-mic:hover { background: var(--bg-hover); color: var(--text-primary); }
#arti-attach-plus:focus-visible, #arti-mic:focus-visible, #arti-send:focus-visible, .arti-ctxbtn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
#arti-mic.is-recording, #arti-mic.is-busy { background: var(--status-error-bg); color: var(--status-error-fg); }
/* „Kontext“-Button — Werte von .ff-btn--secondary --sm. */
.arti-ctxbtn {
  height: var(--h-button-s); padding: 0 var(--sp-3); border: 1px solid var(--border-control); border-radius: var(--radius-md);
  background: var(--bg-surface); color: var(--text-primary); font: 500 var(--fs-control) var(--font-sans);
  margin: 0;
}
.arti-ctxbtn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.arti-ctxbtn.is-active { background: var(--bg-selected); border-color: var(--border-selected); }
.arti-composer-note { color: var(--text-secondary); font-size: var(--fs-caption); }
/* Kontext-Karte über der Eingabe — .ff-card mit .ff-attribute-list-Werten. */
.arti-context { border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-popover); }
.arti-context-title { font-size: var(--fs-control); font-weight: 600; color: var(--text-heading); }
.arti-context-grid { color: var(--text-primary); font-size: var(--fs-control); }
.arti-context-grid dt { color: var(--text-secondary); font-weight: 400; }
/* Regeln des Chats (entfernbar) — Werte von .ff-chip--active mit __remove. */
.arti-rule { border: 1px solid var(--border-selected); border-radius: var(--radius-md); background: var(--bg-selected); color: var(--text-primary); font-size: var(--fs-control); }
.arti-rule-x { color: var(--text-secondary); border-radius: var(--radius-xs); }
.arti-rule-x:hover { background: var(--bg-selected-hover); color: var(--text-primary); }

/* ── Ergebnisse und Aktionen im Chat ───────────────────────────────────────
   Kennzahlen sind .ff-card.ff-kpi, die Heatmap .ff-heatmap--matrix (Markup). Die übrigen
   Karten übernehmen die Werte von .ff-card (Fläche, 1 px Rahmen, Radius 12). */
.kpi-grid { gap: var(--sp-2); }
.arti-result-eyebrow { font-size: var(--fs-control); font-weight: 600; color: var(--text-heading); letter-spacing: normal; }   /* .ff-card-title, klein */
.arti-result-report-hint, .arti-result-text { color: var(--text-secondary); font-size: var(--fs-caption); }
/* Spannweite der Zellfarbe (heatmap_cell_style): stärkste Zelle hell 66 %, dunkel 40 % Akzent —
   so bleibt --text-primary darauf ≥ 4,5:1 (Copilot-Review #216). Theme-Selektoren wie tokens.css. */
:root { --arti-heat-span: 58%; }
[data-theme="dark"], .theme-dark { --arti-heat-span: 32%; }
@media (prefers-color-scheme: dark) { [data-theme="auto"] { --arti-heat-span: 32%; } }
.arti-heatmap .ff-heatmap--matrix { width: auto; border: 0; background: transparent; }
.arti-heatmap .ff-heatmap--matrix td.ff-heatmap__cell { min-width: 44px; height: 28px; padding: 0 6px; border: 0; border-radius: var(--radius-sm); font-size: var(--fs-micro); }
.arti-heatmap .ff-heatmap--matrix th { background: transparent; border: 0; }
/* Insight-Karten (Filial-/Gebiets-Info): .ff-card; der Akzentbalken links fehlt in Last Crumb (Abgleich D5). */
.arti-insight-card { border: 1px solid var(--border-default); border-left: 3px solid var(--action-primary); border-radius: var(--radius-lg); background: var(--bg-surface); color: var(--text-primary); font-size: var(--fs-body); padding: var(--sp-3) var(--sp-4); }
.arti-insight-card-head strong, .arti-insight-card-action { color: var(--text-heading); }
.arti-insight-card-note { color: var(--text-secondary); font-size: var(--fs-caption); }
/* Änderungs-Widget (vorgeschlagene Aktionen) — fehlt in Last Crumb (Abgleich E3): .ff-card-Werte. */
.arti-action { border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: none; }
.arti-action-old { color: var(--text-secondary); }
.arti-action-arrow { color: var(--text-secondary); }
.arti-action-new { color: var(--text-heading); font-weight: 600; }
.arti-action-row { border-color: var(--border-default); }
.arti-action-row-target { color: var(--text-primary); font-size: var(--fs-control); }
.arti-action-meta dt { color: var(--text-secondary); font-size: var(--fs-micro); }
/* Gedächtnis-Vorschlag und Umfang-Karte: vorher Mint-Flächen, jetzt .ff-card. */
.arti-memsug, .arti-scope { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.arti-memsug-label, .arti-scope-label { color: var(--text-secondary); font-size: var(--fs-caption); font-weight: 500; }
.arti-memsug-note { color: var(--text-primary); font-size: var(--fs-body); }
.arti-memsug-icon, .arti-scope-icon { color: var(--text-secondary); }
.arti-scope-title { color: var(--text-heading); font-size: var(--fs-card-title); font-weight: 600; }
/* Filial-Schlagworte in der Umfang-Karte — Werte von .ff-chip. */
.arti-scope-tag { border: 1px solid var(--border-control); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); font-size: var(--fs-control); }
.arti-scope-tag:hover { background: var(--bg-hover); border-color: var(--border-strong); }
/* Gewählt: helle Auswahlfläche, daher dunkle Schrift (die alte Regel setzte Weiß auf Navy). */
.arti-scope-tag[aria-pressed="true"] { background: var(--bg-selected); border-color: var(--border-selected); color: var(--text-primary); }
.arti-scope-tag[aria-pressed="true"] span { color: var(--text-secondary); }
/* Datei-Karte (Upload) — fehlt in Last Crumb (Abgleich C4). */
.arti-file-card { border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: none; }
.arti-file-card-meta { color: var(--text-secondary); font-size: var(--fs-caption); }
.arti-file-card-x { border-radius: var(--radius-xs); }
.arti-file-card-x:hover { background: var(--bg-hover); color: var(--text-primary); }
/* „In Freshdesk übernehmen“ — Werte von .ff-btn--primary --sm. */
.arti-adopt-btn { height: var(--h-button-s); padding: 0 var(--sp-3); border-radius: var(--radius-md); background: var(--action-primary); font: 500 var(--fs-control) var(--font-sans); }
.arti-adopt-btn:hover { transform: none; filter: none; background: var(--action-primary-hover); }
.arti-adopt-btn.is-done { background: var(--status-success-bg); color: var(--status-success-fg); }
.arti-adopt-hint { color: var(--text-secondary); font-size: var(--fs-caption); }
/* Insight-Bewertung (👍/👎) — fehlt in Last Crumb (Abgleich D9). */
.arti-insight-feedback-row { border-top: 1px solid var(--border-default); }
.arti-insight-feedback-label { color: var(--text-secondary); font-size: var(--fs-caption); }

/* Hinweise ohne eigenen Button (Login, Dialoge, Jobs): Last Crumb gibt .ff-notice__text
   min-width: 240px, damit ein Button daneben umbricht. Ohne Button würde das auf schmalen
   Bildschirmen (320 px: nur ~204 px Platz in der Login-Karte) seitlich überlaufen
   (Copilot-Review #213) — der Text darf hier schrumpfen und umbrechen. */
.ff-notice:not(:has(.ff-btn)) .ff-notice__text { min-width: 0; }

/* Handy (Copilot-Review #213): Der Kontext-Button zeigt dort wie bisher nur das Icon,
   sonst wird das Eingabefeld zu schmal (die Regel oben überstimmte arti.css). */
@media (max-width: 640px) {
  .arti-ctxbtn { font-size: 0; gap: 0; padding: 0 9px; }
}
/* Kennzahl-Kacheln: Last Crumb setzt den Wert in 32 px (--fs-kpi). In schmalen Kacheln
   (zwei Spalten auf dem Handy, Mindestbreite 150 px) passt „48.210 €“ so nicht — der Wert
   wird kleiner, sobald die Kachel selbst schmal ist (Container Query, GUIDE.md Regel 6). */
.kpi-grid .ff-kpi { min-width: 0; container-type: inline-size; }
@container (max-width: 200px) { .ff-kpi__value { font-size: 22px; } }
