/* =====================================================================================================================
   RUESS Design System (ab Hub 3.0.0) - EINE zentrale Datei, wird als LETZTES Stylesheet geladen.
   Regeln fuer jede neue/erneuerte Oberflaeche: siehe Skill "ruess-hub-design" (~/.claude/skills/ruess-hub-design/SKILL.md).
   - Werte nur ueber die Tokens unten (--ds-*), keine neuen Einzelfarben/-abstaende in Modul-CSS.
   - Hausstil bleibt: Lime #A2BF13 + Anthrazit, Knoepfe kompakt + rechtsbuendig, keine langen gruenen Balken, Felder 44 px mit Label oben.
   - Bewegung dezent (120-220 ms, transform/opacity), prefers-reduced-motion wird beachtet.
   Diese Datei vereinheitlicht die VORHANDENEN Klassen (button, .ap-*, .bw-*, .ik-*, .kom-*, .modal, .ruess-dialog ...) - kein Umbau des Markups.
   ===================================================================================================================== */

/* ---- 1. Tokens ------------------------------------------------------------------------------------------------------ */
:root {
  /* Farbe (Marke + Semantik). Kontrast gegen Weiss: text 11,2:1, muted 5,0:1, focus 4,9:1; on-brand auf brand 7,4:1 */
  --ds-brand: #a2bf13;
  --ds-brand-hover: #93ad11;
  --ds-brand-press: #86a00f;
  --ds-brand-soft: #f3f7df;
  --ds-on-brand: #202526;
  --ds-ink: #202526;
  --ds-text: #323a3b;
  --ds-muted: #667174;
  --ds-line: #e1e5e5;
  --ds-line-strong: #cbd2cc;
  --ds-surface: #ffffff;
  --ds-surface-2: #f8f9f8;
  --ds-surface-hover: #f2f5ee;
  --ds-bg: #f5f6f5;
  --ds-danger: #b3261e;
  --ds-danger-hover: #9a1f18;
  --ds-danger-soft: #fdecea;
  --ds-success: #2f6b16;
  --ds-success-soft: #eaf4e2;
  --ds-warning: #8a5a00;
  --ds-warning-soft: #fff4d6;
  --ds-info: #2d5f8a;
  --ds-focus: #5e7a08;
  --ds-focus-ring: 0 0 0 3px rgba(94, 122, 8, .22);
  --ds-backdrop: rgba(20, 28, 22, .48);

  /* Rundung, Abstand, Hoehe */
  --ds-radius-sm: 6px;
  --ds-radius-md: 10px;
  --ds-radius-lg: 14px;
  --ds-radius-xl: 18px;
  --ds-radius-pill: 999px;
  --ds-space-1: 4px; --ds-space-2: 8px; --ds-space-3: 12px; --ds-space-4: 16px; --ds-space-5: 20px; --ds-space-6: 24px; --ds-space-8: 32px;
  --ds-h-sm: 30px;     /* kleine Knoepfe in Tabellenzeilen */
  --ds-h-bar: 38px;    /* Knoepfe in Leisten */
  --ds-h-form: 44px;   /* Felder + Knoepfe in Formularen (Hausstil tikos-teile-*) */

  /* Schrift */
  --ds-font-xs: 12px; --ds-font-sm: 13px; --ds-font-md: 14px; --ds-font-lg: 16px; --ds-font-xl: 20px;

  /* Tiefe */
  --ds-shadow-1: 0 1px 2px rgba(15, 23, 20, .08), 0 1px 3px rgba(15, 23, 20, .06);
  --ds-shadow-2: 0 4px 14px rgba(15, 23, 20, .12), 0 2px 4px rgba(15, 23, 20, .06);
  --ds-shadow-3: 0 18px 44px rgba(15, 23, 20, .24), 0 4px 12px rgba(15, 23, 20, .10);

  /* Bewegung */
  --ds-dur-fast: 120ms;
  --ds-dur: 180ms;
  --ds-dur-slow: 220ms;
  --ds-ease: cubic-bezier(.2, .7, .2, 1);
  --ds-ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Alte Tokens auf das System zeigen lassen (ui-2720.css, style.css) */
  --rs-dur: var(--ds-dur);
  --rs-ease: var(--ds-ease);
  --rs-shadow-1: var(--ds-shadow-1);
  --rs-shadow-2: var(--ds-shadow-2);
  --rs-shadow-3: var(--ds-shadow-3);
  --primary: var(--ds-brand);
  --primary-hover: var(--ds-brand-hover);
}

/* ---- 2. Knoepfe: gleiche Zustaende ueberall (Default > Hover > Focus-visible > Pressed > Loading > Disabled) -----------
   Die Modul-Stylesheets sind ueber die Ansichts-ID gescoped (#wareneingangView .ap-btn ...) und damit spezifischer als jede Klasse.
   Damit das System ueberall gleich wirkt, setzen die TOKEN-Eigenschaften (Rundung, Bewegung, Druck) hier mit !important - nur diese. */
:is(button, .ap-btn, .bw-btn, .ik-btn, .btn, .kom-btn, .rd-btn, .ip-btn, .tikos-teile-knopf, .button-link) {
  transition: background-color var(--ds-dur-fast) var(--ds-ease), border-color var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease),
    box-shadow var(--ds-dur-fast) var(--ds-ease), transform var(--ds-dur-fast) var(--ds-ease), opacity var(--ds-dur-fast) var(--ds-ease) !important;
}
/* Hover: Farbe/Kontur, KEIN Hochspringen mehr (style.css hob jeden Knopf um 2 px) */
button:not(:disabled):hover, .button-link:hover { transform: none !important; }
/* Druck-Rueckmeldung: kurz 98 %, weiche Rueckkehr */
:is(button, .ap-btn, .bw-btn, .ik-btn, .btn, .kom-btn, .rd-btn, .ip-btn, .button-link):not(:disabled):active { transform: scale(.98) !important; transition-duration: 60ms !important; }
/* Flaechen-Knoepfe (Karten, Tabellenzellen, Menue, Reiter) nicht skalieren - die sind Karten, keine Aktionsknoepfe */
:is(.sidebar-nav button, [role="tab"], .fleet-assignment-button, .fleet-week-table td button, .fleet-row-main, .fleet-vehicle-card > button, .fleet-week-card,
    .knowledge-card, .knowledge-suggestion, .ruess-lookup-option):not(:disabled):active { transform: none !important; }
/* 3.1.0 (Fehler aus 3.0.0, Marvin 13.11. "Favoriten defekt"): .nav-stern stand oben in der Liste - beim Druecken verlor der Stern sein
   transform: translateY(-50%) (Zentrierung), sprang ~10 px nach unten, das Loslassen landete auf dem Menuepunkt -> kein Favorit.
   Ausserdem war die Ausnahme schwaecher als die Druck-Regel (Spezifitaet) - jetzt mit :not(:disabled) gleich stark und spaeter geladen. */
.nav-stern:active { transform: translateY(-50%) !important; }
/* 3.5.1 (Hub-Prüfung, UI-Audit klassisch 1440 px): Favoriten-Stern im Menü war 20 px - Mindestgröße für Zeigeziele 24 px (WCAG 2.5.8) */
.app-sidebar .nav-stern { width: 24px; height: 24px; }
/* 3.5.1: Hinweis bei fremden Tickets (Ansicht „Alle Tickets“, nur lesen) */
.ticket-nur-lesen-hinweis { margin: 0 0 var(--ds-space-3); color: var(--ds-muted); font-size: var(--ds-font-sm); }
/* Sekundaer/Ghost: helle Flaeche, feine Kontur, Hover leicht getoent */
button.secondary:not(:disabled):hover, .ap-btn:not(.primary):not(.danger):not(:disabled):hover { background: var(--ds-surface-hover); border-color: var(--ds-line-strong); }
/* Gefaehrlich */
button.danger:not(:disabled):hover, .ap-btn.danger:not(:disabled):hover, .btn-danger:not(:disabled):hover { background: var(--ds-danger-hover); border-color: var(--ds-danger-hover); }
/* Laden (busy.js setzt .is-busy / aria-busy): Knopf bleibt gleich breit, Spinner in Textfarbe */
button.is-busy, button[aria-busy="true"], .ap-btn.is-busy { cursor: progress !important; }
/* Rundungen vereinheitlichen: Leisten-/Formularknoepfe 10 px (style.css 16 px, .btn 8 px, .bw-btn 6 px) */
:is(.ap-btn, .bw-btn, .ik-btn, .btn, .kom-btn, .rd-btn, .ip-btn, .tikos-teile-knopf) { border-radius: var(--ds-radius-md) !important; }

/* Symbol-Knoepfe (✕, Pfeile): gleiche Groesse, Form und Rueckmeldung */
:is(.ap-icon-btn, .hilfe-zu, .kom-dialog-close, .rd-zu, .bw-mail-zu, .ik-zu) {
  border-radius: var(--ds-radius-md) !important;
  transition: background-color var(--ds-dur-fast) var(--ds-ease), color var(--ds-dur-fast) var(--ds-ease), transform var(--ds-dur-fast) var(--ds-ease);
}
:is(.ap-icon-btn, .hilfe-zu, .kom-dialog-close, .rd-zu, .bw-mail-zu, .ik-zu, .modal-close):not(:disabled):active { transform: scale(.94) !important; }

/* ---- 3. Dialoge / Fenster: gleiche Form, Tiefe, Hintergrund und Bewegung ------------------------------------------------- */
.modal, .ruess-dialog-overlay, :is(#ausgangsprotokolleView, #eingangsprotokolleView, #autostadtView, #tikosTraegerView, #tikosPreiseView, #wareneingangView, #offeneBestellungenView, #einkaufAufgabenView) .ap-modal { background: var(--ds-backdrop); }
:is(.modal-content, .kom-modal-card, .ruess-dialog),
:is(#ausgangsprotokolleView, #eingangsprotokolleView, #autostadtView, #tikosTraegerView, #tikosPreiseView, #wareneingangView, #offeneBestellungenView, #einkaufAufgabenView) .ap-dialog {
  border-radius: var(--ds-radius-xl) !important;
  box-shadow: var(--ds-shadow-3) !important;
}
/* Ein-/Ausblenden: ui-2720.css steuert per transition + @starting-style; hier nur Dauer/Kurve aus den Tokens */
.modal, .ap-modal, .ruess-dialog-overlay, .users-drawer-backdrop { transition-duration: var(--ds-dur); }
:is(.modal .modal-content, .modal .kom-modal-card, .ap-modal > *, .ruess-dialog) { transition-duration: var(--ds-dur-slow); transition-timing-function: var(--ds-ease-out); }
/* Schliessen-Knopf grosser Dialoge: ruhiger, gleiche Form wie ueberall */
.modal-close { border-radius: var(--ds-radius-md) !important; }

/* ---- 4. Felder ----------------------------------------------------------------------------------------------------------- */
:is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), select, textarea) {
  border-radius: var(--ds-radius-md) !important;
  transition: border-color var(--ds-dur-fast) var(--ds-ease), box-shadow var(--ds-dur-fast) var(--ds-ease), background-color var(--ds-dur-fast) var(--ds-ease);
}
:is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea):not(:disabled):not(:focus):hover { border-color: var(--ds-line-strong); }
:is(input, select, textarea):focus { border-color: var(--ds-focus) !important; box-shadow: var(--ds-focus-ring); outline: none; }
:is(input, select, textarea):focus-visible { outline: none !important; }
:is(input, select, textarea):disabled { background-color: var(--ds-surface-2); color: var(--ds-muted); cursor: not-allowed; }
::placeholder { color: #687274; opacity: 1; } /* 4,9:1 auf Weiss, 4,7:1 auf --ds-surface-2 */
input[type="checkbox"], input[type="radio"] { accent-color: var(--ds-focus); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--ds-focus) !important; outline-offset: 2px; box-shadow: none; }
/* Pflichtfeld-/Fehlerzustand (aria-invalid) einheitlich */
:is(input, select, textarea)[aria-invalid="true"] { border-color: var(--ds-danger) !important; box-shadow: 0 0 0 3px rgba(179, 38, 30, .14); }

/* ---- 5. Tabellen: gleiche Kopfzeile, Linien, Zeilen-Rueckmeldung ------------------------------------------------------- */
:is(.ap-table, .kom-table, .ik-tabelle, .rt-table, .fleet-liste-tabelle, .bw-table, .tikos-teile-tabelle, .anprobe-tabelle) tbody tr {
  transition: background-color var(--ds-dur-fast) var(--ds-ease);
}
:is(.ap-table, .kom-table, .ik-tabelle, .rt-table, .fleet-liste-tabelle, .bw-table, .tikos-teile-tabelle, .anprobe-tabelle) tbody tr:not(.ap-empty-row):hover { background-color: var(--ds-surface-hover); }
:is(.ap-table, .kom-table, .ik-tabelle, .rt-table, .fleet-liste-tabelle, .bw-table, .tikos-teile-tabelle, .anprobe-tabelle) th { color: var(--ds-muted); }
.ap-empty-row td { color: var(--ds-muted); text-align: center; padding: var(--ds-space-6) var(--ds-space-3) !important; }

/* ---- 6. Meldungen (Toasts) und Hinweise ----------------------------------------------------------------------------------- */
:is(#ausgangsprotokolleView, #eingangsprotokolleView, #autostadtView, #tikosTraegerView, #tikosPreiseView, #wareneingangView, #offeneBestellungenView, #einkaufAufgabenView) .ap-toast,
#bewerbungenView .bw-toast, .hub-message-stack > * {
  border-radius: var(--ds-radius-lg) !important;
  box-shadow: var(--ds-shadow-2);
}
:is(#ausgangsprotokolleView, #eingangsprotokolleView, #autostadtView, #tikosTraegerView, #tikosPreiseView, #wareneingangView, #offeneBestellungenView, #einkaufAufgabenView) .ap-toast {
  transition: opacity var(--ds-dur) var(--ds-ease), transform var(--ds-dur-slow) var(--ds-ease-out);
}

/* ---- 7. Badges / Status -------------------------------------------------------------------------------------------------- */
.badge { border-radius: var(--ds-radius-pill); }

/* ---- 8. Karten / Flaechen ------------------------------------------------------------------------------------------------ */
:is(.ip-card, .fleet-record-card-main, [onclick].box) { transition: box-shadow var(--ds-dur) var(--ds-ease), transform var(--ds-dur) var(--ds-ease), border-color var(--ds-dur) var(--ds-ease); }

/* ---- 9. Weniger Bewegung, wenn im System eingestellt --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .busy-spinner, .ruess-loading-dot, button.is-busy::after { animation-duration: 3s !important; animation-iteration-count: infinite !important; }
  :is(button, .ap-btn, .bw-btn, .ik-btn, .btn, .kom-btn, .rd-btn, .ip-btn):active { transform: none !important; }
}
