/* ============================================
   SECTION MONSTERS - DASHBOARD STYLES
   Dateiname: dashboard.css
   Pfad: /css/dashboard.css
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   iOS: SCHRIFT NICHT EIGENMÄCHTIG AUFBLÄHEN LASSEN
   Ergänzt 08.08.2026
   ============================================
   Safari auf iPhone/iPad vergrössert Schrift selbsttätig ("text autosizing"),
   sobald es eine Seite für zu breit hält — unabhängig davon, was im CSS steht.
   Auf dem ShopWächter waren die Titel im Änderungsprotokoll mit font-size:13px
   ausgezeichnet und erschienen auf dem iPhone trotzdem riesig, während derselbe
   Text rechts abgeschnitten wurde. Beides ist DASSELBE Problem: eine überbreite
   Zeile (white-space:nowrap in einer Liste) lässt iOS die Seite als zu breit
   einstufen, worauf es die Schrift hochskaliert.

   Die Deklaration fehlte im gesamten Projekt — weder hier, noch in
   customer-shop-monitor.css, noch in sm-theme-dark.css kam text-size-adjust vor.
   Sie betrifft damit alle Seiten, die dieses Stylesheet laden (37 von 40 in der
   Stichprobe), nicht nur den ShopWächter.

   100% heisst nicht "keine Anpassung", sondern "genau die im CSS angegebene
   Grösse" — responsive Schriftgrössen und Nutzer-Zoom bleiben unangetastet.
   Nur das ungefragte Hochskalieren durch das Betriebssystem entfällt. */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fe;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    /* clip statt hidden: hidden macht <body> zu einem Scroll-Container
       (overflow-y wird implizit auto) und damit zu einem zweiten Scrollport
       neben dem Viewport. Sticky-Elemente haengen dann an einem Scrollport,
       der nie scrollt, und scrollTop-Abfragen am <html> werden irrefuehrend.
       clip klippt genauso, ohne Scrollport. Der H-Overflow-Guard sitzt am
       <html> — von dort propagiert overflow korrekt an den Viewport. */
    overflow-x: hidden;   /* Fallback fuer Engines ohne overflow:clip */
    overflow-x: clip;
    overflow-y: visible;
}

/* ============================================
   DARK MODE
   ============================================ */

body.dark-mode {
    background: #1a202c;
    color: #e5e7eb;
}

body.dark-mode .sidebar {
    background: #2d3748;
    border-right-color: #4a5568;
}

body.dark-mode .sidebar-header {
    border-bottom-color: #4a5568;
}

body.dark-mode .logo-text,
body.dark-mode .menu-item {
    color: #e5e7eb;
}

body.dark-mode .menu-item:hover {
    background: #4a5568;
    color: white;
}

body.dark-mode .menu-label {
    color: #a0aec0;
}

body.dark-mode .topbar {
    background: #2d3748;
    border-bottom-color: #4a5568;
}

body.dark-mode .search-input {
    background: #1a202c;
    border-color: #4a5568;
    color: #e5e7eb;
}

body.dark-mode .search-input::placeholder {
    color: #718096;
}

body.dark-mode .topbar-icon {
    background: #1a202c;
    color: #a0aec0;
}

body.dark-mode .topbar-icon:hover {
    background: #4a5568;
    color: white;
}

body.dark-mode .user-name {
    color: #e5e7eb;
}

body.dark-mode .page-title {
    color: #e5e7eb;
}

body.dark-mode .page-subtitle {
    color: #a0aec0;
}

body.dark-mode .filter-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
}

body.dark-mode .filter-btn:hover {
    background: #4a5568;
    color: white;
}

body.dark-mode .stat-card,
body.dark-mode .chart-card,
body.dark-mode .presets-card {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .stat-label {
    color: #a0aec0;
}

body.dark-mode .stat-value {
    color: #e5e7eb;
}

body.dark-mode .chart-title {
    color: #e5e7eb;
}

body.dark-mode .chart-subtitle {
    color: #a0aec0;
}

body.dark-mode .chart-placeholder {
    background: #1a202c;
}

body.dark-mode .presets-table thead th {
    color: #a0aec0;
    border-bottom-color: #4a5568;
}

body.dark-mode .presets-table tbody td {
    border-bottom-color: #4a5568;
}

body.dark-mode .preset-info h4 {
    color: #e5e7eb;
}

body.dark-mode .btn-action {
    background: #1a202c;
    border-color: #4a5568;
    color: #a0aec0;
}

/* ============================================
   LAYOUT
   ============================================ */

html {
    overflow-x: hidden;
    max-width: 100vw;
}

.dashboard-wrapper {
    display: block;
    min-height: 100vh;
    overflow-x: hidden;   /* Fallback */
    overflow-x: clip;     /* kein zusaetzlicher Scrollport – siehe body */
    overflow-y: visible;
    max-width: 100vw;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;   /* Fallback */
    overflow-x: clip;
    overflow-y: visible;
    width: 100%;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.sidebar::-webkit-scrollbar {
    width: 3px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

body.dark-mode .sidebar {
    scrollbar-color: #4a5568 transparent;
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb {
    background: #4a5568;
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-monster-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
}

.sidebar-close {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.sidebar-menu {
    flex: 1;
    padding: 16px;
}

.menu-section {
    margin-bottom: 24px;
}

.menu-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    padding: 0 12px;
    margin-bottom: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.menu-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.menu-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.menu-item.active:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.menu-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.menu-icon-svg {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.menu-item:hover .menu-icon-svg {
    opacity: 1;
}

.menu-item.active .menu-icon-svg {
    opacity: 1;
    filter: brightness(0) invert(1);
}

body.dark-mode .menu-icon-svg {
    filter: brightness(0) invert(1);
    opacity: 0.6;
}

body.dark-mode .menu-item:hover .menu-icon-svg {
    opacity: 1;
    filter: brightness(0) invert(1);
}

body.dark-mode .menu-item.active .menu-icon-svg {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.menu-badge {
    margin-left: auto;
    background: #667eea;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.menu-badge.new {
    background: #f472b6;
}

.menu-badge.pro {
    background: #a78bfa;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ============================================
   TOP BAR
   ============================================ */

.topbar {
    background: #f8f8f9;
    border-bottom: 1px solid #e8e8ec;
    padding: 16px 24px;
    min-height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* NICHT sticky: components.js injiziert die Topbar in <div id="headerContainer">,
       und dieser Wrapper ist exakt so hoch wie die Topbar selbst. Ein sticky-Element
       kann sich nur innerhalb seines Containing Blocks bewegen — hier also 0px.
       position:sticky war damit auf allen Seiten wirkungslos, hinterliess aber einen
       Sticky-Constraint-Layer, den der Android-WebView losgeloest/versetzt malt
       (freischwebende Glocke). Wer eine echt klebende Topbar will, setzt
       #headerContainer { display: contents; } — dann greift sticky wieder. */
    position: relative;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: #6b7280;
    cursor: pointer;
    padding: 6px 10px;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    transition: background 0.15s;
}

.menu-toggle:hover {
    background: #ebebef;
    color: #1a1a2e;
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid #e8e8ec;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #fff;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: #7c6ff7;
    box-shadow: 0 0 0 3px rgba(124, 111, 247, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #b0b0bc;
    font-size: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #6b6b7a;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
    border: none;
}

.topbar-icon:hover {
    background: #ebebef;
    color: #1a1a2e;
}

.topbar-icon-svg {
    width: 18px;
    height: 18px;
    opacity: 0.65;
    transition: opacity 0.15s;
}

.topbar-icon:hover .topbar-icon-svg {
    opacity: 1;
}

body.dark-mode .topbar-icon-svg {
    filter: brightness(0) invert(1);
    opacity: 0.7;
}

body.dark-mode .topbar-icon:hover .topbar-icon-svg {
    opacity: 1;
}

.notification-badge {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #f8f8f9;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.user-menu:hover {
    background: #ebebef;
    border-color: #e8e8ec;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c6ff7 0%, #9f8fff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    transition: box-shadow .3s ease;
}

/* ✅ V1.0 (06.08.2026): Läuft gerade ein Sync (aktuell nur customer-sync-status.js
   verdrahtet), pulsiert der Avatar-Kasten grün und das Icon wechselt kurzzeitig
   auf ein Sync-Symbol — sichtbar auf JEDER Seite, da der Header geteilt ist. */
@keyframes user-avatar-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.55), 0 0 0 0 rgba(16,185,129,.3); }
    50%      { box-shadow: 0 0 0 5px rgba(16,185,129,.16), 0 0 20px 6px rgba(16,185,129,.55); }
}
@keyframes user-avatar-icon-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.16); }
}
.user-avatar--syncing { animation: user-avatar-glow 1.6s ease-in-out infinite; }
.user-avatar--syncing .user-avatar__icon {
    display: inline-block;
    animation: user-avatar-icon-pulse 1.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .user-avatar--syncing, .user-avatar--syncing .user-avatar__icon { animation: none; }
}

.user-info {
    display: none;
    flex-direction: column;
}

.user-info-desktop {
    display: flex;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.2;
}

.user-role {
    font-size: 11px;
    color: #b0b0bc;
    line-height: 1.2;
}

/* ============================================
   CONTENT AREA
   ============================================ */

.content-area {
    padding: 24px 16px;
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: #6b7280;
}

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.filter-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.filter-btn:hover .filter-icon {
    opacity: 1;
}

.filter-btn.active .filter-icon {
    filter: brightness(0) invert(1);
    opacity: 1;
}

body.dark-mode .filter-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
}

body.dark-mode .filter-btn:hover {
    background: #4a5568;
    color: white;
}

body.dark-mode .filter-icon {
    filter: brightness(0) invert(1);
    opacity: 0.7;
}

/* ============================================
   STATS GRID
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
    min-width: 0;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.stat-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.stat-trend.up {
    background: #d1fae5;
    color: #059669;
}

.stat-trend.down {
    background: #fee2e2;
    color: #dc2626;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
}

.stat-description {
    font-size: 12px;
    color: #9ca3af;
}

/* ============================================
   CHARTS GRID
   ============================================ */

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.chart-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
}

.chart-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.chart-menu {
    color: #9ca3af;
    cursor: pointer;
    font-size: 20px;
}

.chart-placeholder {
    height: 280px;
    background: #f9fafb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 14px;
}

/* ============================================
   PRESETS TABLE
   ============================================ */

.presets-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.presets-table {
    width: 100%;
    border-collapse: collapse;
}

.presets-table thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.presets-table tbody td {
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
}

.preset-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preset-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.preset-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 2px;
}

.preset-info p {
    font-size: 12px;
    color: #9ca3af;
}

.preset-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.preset-badge.beliebt {
    background: #dbeafe;
    color: #1e40af;
}

.preset-badge.neu {
    background: #fce7f3;
    color: #be185d;
}

.preset-badge.top {
    background: #d1fae5;
    color: #065f46;
}

.preset-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.active {
    background: #10b981;
}

.status-dot.inactive {
    background: #ef4444;
}

.btn-action {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-primary-action {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-primary-action:hover {
    opacity: 0.9;
}

.btn-delete:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #1a202c;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 24px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
    font-size: 14px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
    color: #6b7280;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* ============================================
   TOGGLE SWITCHES
   ============================================ */

.feature-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
    position: relative;
}

.toggle-switch:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 34px;
    transition: all 0.3s;
    flex-shrink: 0;
    display: block !important;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background: #667eea;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    user-select: none;
}

body.dark-mode .toggle-switch {
    background: #1a202c;
    border-color: #4a5568;
}

body.dark-mode .toggle-switch:hover {
    background: #374151;
}

body.dark-mode .toggle-label {
    color: #e5e7eb;
}

.feature-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.feature-toggle:hover {
    background: #f3f4f6;
}

.feature-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-text {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.user-detail,
.shop-detail {
    margin-bottom: 16px;
}

.user-detail label,
.shop-detail label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #374151;
    font-size: 13px;
}

.user-detail-value,
.shop-detail-value {
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 13px;
    white-space: pre-line;
}

.feature-item {
    padding: 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 13px;
}

.feature-item.enabled {
    background: #d1fae5;
    color: #065f46;
}

body.dark-mode .modal-content {
    background: #2d3748;
}

body.dark-mode .modal-header {
    border-bottom-color: #4a5568;
    background: #2d3748;
}

body.dark-mode .modal-header h2 {
    color: #e5e7eb;
}

body.dark-mode .modal-close:hover {
    background: #4a5568;
    color: #e5e7eb;
}

body.dark-mode .form-label {
    color: #e5e7eb;
}

body.dark-mode .form-input,
body.dark-mode .form-select {
    background: #1a202c;
    border-color: #4a5568;
    color: #e5e7eb;
}

body.dark-mode .form-input:disabled {
    background: #374151;
    color: #9ca3af;
}

body.dark-mode .feature-toggle {
    background: #1a202c;
}

body.dark-mode .feature-toggle:hover {
    background: #374151;
}

body.dark-mode .toggle-text {
    color: #e5e7eb;
}

body.dark-mode .form-actions {
    border-top-color: #4a5568;
}

body.dark-mode .user-detail label,
body.dark-mode .shop-detail label {
    color: #e5e7eb;
}

body.dark-mode .user-detail-value,
body.dark-mode .shop-detail-value {
    background: #1a202c;
    color: #e5e7eb;
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    flex-direction: column;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 20px 12px;
    }
}

@media (max-width: 768px) {
    html {
        overflow-x: hidden;
        max-width: 100vw;
    }

    body {
        overflow-x: hidden;   /* Fallback */
        overflow-x: clip;
        overflow-y: visible;
        max-width: 100vw;
    }

    .dashboard-wrapper {
        overflow-x: hidden;   /* Fallback */
        overflow-x: clip;
        overflow-y: visible;
        max-width: 100vw;
    }

    .app-layout,
    .main-content,
    .content-area {
        overflow-x: hidden;   /* Fallback */
        overflow-x: clip;
        overflow-y: visible;
        max-width: 100vw;
        min-width: 0;
        width: 100%;
    }

    .sidebar,
    .sm-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 100;
    }

    .sidebar.open,
    .sm-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close,
    .sm-sidebar__close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .menu-toggle {
        display: flex;
    }

    .search-bar {
        display: none;
    }

    .user-info-desktop {
        display: none !important;
    }

    .topbar {
        padding: 12px 16px;
        min-height: auto;
    }

    .topbar-right {
        gap: 8px;
    }

    .topbar-icon {
        width: 40px;
        height: 40px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .content-area {
        padding: 16px 12px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 24px;
    }

    .filter-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .charts-grid {
        gap: 16px;
    }

    .chart-card,
    .presets-card {
        padding: 16px;
        overflow-x: auto;
    }

    .presets-table {
        min-width: 600px;
    }

    .modal {
        padding: 12px;
    }

    .modal-content {
        max-width: 100%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body {
        padding: 16px;
    }

    body.dark-mode .sidebar-close,
    body.dark-mode .sm-sidebar__close {
        background: #4a5568;
        color: #e5e7eb;
    }

    body.dark-mode .sidebar-close:hover,
    body.dark-mode .sm-sidebar__close:hover {
        background: #2d3748;
    }

    .dashboard-container {
        max-width: 100% !important;
        padding: 16px 12px !important;
    }
}

/* ============================================
   QUERY DETAILS STYLES V3.0
   ============================================ */

.products-filter {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 2px solid #e5e7eb;
    flex-wrap: wrap;
    align-items: center;
}

.filter-label {
    font-weight: 600;
    font-size: 14px;
    color: #6d7175;
    margin-right: 8px;
}

.filter-btn {
    padding: 10px 20px;
    background: #f6f6f7;
    border: 2px solid #c9cccf;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn:hover {
    background: #e1e3e5;
    border-color: #b4b8bc;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.products-table tbody tr {
    transition: all 0.2s ease;
}

.product-row-clicked {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.02) 100%);
    border-left: 4px solid #10b981;
}

.product-row-not-clicked {
    background: white;
    opacity: 0.85;
}

.product-row-clicked:hover {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.04) 100%);
    opacity: 1;
}

.product-row-not-clicked:hover {
    background: #f9fafb;
    opacity: 1;
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 16px;
}

.product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-title {
    font-weight: 600;
    font-size: 15px;
    color: #1a202c;
    margin-bottom: 4px;
    line-height: 1.4;
}

.product-price {
    font-size: 14px;
    color: #10b981;
    font-weight: 600;
    margin-bottom: 4px;
}

.product-handle {
    font-size: 12px;
    color: #9ca3af;
    font-family: 'Monaco', 'Courier New', monospace;
}

.product-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(6, 182, 212, 0.2);
}

.product-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(6, 182, 212, 0.3);
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #10b981;
}

.badge-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 1px solid #3b82f6;
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #f59e0b;
}

.badge-muted {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.badge-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #ef4444;
}

.table-footer {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.table-info p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #4b5563;
    line-height: 1.8;
}

.table-info p:last-child {
    margin-bottom: 0;
}

.table-info strong {
    color: #1a202c;
    font-weight: 600;
}

.table-info .badge {
    margin: 0 4px;
    vertical-align: middle;
}

.query-header {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 2px solid #e5e7eb;
    margin-bottom: 32px;
}

.query-title {
    font-size: 36px;
    font-weight: 800;
    color: #1a202c;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.query-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.query-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 2px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    min-width: 0;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

@media (max-width: 768px) {
    .products-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-label {
        margin-bottom: 8px;
    }

    .filter-btn {
        width: 100%;
        justify-content: center;
    }

    .query-title {
        font-size: 28px;
    }

    .query-badge {
        font-size: 22px;
        padding: 6px 16px;
    }

    .product-cell {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-image {
        width: 100%;
        height: auto;
        max-width: 200px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }
}

/* ============================================
   SM BREADCRUMBS
   ============================================ */

.sm-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 10px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
}

.sm-bc-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    padding: 3px 6px;
    border-radius: 6px;
    transition: all .18s;
}

.sm-bc-link {
    color: #6b7280;
    text-decoration: none;
}

.sm-bc-link:hover {
    color: var(--primary, #667eea);
    background: #eff6ff;
    text-decoration: none;
}

.sm-bc-sep {
    color: #d1d5db;
    font-size: 16px;
    font-weight: 400;
    user-select: none;
}

.sm-bc-current {
    color: #1a202c;
    font-weight: 700;
    background: #f3f4f6;
}

/* ============================================
   HEROAI SLIDE-IN PANELS — SCHATTEN-FIX
   ============================================ */

.hai-panel,
.shai-panel,
.swai-panel,
.spai-panel {
    box-shadow: none !important;
}

.hai-panel.open,
.shai-panel.open,
.swai-panel.open,
.spai-panel.open {
    box-shadow: -8px 0 40px rgba(0,0,0,.35) !important;
}

.hai-strip,
.shai-strip,
.swai-strip,
.spai-strip {
    box-shadow: none !important;
}

/* ============================================
   ZENTRALER OVERFLOW-FIX V3
   Einmalig hier — keine Tool-CSS-Dateien anfassen.
   ============================================ */

/* 1 ── Main Content: einheitlich 260px erzwingen.
        Tool-CSS-Dateien setzen teils 280px — das sprengt
        den Viewport und erzeugt den Schatten-Streifen. */
.main-content {
    margin-left: 260px !important;
    min-width: 0 !important;
    /* clip statt hidden — hidden machte .main-content zu einem Scroll-Container
       (overflow-y implizit auto) mit clientHeight == scrollHeight. Zusammen mit
       body + .dashboard-wrapper lagen so DREI Phantom-Scrollports um den Content;
       welcher davon am Ende wirklich scrollt, entscheiden Engines unterschiedlich
       (Flexbox min-height:auto → 0, sobald overflow != visible). Genau deshalb
       konnte documentElement.scrollTop 0 melden, obwohl die Seite sichtbar
       gescrollt war. clip klippt identisch, ohne Scrollport. */
    overflow-x: hidden !important;   /* Fallback */
    overflow-x: clip !important;
    overflow-y: visible !important;
    box-sizing: border-box !important;
}

/* 2 ── Dashboard-Container: nie breiter als der verfügbare Platz.
        calc() zieht Sidebar + 2px Puffer ab. */
.dashboard-container {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: min(1400px, calc(100vw - 260px - 2px)) !important;
}

/* 3 ── Slide-in Panels (geschlossen): konkrete Root-Klassen/-IDs.
        visibility:hidden stoppt das box-shadow-Rendering im
        off-screen Compositing-Layer komplett.
        Neue Panels hier einfach ergänzen — nie in Tool-CSS-Dateien. */
#th-panel,
#krDetailPanel,
.hai-panel,
.shai-panel,
.swai-panel,
.spai-panel,
/* MarktBlick + alle competitor/own-shop Subpages */
.ci-panel,
/* Team-Board: 5 Slide-in-Panels (Task/Projekt/Detail/Stats/Notif) */
.tb-panel {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 4 ── Panels geöffnet: visibility zurücksetzen */
#th-panel.th-open,
#krDetailPanel.kr-panel-offen,
.hai-panel.open,
.shai-panel.open,
.swai-panel.open,
.spai-panel.open,
/* MarktBlick + alle competitor/own-shop Subpages */
.ci-panel.open,
/* Team-Board */
.tb-panel.tb-panel--open {
    visibility: visible !important;
    pointer-events: auto !important;
}

/* 5 ── Mobile */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0 !important;
    }
    .dashboard-container {
        max-width: 100% !important;
    }
}


.krhai-panel {
    visibility: hidden !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

.krhai-panel.open {
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: -8px 0 40px rgba(0,0,0,.35) !important;
}


/* ============================================================
   SYNC-BANNER — Layout-Fix analog UmsatzRadar
   Ergänzung für V9.1: banner-top + chips untereinander
   ============================================================ */

.kr-sync-banner {
    flex-direction: column;
    gap: 12px;
}

.kr-sync-banner-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.kr-sync-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.kr-sync-chip {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: var(--kr-radius-sm, 6px);
    padding: 8px 14px;
    text-align: center;
    flex: 1;
    min-width: 80px;
    max-width: 140px;
}

.kr-sync-chip strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #1a202c;
}

.kr-sync-chip span {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .04em;
}

@media (max-width: 768px) {
    .kr-sync-chips { justify-content: center; }
    .kr-sync-chip  { flex: 1 1 auto; }
}

/* ═══════════════════════════════════════════════════════════════
   EINHEITLICHER INHALTSBEREICH-LOADER  ·  .sm-loader
   Ersetzt alle alten seitenspezifischen Voll-Preloader (dunkle
   Mesh-Overlays wie helle Spinner). Dezent, hell, zentriert – die
   App-Shell (Sidebar/Header/Bottom-Nav) bleibt sichtbar, nur der
   Datenbereich zeigt diesen Spinner. Zentraler Stil: hier anpassen,
   wirkt auf allen ~43 Tool-/Kundenseiten.
   ═══════════════════════════════════════════════════════════════ */
.sm-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 55vh;
    padding: 40px 20px;
    text-align: center;
}
.sm-loader-ring {
    width: 42px;
    height: 42px;
    border: 3px solid var(--mb-border, #e9eaf2);
    border-top-color: var(--mb-primary, #6366f1);
    border-radius: 50%;
    animation: smLoaderSpin .8s linear infinite;
}
@keyframes smLoaderSpin { to { transform: rotate(360deg); } }
.sm-loader-text {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--mb-text-3, #9aa0b4);
    letter-spacing: .01em;
}
@media (prefers-reduced-motion: reduce) {
    .sm-loader-ring { animation-duration: 2s; }
}

/* ═══════════════════════════════════════════════════════════════
   SOFORT-SHELL-SKELETT  ·  #sidebarContainer:empty / #headerContainer:empty
   Die App-Shell (Sidebar + Header) wird von components.js per fetch
   nachgeladen (/includes/sidebar-*.html + /includes/header.html). Bis
   der fetch fertig ist, waren die Container leer → kurzer „leerer"
   Moment beim harten Laden (Sidebar/Header noch nicht da). Diese
   :empty-Regeln halten die Sidebar-Fläche + Header-Leiste SOFORT als
   Platzhalter. Sobald die echte Shell eingefügt ist, greift :empty
   nicht mehr → nahtloser Übergang, kein Layout-Sprung.
   ═══════════════════════════════════════════════════════════════ */
#sidebarContainer:empty {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    z-index: 1;
}
#headerContainer:empty {
    display: block;
    min-height: 80px;
    background: #f8f8f9;
    border-bottom: 1px solid #e8e8ec;
}
@media (max-width: 768px) {
    /* Mobile: Sidebar ist off-canvas → keine Fläche halten (nur Header-Leiste) */
    #sidebarContainer:empty { display: none; }
}

/* ════════════════════════════════════════════════════════════
   DYNAMISCHE LADE-OVERLAYS — SOFORT-ZÄHMUNG (render-blocking)
   ────────────────────────────────────────────────────────────
   ~40 Subtool-JS hängen bei Aktionen (Filter/Zeitraum wechseln,
   Nachladen) ein #…-loading-overlay direkt an <body> — meist mit
   position:fixed; inset:0; z-index:9998. Das verdeckt für einen
   kurzen Moment die GANZE Shell (Sidebar + Header), bevor der
   Overlay-Zähmer in sm-preloader.js (MutationObserver, asynchron)
   es in die .content-area einsperren kann → sichtbares Vollbild-
   Aufblitzen bei jeder Aktion.

   Diese Regel greift SOFORT (im <head>, render-blocking, kein
   Race) und beschränkt jedes noch ungezähmte Lade-Overlay auf den
   Inhaltsbereich: Sidebar (links) + Header (oben) bleiben IMMER
   sichtbar. Sobald der Zähmer es final in die .content-area
   verschoben hat, setzt er [data-sm-tamed] — dann greift diese
   Regel nicht mehr und die absolute-Positionierung des Zähmers
   (bündig im Content) übernimmt.

   !important, weil die Overlays inset:0/z-index:9998 per Inline-
   Style bzw. per ID-Selektor setzen.
   ════════════════════════════════════════════════════════════ */
[id$="-loading-overlay"]:not([data-sm-tamed]),
[id$="LoadingOverlay"]:not([data-sm-tamed]),
#tp-overlay:not([data-sm-tamed]) {
    position: fixed !important;
    top: 80px !important;      /* unter der Topbar (min-height 80px) */
    left: 280px !important;    /* rechts der Sidebar (280px breit)   */
    right: 0 !important;
    bottom: 0 !important;
    z-index: 40 !important;    /* über dem Content, unter HeroAI/Modals/Sidebar */
}
@media (max-width: 768px) {
    /* Mobile: Sidebar off-canvas, Header schmal → nur den Content abdecken */
    [id$="-loading-overlay"]:not([data-sm-tamed]),
    [id$="LoadingOverlay"]:not([data-sm-tamed]),
    #tp-overlay:not([data-sm-tamed]) {
        top: 56px !important;
        left: 0 !important;
    }
}
/* ════════════════════════════════════════════════════════════
   SIDEBAR-STEUERUNG (01.08.2026)
   ────────────────────────────────────────────────────────────
   Zwei Betriebsarten:

   A) KOMPAKT — Handy + Tablet im HOCHKANTFORMAT
      Die Sidebar liegt off-canvas und wird per ☰ eingeblendet. Sie verdeckt
      den Inhalt, deshalb gibt es hier das Schließen-X, und ein Klick auf einen
      Menüpunkt schließt sie automatisch (siehe js/components.js).
      Der Breakpoint prüft zusätzlich die ORIENTIERUNG: Eine reine Breiten-
      Grenze kann Tablet-Hochkant und -Querformat nicht trennen (ein iPad 9.7"
      quer und ein iPad Pro 12.9" hochkant sind beide 1024 px breit).

   B) WEIT — Desktop + Tablet im QUERFORMAT
      Die Sidebar steht permanent. Kein Schließen-X (sinnlos, sie verdeckt
      nichts). Stattdessen klappt derselbe ☰-Button sie bei Bedarf ein
      (html.sm-sidebar-collapsed) und gibt den Platz an den Inhalt ab; ein
      erneuter Klick holt sie zurück. Der Zustand wird gemerkt.
   ════════════════════════════════════════════════════════════ */

/* ☰ ist jetzt auf ALLEN Größen sichtbar: kompakt = öffnen, weit = ein-/ausklappen */
.menu-toggle { display: flex; }

/* ── A) KOMPAKT ─────────────────────────────────────────── */
@media (max-width: 900px), (max-width: 1024px) and (orientation: portrait) {
    .sidebar,
    .sm-sidebar {
        transform: translateX(-100%);
        transition: transform .3s ease;
        z-index: 100;
    }
    .sidebar.open,
    .sm-sidebar.open { transform: translateX(0); }

    /* Schließen-X nur hier */
    .sidebar-close,
    .sm-sidebar__close {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .main-content { margin-left: 0 !important; }
    .app-layout   { margin-left: 0 !important; }

    /* Eingeklappt-Zustand ist hier bedeutungslos — Sidebar ist ohnehin off-canvas */
    html.sm-sidebar-collapsed .main-content,
    html.sm-sidebar-collapsed .app-layout { margin-left: 0 !important; }
}

/* ── B) WEIT: eingeklappt ───────────────────────────────── */
@media (min-width: 901px) {
    .sidebar,
    .sm-sidebar { transition: transform .25s ease; }

    html.sm-sidebar-collapsed .sidebar,
    html.sm-sidebar-collapsed .sm-sidebar {
        transform: translateX(-100%);
    }
    /* Platz an den Inhalt abgeben */
    html.sm-sidebar-collapsed .main-content { margin-left: 0 !important; }
    html.sm-sidebar-collapsed .app-layout   { margin-left: 0 !important; }
    /* Sofort-Shell-Skelett darf im eingeklappten Zustand keine Fläche halten */
    html.sm-sidebar-collapsed #sidebarContainer:empty { display: none; }
}

/* ============================================================
   NOTIZBOARD — SCHNELLNOTIZ-SLIDE-IN-PANEL (js/sm-schnellnotiz.js)
   Kopfzeilen-Icon öffnet ein Slide-in-Panel von rechts (Handy: von
   unten), analog #sm-a11y-panel. Global in dashboard.css, weil das
   Kopfzeilen-Icon auf JEDER Kunden-Seite erscheint.

   ⚠️ SCHATTEN NUR IM OFFENEN ZUSTAND (Projektregel, CLAUDE.md):
   box-shadow steht ausschließlich an .nb-quick-panel.is-auf, NIE an
   der Basis-Regel — sonst blutet er am rechten Rand durch, auch wenn
   das Panel per translateX(100%) offscreen liegt.
   ============================================================ */

/* Scroll-Sperre für Vollbild-Panels/Modals (Schnellnotiz-Panel, Zeichnen-
   Modal). Generischer Klassenname, an <html> gesetzt — die eigentliche
   Seite scrollt hier auf html, NICHT auf body (siehe dashboard.css
   Grundlayout). overflow:hidden allein reicht auf iOS Safari oft nicht
   gegen Touch-Rubberband; touch-action:none ergänzt das zuverlässig. */
html.sm-modal-lock {
    overflow: hidden !important;
    touch-action: none;
}

#nb-quick-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 34, .42);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s;
    z-index: 2147482000;
}
#nb-quick-overlay.is-auf { opacity: 1; visibility: visible; }

.nb-quick-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(460px, 94vw);
    background: var(--mb-surface, #fff);
    border-left: 1px solid var(--mb-border, #e9eaf2);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.22, .61, .36, 1);
    z-index: 2147482001;
    /* KEIN box-shadow hier — siehe Kopf */
}
.nb-quick-panel.is-auf {
    transform: translateX(0);
    box-shadow: -8px 0 40px rgba(15, 18, 34, .18);
}

@media (max-width: 560px) {
    .nb-quick-panel {
        width: 100%;
        /* inset:0 statt top+height-Mix: die Fixed-Box füllt IMMER die
           komplette Fixed-Containing-Box, unabhängig davon, ob iOS Safaris
           Adressleiste gerade ein-/ausgeblendet ist. Kombiniert mit der
           Scroll-Sperre unten (html.sm-modal-lock) — ohne die blieb oben/
           unten ein Streifen der Hintergrundseite sichtbar UND scrollbar,
           weil deren Scroll-Bewegung Safaris Adressleisten-Ein-/Ausblenden
           auslöste und die Fixed-Box kurzzeitig nicht mehr deckungsgleich
           mit dem sichtbaren Viewport war. */
        inset: 0;
        border-left: none;
        border-top: none;
        border-radius: 0;
        transform: translateY(100%);
    }
    .nb-quick-panel.is-auf {
        transform: translateY(0);
        box-shadow: 0 -8px 40px rgba(15, 18, 34, .22);
    }
}

.nb-quick-kopf {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--mb-border, #e9eaf2);
    flex-shrink: 0;
}
.nb-quick-titel { font-size: 16px; font-weight: 800; color: var(--mb-text, #1a202c); }
.nb-quick-untertitel { font-size: 12px; color: var(--mb-text-2, #6b7280); margin-top: 2px; }
.nb-quick-schliessen {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border: 1px solid var(--mb-border, #e9eaf2);
    background: var(--mb-surface-2, #f7f8fc);
    color: var(--mb-text-2, #6b7280);
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    transition: background .15s, color .15s;
}
.nb-quick-schliessen:hover { background: var(--mb-border, #e9eaf2); color: var(--mb-text, #1a202c); }

.nb-quick-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 18px; }

/* ── Text/Handschrift-Umschalter ─────────────────────────── */
.nb-quick-toggle {
    display: flex;
    background: var(--mb-surface-2, #f7f8fc);
    border: 1px solid var(--mb-border, #e9eaf2);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 14px;
}
.nb-quick-toggle button {
    flex: 1;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--mb-text-2, #6b7280);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.nb-quick-toggle button.is-active {
    background: var(--mb-surface, #fff);
    color: var(--mb-primary, #6366f1);
    box-shadow: 0 1px 3px rgba(15, 18, 34, .12);
}

.nb-quick-field { margin-bottom: 12px; }
.nb-quick-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--mb-text-3, #9aa0b4);
    margin-bottom: 6px;
}
.nb-quick-input,
.nb-quick-textarea {
    width: 100%;
    border: 1px solid var(--mb-border, #e9eaf2);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--mb-text, #1a202c);
    background: var(--mb-surface, #fff);
    transition: border-color .15s;
}
.nb-quick-input:focus,
.nb-quick-textarea:focus { outline: none; border-color: var(--mb-primary, #6366f1); }
.nb-quick-textarea { min-height: 110px; resize: vertical; line-height: 1.55; }

/* ── Notizfarben ──────────────────────────────────────────── */
.nb-color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.nb-color-swatch {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .12s, border-color .12s;
}
.nb-color-swatch.is-active { border-color: var(--mb-text, #1a202c); transform: scale(1.12); }

/* ── Anhänge ──────────────────────────────────────────────── */
.nb-quick-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px dashed var(--mb-border-strong, #dcdfeb);
    border-radius: 10px;
    background: var(--mb-surface-2, #f7f8fc);
    color: var(--mb-text-2, #6b7280);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.nb-quick-attach-btn:hover { border-color: var(--mb-primary, #6366f1); color: var(--mb-primary, #6366f1); }
.nb-attach-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.nb-attach-thumb {
    position: relative;
    width: 56px; height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--mb-border, #e9eaf2);
    background: var(--mb-surface-2, #f7f8fc);
}
.nb-attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nb-attach-thumb-remove {
    position: absolute;
    top: 2px; right: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 18, 34, .68);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
}

.nb-plan-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--mb-blue-bg, #eff6ff);
    border: 1px solid var(--mb-blue-border, #bfdbfe);
    color: var(--mb-blue-text, #1e40af);
    font-size: 12px;
    line-height: 1.5;
    margin-top: 8px;
}

.nb-quick-save {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: var(--mb-grad, linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%));
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    transition: opacity .15s, transform .1s;
}
.nb-quick-save:hover { opacity: .92; }
.nb-quick-save:active { transform: scale(.99); }
.nb-quick-save:disabled { opacity: .55; cursor: not-allowed; }

/* ── Letzte Notizen ───────────────────────────────────────── */
.nb-quick-recent-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 0 10px;
}
.nb-quick-recent-head span { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--mb-text-3, #9aa0b4); }
.nb-quick-recent-head a { font-size: 12px; font-weight: 700; color: var(--mb-primary, #6366f1); text-decoration: none; }
.nb-quick-recent-head a:hover { text-decoration: underline; }

.nb-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .12s;
}
.nb-recent-item:hover { background: var(--mb-surface-2, #f7f8fc); }
.nb-recent-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.nb-recent-body { flex: 1; min-width: 0; }
.nb-recent-title {
    font-size: 13px; font-weight: 700; color: var(--mb-text, #1a202c);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-recent-meta { font-size: 11px; color: var(--mb-text-3, #9aa0b4); margin-top: 1px; }
.nb-recent-empty { font-size: 12.5px; color: var(--mb-text-3, #9aa0b4); padding: 14px 8px; text-align: center; }

/* ============================================================
   NOTIZBOARD — HANDSCHRIFT-/ZEICHENFLÄCHE (js/nb-canvas.js)
   Wiederverwendet im Schnellnotiz-Panel, auf der Übersichtsseite
   und beim Beschriften eines angehängten Screenshots.
   ============================================================ */

.nb-canvas-wrap { border: 1px solid var(--mb-border, #e9eaf2); border-radius: 12px; overflow: hidden; }
.nb-canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    background: var(--mb-surface-2, #f7f8fc);
    border-bottom: 1px solid var(--mb-border, #e9eaf2);
}
.nb-canvas-modes, .nb-canvas-colors, .nb-canvas-widths, .nb-canvas-actions { display: flex; align-items: center; gap: 6px; }
.nb-canvas-actions { margin-left: auto; }
.nb-canvas-mode {
    width: 28px; height: 28px;
    border-radius: 8px;
    border: 1px solid var(--mb-border, #e9eaf2);
    background: var(--mb-surface, #fff);
    cursor: pointer;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.nb-canvas-mode.is-active { border-color: var(--mb-primary, #6366f1); background: var(--mb-grad-soft, rgba(99,102,241,.08)); }
.nb-canvas-color {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}
.nb-canvas-color.is-active { border-color: var(--mb-text, #1a202c); box-shadow: 0 0 0 2px var(--mb-surface, #fff) inset; }
.nb-canvas-width {
    width: 26px; height: 26px;
    border-radius: 8px;
    border: 1px solid var(--mb-border, #e9eaf2);
    background: var(--mb-surface, #fff);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.nb-canvas-width.is-active { border-color: var(--mb-primary, #6366f1); background: var(--mb-grad-soft, rgba(99,102,241,.08)); }
.nb-canvas-width-dot { border-radius: 50%; background: var(--mb-text, #1a202c); display: block; }
.nb-canvas-btn {
    width: 28px; height: 28px;
    border-radius: 8px;
    border: 1px solid var(--mb-border, #e9eaf2);
    background: var(--mb-surface, #fff);
    cursor: pointer;
    font-size: 13px;
}
.nb-canvas-btn:hover { background: var(--mb-surface-2, #f7f8fc); }
.nb-canvas-stage { position: relative; width: 100%; touch-action: none; }
.nb-canvas-el { display: block; cursor: crosshair; }

.nb-canvas-text-input {
    position: absolute;
    z-index: 5;
    border: 1px dashed var(--mb-primary, #6366f1);
    background: rgba(255, 255, 255, .85);
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 600;
    padding: 1px 4px;
    min-width: 40px;
    border-radius: 3px;
    outline: none;
}

/* ── Gemeinsames Zeichnen-/Beschriften-Modal (nb-canvas.js openNbCanvasModal) ── */
.nb-canvas-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 34, .55);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.nb-canvas-modal {
    background: var(--mb-surface, #fff);
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    padding: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.nb-canvas-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--mb-text, #0f1222);
}
.nb-canvas-modal-close {
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--mb-text-2, #555b70);
}
.nb-canvas-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

/* ⚠️ MUSS nach den Basis-Regeln von .nb-quick-input/.nb-quick-textarea/
   .nb-canvas-text-input stehen (siehe weiter oben): eine @media-Regel wirkt
   sich NICHT auf die CSS-Spezifität aus — bei gleicher Spezifität gewinnt
   bei einer Kollision die später im Quellcode stehende Regel, unabhängig
   davon, ob ihre Media-Bedingung zutrifft. Stand vorher weiter oben VOR der
   Basis-Regel und wurde deshalb auf dem Handy von ihr überschrieben (13.5px
   statt 16px) — genau das löste den iOS-Auto-Zoom trotz "Fix" weiter aus. */
@media (max-width: 560px) {
    /* 16px verhindert iOS-Safari Auto-Zoom beim Fokussieren von Feldern */
    .nb-quick-input, .nb-quick-textarea, .nb-canvas-text-input { font-size: 16px; }
}
