/* ============================================================
   mobile.css – Responsive Anpassungen für die Fonds-Lupe
   ============================================================

   LADEREIHENFOLGE
   Diese Datei wird in app.R als LETZTES Stylesheet im <head>
   eingebunden (nach fonds.css und nach allen tags$style-Blöcken
   im <head>). Wegen der vielen !important-Regeln in fonds.css
   ist das der zuverlässigste Hebel: Bei gleicher Spezifität und
   gleichem !important-Status gewinnt die später geladene Regel.
   Ausnahme: <style>-Blöcke, die zur Laufzeit in den <body>
   eingefügt werden (z. B. aus createComparisonModal.R), kommen
   danach und gewinnen bei gleicher Spezifität weiterhin.

   BREAKPOINTS (Bootstrap 3) – verbindlich für alle neuen Regeln
   ------------------------------------------------------------
     xs  Smartphone       max-width:  767px
     sm  Tablet hoch      min-width:  768px  /  max-width:  991px
     md  Tablet quer      min-width:  992px  /  max-width: 1199px
     lg  Desktop          min-width: 1200px

   Grenzen nie überlappen lassen: "max-width: 767px" passt zu
   "min-width: 768px". Kein "max-width: 768px" verwenden, sonst
   greifen bei exakt 768 px beide Regeln.
   Keine eigenen Zwischenwerte (900, 1400 …) einführen.
   Dokumentierte Ausnahme: Navbar klappt schon unter 992px zum
   Hamburger-Menü ein (siehe Abschnitt "Navbar kompakt" unten).

   AUDIT fonds.css (16 Media Queries, Stand 09.11.2026)
   ------------------------------------------------------------
     Z. 1416  768px  -> 767px   (Überlappung korrigiert)
     Z. 1568  768px  -> 767px   (Überlappung korrigiert)
     Z. 3047  1400px -> 1199px  (.products-grid, auf lg-Schwelle)
     Z. 3053  768px  -> 767px   (Überlappung korrigiert)
     Z. 3543  1400px -> 1199px  (.product-card-simple, auf lg-Schwelle)
     Z. 3551  900px  -> 991px   (.product-card-simple einspaltig, auf sm-Schwelle)
     Bereits konform: Z. 1072, 1195, 1218, 1527, 3187, 3195,
     3203, 3263, 3270 sowie @media print (Z. 3091).
   Ebenfalls 768px -> 767px angeglichen:
     app.R (Inline-CSS Anleitungs-Button)
     functions/createComparisonModal.R (Toolbar)
   ============================================================ */


/* ---------- xs: Smartphone (bis 767px) ---------- */
@media (max-width: 767px) {

  /* ===== AP 2: Grid-Struktur ===== */

  /* Erste Zeile jedes Containers (Banner, Info-Boxen): fonds.css macht
     sie mit "display: flex !important" zur Flex-Zeile. Unter 768px haben
     Bootstrap-Spalten keine Breite, die Spalte schrumpft dann auf
     Inhaltsbreite (Banner wird winzig). Mobil normal stapeln. */
  .container-fluid > .row:first-of-type {
    display: block !important;
  }

  /* Filter-Buttons untereinander, gleich breit (fonds.css: Spalte zentriert) */
  .button-container #strat1-reset_filter,
  .button-container #strat1-submit_data,
  .button-container #strat1-submit_data_disabled {
    width: 100% !important;
    max-width: 300px !important;
  }

  .button-container .button-group > div {
    width: 100%;
    max-width: 300px;
  }

  /* Marktüberblick-Kacheln (2x2): weniger Innenabstand, kleinere Zahl.
     !important nötig, weil Padding/Schrift als Inline-Style in app.R stehen */
  .info-card {
    padding: 15px 8px !important;
  }

  .info-card > div:nth-child(2) {
    font-size: 24px !important;
  }

  /* Shiny-Meldungen: volle Breite am unteren Rand (über der Home-Leiste),
     Schließen-Fläche 44px. Vorher 286px breit, rechts unten, über dem Inhalt. */
  #shiny-notification-panel {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .shiny-notification {
    position: relative;
    margin: 8px 0 0 0;
    padding: 12px 48px 12px 14px;
    font-size: 15px;
    line-height: 1.4;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  }

  .shiny-notification-close {
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    float: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  /* Footer: feste Höhe 100px aufheben, Spalten stapeln sich */
  .footer {
    height: auto;
    padding-bottom: 10px;
  }

  .footer img {
    max-width: 100%;
    height: auto;
  }
}

/* ---------- Navbar kompakt mit Hamburger-Menü (bis 991px) ----------
   Ausnahme zur Breakpoint-Konvention oben: Die Navbar klappt nicht wie
   Bootstrap-Standard erst unter 768px ein, sondern schon unter 992px,
   weil Logo, drei lange Tab-Titel und Feedback-Adresse auf Tablets
   (768-991px) nicht in eine Zeile passen. Die Bootstrap-Regeln, die
   ab 768px die Desktop-Navbar erzwingen, werden im sm-Block unten
   zurückgenommen. */
@media (max-width: 991px) {

  /* ===== AP 1: Navbar und Header ===== */

  /* Navbar-Höhe: fonds.css erzwingt 100px */
  .navbar,
  .navbar-brand {
    min-height: 0 !important;
  }

  /* Container darf umbrechen: Kopfzeile oben, aufgeklapptes Menü darunter */
  .navbar.navbar-default .container-fluid {
    flex-wrap: wrap !important;
    padding-left: 0 !important;
  }

  /* Kopfzeile: Logo + Feedback links, Hamburger rechts */
  .navbar-header {
    width: 100% !important;
    margin-right: 0 !important;           /* Bootstrap: -15px -> horiz. Scrollen */
  }

  .navbar-brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;                          /* erlaubt Textumbruch im Flex-Item */
    height: auto !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  .navbar-toggle {
    order: 2;
    flex: 0 0 auto;
    margin: 0 15px 0 8px;
  }

  /* Logo und Feedback nebeneinander (title = div(...) in app.R) */
  .navbar-brand > div {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  /* Logo 80px -> 40px */
  .navbar-logo {
    height: 40px;
  }

  /* Feedback-Adresse: aus der absoluten Positionierung lösen, umbrechen */
  .navbar-feedback {
    position: static;
    transform: none;
    text-align: left;
    font-size: 12px;
    line-height: 1.3;
    margin-left: 12px;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* Aufgeklapptes Menü über volle Breite */
  .navbar-collapse {
    width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0;                       /* Tabs bündig mit dem Logo */
    padding-right: 0;
  }

  /* Tab-Leiste: absolute Zentrierung aus fonds.css aufheben, untereinander */
  .navbar .navbar-nav {
    position: static !important;
    left: auto !important;
    transform: none !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 0 8px 0;
  }

  .navbar-default .navbar-nav > li > a {
    font-size: 16px !important;
    padding: 10px 15px;
  }

  /* Tab-Titel: Desktop-Abstand, Schriftgröße und nowrap neutralisieren */
  .navbar-tab-title {
    margin-top: 0;
    font-size: 16px;
    white-space: normal;
  }
}

/* ---------- bis 991px: Inhalte einspaltig ---------- */
@media (max-width: 991px) {

  /* ===== AP 2: Grid-Struktur ===== */
  /* Filter- und Auswahl-Karte gestapelt: Abstand dazwischen */
  .comptool-main-row > [class*="col-"] + [class*="col-"] {
    margin-top: 20px;
  }
}

/* ---------- sm: Tablet hoch (768px bis 991px) ---------- */
@media (min-width: 768px) and (max-width: 991px) {

  /* ===== AP 1: Bootstrap-Desktop-Navbar zurücknehmen ===== */
  /* Hamburger-Button einblenden (Bootstrap: display:none ab 768px) */
  .navbar-toggle {
    display: block;
  }

  /* Menü eingeklappt, bis der Button es öffnet
     (Bootstrap: .navbar-collapse.collapse display:block !important ab 768px) */
  .navbar-collapse.collapse {
    display: none !important;
  }

  .navbar-collapse.collapse.in {
    display: block !important;
  }

  /* Tabs untereinander statt nebeneinander */
  .navbar-nav,
  .navbar-nav > li {
    float: none !important;
  }
}

/* ---------- ab md: Desktop (ab 992px) ---------- */
@media (min-width: 992px) {

  /* ===== AP 1: Navbar ===== */
  /* collapsible = TRUE legt die Tab-Liste in einen zusätzlichen
     .navbar-collapse-Container. Ab 992px wird er für das Layout
     "durchsichtig", damit die absolute Zentrierung der Tabs aus
     fonds.css wie vorher am Flex-Container .container-fluid hängt. */
  .navbar-collapse.collapse {
    display: contents !important;          /* schlägt Bootstrap display:block !important */
  }
}

/* ---------- bis md: alles unter Desktop (bis 1199px) ---------- */
@media (max-width: 1199px) {

}

/* ===== AP 6d: Grafik-Menü (Vollbild, Bild speichern) ===== */
/* Button-Größe und Tastaturbedienung: chart-menu.js */

/* Tastaturfokus am Menü-Button sichtbar (SVG: Rahmen statt outline) */
.highcharts-contextbutton:focus { outline: none; }
.highcharts-contextbutton:focus-visible .highcharts-button-box {
  stroke: #1f2a44;
  stroke-width: 3px;
}
.highcharts-contextmenu .highcharts-menu-item:focus-visible {
  outline: 3px solid #1f2a44;
  outline-offset: -3px;
}

/* Touch-Geräte: Einträge mind. 44 px hoch, Schrift 16 px.
   !important, weil Highcharts die Abstände als Inline-Style setzt. */
@media (pointer: coarse) {
  .highcharts-contextmenu .highcharts-menu-item {
    padding: 12px 16px !important;
    font-size: 16px !important;
    line-height: 20px !important;
    min-height: 44px;
    box-sizing: border-box;
  }
}

/* ===== AP 8: Info-Buttons ===== */
/* Trefferfläche 44 x 44 px für alle Info-Buttons (Klasse info-target,
   gesetzt in comptool_module.R). Das sichtbare Symbol bleibt gleich groß;
   negative Ränder halten Zeilenhöhe und Abstand zum Text wie bisher.
   Filter-Drawer: zusätzlich filter-drawer.css. */
.info-target {
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* Info-Buttons an den Grafik-Überschriften (in h3) */
.chart-info-btn {
  margin: -13px 0 -13px -5px !important;
}

/* Sichtbarer Tastaturfokus: Ring eng um das Symbol statt um die ganze Fläche */
.info-target:focus { outline: none !important; box-shadow: none !important; }
.info-target:focus-visible {
  outline: 3px solid #1f2a44 !important;
  outline-offset: -9px;
  border-radius: 50%;
}

/* Hinweistext unter einer Filter-Checkbox (ersetzt Hover-Tooltip) */
.filter-hint {
  margin: -4px 0 4px 0;
  font-size: 13px;
  line-height: 1.4;
  color: #555;
}

/* Checkbox-Zeilen im Drawer: Info-Symbol auf Höhe des Label-Texts.
   Der Checkbox-Container hat unten Abstand, die Zeilenmitte liegt
   deshalb 8 px unter der Textmitte. */
.filter-drawer .filter-check .info-target {
  margin-top: -20px !important;
  margin-bottom: -4px !important;
}

/* Hinweis bündig unter dem Label-Text (Schalter + Abstand = 101 px) */
.filter-drawer .filter-hint {
  padding-left: 101px;
}

/* ===== AP 9: Info-Tabs ===== */

/* Infoboxen (info_box() in app.R): Symbol, Titel und Plus nebeneinander
   per Flexbox statt absoluter Positionierung. Vorher überdeckte das Plus
   bei schmalen Bildschirmen den Titel, und line-height: 40px machte
   mehrzeilige Titel sehr hoch. */
.fl-infobox > .box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 12px;
  min-height: 64px;
  cursor: pointer;
}
/* Clearfix-Pseudoelemente von Bootstrap wären sonst Flex-Elemente */
.fl-infobox > .box-header::before,
.fl-infobox > .box-header::after { display: none; }

.fl-infobox > .box-header > .box-title {
  flex: 1 1 auto;
  width: auto;
  margin: 0;
  padding: 0;
  font-size: 20px;
  line-height: 1.3;
}
.fl-infobox-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fl-infobox-title img {
  position: static !important;
  flex: 0 0 auto;
  margin: 0 !important;
}
.fl-infobox > .box-header > .box-tools {
  position: static;
  float: none !important;
  flex: 0 0 auto;
  margin: 0;
}
.fl-infobox .btn-box-tool {
  min-width: 44px;
  min-height: 44px !important;   /* fonds.css: .btn min-height 40px !important */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fl-infobox > .box-header:hover { background: #e9e9e9; }

/* Boxen bündig mit dem Text darüber (box(width = 12) bringt eine
   eigene Spalte mit 15px Innenabstand mit) */
.col-sm-12:has(> .fl-infobox) {
  padding-left: 0;
  padding-right: 0;
}

/* Lange Links (z. B. ausgeschriebene Adressen) und überlange Wörter
   umbrechen, statt die Seite am Handy breiter als den Bildschirm zu
   machen. Keine automatische Silbentrennung (hyphens: auto): die trennt
   am Handy fast jede Zeile. Lange Wörter in den Texten stattdessen mit
   &shy; versehen (z. B. Startseite1.html). */
.box-body a {
  overflow-wrap: anywhere;
}
.box-body {
  overflow-wrap: break-word;
}

/* Abstand vor "Mehr Informationen zur Fonds-Lupe" (statt 5 x br()) */
.section-gap { height: 48px; }



@media (max-width: 767px) {
  .fl-infobox > .box-header > .box-title { font-size: 18px; }
  .fl-infobox-title { gap: 10px; }
  .fl-infobox-title img { width: 32px; height: 28px; }
  .section-gap { height: 24px; }

  /* Überschriften der Info-Tabs: 40/32px waren am Handy zu groß */
  .tab-pane[data-value="info_tab"] h1,
  .tab-pane[data-value="dinfo"] h1 { font-size: 26px; }
  .tab-pane[data-value="info_tab"] h2,
  .tab-pane[data-value="dinfo"] h2 { font-size: 22px; }
}

/* ===== AP 5: Auswahlkarten und gemeinsame Bausteine ===== */
/* Klasse sel-card (nicht fund-card: die ist in fonds.css für die
   Kartenansicht im Grafik-Modal vergeben) */
/* R-Seite: functions/fund_badges.R (fund_nr_badge, risk_scale) und
   selection_card() in comptool_module.R */

/* Buttons über den Karten: nebeneinander, bei Platzmangel untereinander */
.selection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 12px 0 4px;
}

/* Suchfeld und Button "Filtereinstellungen" in einer Zeile
   (comptoolUI). Der Button sitzt auf Höhe des Eingabefelds, nicht des
   Labels. Reicht die Breite nicht (Handy), rutscht er darunter und wird
   so breit wie das Feld. */
.search-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-top: 8px;
}
.search-filter-row .search-field-slot {
  flex: 1 1 320px;
  min-width: 0;
}
.search-filter-row .search-field-slot .form-group {
  margin-bottom: 0;
}
.search-filter-row .filter-open-btn {
  flex: 0 0 auto;
}
@media (max-width: 767px) {
  .search-filter-row .filter-open-btn {
    flex: 1 1 100%;
  }
}

/* Vergleichs-Button unter 2 Fonds: aria-disabled statt disabled, damit
   er per Tastatur erreichbar bleibt; ein Klick erklärt, was fehlt
   (compare_actions_ui in comptool_module.R) */
.fl-btn.is-disabled,
.fl-btn.is-disabled:hover,
.fl-btn.is-disabled:focus,
.compare-fab.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* Hinweis unter dem Vergleichs-Button ("mindestens 2 Fonds") */
.compare-hint {
  margin: 4px 0 0;
  color: #495057;
  font-size: 15px;
}

/* Seit Schritte-Grafik und Filterleiste weg sind, ist die Auswahlzeile
   die erste .row im Container und würde die Regeln für
   ".container-fluid > .row:first-of-type" aus fonds.css erben (40px
   Abstand, Schatten an der Karte). Auf den bisherigen Stand zurück. */
.container-fluid > .row.comptool-main-row:first-of-type {
  gap: 0 !important;
  margin-bottom: 10px !important;
}
.container-fluid > .row.comptool-main-row:first-of-type .card,
.container-fluid > .row.comptool-main-row:first-of-type .card:hover {
  box-shadow: none !important;
  transition: none !important;
}

/* Raster: so viele Karten nebeneinander, wie bei mind. 260px Breite
   Platz haben (Handy: eine, Tablet: zwei, Desktop: drei) */
.sel-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin-top: 12px;
}

.sel-card {
  position: relative;
  min-width: 0;
  padding: 10px 6px 12px 14px;
  border: 1px solid #bfbfbf;
  border-radius: 8px;
  background: #fff;
  overflow-wrap: break-word;
}
.sel-card-outside {
  border: 2px dashed #ec6600;
  background: #fff8f0;
}

.sel-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sel-card-head .fund-nr {
  width: 28px;
  height: 28px;
  margin-right: 0;
  font-size: 14px;
  flex: 0 0 auto;
}
.sel-card-isin {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: #555;
}

/* X zum Entfernen: Trefferfläche 44 x 44 px */
.sel-card-remove.btn {
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px !important;            /* fonds.css: .btn min-height 40px !important */
  height: 44px;
  margin: -6px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #262626;
  font-size: 20px;
  line-height: 1;
  box-shadow: none;
}
.sel-card-remove.btn:hover { background: #f2f2f2; }
.sel-card-remove.btn:focus { outline: none; box-shadow: none; }
.sel-card-remove.btn:focus-visible { outline: 3px solid #1f2a44; outline-offset: -3px; }

.sel-card-name {
  margin: 6px 0 2px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}
.sel-card-vwg {
  margin-bottom: 8px;
  font-size: 13px;
  color: #555;
}
.sel-card-note {
  margin: 6px 0 0;
  font-size: 14px;
  color: #8c3d00;                         /* 7,5 : 1 auf #fff8f0 */
}

.fund-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.fund-chip {
  padding: 2px 8px;
  border: 1px solid #bfbfbf;
  border-radius: 12px;
  background: #f8f9fa;
  font-size: 13px;
}
.fund-chip-fx {
  border-color: #262626;
  font-weight: 600;
}

.sel-card .fund-position {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

/* Risikoskala und Kartenkopf (.risk-scale, .cmp-card-*): www/fund-card.css */

/* Schwebender Button "Vergleichen (n)": nur am Handy, ab zwei Fonds
   (www/compare-fab.js blendet ihn aus, solange der normale Button im
   Bild ist). Unter Drawer (z-index 1034) und Modals. */
.compare-fab { display: none; }
@media (max-width: 767px) {
  .compare-fab {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1030;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: 26px;
    background: #c45500;                   /* weiße Schrift 4,5 : 1 (#ec6600: nur 3,2 : 1) */
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: opacity .2s ease, transform .2s ease;
  }
  .compare-fab.is-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
  }
  .compare-fab:focus-visible { outline: 3px solid #1f2a44; outline-offset: 3px; }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .compare-fab { transition: none; }
}

/* iOS zoomt beim Antippen in Eingabefelder unter 16 px Schrift
   (ISIN-Suche, Suchfelder der Auswahlmenüs) */
@media (pointer: coarse) {
  .selectize-input input,
  .selectize-input,
  .bootstrap-select .bs-searchbox input {
    font-size: 16px !important;
  }
}

/* ===== AP 7: Vergleichsmodal ===== */
/* R-Seite: functions/createComparisonModal.R (createTableView, .cmp-modal) */

/* Modal: breiter (bis 1200px), feste Höhe; nur der Tabellenbereich
   scrollt (vorher: Modal und Tabelle mit max-height: 70vh scrollten
   ineinander). Kopfzeile und erste Spalte bleiben stehen. */
/* #shiny-modal-wrapper ... !important: fonds.css setzt für alle großen
   Modals width 95vw / margin 20px / min-height 90vh mit !important */
#shiny-modal-wrapper .modal-dialog.modal-lg:has(.cmp-modal) {
  width: min(1200px, 96vw) !important;
  margin: 2vh auto !important;
}
#shiny-modal-wrapper .modal-content:has(.cmp-modal) {
  display: flex;
  flex-direction: column;
  height: 96vh;
  min-height: 0 !important;
}
/* Export: beide Buttons zeigen (fonds.css blendete CSV je nach früherer
   Ansicht Karten/Tabelle aus) */
.modal-content:has(.cmp-modal) .export-btn.html-export,
.modal-content:has(.cmp-modal) .export-btn.csv-export { display: inline-block !important; }
.modal-content:has(.cmp-modal) > .modal-header,
.modal-content:has(.cmp-modal) > .modal-footer { flex: 0 0 auto; }
.modal-content:has(.cmp-modal) > .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.cmp-modal {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.cmp-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 0 12px;
}
.cmp-scroll:focus-visible { outline: 3px solid #1f2a44; outline-offset: -3px; }
.cmp-hint { margin: 12px 16px 4px !important; }

/* Gruppen-Leiste */
.cmp-toolbar {
  flex: 0 0 auto;                         /* nicht vom Tabellenbereich zusammendrücken lassen */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  background: #f8f9fa;
}
.cmp-group-btn {
  min-height: 44px;
  padding: 6px 16px;
  border: 2px solid #ec6600;
  border-radius: 22px;
  background: #fff;
  color: #262626;
  font-size: 14px;
  font-weight: 500;
}
.cmp-group-btn.active {
  background: #262626;
  border-color: #262626;
  color: #fff;
}
.cmp-group-btn:focus-visible { outline: 3px solid #1f2a44; outline-offset: 2px; }

/* Tabelle */
.cmp-table {
  width: 100%;
  border-collapse: separate;              /* nötig für sticky + Rahmen */
  border-spacing: 0;
  font-size: 14px;
  color: #262626;
}
.cmp-table th, .cmp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e3e3e3;
  vertical-align: top;
  text-align: left;
  background: #fff;
}
.cmp-table td { min-width: 140px; }

/* Kopfzeile bleibt oben stehen */
.cmp-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 2px solid #262626;
}
.cmp-col-head .fund-nr {
  width: 28px;
  height: 28px;
  margin: 0 0 6px;
  font-size: 14px;
}
.cmp-col-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: break-word;
}
.cmp-col-isin {
  display: block;
  margin: 2px 0 6px;
  font-size: 12px;
  font-weight: 400;
  color: #555;
}
.cmp-col-head .risk-scale { font-size: 13px; font-weight: 400; }

/* Erste Spalte (Eigenschaften) bleibt links stehen */
.cmp-table .cmp-corner,
.cmp-table .cmp-row-label {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  background: #f8f9fa;
  font-weight: 600;
  border-right: 1px solid #e3e3e3;
}
.cmp-table thead .cmp-corner { z-index: 3; vertical-align: bottom; }
.cmp-row-note {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: #555;
}

/* Gruppenüberschriften: Text bleibt beim waagrechten Scrollen sichtbar */
.cmp-group-row th {
  padding: 14px 12px 6px;
  background: #fff;
  border-bottom: 1px solid #262626;
}
.cmp-group-title,
.cmp-group-note {
  position: sticky;                       /* bleibt links im Bild */
  left: 12px;
  display: block;
  max-width: min(760px, calc(100vw - 80px));
}
.cmp-group-title { font-size: 15px; font-weight: 700; }
.cmp-group-note { margin-top: 2px; }
.cmp-group-note { font-size: 12px; font-weight: 400; color: #555; }

/* Bester Wert je Zeile: fett + Text (nicht nur Farbe) */
.cmp-table td.is-best { font-weight: 700; background: #fff3e6; }
.cmp-best-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid #8c3d00;
  border-radius: 8px;
  color: #8c3d00;
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}

/* Gruppen-Filter */
.cmp-table:not([data-group="all"]) tbody tr { display: none; }
.cmp-table[data-group="basis"]   tbody tr.grp-basis,
.cmp-table[data-group="kosten"]  tbody tr.grp-kosten,
.cmp-table[data-group="perf"]    tbody tr.grp-perf,
.cmp-table[data-group="details"] tbody tr.grp-details,
.cmp-table[data-group="esg"]     tbody tr.grp-esg { display: table-row; }

/* Handy: Modal bildschirmfüllend, schmalere erste Spalte */
@media (max-width: 767px) {
  #shiny-modal-wrapper .modal-dialog.modal-lg:has(.cmp-modal) {
    width: 100vw !important;
    margin: 0 !important;
  }
  #shiny-modal-wrapper .modal-content:has(.cmp-modal) {
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .cmp-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 12px;
  }
  .cmp-group-btn { flex: 0 0 auto; }
  .cmp-table { font-size: 13px; }
  /* Spaltenkopf kompakter: Wort "Risiko" weglassen (Screenreader-Text bleibt) */
  .cmp-col-head .risk-scale-label { display: none; }
  .cmp-col-name { font-size: 14px; }
  .cmp-table th, .cmp-table td { padding: 8px; }
  .cmp-table td { min-width: 130px; }
  .cmp-table .cmp-corner,
  .cmp-table .cmp-row-label {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    font-size: 12px;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;                /* "Verwaltungsgesellschaft" passt sonst nicht */
    hyphens: auto;
  }
}

/* Detailansicht eines Fonds im Vergleichsmodal (AP 7b) */
.cmp-detail[hidden], .cmp-detail-panel[hidden],
.cmp-toolbar[hidden], .cmp-scroll[hidden] { display: none !important; }
.cmp-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 16px 16px;
}
.cmp-detail .comparison-card {
  float: none;
  width: 100%;
  max-width: 640px;
  padding: 0;
}
/* Abschnitte der Karte (.fund-card-full, .cmp-pane-title, .cmp-risk-warning): www/fund-card.css */

/* Fondsname im Spaltenkopf als Button zur Detailansicht */
.cmp-detail-btn {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 2px 0;
  border: 0;
  background: none;
  text-align: left;
  color: #262626;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cmp-detail-btn:hover { color: #8c3d00; }
.cmp-detail-btn:focus-visible { outline: 3px solid #1f2a44; outline-offset: 2px; }
.cmp-detail-hint {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: #555;
  text-decoration: none;
}

/* Kopf mit Schließen-X (AP 7f) */
.cmp-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cmp-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -8px -8px -8px 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #262626;
  font-size: 22px;
  line-height: 1;
}
.cmp-close:hover { background: #f2f2f2; }
.cmp-close:focus-visible { outline: 3px solid #1f2a44; outline-offset: -3px; }

/* Footer: Desktop nebeneinander, Handy untereinander (AP 7f) */
.cmp-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.cmp-footer-export { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-footer .btn { min-height: 44px !important; margin: 0 !important; }   /* fonds.css: .btn 40px !important */


@media (max-width: 767px) {
  .modal-content:has(.cmp-modal) > .modal-header { padding: 10px 16px; }
  .modal-content:has(.cmp-modal) .modal-title { font-size: 18px; }
  .modal-content:has(.cmp-modal) > .modal-footer { padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cmp-footer, .cmp-footer-export { flex-direction: column; align-items: stretch; }
  .cmp-footer .btn { width: 100%; }
  /* CSV am Handy ausblenden (Tabellenkalkulation ist dort kaum nutzbar) */
  .modal-content:has(.cmp-modal) .export-btn.csv-export { display: none !important; }
  /* "Schließen" unten entfällt am Handy: X im Kopf */
  .cmp-footer > div:last-child { display: none; }
  .cmp-detail { padding: 10px 12px 12px; }
}

/* Download-Leiste auf Touch-Geräten (www/file-download.js, AP 7g):
   über allen Modals (Bootstrap-Modal z-index 1050) */
.fl-download {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1070;
  padding: 12px;
  border: 1px solid #262626;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.fl-download-text {
  margin: 0 0 8px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.fl-download-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 44px;
  padding: 6px 16px;
  border: 2px solid #262626;
  border-radius: 22px;
  background: #fff;
  color: #262626 !important;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none !important;
}
.fl-download-btn.is-primary { background: #262626; color: #fff !important; }
.fl-download-btn:focus-visible { outline: 3px solid #1f2a44; outline-offset: 2px; }


/* ===== Buttons: einheitliches System ===== */
/* Vier Typen, überall gleich (R: class = "fl-btn fl-btn-primary" usw.):
   - fl-btn-primary   Hauptaktion: gefüllt, #C45500 (weiße Schrift 4,5 : 1),
                      höchstens eine je Bereich bzw. Dialog
   - fl-btn-secondary Nebenaktion und "Schließen": weiß, Rahmen anthrazit
   - Symbol-Buttons   rund, 44 px (X, Info, Plus): eigene Klassen, s. o.
   - Umschalter       Risiko-Buttons, Filter-Chips, Gruppen im Vergleich
   Ersetzt den Orange-Verlauf mit weißer Schrift (3,2 bzw. 2,4 : 1),
   eckige Bootstrap-Buttons, feste Maße (150 x 35 px) und die vielen
   Inline-Styles. !important nur, wo fonds.css Bootstrap/alte Regeln mit
   !important setzt. */
.fl-btn,
.fl-btn.btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px !important;            /* fonds.css: .btn 40px !important */
  height: auto !important;
  max-width: 100%;
  padding: 8px 22px !important;
  border-radius: 22px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  white-space: normal;
  text-align: center;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: background-color .15s ease, border-color .15s ease;
  cursor: pointer;
}
.fl-btn-primary,
.fl-btn-primary.btn,
.fl-btn-primary:visited {
  background: #c45500 !important;
  border: 2px solid #c45500 !important;
  color: #fff !important;
}
.fl-btn-primary:hover,
.fl-btn-primary:focus {
  background: #a84800 !important;
  border-color: #a84800 !important;
  color: #fff !important;
}
.fl-btn-secondary,
.fl-btn-secondary.btn,
.fl-btn-secondary:visited {
  background: #fff !important;
  border: 2px solid #262626 !important;
  color: #262626 !important;
}
.fl-btn-secondary:hover,
.fl-btn-secondary:focus {
  background: #f2f2f2 !important;
  border-color: #262626 !important;
  color: #262626 !important;
}
.fl-btn:focus { outline: none !important; }
.fl-btn:focus-visible {
  outline: 3px solid #1f2a44 !important;
  outline-offset: 2px !important;
}
.fl-btn:disabled,
.fl-btn.disabled {
  background: #e9ecef !important;
  border-color: #adb5bd !important;
  color: #495057 !important;                /* 7 : 1 auf #e9ecef */
  cursor: not-allowed;
  opacity: 1 !important;
}
.fl-btn-large { font-size: 18px !important; padding: 12px 28px !important; }

/* Abstände zu Nachbarn: Dialog-Footer und Button-Reihen */
.modal-footer .fl-btn + .fl-btn { margin-left: 8px; }
.cmp-detail-back { margin-bottom: 12px; }

/* Impressum / Datenschutz im Footer: wie Links (Datenschutz ist einer,
   Impressum öffnet ein Fenster in der App) */
.fl-link,
.fl-link.btn {
  min-height: 44px !important;
  padding: 10px 8px !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: #262626 !important;
  font-weight: 600;
  text-decoration: underline !important;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
}
.fl-link:hover { color: #8c3d00 !important; }
.fl-link:focus-visible { outline: 3px solid #1f2a44; outline-offset: 2px; }


/* ===== Modals: Höhe nach Inhalt ===== */
/* fonds.css gab jedem Modal min-height: 90vh (viel Leerraum unter kurzen
   Info-Texten). Jetzt passt sich die Höhe dem Inhalt an. Ausnahme:
   die Anleitung mit Reitern behält eine Mindesthöhe, damit das Fenster
   beim Wechseln der Reiter nicht springt. Das Vergleichsmodal setzt seine
   Höhe selbst (Abschnitt AP 7). */
#shiny-modal-wrapper .modal-content:has(#guide_tabs) {
  min-height: min(80vh, 720px);
}

/* Datentabellen: echte <caption> (functions/a11y_table.R), Aussehen wie
   die frühere Überschriftszeile von htmlTable */
caption.gmisc_caption {
  caption-side: top;
  padding: 0 0 6px;
  text-align: left;
  color: #262626;
}
.gmisc_table th[scope="row"] { font-weight: 600; }

/* Links im Fließtext zusätzlich unterstrichen (nicht nur Farbe) – AP 11 */
.tab-content p a,
.tab-content li a,
.box-body a,
.modal-body p a,
.modal-body li a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.table-scroll:focus-visible { outline: 3px solid #1f2a44; outline-offset: 2px; }

/* Tastaturfokus sichtbar (AP 11): ISIN-Suche und Footer-Links */
.selectize-input.focus {
  outline: 3px solid #1f2a44 !important;
  outline-offset: 1px;
}
.fl-link:focus-visible {
  outline: 3px solid #1f2a44 !important;
  outline-offset: 2px !important;
}

/* ===== Lesehilfe über Kosten- und Performance-Grafik =====
   chart_reading_guide() in comptool_module.R. Symbole wie in der
   Highcharts-Legende (graphs.R: LEGEND_OUTER, LEGEND_INNER) und den
   Markierungen (www/selected-markers.js). */
.chart-guide {
  margin: 10px 0 24px;
  padding: 16px 20px;
  background: #f8f9fa;
  border: 1px solid #E5E8E8;
  border-radius: 8px;
}
.chart-guide-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}
.chart-guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 10px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chart-guide-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.5;
}
.chart-guide-sym {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
/* Balken-Symbole schmaler als der Nummern-Kreis: seitlich auffüllen,
   damit alle Texte bündig beginnen */
.chart-guide-sym.sym-outer,
.chart-guide-sym.sym-inner,
.chart-guide-sym.sym-median {
  margin-left: 4px;
  margin-right: 4px;
}
.chart-guide-sym.sym-outer {
  width: 14px; height: 24px;
  background: #e3e3e3;
  border: 1px solid #9a9a9a;
}
.chart-guide-sym.sym-inner {
  width: 14px; height: 24px;
  background: linear-gradient(#e3e3e3 0 25%, #8a8a8a 25% 75%, #e3e3e3 75%);
  border: 1px solid #9a9a9a;
}
.chart-guide-sym.sym-median {
  width: 14px; height: 24px;
  background: radial-gradient(circle, #000 0 4px, transparent 4.5px);
}
.chart-guide-sym.sym-fund {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #1f2a44;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #1f2a44;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.chart-guide-note {
  margin: 12px 0 0;
  color: #495057;
  font-size: 15px;
}

/* Kurzbeschreibung je Grafik und Pflichthinweis zur Performance */
.chart-intro p { margin: 0 0 8px; }
.chart-unit-note { color: #495057; font-size: 15px; }
.chart-disclaimer {
  margin: 8px 0 16px;
  padding: 10px 14px;
  background: #fffbf0;
  border-left: 3px solid #ffb900;
  border-radius: 4px;
}
.chart-disclaimer p { margin: 0; font-size: 15px; line-height: 1.55; color: #333; }

/* ===== Vergleichbare Fonds anzeigen =====
   Button auf der Auswahlkarte (selection_card) und Hinweis unter den
   Filter-Chips (output$comparable_info) in comptool_module.R */
.sel-card-comparable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;                 /* Touch-Ziel */
  margin-top: 4px;
  padding: 0;
  border: none;
  background: none;
  color: #C45500;                   /* wie fl-btn-primary, 4,5 : 1 auf Weiß */
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.sel-card-comparable:hover { color: #8C3D00; }
.sel-card-comparable:focus-visible { outline: 3px solid #1a5fb4; outline-offset: 2px; }

.comparable-info {
  position: relative;
  margin: 14px 0 4px;
  padding: 12px 44px 12px 14px;
  background: #eef3f8;
  border-left: 3px solid #1f2a44;
  border-radius: 4px;
}
.comparable-info p { margin: 0 0 8px; line-height: 1.5; }
.comparable-info .fl-btn { margin-top: 4px; }
.comparable-info-close,
.comparable-info-close:hover,
.comparable-info-close:focus {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #333;
  text-decoration: none;
}
.comparable-info-close:focus-visible { outline: 3px solid #1a5fb4; }

/* ===== Schritt für Schritt filtern (Assistent, Prototyp) =====
   Einstiegslink unter der Such-Zeile und Dialog (output$wiz_body,
   output$wiz_footer in comptool_module.R) */
.wiz-entry {
  margin: 10px 0 0;
  font-size: 15px;
  color: #495057;
}
.wiz-entry a {
  font-weight: 600;
  color: #C45500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wiz-entry a:hover { color: #8C3D00; }

.wiz-intro { margin: 0 0 14px; }
.wiz-progress { display: flex; gap: 6px; margin-bottom: 6px; }
.wiz-progress-dot {
  flex: 1 1 0;
  height: 4px;
  border-radius: 2px;
  background: #E5E8E8;
}
.wiz-progress-dot.is-done { background: #ec6600; }
.wiz-step-label { margin: 0 0 4px; font-size: 14px; color: #6c757d; }
.wiz-question { margin: 0 0 6px; font-size: 20px; font-weight: 600; line-height: 1.3; }
.wiz-question:focus { outline: none; }
.wiz-help { margin: 0 0 14px; color: #495057; line-height: 1.5; }
.wiz-step .shiny-input-container { margin-bottom: 0; }
.wiz-step .shiny-label-null { display: none !important; }
.wiz-step .checkbox,
.wiz-step .radio { margin: 0 0 6px; }
/* Optionen als Karten mit normalen Kästchen/Punkten: fonds.css macht
   aus allen Checkboxen Schalter, für eine Mehrfachauswahl passen echte
   Kästchen besser */
.wiz-step .checkbox label,
.wiz-step .radio label {
  display: flex !important;
  align-items: flex-start !important;
  width: 100%;
  min-height: 44px !important;
  padding: 10px 12px !important;
  border: 1px solid #E5E8E8;
  border-radius: 6px;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  cursor: pointer;
}
.wiz-step .checkbox label:hover,
.wiz-step .radio label:hover { background: #f8f9fa; }
.wiz-step .checkbox input[type="checkbox"]:not(.irs-hidden-input),
.wiz-step .radio input[type="radio"] {
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
  position: static !important;
  flex: 0 0 auto;
  width: 20px !important;
  height: 20px !important;
  margin: 1px 12px 0 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  transition: none !important;
  accent-color: #ec6600 !important;
}
.wiz-step .checkbox input[type="checkbox"]:not(.irs-hidden-input)::before { content: none !important; display: none !important; }
.wiz-step .checkbox input:checked + span,
.wiz-step .radio input:checked + span { font-weight: 600; }
.wiz-desc { color: #495057; }
.wiz-risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
}

.wiz-footer { width: 100%; text-align: left; }
.wiz-count { margin: 0 0 10px; font-weight: 600; }
.wiz-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.wiz-disclaimer { margin: 12px 0 0; font-size: 13px; color: #6c757d; line-height: 1.45; }
.comparable-info .wiz-disclaimer { margin: 4px 0 0; }
@media (max-width: 767px) {
  .wiz-buttons .fl-btn { flex: 1 1 auto; }
}
