/* NAVO – Bedienbarkeit: Korrekturen aus dem Seitenrundgang (test/ux-rundgang-test.js). Wird als letzte Stildatei geladen.
   Kontrast nach WCAG AA (4,5 : 1 für normalen Text), Tippflächen am Handy, nichts darf am Handyrand abgeschnitten werden. */

/* „--card“ wird in mehreren Modulen mit hellem Ersatzwert benutzt, war aber nirgends gesetzt – im Dunkelmodus standen
   dadurch helle Schrift auf weißen Knöpfen und Kacheln (Fahrzeugtablets, Verträge erstellen, Info-Knöpfe). */
:root {
  --card: var(--panel);
}

/* Hell: Tabellenköpfe, Tastenkürzel und Nebentexte (vorher 3,3 : 1) und blaue Links auf grauem Grund (vorher 4,3 : 1) */
:root:not([data-theme='dark']) {
  --faint: #66666b;
  --muted: #66666b; /* auch auf blau/gelb getönten Flächen ≥ 4,5 : 1 (vorher 4,4 : 1) */
  --accent: #0066cc;
  --accent-2: #0071e3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --faint: #98989d;
    --muted: #a1a1a6;
    --accent: #0a84ff;
    --accent-2: #409cff;
    --accent-soft: #071d38;
  }
}
:root[data-theme='dark'] {
  --faint: #98989d;
  --muted: #a1a1a6;
  --accent: #0a84ff;
  --accent-2: #409cff;
  --accent-soft: #071d38;
}
/* Dunkel: weiße Schrift auf #0a84ff hat nur 3,7 : 1 – Hauptknöpfe bekommen ein etwas tieferes Blau */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .btn.primary,
  :root:not([data-theme='light']) .ft-tabs button.active {
    background: #0071e3;
    border-color: #0071e3;
  }
  :root:not([data-theme='light']) .btn.primary:hover {
    background: #0066cc;
    border-color: #0066cc;
  }
}
:root[data-theme='dark'] .btn.primary,
:root[data-theme='dark'] .ft-tabs button.active {
  background: #0071e3;
  border-color: #0071e3;
}
:root[data-theme='dark'] .btn.primary:hover {
  background: #0066cc;
  border-color: #0066cc;
}

/* Touch: Werkzeugleiste des Texteditors, Info-Knöpfe und Filter-Chips daumentauglich (vorher 16–31 px) */
@media (pointer: coarse) {
  .rt-bar button {
    min-width: 40px;
    height: 40px;
  }
  .rt-bar select {
    height: 40px;
  }
  .rt-more {
    width: 30px;
    height: 30px;
  }
  .finfo {
    position: relative;
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  /* sichtbar klein, Tippfläche 40 × 40 */
  .finfo::after {
    content: '';
    position: absolute;
    inset: -9px;
  }
  .vt-chip,
  .chip,
  .dupx-fchip,
  .ap-chip,
  .ft-tabs button {
    min-height: 40px;
  }
  .rt-colors button[data-color] {
    min-width: 32px;
    width: 32px;
    height: 32px;
  }
  .dict-btn {
    width: 36px;
    height: 36px;
  }
  .msgr-filter button,
  .ak-seg button,
  .pe-ib {
    min-height: 36px;
    min-width: 36px;
  }
}

/* Einrichtung am Handy: Knöpfe rutschen unter den Text statt rechts aus dem Bild */
@media (max-width: 640px) {
  .setup-step {
    flex-wrap: wrap;
  }
  .setup-main {
    flex-basis: calc(100% - 42px);
  }
  .setup-step > .btn,
  .setup-step > button {
    margin-left: 42px;
  }
  .setup-step > .btn + .btn,
  .setup-step > button + .btn {
    margin-left: 0;
  }
}

/* App-Modus: der runde „+“ oben trägt die Aktion als Text („+ Projekt“) – sonst ist er vom „+“ unten nicht zu unterscheiden */
.ap-hbtn.ap-plus.has-t {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px 0 9px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

/* Hinweise erscheinen bei offenem Dialog oben – unten verdeckten sie die Knöpfe „Senden“/„Speichern“ */
body:has(.modal-bg) .toasts {
  bottom: auto;
  top: 16px;
}

/* Erste Anmeldung: Willkommenskarte und Hinweis zur Zwei-Faktor-Anmeldung überlagerten sich – der Hinweis wartet,
   bis die Willkommenskarte geschlossen ist (twofa.js prüft das nur beim Erscheinen, die Karte kommt oft danach) */
body:has(.tour-welcome) .tf-bar {
  display: none;
}

/* Einkaufsliste im Hochformat-Tablet (761–1000 px): sechs Spalten passten nicht, „Hinzufügen“ ragte aus dem Bild –
   Lieferant und Knopf rutschen in die zweite Zeile. (#view: Vorrang vor dem zur Laufzeit eingefügten Modulstil) */
@media (min-width: 761px) and (max-width: 1000px) {
  #view .ek-add {
    grid-template-columns: minmax(130px, 1fr) minmax(160px, 2fr) 80px 100px;
  }
}

/* Touch-Geräte ohne App-Modus (Tablets): kleine Knöpfe und Zeitraum-Chips mit mindestens 36 px Höhe (vorher 28 px) */
@media (pointer: coarse) {
  .btn.sm,
  .btn,
  .zr-chip {
    min-height: 36px;
  }
  .dk-tadd {
    min-width: 32px;
    min-height: 32px;
  }
  /* Ordnerbaum: Abschnittsköpfe („PROJEKTE“) zum Auf-/Zuklappen */
  .dk-thb {
    min-height: 32px;
  }
}

/* Restkontrast (vorher 3,7–4,4 : 1): aktiver Reiter im App-Modus hell dunkler, dunkel heller; Zeitraum-Chips,
   Zähler und Avatar im Dunkelmodus mit tieferem Blau bzw. hellerer Schrift */
.appmode .subnav a.active,
.ap-period {
  color: #0058b0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .appmode .subnav a.active,
  :root:not([data-theme='light']) .ap-period,
  :root:not([data-theme='light']) .ap-avatar,
  :root:not([data-theme='light']) .tb-av {
    color: var(--accent-2);
  }
  :root:not([data-theme='light']) .zr-chip.on,
  :root:not([data-theme='light']) .ap-cnt,
  :root:not([data-theme='light']) .nav-badge,
  :root:not([data-theme='light']) .wz-steps li.on span,
  :root:not([data-theme='light']) .dk-q.on span,
  :root:not([data-theme='light']) .cal .day.today .dn,
  :root:not([data-theme='light']) .vm-bigbtn.primary,
  :root:not([data-theme='light']) .pe-ib.primary {
    background: #0071e3;
    border-color: #0071e3;
  }
  :root:not([data-theme='light']) .vm-bigbtn.primary span {
    color: var(--on-accent);
  }
}
:root[data-theme='dark'] .appmode .subnav a.active,
:root[data-theme='dark'] .ap-period,
:root[data-theme='dark'] .ap-avatar,
:root[data-theme='dark'] .tb-av {
  color: var(--accent-2);
}
:root[data-theme='dark'] .zr-chip.on,
:root[data-theme='dark'] .ap-cnt,
:root[data-theme='dark'] .nav-badge,
:root[data-theme='dark'] .wz-steps li.on span,
:root[data-theme='dark'] .dk-q.on span,
:root[data-theme='dark'] .cal .day.today .dn,
:root[data-theme='dark'] .vm-bigbtn.primary,
:root[data-theme='dark'] .pe-ib.primary {
  background: #0071e3;
  border-color: #0071e3;
}
:root[data-theme='dark'] .vm-bigbtn.primary span {
  color: var(--on-accent);
}
