
    :root {
      /* STRONA 2 (Panel Po Zalogowaniu) - Globalne zmienne aplikacji
         v. 4.7.6 (Precision UI): chlodne tlo robocze + snieznobiale karty + precyzyjne obramowanie 1px
         + wielowarstwowy, miekki cien. Akcent inzynieryjny: #1d4ed8 / #2563eb. */
      --primary: #2563eb;
      --primary-dark: #1d4ed8;
      --primary-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);
      --bg: #f1f5f9;
      --card-bg: #ffffff;
      --text: #0f172a;
      --text-muted: #64748b;
      --border: rgba(15, 23, 42, 0.08);
      --success: #10b981;
      --danger: #ef4444;
      --sibe-accent: #0ea5e9;
      --ai-purple: #8b5cf6;
      --ai-gradient: linear-gradient(135deg, #a855f7, #6366f1);
      --gold: #f59e0b;
      --gold-gradient: linear-gradient(135deg, #fbbf24, #d97706);
      /* v. 4.7.6: wielowarstwowe, miekkie cienie (bez "plastikowego" efektu) */
      --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
      --shadow-md: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -4px rgba(15, 23, 42, 0.06);
      --shadow-lg: 0 2px 4px rgba(15, 23, 42, 0.05), 0 18px 40px -8px rgba(15, 23, 42, 0.12);
      /* v. 4.7.6: zaokraglenia - 16px karty/sekcje, 12px przyciski/pola/kafelki wewnetrzne, 999px kapsuly */
      --radius: 16px;
      --radius-sm: 12px;
      --radius-pill: 999px;
    }

    body.dark-mode {
      --primary: #3b82f6;
      --primary-dark: #2563eb;
      --bg: #090d16;
      --card-bg: #111827;
      --text: #f8fafc;
      --text-muted: #94a3b8;
      --border: rgba(148, 163, 184, 0.14);
      /* v. 4.7.6: glebia bez rozjasniania tla (cienie + refleks na gornej krawedzi) */
      --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.5);
      --shadow-md: 0 1px 2px rgba(2, 6, 23, 0.5), 0 10px 28px -6px rgba(2, 6, 23, 0.6);
      --shadow-lg: 0 2px 6px rgba(2, 6, 23, 0.55), 0 24px 54px -10px rgba(2, 6, 23, 0.7);
    }

    body.dark-mode header { background-color: rgba(9, 13, 22, 0.72); border-bottom-color: rgba(148, 163, 184, 0.14); color: #f8fafc; }
    body.dark-mode .nav-tab, body.dark-mode .nav-group-header { background: #161f33; color: #f8fafc; border-color: rgba(148, 163, 184, 0.14); }
    body.dark-mode .nav-tab.active { background: linear-gradient(135deg, #1d4ed8, #172554) !important; color: #ffffff !important; border-color: transparent !important; }
    body.dark-mode .widget-box, body.dark-mode .card, body.dark-mode .chat-container { background: #111827; border-color: rgba(148, 163, 184, 0.14); color: #f8fafc; }
    body.dark-mode .designer-empty-card { background: #111827; border-color: rgba(148, 163, 184, 0.14); color: #f8fafc; }
    body.dark-mode .form-control { background: #0f172a; color: #f8fafc; border-color: rgba(148, 163, 184, 0.14); }
    body.dark-mode .machine-table th { background: #0f172a; color: #f8fafc; border-color: rgba(148, 163, 184, 0.14); }
    body.dark-mode .machine-table td { border-color: rgba(148, 163, 184, 0.14); }
    body.dark-mode .chat-messages { background: rgba(9, 13, 22, 0.55); }
    body.dark-mode .chat-msg { background: #161f33; border-color: rgba(148, 163, 184, 0.14); color: #f8fafc; }
    body.dark-mode .chat-msg.mine { background: rgba(29, 78, 216, 0.26); border-color: rgba(96, 165, 250, 0.45); }
    body.dark-mode .user-dropdown-menu { background: #111827; border-color: rgba(148, 163, 184, 0.14); color: #f8fafc; }
    body.dark-mode .sidebar { background: #0d1424; border-color: rgba(148, 163, 184, 0.14); }

    * { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
    
    html, body { height: 100vh; height: 100dvh; overflow: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background-color: var(--bg); color: var(--text); font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 0.85rem; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: 0; }
    /* v. 4.7.6: BEZ transition na html/body - zmiana motywu (background-color/color) nastepuje natychmiast (0 ms),
       wczesniej "transition: background 0.3s, color 0.3s" dawalo efekt powolnego sciemniania/rozjasniania ekranu. */

    /* iOS Safe Areas – v.1.0: TYLKO Jedno nakładanie! Górę obsługuje top-banner + header margin */
    @supports (padding: env(safe-area-inset-top)) {
      body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: 0; }
      #auth-screen { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
      .sidebar { height: auto; max-height: 100%; }
    }

    /* LOADER PWA – v.1.0: ZAWSZE ciemny (jak strona logowania) */
    #pwa-splash-loader {
      position: fixed !important;
      inset: 0;
      background-color: #0b0f19 !important;
      z-index: 999999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #f8fafc;
      transition: none; /* v. 4.7.6: natychmiastowe ukrycie loadera/overlay (bez fade) */
      visibility: visible;
      opacity: 1;
    }
    .spinner-box {
      width: 40px;
      height: 40px;
      border: 3.5px solid rgba(37, 99, 235, 0.15);
      border-top-color: #2563eb;
      border-radius: 50%;
      animation: spin 0.75s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
      margin-bottom: 12px;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* Cloud Loading Screen (v.1.0) - gezeigt beim Start vor dem Login */
    #cloud-loading-screen {
      position: fixed !important;
      inset: 0;
      background-color: #0b0f19 !important;
      z-index: 999999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #f8fafc;
      transition: none; /* v. 4.7.6: natychmiastowe ukrycie loadera/overlay (bez fade) */
      visibility: visible;
      opacity: 1;
    }
    .cloud-loading-content {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      text-align: center;
    }
    .cloud-icon {
      font-size: 64px;
      filter: drop-shadow(0 4px 8px rgba(37,99,235,0.4));
      animation: cloudFloat 3s ease-in-out infinite;
    }
    @keyframes cloudFloat {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-10px); }
    }
    .cloud-text {
      font-size: 1.1rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      color: #f8fafc;
    }
    .cloud-progress {
      width: 200px;
      height: 4px;
      background: rgba(255,255,255,0.1);
      border-radius: 2px;
      overflow: hidden;
    }
    .cloud-progress-bar {
      width: 0%;
      height: 100%;
      background: linear-gradient(90deg, #2563eb, #38bdf8);
      border-radius: 2px;
      animation: cloudProgress 1.5s ease-in-out infinite;
    }
    @keyframes cloudProgress {
      0% { width: 0%; }
      50% { width: 70%; }
      100% { width: 100%; }
    }

    .top-banner { width: 100%; background: linear-gradient(90deg, #1e293b, #2563eb, #1e293b); color: white; padding: 6px 0; padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); line-height: 1.2; font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; -webkit-font-smoothing: antialiased; overflow: hidden; white-space: nowrap; position: fixed !important; top: 0; left: 0; z-index: 35000; box-shadow: var(--shadow-sm); }
    .marquee-container { display: inline-block; white-space: nowrap; animation: marquee 32s linear infinite; padding-left: 100%; }
    .banner-dot { color: #38bdf8; margin: 0 16px; font-weight: 900; font-size: 0.8rem; }
    @keyframes marquee { 
      0% { transform: translateX(0); } 
      100% { transform: translateX(-100%); } 
    }

    header { background-color: rgba(255, 255, 255, 0.95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); padding: 6px 14px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm); margin-top: calc(28px + env(safe-area-inset-top)); height: calc(54px + env(safe-area-inset-top)); overflow: visible; position: relative; z-index: 25000; flex-shrink: 0; }
    .header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
    
    .elstek-logo-img { height: 26px; width: auto; display: block; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(37,99,235,0.2)); }

    .menu-toggle-btn { display: none; background: var(--primary-gradient); color: white; border: none; border-radius: var(--radius-sm); width: 36px; height: 36px; font-size: 1.15rem; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }
    .menu-toggle-btn:active { transform: scale(0.95); }

    .header-right { display: flex; align-items: center; gap: 8px; overflow-x: visible; max-width: 100%; position: relative; }
    .user-info { font-size: 0.8rem; display: flex; align-items: center; gap: 8px; color: var(--text-muted); position: relative; }

    .header-points-badge { 
      background: rgba(245, 158, 11, 0.1); 
      border: 1px solid rgba(245, 158, 11, 0.4); 
      color: var(--gold); 
      padding: 5px 9px; 
      border-radius: 20px; 
      font-weight: 700; 
      font-size: 0.95rem; 
      display: inline-flex; 
      align-items: center; 
      justify-content: center;
      cursor: pointer; 
      box-shadow: 0 2px 6px rgba(245, 158, 11, 0.12);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
      white-space: nowrap; 
      flex-shrink: 0; 
      line-height: 1;
    }
    .header-points-badge:hover { transform: translateY(-1px) scale(1.05); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25); background: rgba(245, 158, 11, 0.2); }

    .user-profile-badge { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 3px 9px 3px 4px; border-radius: 30px; flex-shrink: 0; background: var(--card-bg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: all 0.2s; position: relative; }
    .user-profile-badge:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15); transform: translateY(-1px); }
    .user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.75rem; color: var(--primary); flex-shrink: 0; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); }
    .user-display-name { font-weight: 800; display: inline-block; font-size: 0.8rem; white-space: nowrap; color: var(--text); }
    
    /* Awatary - ulepszone style (v.1.0) */
    .user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
    /* v. 3.1: kropka statusu nie moze byc przycinana przez overflow kontenera (mobile + desktop) */
    #user-avatar-container { overflow: visible !important; }
    #user-avatar-container img { border-radius: 50%; }
    .dropdown-profile-avatar { width: 64px; height: 64px; border-radius: 50%; border: 3px solid white; object-fit: cover; margin: 0 auto 8px auto; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.25); overflow: hidden; }
    .contact-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-gradient); color: white; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; flex-shrink: 0; box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3); border: 2px solid white; }
    .qr-card-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--border); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.5rem; color: var(--primary); border: 4px solid var(--primary); margin: 0 auto 12px; box-shadow: 0 8px 16px rgba(0,0,0,0.2); }
    .modal-user-avatar { width: 64px; height: 64px; border-radius: 50%; border: 4px solid white; object-fit: cover; margin: 0 auto 8px; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; color: var(--primary); box-shadow: 0 6px 12px rgba(0,0,0,0.25); }

    /* DSGVO Security Badge (v.1.0) */
    .dsgvo-badge {
      margin-top: 10px;
      padding: 8px 12px;
      background: rgba(56, 189, 248, 0.08);
      border: 1px solid rgba(56, 189, 248, 0.35);
      border-radius: var(--radius-sm);
      color: #cbd5e1;
      font-size: 0.7rem;
      text-align: center;
      line-height: 1.3;
    }
    .dsgvo-badge .dsgvo-line1 {
      font-weight: 700;
      color: #f1f5f9;
      margin-bottom: 3px;
      font-size: 0.75rem;
    }
    .dsgvo-badge .dsgvo-line2 {
      font-size: 0.68rem;
      color: #93c5fd;
      opacity: 1;
    }
    @media (max-width: 400px) {
      .dsgvo-badge {
        font-size: 0.68rem;
        padding: 6px 10px;
      }
      .dsgvo-badge .dsgvo-line1 {
        font-size: 0.7rem;
      }
      .dsgvo-badge .dsgvo-line2 {
        font-size: 0.64rem;
      }
    }

    .user-dropdown-menu {
      position: absolute;
      top: 46px;
      right: 0;
      width: 320px;
      max-width: calc(100vw - 20px);
      background: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: var(--shadow-lg);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      display: none;
      flex-direction: column;
      z-index: 30000;
      overflow: hidden;
      animation: fadeInDropdown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .user-dropdown-menu.active { display: flex; }
    @keyframes fadeInDropdown {
      from { opacity: 0; transform: translateY(-8px) scale(0.98); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    /* v.1.0: jasny, nowoczesny nagłówek menu profilu – czysta powierzchnia, subtelna krawędź,
       wysoki kontrast nazwy/odznak/e-mail; niebieski akcent zostaje tylko na awatarze */
    .dropdown-profile-header {
      background: var(--card-bg);
      padding: 16px 16px 12px 16px;
      text-align: center;
      position: relative;
      color: var(--text);
      border-bottom: 1px solid var(--border);
    }
    .dropdown-profile-avatar {
      width: 64px;
      height: 64px;
      border-radius: 50%;
      border: 3px solid var(--card-bg);
      object-fit: cover;
      margin: 0 auto 8px auto;
      background: linear-gradient(135deg, #2563eb, #1d4ed8);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      font-size: 1.1rem;
      color: white;
      box-shadow: 0 2px 10px rgba(37, 99, 235, 0.28);
      overflow: hidden;
    }
    .dropdown-profile-body {
      padding: 12px;
      background: var(--card-bg);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .dropdown-item { padding: 9px 12px; font-size: 0.8rem; font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: space-between; cursor: pointer; background: transparent; border: none; border-bottom: 1px solid var(--border); width: 100%; text-align: left; transition: background 0.15s, color 0.15s; }
    .dropdown-item:last-child { border-bottom: none; }
    .dropdown-item.danger { color: var(--danger); border-top: 1px solid var(--border); border-bottom: none; }

    /* v.1.0: badge „N online" usunięty z nagłówka (liczba online jest na Startseite);
       @keyframes pulse zostaje – używa go .mic-btn.recording */
    @keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } }

    .main-layout { display: flex; flex: 1 1 0%; min-height: 0; width: 100%; max-width: 100%; margin: 12px auto; gap: 14px; padding: 0 10px; height: auto; max-height: none; }
    
    .sidebar-overlay {
      position: fixed !important;
      inset: 0;
      background: rgba(0, 0, 0, 0.4);
      z-index: 19999;
      display: none;
      pointer-events: none;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      transition: opacity 0.3s ease;
    }
    .sidebar-overlay.mobile-open {
      display: block;
      pointer-events: auto !important;
    }

    .sidebar { 
      width: 275px; 
      flex-shrink: 0; 
      display: flex; 
      flex-direction: column; 
      gap: 8px; 
      overflow-y: auto; 
      -webkit-overflow-scrolling: touch; 
      min-height: 0;
      max-height: 100%;
      height: auto;
      padding: 12px 10px; 
      position: relative; 
      background: var(--card-bg); 
      border-radius: var(--radius); 
      border: 1px solid var(--border); 
      box-shadow: var(--shadow-md); 
      backdrop-filter: blur(16px);
      touch-action: pan-y;
      overscroll-behavior-y: contain;
    }

    .sidebar-title { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; padding-left: 4px; }
    
    .nav-group-header { 
      background: rgba(37, 99, 235, 0.03); 
      border: 1px solid var(--border); 
      border-radius: var(--radius-sm); 
      padding: 10px 12px; 
      font-size: 0.8rem; 
      font-weight: 700; 
      color: var(--text); 
      cursor: pointer; 
      display: flex; 
      justify-content: space-between; 
      align-items: center; 
      box-shadow: var(--shadow-sm); 
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation; user-select: none; -webkit-user-select: none;
      pointer-events: auto !important;
    }
    .nav-group-content { display: flex; flex-direction: column; gap: 6px; padding-left: 4px; margin-bottom: 4px; }
    .nav-group-content.collapsed { display: none; pointer-events: none; }

    .nav-tab { 
      background: var(--card-bg); 
      border: 1px solid var(--border); 
      border-radius: var(--radius-sm); 
      padding: 10px 12px; 
      font-size: 0.81rem; 
      font-weight: 600; 
      color: var(--text); 
      cursor: pointer; 
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
      box-shadow: var(--shadow-sm); 
      display: flex;
      justify-content: flex-start;
      align-items: center;
      gap: 8px;
      min-width: 0;
      line-height: 1.3;
      min-height: 38px;
      position: relative;
      overflow: hidden;
      -webkit-tap-highlight-color: transparent; 
      touch-action: manipulation; user-select: none; -webkit-user-select: none;
    }
    .nav-tab.active { background: linear-gradient(135deg, #1d4ed8, #172554) !important; color: #ffffff !important; border-color: transparent !important; box-shadow: 0 6px 16px rgba(29, 78, 216, 0.45); }
    
    .nav-tab.subtab-protocol { padding-left: 18px; font-size: 0.78rem; display: none; }
    .nav-tab.subtab-protocol.active { background: linear-gradient(135deg, #1d4ed8, #172554) !important; color: #fff !important; border-color: transparent !important; }
    /* v.1.0: „Support my Work" – sticky przypięta na dole NAVIGATION, wyraźny połysk ELSTEK (::after sweep) */
    /* v.1.0: „Support my Work" – stonowany granat, delikatny refleks */
    .nav-support-tab { z-index: 5; margin-top: auto; border: 1px solid rgba(100, 116, 139, 0.35); background: linear-gradient(135deg, #f1f5f9, #cbd5e1); color: #0f172a !important; font-weight: 800; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25); overflow: hidden; }
    .nav-support-tab::after { content: ''; position: absolute; top: -40%; bottom: -40%; left: -60%; width: 35%; background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.18), transparent); transform: skewX(-18deg); animation: supportSweep 5.5s ease-in-out infinite; pointer-events: none; }
    .nav-support-tab.active { background: linear-gradient(135deg, #1d4ed8, #172554) !important; color: #ffffff !important; border-color: transparent !important; }
    .nav-support-tab.active::after { animation: none; opacity: 0.15; }
    @keyframes supportSweep { 0% { left: -60%; } 55%, 100% { left: 130%; } }
    @media (prefers-reduced-motion: reduce) { .nav-support-tab::after { animation: none; opacity: 0; } }

    .nav-badge { background: var(--gold-gradient); color: white; font-size: 0.65rem; padding: 2px 6px; border-radius: 10px; font-weight: 700; display: none; box-shadow: 0 2px 5px rgba(245, 158, 11, 0.3); }
    .nav-badge.red { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3); }

    /* v. 3.1: „Nitro" – domyślny gradient w zmiennej (--nitro-default), presety nadpisują tylko --nitro-grad (kaskada bez nadpisywania) */
    .nitro-name { color: inherit; --nitro-default: linear-gradient(90deg, #b45309, #b91c1c, #6d28d9, #1d4ed8); background-image: var(--nitro-grad, var(--nitro-default)); }
    @supports ((-webkit-background-clip: text) or (background-clip: text)) {
      .nitro-name {
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
      }
      body.dark-mode .nitro-name {
        --nitro-default: linear-gradient(90deg, #fbbf24, #f87171, #c084fc, #60a5fa);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
      }
      /* v. 3.1: presety Nitro – JEDNO źródło gradientu (var --nitro-grad) dla tekstu i kropki podglądu (100% 1:1) */
      .nitro-gold { --nitro-grad: linear-gradient(90deg, #92400e, #d97706, #f59e0b); }
      .nitro-cyber { --nitro-grad: linear-gradient(90deg, #1e3a8a, #0369a1, #0891b2); }
      .nitro-emerald { --nitro-grad: linear-gradient(90deg, #064e3b, #047857, #10b981); }
      .nitro-ruby { --nitro-grad: linear-gradient(90deg, #7f1d1d, #b91c1c, #e11d48); }
      .nitro-aurora { --nitro-grad: linear-gradient(90deg, #15803d, #0284c7, #6366f1, #9333ea); }
      .nitro-sunset { --nitro-grad: linear-gradient(90deg, #ea580c, #ec4899, #8b5cf6); }
      .nitro-galaxy { --nitro-grad: linear-gradient(90deg, #6b21a8, #9333ea, #c026d3); }
      .nitro-flame { --nitro-grad: linear-gradient(90deg, #991b1b, #ea580c, #facc15); }
      .nitro-toxic { --nitro-grad: linear-gradient(90deg, #65a30d, #059669, #0891b2); }
      /* v. 3.1: nowe mieszanki Discord-Nitro (2-3 barwy, czytelne na jasnym tle) */
      .nitro-ice { --nitro-grad: linear-gradient(90deg, #0e7490, #06b6d4, #60a5fa); }
      .nitro-berry { --nitro-grad: linear-gradient(90deg, #9d174d, #db2777, #a855f7); }
      .nitro-lime { --nitro-grad: linear-gradient(90deg, #4d7c0f, #84cc16, #2dd4bf); }
      .nitro-prism { --nitro-grad: linear-gradient(90deg, #1e40af, #7c3aed, #db2777); }
      /* v. 4.7.6: metaliczne + 3-farbowe presety (silber / bronze / platin-gold / aurora3 / sunset3d / ELSTEK) */
      .nitro-silver { --nitro-grad: linear-gradient(100deg, #334155, #64748b, #b6c2cf, #475569); }
      .nitro-bronze { --nitro-grad: linear-gradient(100deg, #7c2d12, #b45309, #d97706, #92400e); }
      .nitro-platin { --nitro-grad: linear-gradient(100deg, #475569, #94a3b8, #eab308, #a16207); }
      .nitro-aurora3 { --nitro-grad: linear-gradient(100deg, #065f46, #14b8a6, #22d3ee, #7c3aed); }
      .nitro-sunset3d { --nitro-grad: linear-gradient(100deg, #b45309, #f59e0b, #fb7185, #9f1239); }
      .nitro-elstek { --nitro-grad: linear-gradient(100deg, #1e3a8a, #2563eb, #94a3b8, #f59e0b); }
      .nitro-name.nitro-silver, .nitro-swatch.nitro-silver { background-image: var(--nitro-grad); }
      .nitro-name.nitro-bronze, .nitro-swatch.nitro-bronze { background-image: var(--nitro-grad); }
      .nitro-name.nitro-platin, .nitro-swatch.nitro-platin { background-image: var(--nitro-grad); }
      .nitro-name.nitro-aurora3, .nitro-swatch.nitro-aurora3 { background-image: var(--nitro-grad); }
      .nitro-name.nitro-sunset3d, .nitro-swatch.nitro-sunset3d { background-image: var(--nitro-grad); }
      .nitro-name.nitro-elstek, .nitro-swatch.nitro-elstek { background-image: var(--nitro-grad); }
      .nitro-name.nitro-gold, .nitro-swatch.nitro-gold { background-image: var(--nitro-grad); }
      .nitro-name.nitro-cyber, .nitro-swatch.nitro-cyber { background-image: var(--nitro-grad); }
      .nitro-name.nitro-emerald, .nitro-swatch.nitro-emerald { background-image: var(--nitro-grad); }
      .nitro-name.nitro-ruby, .nitro-swatch.nitro-ruby { background-image: var(--nitro-grad); }
      .nitro-name.nitro-aurora, .nitro-swatch.nitro-aurora { background-image: var(--nitro-grad); }
      .nitro-name.nitro-sunset, .nitro-swatch.nitro-sunset { background-image: var(--nitro-grad); }
      .nitro-name.nitro-galaxy, .nitro-swatch.nitro-galaxy { background-image: var(--nitro-grad); }
      .nitro-name.nitro-flame, .nitro-swatch.nitro-flame { background-image: var(--nitro-grad); }
      .nitro-name.nitro-toxic, .nitro-swatch.nitro-toxic { background-image: var(--nitro-grad); }
      .nitro-name.nitro-ice, .nitro-swatch.nitro-ice { background-image: var(--nitro-grad); }
      .nitro-name.nitro-berry, .nitro-swatch.nitro-berry { background-image: var(--nitro-grad); }
      .nitro-name.nitro-lime, .nitro-swatch.nitro-lime { background-image: var(--nitro-grad); }
      .nitro-name.nitro-prism, .nitro-swatch.nitro-prism { background-image: var(--nitro-grad); }
      /* Modal profilu (niebieski baner): domyślny gradient jaśniejszy, ale TYLKO gdy brak wybranego presetu */
      #user-profile-modal .nitro-name { --nitro-default: linear-gradient(90deg, #fde68a, #fecaca, #e9d5ff, #bfdbfe); }
      /* v. 3.1: pełny efekt Nitro – płynący gradient (ten sam we wszystkich miejscach) */
      .nitro-name { background-size: 200% 100%; background-repeat: repeat; animation: nitroFlow 6s linear infinite; }
      @media (prefers-reduced-motion: reduce) { .nitro-name { animation: none; } }
    }
    @keyframes nitroFlow { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
    .nitro-swatch.nitro-standard { background-image: linear-gradient(90deg, #b45309, #b91c1c, #6d28d9, #1d4ed8); }

    /* v. 3.4: nitro-swatch-fallback - gradienty presetow takze bez wsparcia background-clip:text
       (kolka wyboru i kropka podgladu sa zawsze kolorowe, bez pustego stanu) */
    .nitro-gold { --nitro-grad: linear-gradient(90deg, #92400e, #d97706, #f59e0b); }
    .nitro-cyber { --nitro-grad: linear-gradient(90deg, #1e3a8a, #0369a1, #0891b2); }
    .nitro-emerald { --nitro-grad: linear-gradient(90deg, #064e3b, #047857, #10b981); }
    .nitro-ruby { --nitro-grad: linear-gradient(90deg, #7f1d1d, #b91c1c, #f43f5e); }
    .nitro-aurora { --nitro-grad: linear-gradient(90deg, #0f766e, #22d3ee, #a78bfa); }
    .nitro-sunset { --nitro-grad: linear-gradient(90deg, #b45309, #ea580c, #db2777); }
    .nitro-galaxy { --nitro-grad: linear-gradient(90deg, #312e81, #6d28d9, #0891b2); }
    .nitro-flame { --nitro-grad: linear-gradient(90deg, #991b1b, #dc2626, #f59e0b); }
    .nitro-toxic { --nitro-grad: linear-gradient(90deg, #65a30d, #059669, #0891b2); }
    .nitro-ice { --nitro-grad: linear-gradient(90deg, #0e7490, #06b6d4, #60a5fa); }
    .nitro-berry { --nitro-grad: linear-gradient(90deg, #9d174d, #db2777, #a855f7); }
    .nitro-lime { --nitro-grad: linear-gradient(90deg, #4d7c0f, #84cc16, #2dd4bf); }
    .nitro-prism { --nitro-grad: linear-gradient(90deg, #1e40af, #7c3aed, #db2777); }
    /* v. 4.7.6: metaliczne + 3-farbowe presety – te same gradienty takze bez background-clip:text */
    .nitro-silver { --nitro-grad: linear-gradient(100deg, #334155, #64748b, #b6c2cf, #475569); }
    .nitro-bronze { --nitro-grad: linear-gradient(100deg, #7c2d12, #b45309, #d97706, #92400e); }
    .nitro-platin { --nitro-grad: linear-gradient(100deg, #475569, #94a3b8, #eab308, #a16207); }
    .nitro-aurora3 { --nitro-grad: linear-gradient(100deg, #065f46, #14b8a6, #22d3ee, #7c3aed); }
    .nitro-sunset3d { --nitro-grad: linear-gradient(100deg, #b45309, #f59e0b, #fb7185, #9f1239); }
    .nitro-elstek { --nitro-grad: linear-gradient(100deg, #1e3a8a, #2563eb, #94a3b8, #f59e0b); }
    .nitro-swatch { background-image: var(--nitro-grad, linear-gradient(90deg, #b45309, #b91c1c, #6d28d9, #1d4ed8)); }
    .nitro-pick { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; font-size: 0.72rem; font-weight: 700; color: var(--text); background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; cursor: pointer; }
    .nitro-pick:hover { border-color: var(--primary); }
    .nitro-pick.active { border-color: var(--primary); background: rgba(37, 99, 235, 0.08); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
    /* v. 3.1: kropka podglądu korzysta z tego samego var(--nitro-grad) co tekst nazwy (1:1) */
    .nitro-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.12) inset; }
    /* v. 3.1: kompaktowy selektor Nitro – jedna linia okrągłych próbek (scroll poziomy) */
    .nitro-swatches { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 4px 2px 6px; min-width: 0; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
    .nitro-pick-dot { width: 28px; height: 28px; padding: 0 !important; border-radius: 50%; justify-content: center; flex: 0 0 auto; }
    .nitro-pick-dot .nitro-swatch { width: 20px; height: 20px; }
    .nitro-pick-dot.active { box-shadow: 0 0 0 2px var(--primary), 0 0 0 4px rgba(37,99,235,0.18); }
    /* v. 3.1: lekkie słupki KPI (Analysen & Diagramme) – czysty CSS, czytelne na telefonie */
    .kpi-bars { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 2px; }
    .kpi-bar-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
    .kpi-bar-label { flex: 0 0 110px; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .kpi-bar-track { flex: 1 1 auto; min-width: 0; height: 10px; background: rgba(100,116,139,0.18); border-radius: 6px; overflow: hidden; }
    .kpi-bar-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #38bdf8); transition: width 0.35s ease; }
    .kpi-bar-fill.warn { background: linear-gradient(90deg, #dc2626, #f97316); }
    .kpi-bar-val { flex: 0 0 58px; text-align: right; font-size: 0.7rem; font-weight: 800; color: var(--text); }
    /* v. 3.1: pływający pasek NEWS/WARNUNG na Startseite (0 px gdy brak wpisów) */
    .start-ticker { display: none; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; overflow: hidden; margin: 0 0 12px; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(37,99,235,0.35); background: rgba(37,99,235,0.07); }
    .start-ticker.has-warn { border-color: rgba(220,38,38,0.45); background: rgba(220,38,38,0.07); }
    .start-ticker-label { flex: 0 0 auto; font-size: 0.85rem; }
    .start-ticker-viewport { position: relative; flex: 1 1 auto; min-width: 0; width: 100%; overflow: hidden; white-space: nowrap; }
    .start-ticker-track { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; width: max-content; animation: startTickerRun 26s linear infinite; will-change: transform; }
    @keyframes startTickerRun { from { transform: translateX(0); } to { transform: translateX(-50%); } }
    @media (prefers-reduced-motion: reduce) { .start-ticker-track { animation: none; } }
    .start-ticker-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 700; color: var(--text); white-space: nowrap; }
    .start-ticker-badge { flex: 0 0 auto; font-size: 0.56rem; font-weight: 900; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 9px; color: #fff; background: var(--primary); }
    .start-ticker-badge.warnung { background: #dc2626; }
    .start-ticker-item.warnung { color: #b91c1c; }
    .start-ticker-sep { color: var(--text-muted); opacity: 0.6; }
    /* v. 3.1: badge w zakładce News */
    .news-badge { display: inline-block; margin-left: 6px; font-size: 0.58rem; font-weight: 900; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 9px; color: #fff; background: var(--primary); }
    .news-badge.warnung { background: #dc2626; }
    .news-badge.info { background: var(--text-muted); }
    .news-card.warnung { border-left: 3px solid #dc2626; }
    @media (max-width: 600px) {
      .kpi-bar-label { flex: 0 0 84px; font-size: 0.66rem; }
      .kpi-bar-val { flex: 0 0 48px; font-size: 0.66rem; }
      .start-ticker-item { font-size: 0.7rem; }
    }
    .profile-modal-footer { display: flex; gap: 8px; margin-top: 14px; flex: 0 0 auto; }
    .profile-modal-footer .btn { flex: 1 1 0; width: auto; height: 38px; min-height: 38px; padding: 8px 12px; }
    @media (max-width: 600px) {
      .profile-modal-footer .btn { height: 34px; min-height: 34px; padding: 6px 10px; font-size: 0.8rem; }
      .nitro-pick-dot { width: 26px; height: 26px; }
      .nitro-pick-dot .nitro-swatch { width: 18px; height: 18px; }
    }
    /* v. 3.1: kompaktowy przycisk zapisu statusu (bez rozciągania .btn 100%) */
    .btn-status-save { width: auto !important; flex: 0 0 auto; align-self: center; padding: 6px 14px !important; font-size: 0.72rem !important; line-height: 1; min-height: 34px; height: 34px; border-radius: 10px; white-space: nowrap; }
    @media (max-width: 600px) {
      .btn-status-save { min-height: 32px; height: 32px; padding: 5px 12px !important; font-size: 0.7rem !important; }
    }

    .content-area { flex-grow: 1; min-width: 0; min-height: 0; touch-action: auto; height: auto; flex: 1 1 0%; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: rgba(100,116,139,0.55) transparent; -webkit-overflow-scrolling: touch; padding-right: 4px; padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px)); position: relative; scroll-behavior: smooth; }
    .content-area.switching { pointer-events: none; opacity: 0.3; transition: opacity 0.15s ease; }
    /* v.1.0: trwale widoczny pionowy pasek przewijania po prawej (desktop + mobile) */
    .content-area::-webkit-scrollbar { width: 12px; }
    .content-area::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.45); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
    .content-area::-webkit-scrollbar-thumb:hover { background-color: rgba(100,116,139,0.7); }
    .content-area::-webkit-scrollbar-track { background: transparent; }
    
    /* v. 4.0: bez animacji fadeInSection - sekcja po przelaczeniu ma od razu pelne krycie (koniec przygaszania KPI po logowaniu) */
    .app-section { width: 100%; min-width: 0; display: none; }
    .app-section.active-section { display: block; }
    /* v.1.0: wszystkie karty/sekcje wypełniają dostępną szerokość obok menu (desktop >900 px) */
    .app-section .card, .app-section .designer-empty-card, .app-section .widget-box,
    .app-section .table-responsive, .app-section .shop-hero { max-width: 100%; margin-left: 0; margin-right: 0; }
    /* v.1.0: pojedyncze pola dokumentow nie rozciagaja sie na cala szerokosc 1500px+ (czytelnosc), trzymaja sie lewej */
    .app-section .form-group { max-width: 860px; }
    .app-section .row .form-group { max-width: none; }
    @keyframes fadeInSection {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* STRONA 1: EKRAN LOGOWANIA (Wymuszony gradient ciemny v.1.0) */
    #auth-screen { 
      position: fixed !important; 
      inset: 0; 
      top: 0; 
      background: radial-gradient(circle at center, #1e293b 0%, #0b0f19 100%) !important; 
      display: none; 
      flex-direction: column; 
      align-items: center; 
      justify-content: space-between; 
      z-index: 36000; 
      padding: 16px; 
      overflow-y: auto; 
    }
    
    .auth-wrapper { margin: auto 0; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
    
    .auth-logo-card {
      background: linear-gradient(135deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.97) 100%);
      border: 1px solid rgba(56, 189, 248, 0.45);
      backdrop-filter: blur(24px);
      -webkit-backdrop-filter: blur(24px);
      border-radius: var(--radius);
      padding: 18px 22px;
      width: 100%;
      box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.15), 0 10px 30px rgba(37, 99, 235, 0.35), 0 0 46px rgba(56, 189, 248, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      overflow: hidden;
    }
    /* v.1.0: shimmer – subtelny błysk światła przez kafelek logo (klimat #intro-splash) */
    .auth-logo-card::after {
      content: '';
      position: absolute;
      top: -60%;
      left: -80%;
      width: 60%;
      height: 220%;
      background: linear-gradient(105deg, transparent 40%, rgba(125, 211, 252, 0.16) 48%, rgba(255, 255, 255, 0.28) 50%, rgba(125, 211, 252, 0.16) 52%, transparent 60%);
      transform: rotate(8deg);
      animation: logoShimmer 4.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
      pointer-events: none;
    }
    @keyframes logoShimmer { 0% { left: -80%; } 55%, 100% { left: 130%; } }
    @keyframes logoGlowPulse { 0%, 100% { filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.45)) drop-shadow(0 4px 10px rgba(37, 99, 235, 0.3)); } 50% { filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.7)) drop-shadow(0 6px 14px rgba(37, 99, 235, 0.4)); } }
    .auth-logo-img { height: 46px; width: auto; max-width: calc(100% - 110px); object-fit: contain; animation: logoGlowPulse 3.2s ease-in-out infinite; }
    @media (prefers-reduced-motion: reduce) {
      .auth-logo-img { animation: none !important; filter: drop-shadow(0 0 14px rgba(56, 189, 248, 0.55)) drop-shadow(0 4px 10px rgba(37, 99, 235, 0.35)); }
      .auth-logo-card::after { display: none !important; }
    }

    .auth-card { background: rgba(17, 24, 39, 0.9); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(20px); border-radius: var(--radius); padding: 20px; width: 100%; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; }
    .auth-card h2 { margin-bottom: 2px; color: var(--primary); font-size: 1.15rem; text-align: center; font-weight: 800; letter-spacing: 0.5px; }
    .auth-card p { font-size: 0.78rem; color: #94a3b8; margin-bottom: 14px; text-align: center; font-weight: 600; }

    .form-control { width: 100%; max-width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.88rem; background-color: #ffffff; color: var(--text); outline: none; transition: all 0.2s; box-shadow: var(--shadow-sm); }
    #auth-screen .form-control { background-color: #0f172a !important; color: #f8fafc !important; border-color: #334155 !important; }
    body.dark-mode .form-control { background-color: #0f172a; }
    .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15); }
    /* v.1.0: textarea nie rozciąga się wszerz poza kartę (SiBe, Prüfung, Angebot, E-Check) */
    textarea.form-control { resize: vertical; }
    .form-group { margin-bottom: 12px; width: 100%; }
    .form-group label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 5px; color: var(--text); }
    #auth-screen .form-group label { color: #f8fafc !important; }

    .password-input-wrapper { position: relative; width: 100%; display: flex; align-items: center; }
    .password-input-wrapper input { width: 100%; padding-right: 40px; }
    .password-toggle-btn { position: absolute; right: 10px; background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #94a3b8; padding: 4px; display: flex; align-items: center; justify-content: center; transition: color 0.15s; }
    .password-toggle-btn:hover { color: var(--primary); }

    .auth-options { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; margin-top: 4px; margin-bottom: 14px; color: #94a3b8; width: 100%; }
    .auth-options label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
    .auth-options input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
    .auth-options a { color: var(--primary); text-decoration: none; font-weight: 600; }

    .cloud-status-box { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); padding: 7px 10px; margin-bottom: 10px; font-size: 0.75rem; display: flex; align-items: center; justify-content: space-between; width: 100%; font-weight: 600; color: #f8fafc; }
    .status-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 700; }
    .status-dot-pulse { width: 7px; height: 7px; background: var(--success); border-radius: 50%; display: inline-block; animation: pulse 2s infinite; }

    .bottom-pinned-container { margin-bottom: 6px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 360px; }
    /* v. 4.7.6: pasek licznikow na ekranie logowania = 2 elementy (Besuche + Online),
       wysrodkowane symetrycznie w pigulce (licznik „Aktualisierungen" usuniety) */
    .login-stats { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-sm); padding: 7px 12px; width: 100%; color: #f8fafc; font-size: 0.72rem; display: flex; justify-content: center; align-items: center; gap: 34px; text-align: center; backdrop-filter: blur(8px); box-shadow: var(--shadow-sm); }
    .stat-box { display: flex; flex-direction: column; align-items: center; gap: 1px; flex: 0 0 auto; min-width: 62px; }
    .stat-box span:first-child { font-size: 0.9rem; font-weight: 800; color: var(--primary); }
    /* symetria na waskich ekranach (iPhone SE): mniejszy odstep, identyczne kolumny */
    @media (max-width: 380px) {
      .login-stats { gap: 22px; }
      .stat-box { min-width: 54px; }
    }

    .footer-links { color: #94a3b8; font-size: 0.65rem; text-align: center; width: 100%; display: flex; flex-direction: column; gap: 3px; }
    .footer-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; align-items: center; }
    .footer-links a { color: #f8fafc; text-decoration: none; transition: color 0.15s; }
    .footer-links a:hover { color: var(--primary); text-decoration: underline; }

    .error-msg { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 0.78rem; margin-bottom: 10px; text-align: center; display: none; width: 100%; font-weight: 600; }
    .error-msg.warn { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.4); color: #fbbf24; }
    .form-control.input-error { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important; }

    /* Przycisk logowania ze spinnerem (v.1.0) */
    .btn-login { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; }
    .btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none !important; }
    .btn-spinner { width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,0.35); border-top-color: #ffffff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; flex-shrink: 0; }

    /* Małe ekrany iPhone SE / mini (v.1.0) */
    @media (max-width: 400px) {
      .auth-wrapper { max-width: 95%; gap: 10px; }
      .auth-logo-card { padding: 12px 14px; }
      .auth-logo-img { height: 38px; max-width: calc(100% - 96px); }
      .auth-card { padding: 14px 12px; }
      .auth-card h2 { font-size: 1.02rem; }
      .auth-card p { font-size: 0.74rem; margin-bottom: 10px; }
      .form-control { padding: 11px 10px; font-size: 0.92rem; }
      .form-group label { font-size: 0.76rem; }
      .auth-options { font-size: 0.72rem; }
      .cloud-status-box { font-size: 0.7rem; padding: 6px 8px; }
      #login-error { font-size: 0.72rem; }
      .btn-login { min-height: 46px; font-size: 0.92rem; }
    }

    /* iOS anti-zoom (v.1.0): Safari skaluje widok przy focusie pola <16px – wymuszamy 16px na mobile */
    @media (max-width: 640px) {
      input, select, textarea, .form-control { font-size: 16px !important; }
    }
    /* v.1.0: kompaktowy ekran logowania na iPhone (mniejsze marginesy/typografia, bez skalowania w pion) */
    @media (max-width: 640px) {
      #auth-screen { padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
      .main-layout { margin: 8px auto 0; }
      .auth-wrapper { gap: 10px; max-width: 96%; }
      .auth-logo-card { padding: 12px 14px; }
      .auth-logo-img { height: 42px; }
      .auth-card { padding: 14px 12px; }
      .auth-card h2 { font-size: 1rem; }
      .auth-card p { font-size: 0.72rem; margin-bottom: 8px; }
      .form-group { margin-bottom: 10px; }
      .btn-login { min-height: 42px; }
      .dsgvo-badge { font-size: 0.62rem; padding: 8px 10px; }
      .dsgvo-line2 { font-size: 0.58rem; }
      .bottom-pinned-container { margin-top: 8px; gap: 6px; max-width: 96%; }
      .login-stats { padding: 6px 10px; font-size: 0.68rem; }
      .footer-links { gap: 2px; }
    }
    /* v.1.0: wstrzykiwany panel Benutzerverwaltung trwale ukryty (UI admina = #users-admin-modal) */
    #benutzer-verwaltung-panel { display: none !important; }
    @media (max-width: 480px) {
      .login-stats { font-size: 0.68rem; }
      .footer-links { font-size: 0.6rem; }
      .footer-row { gap: 6px; row-gap: 2px; }
    }

    /* Globalny popover statusu (Teams-style, v.1.0) */
    #status-popover .status-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--text); -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
    #status-popover .status-opt:hover { background: rgba(37,99,235,0.08); }
    #status-popover .status-opt.active { background: rgba(37,99,235,0.14); }
    #status-popover .status-opt .sdot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
    #dropdown-status-row:hover { background: rgba(37,99,235,0.1) !important; }

    /* Powiadomienia toast (v.1.0) */
    .toast-container { position: fixed !important; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); right: 20px; z-index: 2147483647; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 40px); max-width: 320px; }
    .toast { background: #1e293b; color: #f8fafc; border-left: 4px solid var(--success); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 0.8rem; font-weight: 600; animation: toastIn 0.3s ease; transition: opacity 0.3s; min-width: 230px; }
    .toast.error { border-left-color: var(--danger); }
    .toast.warn { border-left-color: var(--gold); }
    @keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

    .card { background: var(--card-bg); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); border-color: var(--primary); }
    .card-title { font-size: 1rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
    .card-title.sibe-title { color: var(--sibe-accent); }

    /* v.1.0: obszar przewijany w modalach (flex-column) musi móc się kurczyć –
       bez min-height:0 treść bywa ucinana zamiast przewijana (iOS/Android + desktop) */
    #donate-modal > div > div[style*="overflow-y: auto"],
    #qr-card-modal > div > div[style*="overflow-y: auto"],
    #user-profile-modal > div > div[style*="overflow-y: auto"],
    #login-history-modal > div > div[style*="overflow-y: auto"] { min-height: 0; -webkit-overflow-scrolling: touch; }

    .designer-empty-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; text-align: center; box-shadow: var(--shadow-md); backdrop-filter: blur(16px); margin-bottom: 14px; position: relative; overflow: hidden; }
    /* v.1.0: Protokolle-Hub - tresc od lewej (dokument), nie pigulka na srodku */
    #section-protokolle-main .designer-empty-card { text-align: left; }
    .designer-empty-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3.5px; background: var(--primary-gradient); }
    .designer-empty-card h2 { font-size: 1.25rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; letter-spacing: 0.5px; text-transform: uppercase; }
    .designer-empty-card p { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

    .dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
    .widget-box { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow-sm); transition: transform 0.2s, box-shadow 0.2s; }
    .widget-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
    .widget-title { font-size: 0.82rem; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 5px; color: var(--text); }
    #pwa-install-btn { display: none; }

    /* Accordion / Collapsible Sections (v.1.0) */
    .accordion-section { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
    .accordion-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: rgba(37,99,235,0.05); cursor: pointer; font-weight: 700; font-size: 0.8rem; color: var(--text); transition: background 0.2s; }
    .accordion-header:hover { background: rgba(37,99,235,0.12); }
    .accordion-header .accordion-arrow { font-size: 0.7rem; transition: transform 0.2s; }
    .accordion-header.expanded .accordion-arrow { transform: rotate(180deg); }
    .accordion-content { padding: 0 14px 14px; overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
    .accordion-content.expanded { max-height: 2000px; }
    .pwa-install-available #pwa-install-btn { display: block; }

    .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; text-align: center; }
    .cal-header { font-weight: 700; font-size: 0.72rem; color: var(--text-muted); padding: 3px; }
    .cal-day { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 52px; padding: 5px; font-size: 0.75rem; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
    .cal-day:hover { border-color: var(--primary); background: rgba(37, 99, 235, 0.04); transform: translateY(-1px); box-shadow: var(--shadow-md); }
    .cal-event-dot { background: var(--primary); color: white; font-size: 0.58rem; padding: 2px 4px; border-radius: 4px; margin-top: 2px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }

    .chat-container { display: flex; flex-direction: column; height: 360px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }
    .chat-messages { flex-grow: 1; min-height: 0; padding: 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; background: rgba(0,0,0,0.015); display: flex; flex-direction: column; gap: 8px; }
    .chat-msg { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; max-width: 85%; font-size: 0.82rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; animation: fadeInMsg 0.2s ease; }
    @keyframes fadeInMsg { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
    .chat-msg.mine { background: rgba(37, 99, 235, 0.08); border-color: rgba(37, 99, 235, 0.3); align-self: flex-end; }
    .chat-msg .author { font-size: 0.66rem; font-weight: 600; color: var(--text-muted); margin-bottom: 3px; display: flex; justify-content: space-between; align-items: center; }
    .chat-msg-author-line { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; }
    .chat-author-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .chat-msg-roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
    .chat-msg-del { background: none; border: none; cursor: pointer; font-size: 0.8rem; opacity: 0.55; padding: 0 2px; }
    .chat-msg-del:hover { opacity: 1; }
    .chat-input-area { display: flex; padding: 10px; background: var(--card-bg); border-top: 1px solid var(--border); gap: 8px; align-items: center; }
      /* Chat pill bar */
      .chat-pill-bar { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; }
      .chat-pill-bar::-webkit-scrollbar { display: none; }
      .chat-pill { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-muted); font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
      .chat-pill.chat-pill-active { background: var(--primary); color: white; border-color: var(--primary); }
      /* v. 3.1: zakładka Dringend (czerwona) + czerwona etykieta na dymku */
      .chat-pill.chat-pill-dringend { border-color: #dc2626; color: #dc2626; font-weight: 800; }
      .chat-pill.chat-pill-dringend.chat-pill-active { background: #dc2626; border-color: #dc2626; color: #fff; }
      .chat-urgent-badge { display: inline-block; background: #dc2626; color: #fff; font-size: 0.58rem; font-weight: 900; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 10px; margin-top: 4px; }
      .chat-msg.dringend { border-left: 3px solid #dc2626; padding-left: 6px; }
      /* v. 3.1: własne dymki (po prawej) – tekst zawsze wyrównany do lewej */
      .chat-msg.mine .chat-msg-text, .chat-msg.mine .chat-msg-bubble { text-align: left; }
      .chat-dm-user.active { border-color: var(--primary); background: rgba(37,99,235,0.08); }
      #chat-input { min-width: 0; }
      #chat-input::placeholder { font-size: 0.8rem; opacity: 0.85; }

      /* v. 3.1: Reply – pasek podglądu nad polem wpisywania + cytat w dymku */
      .chat-reply-bar { display: none; align-items: flex-start; gap: 8px; padding: 6px 10px; background: rgba(37,99,235,0.06); border-top: 1px solid var(--border); }
      body.dark-mode .chat-reply-bar { background: rgba(37,99,235,0.18); }
      .chat-reply-body { flex: 1; min-width: 0; border-left: 3px solid var(--primary); padding-left: 8px; }
      .chat-reply-title { font-size: 0.64rem; font-weight: 800; color: var(--primary); }
      .chat-reply-quote { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .chat-reply-cancel { background: none; border: none; cursor: pointer; font-size: 0.95rem; font-weight: 800; color: var(--text-muted); padding: 0 4px; }
      .chat-reply-cancel:hover { color: var(--danger); }
      .chat-reply-btn { background: none; border: none; cursor: pointer; font-size: 0.8rem; opacity: 0.5; padding: 0 3px; }
      .chat-reply-btn:hover { opacity: 1; }
      .chat-quote { border-left: 3px solid var(--primary); background: rgba(37,99,235,0.07); border-radius: 0 8px 8px 0; padding: 4px 8px; margin: 4px 0; max-width: 100%; }
      body.dark-mode .chat-quote { background: rgba(37,99,235,0.22); }
      .chat-quote-author { display: block; font-size: 0.6rem; font-weight: 800; color: var(--primary); }
      .chat-quote-text { display: block; font-size: 0.66rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .chat-msg.mine .chat-quote { text-align: left; }

    /* v. 3.1: mobile (<=600px) – placeholder "Nachricht schreiben..." bez ucinania na iPhonie */
    @media (max-width: 600px) {
      #chat-input { font-size: 0.8rem !important; padding: 6px 8px; min-width: 0; }
      #chat-input::placeholder { font-size: 0.72rem; letter-spacing: -0.01em; opacity: 0.9; }
      .chat-input-area { gap: 6px; }
      .chat-input-area .btn { padding-left: 10px; padding-right: 10px; }
    }
      .chat-pill:hover { background: rgba(37,99,235,0.08); border-color: var(--primary); color: var(--primary); }

      /* DM list */
      .chat-dm-list { border-top: 1px solid var(--border); }
      .chat-dm-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
      .chat-dm-users { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
      .chat-dm-user { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; background: var(--card-bg); border: 1px solid var(--border); }
      .chat-dm-user:hover { background: rgba(37,99,235,0.05); border-color: var(--primary); }
      .chat-dm-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
      .chat-dm-info { flex: 1; min-width: 0; }
      .chat-dm-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .chat-dm-role { font-size: 0.68rem; color: var(--text-muted); }
      .chat-dm-status { width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-left: 6px; }
      .chat-dm-status.offline { background: var(--text-muted); }

      /* Modern message bubbles */
      .chat-msg.mine { align-self: flex-end; align-items: flex-end; }
      .chat-msg.other { align-self: flex-start; align-items: flex-start; }
      .chat-msg-bubble { padding: 10px 14px; border-radius: 16px; font-size: 0.85rem; line-height: 1.4; position: relative; }
      .chat-msg.mine .chat-msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
      .chat-msg.other .chat-msg-bubble { background: #f1f5f9; color: var(--text); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
      body.dark-mode .chat-msg.other .chat-msg-bubble { background: #1e293b; border-color: #334155; color: #f8fafc; }
      .chat-msg-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; margin-top: 4px; }
      .chat-msg-role { font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: rgba(37,99,235,0.1); color: var(--primary); margin-left: 8px; white-space: nowrap; }
      .chat-msg .role-badge { font-weight: 600; font-size: 0.55rem; opacity: 0.85; padding: 1px 6px; }
      .chat-msg-text { font-size: 0.9rem; line-height: 1.42; color: var(--text); word-break: break-word; white-space: pre-wrap; margin-top: 3px; }
      body.dark-mode .chat-msg.mine .chat-msg-bubble { background: #2563eb; }
      body.dark-mode .chat-msg.other .chat-msg-bubble { background: #1e293b; color: #f8fafc; }

      /* Attachment button */
      .chat-attach-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
      .chat-attach-btn:hover { background: rgba(37,99,235,0.08); border-color: var(--primary); color: var(--primary); }

      /* iOS safe area for input */
      .chat-input-area { padding: 10px env(safe-area-inset-right) env(safe-area-inset-bottom) 10px env(safe-area-inset-left); }


    .ai-fab { 
      position: fixed !important; 
      bottom: calc(20px + env(safe-area-inset-bottom, 0px)); 
      right: 20px; 
      background: linear-gradient(135deg, #1d4ed8, #0ea5e9); 
      color: white; 
      width: 52px; 
      height: 52px; 
      border-radius: 16px; 
      display: flex; 
      flex-direction: column; 
      align-items: center; 
      justify-content: center; 
      box-shadow: 0 10px 25px rgba(37, 99, 235, 0.45); 
      cursor: pointer; 
      z-index: 2147483647; 
      border: 1.5px solid rgba(255,255,255,0.25); 
      touch-action: manipulation;
      user-select: none;
      pointer-events: auto !important;
      transition: transform 0.2s, box-shadow 0.2s;
    
    }
    .ai-fab:active { cursor: grabbing; transform: scale(0.95); }
    .ai-fab:hover { box-shadow: 0 14px 32px rgba(37, 99, 235, 0.55); transform: translateY(-2px); }
    .ai-fab-icon { font-size: 1.25rem; line-height: 1; pointer-events: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
    .ai-fab-sub { font-size: 0.5rem; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; opacity: 0.95; margin-top: 1px; pointer-events: none; }
    .ai-fab:active { cursor: grabbing; transform: scale(0.95); }
    .ai-fab:hover { box-shadow: 0 14px 32px rgba(37, 99, 235, 0.55); transform: translateY(-2px); }
    .ai-fab-icon { font-size: 1.25rem; line-height: 1; pointer-events: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
    .ai-fab-sub { font-size: 0.5rem; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; opacity: 0.95; margin-top: 1px; pointer-events: none; }

    /* v. 4.7.6: ELSTEK AI Bot (FAB + okno czatu) WYLACZNIE po zalogowaniu.
       Przed zalogowaniem (ekran #auth-screen widoczny / brak klasy na <body>) przycisk i okno
       sa calkowicie ukryte – !important przebija inline 'display: none'/flex oraz style modulow.
       Klase 'elstek-logged-in' ustawia hideBootScreens() (login / 2FA / auto-login), a zdejmuje logout(). */
    body:not(.elstek-logged-in) #ai-fab-btn,
    body:not(.elstek-logged-in) #ai-fab-btn .ai-fab-icon,
    body:not(.elstek-logged-in) #ai-fab-btn .ai-fab-sub,
    body:not(.elstek-logged-in) #ai-floating-window,
    body:not(.elstek-logged-in) #ai-floating-window * { display: none !important; visibility: hidden !important; }
    /* Awaryjnie: nawet z klasa, gdy widoczny jest ekran logowania (np. wygasla sesja).
       'lang-auth-on' jest utrzymywane przez MutationObserver na #auth-screen (index.html v.4.x). */
    body.lang-auth-on #ai-fab-btn,
    body.lang-auth-on #ai-fab-btn *,
    body.lang-auth-on #ai-floating-window { display: none !important; visibility: hidden !important; }

    .ai-floating-window { 
      position: fixed !important; 
      z-index: 50001;
      bottom: calc(82px + env(safe-area-inset-bottom, 0px)); 
      right: 20px; 
      width: 340px; 
      max-width: calc(100vw - 20px); 
      height: 380px; 
      max-height: calc(100vh - 120px); 
      background: var(--card-bg); 
      border: 1px solid rgba(139, 92, 246, 0.4); 
      border-radius: var(--radius); 
      box-shadow: var(--shadow-lg); 
      z-index: 40001; 
      display: none; 
      flex-direction: column; 
      overflow: hidden; 
      backdrop-filter: blur(16px); 
      -webkit-backdrop-filter: blur(16px);
    }
    
    .ai-floating-header { background: var(--ai-gradient); color: white; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 0.85rem; flex-shrink: 0; box-shadow: var(--shadow-sm); }
    .ai-floating-header button { background: none; border: none; color: white; font-size: 1.1rem; cursor: pointer; opacity: 0.9; transition: opacity 0.15s; }
    .ai-floating-header button:hover { opacity: 1; }
    .ai-floating-body { flex-grow: 1; min-height: 0; padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; background: rgba(0,0,0,0.015); -webkit-overflow-scrolling: touch; }
    .ai-floating-footer { padding: 8px 10px; background: var(--card-bg); border-top: 1px solid var(--border); display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

    .tts-btn, .mic-btn { background: none; border: none; cursor: pointer; font-size: 0.95rem; padding: 5px 7px; border-radius: var(--radius-sm); opacity: 0.8; transition: all 0.15s; display: inline-flex; align-items: center; justify-content: center; }
    .tts-btn:hover, .mic-btn:hover { opacity: 1; background: rgba(139, 92, 246, 0.12); transform: scale(1.05); }
    .mic-btn.recording { color: var(--danger); animation: pulse 0.8s infinite; background: rgba(239, 68, 68, 0.2); border-radius: 50%; }

    .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; }
    /* v.1.0: elementy siatki pól mogą się kurczyć (select/input nie rozpycha karty) */
    .row > * { min-width: 0; }
    
    @media (max-width: 900px) {
      header { padding: 4px 8px; height: 48px; }
      .header-right { gap: 4px; }
      .user-info { gap: 4px; }
      
      .header-points-badge { padding: 4px 6px; font-size: 0.85rem; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; }
      
      .menu-toggle-btn { display: flex; }
      .main-layout { position: relative; padding: 0 6px; }
      .sidebar { 
        position: fixed !important; 
        top: calc(76px + env(safe-area-inset-top, 0px)); 
        left: -100%; 
        width: 290px; 
        max-width: 82vw;
        height: auto; bottom: env(safe-area-inset-bottom, 0px); 
        max-height: calc(100vh - 96px);
        max-height: calc(100dvh - 76px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        background: var(--card-bg); 
        z-index: 20001; 
        box-shadow: 10px 0 30px rgba(0,0,0,0.15); 
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
        padding: 14px; 
        border-right: 1px solid var(--border);
        overflow-y: auto !important; 
        touch-action: pan-y;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
      }
      .sidebar.mobile-open { left: 0; }
      /* v.1.0: Support my Work w przewijanym menu – bez nachodzenia na pozycje */
      .nav-support-tab { position: sticky !important; bottom: 0 !important; margin-top: auto !important; z-index: 6; }
      .content-area { width: 100%; }
      .dashboard-grid, .row { grid-template-columns: 1fr; }
      /* v.1.0: Team – wer ist online? pełna szerokość na mobile */
      #section-team .card, #team-grid { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
      #team-grid .widget-box { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
      /* v.1.0: Firmenwagen – Mängel- und Reparaturmeldungen pełna szerokość na mobile */
      #section-firmenwagen .card, #section-firmenwagen .table-responsive { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
      /* v.1.0: Maschinen & Werkzeuge – Equipment-Verwaltung pełna szerokość na mobile */
      #section-maschinen .card, #section-maschinen .table-responsive { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
      /* v.1.0: mniejsze rozpychanie tabel na wąskich ekranach (poziomy swipe działa w .table-responsive) */
      .machine-table { min-width: 380px; }
      .machine-table th, .machine-table td { padding: 6px 8px; font-size: 0.74rem; }
      /* v.1.0: E-Check / Angebot - mniejszy martwy scroll tabel na tabletach / srednich oknach */
      #section-echeck table, #section-angebot table { min-width: 520px !important; }
      .row > .form-group { margin-bottom: 0; }
      .chat-msg { max-width: 94% !important; }
      .chat-msg .author { flex-wrap: wrap; }
      .user-display-name { display: inline-block; font-size: 0.72rem; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
      
      .ai-fab { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); right: 12px; width: 48px; height: 48px; }
      .ai-floating-window { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); right: 10px; left: auto; width: min(90vw, 340px); height: 45dvh; max-height: 320px; }
      /* v.1.0: karty i sekcje pełnej szerokości także na tabletach / wąskich oknach (641-900 px) */
      .app-section .card, .app-section .widget-box, .app-section .table-responsive,
      #section-firmenwagen .card, #section-maschinen .card {
        width: 100% !important; max-width: 100% !important;
        margin-left: 0 !important; margin-right: 0 !important;
      }
      .app-section #pdiff-canvas-wrap { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
    }

    /* v.1.0: uniwersalne dopasowanie WSZYSTKICH kategorii otwieranych z menu na telefonach
       – spójna skala, brak poziomego przepełnienia, normalne przewijanie treści dotykiem */
    @media (max-width: 640px) {
      /* wspólny scroller treści: mniejszy dolny odstęp (bez jasnego pasa u dołu na iOS) */
      .content-area { padding-right: 2px; padding-bottom: calc(36px + env(safe-area-inset-bottom, 0px)); overflow-x: hidden; }
      /* każda sekcja z menu: pełna szerokość, bez wychodzenia poza ekran */
      .app-section { width: 100%; max-width: 100%; }
      .app-section .card, .app-section .widget-box, .app-section .chat-container,
      .app-section .designer-empty-card, .app-section .table-responsive {
        width: 100% !important; max-width: 100% !important;
        margin-left: 0 !important; margin-right: 0 !important; box-sizing: border-box;
      }
      /* v.1.0: sekcje i ich siatki wyrównane do pełnej szerokości (bez przesunięć) */
      .app-section > * { margin-left: 0 !important; margin-right: 0 !important; max-width: 100% !important; box-sizing: border-box; }
      .app-section .row { margin-left: 0 !important; margin-right: 0 !important; width: 100% !important; max-width: 100% !important; }
      .app-section #pdiff-canvas-wrap { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
      /* kompaktowe karty, nagłówki i formularze (mniej rozstrzelone na ~390 px) */
      .app-section .card { padding: 12px; margin-bottom: 10px; }
      .app-section .widget-box { padding: 12px; }
      .form-group { margin-bottom: 10px; }
      .card-title { font-size: 0.9rem; }
      .app-section h1 { font-size: 1.06rem; line-height: 1.3; }
      .app-section h2 { font-size: 1rem; line-height: 1.3; }
      .app-section h3 { font-size: 0.9rem; }
      /* tabele: przewijanie poziome tylko wewnątrz kontenera, bez rozpychania widoku */
      .app-section .table-responsive { overflow-x: auto !important; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
      .machine-table { min-width: 340px !important; }
      /* wbudowane siatki 3/4-kolumnowe (Quick Actions, Planvergleich-Slider) → 2 kolumny */
      .app-section .dashboard-grid[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
      .app-section .form-group > div[style*="repeat(4,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
      /* ostatnia karta nie zostawia pustej przestrzeni przed końcem sekcji */
      .app-section .card:last-child, .app-section .widget-box:last-child { margin-bottom: 0; }
      /* v.1.0: kompaktowe karty powitalne (Startseite / Protokolle / Support) */
      .designer-empty-card { padding: 14px 12px; margin-bottom: 10px; }
      .designer-empty-card h2 { font-size: 1.08rem; }
      .designer-empty-card p { font-size: 0.74rem; }
      /* ElstekChat: wysokość dopasowana do ekranu – wiadomości scrollują wewnątrz .chat-messages */
      .chat-container { height: clamp(240px, 52dvh, 360px); }
      /* Kalender: ciaśniejsze komórki 7-kolumnowe (czytelne na ~390 px) */
      .calendar-grid { gap: 3px; }
      .cal-day { min-height: 44px; padding: 4px; font-size: 0.66rem; }
      .cal-header { font-size: 0.64rem; padding: 2px 0; }
      /* Modale (Passwort / Zeiterfassung / Benutzer) – bez bocznego ucinania na 375 px */
      #password-modal .card { max-width: min(92vw, 360px) !important; }
      #timer-summary-modal .card { max-width: min(92vw, 420px) !important; }
      #users-admin-modal .card { max-width: min(92vw, 400px) !important; }
      /* v.1.0: paski akcji w kartach zawijają się zamiast ucinać (Stunden, Buchhaltung, …) */
      .app-section .card-title > div { flex-wrap: wrap; }
      .app-section [style*="justify-content:space-between"],
      .app-section [style*="justify-content: space-between"] { flex-wrap: wrap; }
      /* pola w poziomych rzędach flex mogą się kurczyć – nic nie wystaje poza kartę (Maschinen QR, Angebot-Import) */
      .app-section .form-group > div[style*="display: flex"] > .form-control,
      .app-section .form-group > div[style*="display:flex"] > .form-control { min-width: 0; }
      /* Kontakte: karta zawija akcje na wąskim ekranie */
      .contact-card { flex-wrap: wrap; }
      /* v.1.0: E-Check / Angebot - tabele mieszczą więcej kolumn, zanim pojawi się poziomy scroll */
      #section-echeck table, #section-angebot table { min-width: 460px !important; font-size: 0.68rem !important; }
      #section-echeck table th, #section-echeck table td,
      #section-angebot table th, #section-angebot table td { padding: 4px 3px !important; }
      /* v.1.0: poziome rzędy flex w sekcjach zawijają się zamiast wystawać (QR, Import, GPS) */
      .app-section [style*="display: flex"], .app-section [style*="display:flex"] { flex-wrap: wrap; }
    }

    .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 10px 14px; border: none; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 700; cursor: pointer; background: var(--primary-gradient); color: white; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); text-decoration: none; min-height: 40px; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }
    .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35); filter: brightness(1.05); }
    .btn:active { transform: scale(0.97); }
    .btn-secondary { background: linear-gradient(135deg, #64748b, #475569); box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2); }
    .btn-success { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25); }
    .btn-success:hover { background: linear-gradient(135deg, #059669, #047857); }
    .btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25); }
    .btn-danger:hover { background: linear-gradient(135deg, #dc2626, #b91c1c); }
    .btn-small { padding: 6px 10px; font-size: 0.75rem; width: auto; min-height: 30px; font-weight: 700; box-shadow: var(--shadow-sm); }

    .checklist-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); gap: 10px; flex-wrap: wrap; }
    .checklist-item:last-child { border-bottom: none; }
    .checklist-item label { font-size: 0.81rem; cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
    .checklist-item input[type="radio"] { accent-color: var(--sibe-accent); width: 15px; height: 15px; cursor: pointer; }

    .signature-pad { border: 1px solid var(--border); border-radius: var(--radius-sm); width: 100%; height: 110px; background: var(--card-bg); touch-action: none; cursor: crosshair; box-shadow: var(--shadow-sm); }
    .ai-result-box { background: rgba(139, 92, 246, 0.08); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: var(--radius-sm); padding: 10px; font-size: 0.79rem; color: var(--ai-purple); margin-top: 8px; display: none; box-shadow: var(--shadow-sm); }

    .table-responsive { width: 100%; overflow: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); touch-action: pan-x pan-y; }
    .machine-table { width: 100%; border-collapse: collapse; font-size: 0.79rem; min-width: 480px; }
    .machine-table th, .machine-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
    .machine-table th { background: rgba(0,0,0,0.03); font-weight: 700; color: var(--text); }
    .badge-out { background: rgba(239, 68, 68, 0.12); color: var(--danger); padding: 2px 6px; border-radius: 6px; font-weight: 700; font-size: 0.68rem; white-space: nowrap; border: 1px solid rgba(239, 68, 68, 0.2); }
    .badge-in { background: rgba(16, 185, 129, 0.12); color: var(--success); padding: 2px 6px; border-radius: 6px; font-weight: 700; font-size: 0.68rem; white-space: nowrap; border: 1px solid rgba(16, 185, 129, 0.2); }

    .contact-card { display: flex; align-items: center; justify-content: space-between; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; gap: 8px; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
    .contact-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
    .contact-info { display: flex; align-items: center; gap: 10px; }
    .contact-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-gradient); color: white; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.88rem; flex-shrink: 0; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25); }
    .contact-actions { display: flex; gap: 5px; }

    .badge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 8px; }
    .badge-card { background: rgba(37, 99, 235, 0.04); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 5px; box-shadow: var(--shadow-sm); transition: transform 0.2s; }
    .badge-card:hover { transform: translateY(-2px); }
    .badge-card.unlocked { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.06); }
    .badge-icon { font-size: 1.5rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); }
    .badge-title { font-weight: 800; font-size: 0.75rem; color: var(--text); }
    .badge-sub { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; }

    .news-card { border-left: 4px solid var(--primary); background: var(--card-bg); border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
    .news-meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 3px; font-weight: 600; }

    .amazon-icon-svg { width: 22px; height: 22px; fill: #ff9900; display: inline-block; vertical-align: middle; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1)); }

    .goal-progress-box { background: rgba(37, 99, 235, 0.04); border: 1px solid rgba(37, 99, 235, 0.2); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
    .goal-progress-bar-bg { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 6px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.06); }
    .goal-progress-bar-fill { height: 100%; background: var(--primary-gradient); transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 4px; }
    .voucher-code-badge { background: #0f172a; color: #38bdf8; font-family: monospace; font-weight: 800; padding: 2px 5px; border-radius: 4px; font-size: 0.72rem; border: 1px solid #0284c7; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

    @media print {
      body { background: white; color: black; padding: 0; font-size: 10pt; }
      header, .top-banner, #auth-screen, .sidebar, .sidebar-overlay, .no-print, .btn, .ai-fab, .ai-floating-window { display: none !important; }
      .main-layout { display: block; margin: 0; padding: 0; height: auto; }
      .content-area { width: 100%; height: auto; overflow: visible; }
      .card, .designer-empty-card { border: none; box-shadow: none; padding: 4px 0; margin: 0; }
      .signature-pad { border: 1px solid #000; }
      /* v.1.0: druk pojedynczego protokołu – tylko print-area widoczna */
      /* v.1.0: druk pojedynczego dokumentu – proto i angebot print-area widoczne */
      body.printing-proto .app-section > *:not(#proto-print-area):not(#angebot-print-area) { display: none !important; }
      body.printing-proto #proto-print-area, body.printing-proto #angebot-print-area { display: block !important; }
    }
    /* D1 (v.1.0): Bottom-Sheet na telefonach – modale wsuwają się od dołu jak natywne aplikacje */
    @media (max-width: 600px) {
      #user-profile-modal, #qr-card-modal, #login-history-modal {
        align-items: flex-end !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
      }
      #user-profile-modal > div, #qr-card-modal > div, #login-history-modal > div {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88dvh !important;
        border-radius: 18px 18px 0 0 !important;
        animation: sheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      }
    }
    @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* v. 3.4: ios-profile-visible - naglowek modalu profilu nie moze byc przyciety na iPhone.
   Bottom-sheet z max-height 88dvh/90vh + align-items:flex-end wychodzil ponad gorna krawedz
   (vh = duzy viewport w iOS) - teraz karta zawsze miesci sie w widocznym obszarze. */
@media (max-width: 600px) {
  #user-profile-modal > div, #qr-card-modal > div, #login-history-modal > div,
  #password-modal > div, #users-admin-modal > div, #timer-summary-modal > div {
    max-height: 100% !important;
  }
}
@supports (height: 100dvh) {
  @media (max-width: 600px) {
    #user-profile-modal > div {
      max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 6px) !important;
    }
  }
}

    /* ===== PRÄMIENSHOP v.1.0 – Hero + karty premium ===== */
    .shop-hero { background: linear-gradient(135deg, #1e293b, #0f172a); border: 1px solid rgba(251,191,36,0.35); border-radius: var(--radius); padding: 16px; color: #fff; box-shadow: 0 10px 24px rgba(15,23,42,0.35); position: relative; overflow: hidden; }
    .shop-hero::after { content: ''; position: absolute; top: -40px; right: -40px; width: 140px; height: 140px; background: rgba(148,163,184,0.07); border-radius: 50%; }
    .shop-hero-top { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
    .shop-hero-label { font-size: 0.68rem; font-weight: 900; letter-spacing: 1.2px; color: #fbbf24; }
    .shop-hero-points { font-size: 2.3rem; font-weight: 900; line-height: 1.1; text-shadow: 0 2px 8px rgba(0,0,0,0.25); }
    .shop-hero-eur { font-size: 0.88rem; font-weight: 800; opacity: 0.95; }
    .shop-hero-ring { font-size: 2.4rem; background: rgba(251,191,36,0.10); border: 2px solid rgba(251,191,36,0.45); width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
    .shop-hero-note { margin-top: 10px; font-size: 0.72rem; font-weight: 700; color: #cbd5e1; background: rgba(255,255,255,0.05); border-radius: 8px; padding: 6px 10px; position: relative; z-index: 1; }
    .shop-next-reward { margin-top: 10px; background: rgba(255,255,255,0.05); border-radius: 10px; padding: 8px 10px; position: relative; z-index: 1; }
    .shop-next-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.74rem; font-weight: 700; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
    .shop-next-bar { height: 10px; border-radius: 6px; background: rgba(0,0,0,0.25); overflow: hidden; }
    .shop-next-bar > div { height: 100%; background: linear-gradient(90deg, #fbbf24, #f59e0b); border-radius: 6px; transition: width 0.6s ease; box-shadow: 0 0 8px rgba(251,191,36,0.45); }
    .shop-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .shop-cats::-webkit-scrollbar { display: none; }
    .shop-chip { background: var(--card-bg); border: 1px solid var(--border); color: var(--text); border-radius: 20px; padding: 7px 14px; font-size: 0.75rem; font-weight: 700; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: all 0.2s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
    .shop-chip.active { background: var(--primary); color: white; border-color: transparent; box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
    .shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .shop-card { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 10px 10px; text-align: center; background: var(--card-bg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; }
    .shop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
    .shop-card.affordable { border: 2px solid var(--success); box-shadow: 0 6px 16px rgba(16,185,129,0.18); }
    .shop-card.near { border: 1px solid rgba(251,191,36,0.55); animation: shopPulse 2.2s ease-in-out infinite; }
    @keyframes shopPulse { 0%,100% { box-shadow: 0 6px 16px rgba(251,191,36,0.08); } 50% { box-shadow: 0 6px 22px rgba(251,191,36,0.20); } }
    .shop-emoji-ring { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 50%; background: rgba(148,163,184,0.10); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 1.7rem; box-shadow: 0 4px 12px rgba(245,158,11,0.35); }
    .shop-badge { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); font-size: 0.58rem; font-weight: 900; padding: 2px 8px; border-radius: 10px; white-space: nowrap; letter-spacing: 0.4px; }
    .shop-badge.ok { background: var(--success); color: white; }
    .shop-badge.near { background: var(--gold); color: white; }
    .shop-card-title { font-weight: 800; font-size: 0.78rem; color: var(--text); min-height: 34px; display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
    .shop-card-desc { font-size: 0.66rem; color: var(--text-muted); margin-bottom: 8px; }
    .shop-card-price { font-size: 0.82rem; font-weight: 900; color: var(--gold); margin-bottom: 8px; }
    .shop-card-price span { font-size: 0.68rem; opacity: 0.85; }
    .shop-card-actions { margin-top: auto; }
    .shop-card-actions .btn:disabled { opacity: 0.55; }
    .shop-missing { font-size: 0.62rem; color: var(--text-muted); margin-top: 5px; font-weight: 700; }

    /* Donate tab (v.1.0) */
    .donate-tab { background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(139, 92, 246, 0.08)); border-color: rgba(236, 72, 153, 0.45) !important; font-weight: 800; color: var(--text); }

    /* Odznaki w sklepie (v.1.0) */
    .shop-badges-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .shop-badges-strip::-webkit-scrollbar { display: none; }
    .shop-mini-badge { display: flex; align-items: center; gap: 6px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
    .shop-mini-badge.unlocked { border-color: var(--gold); color: var(--text); background: rgba(245,158,11,0.08); box-shadow: 0 2px 8px rgba(245,158,11,0.15); }

    /* Konfetti (v.1.0) */
    .confetti-piece { position: fixed !important; top: -20px; z-index: 99998; pointer-events: none; border-radius: 2px; animation: confettiFall linear forwards; }
    @keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); } }
    /* iOS FIX (v.1.0): hover TYLKO dla myszki – na dotyku 1. tap = click (bez podwójnego tapnięcia) */
    @media (hover: hover) and (pointer: fine) {
      .nav-tab:hover { border-color: var(--primary); color: var(--primary); background: rgba(37, 99, 235, 0.06); transform: translateX(3px); box-shadow: var(--shadow-md); }
      body.dark-mode .nav-tab:hover { background: #334155; color: #60a5fa; }
      .nav-group-header:hover { background: rgba(37, 99, 235, 0.08); color: var(--primary); border-color: var(--primary); transform: translateX(2px); }
      .dropdown-item:hover { background: rgba(37, 99, 235, 0.08); color: var(--primary); }
      .dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.08); }
      .donate-tab:hover { background: rgba(236, 112, 199, 0.12); border-color: #ec4899 !important; transform: translateX(3px); }
    }
    /* iPhone header cleanup (v.1.0): górna część mieści się na wąskim ekranie */
    @media (max-width: 600px) {
      #user-status-text { display: none !important; }
      .elstek-logo-img { height: 22px; }
      .user-display-name { font-size: 0.7rem; max-width: 64px; }
      .header-points-badge { padding: 3px 6px; font-size: 0.85rem; }
      .user-avatar { width: 36px; height: 36px; }
      .user-profile-badge { padding: 2px 7px 2px 2px; gap: 5px; }
      .menu-toggle-btn { width: 34px; height: 34px; font-size: 1.05rem; }
    }
    /* ===== v.1.0: Mobile/Dotyk - ulepszenia ===== */
    .btn-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.35rem; line-height: 1; min-width: 40px; min-height: 40px; cursor: pointer; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
    .btn-close:active { background: var(--border); }
    @media (max-width: 600px) {
      #users-admin-modal, #donate-modal, #timer-summary-modal {
        align-items: flex-end !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
      }
      #users-admin-modal > div, #donate-modal > div, #timer-summary-modal > div {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88dvh !important;
        border-radius: 18px 18px 0 0 !important;
        animation: sheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      }
    }
    @media (max-width: 480px) {
      #team-grid { grid-template-columns: 1fr; }
      /* v.1.0: pływające okno AI nie przykrywa polowy ekranu */
      .ai-floating-window { width: calc(100vw - 24px); right: 12px; max-width: none; }
      /* v.1.0: toasty przewidywalnie na szerokosc z marginesami */
      .toast-container { left: 12px; right: 12px; max-width: none; }
      .toast { min-width: 0; width: 100%; }
      /* v.1.0: mniejszy, elegancki tekst marquee na telefonie / iPhone */
      .top-banner { font-size: 10.5px; }
    }
    /* v.1.0: waskie ekrany Android/Honor - marquee i gorny pasek bez ucinania napisow */
    @media (max-width: 480px) {
      .top-banner { font-size: 10px; padding-left: 8px; padding-right: 8px; }
      header { padding-left: 6px; padding-right: 6px; }
      .header-left { gap: 6px; }
      .content-area { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
    }
    @media (hover: none) and (pointer: coarse) {
      .tts-btn { padding: 9px 11px; font-size: 1.1rem; }
      .btn-small { min-height: 38px; }
    }
    /* ===== INTRO-SPLASH Teaser (v.1.0) ===== */
        #intro-splash { position: fixed !important; inset: 0; z-index: 900000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: #0b0f19; overflow: hidden; padding: 30px 24px; text-align: center; transition: none; /* v. 4.7.6: brak powolnego fade/blur przy zamknieciu */ }
    #intro-splash::before { content: ''; position: absolute; inset: -2%; background: radial-gradient(1100px 640px at 50% -12%, rgba(37, 99, 235, 0.30), transparent 62%), radial-gradient(900px 560px at 88% 112%, rgba(139, 92, 246, 0.20), transparent 60%), radial-gradient(700px 500px at 8% 100%, rgba(251, 191, 36, 0.10), transparent 55%); transform: scale(1.14); animation: introKenBurns 18s cubic-bezier(0.22, 1, 0.36, 1) forwards; will-change: transform; pointer-events: none; }
    @keyframes introKenBurns { from { transform: scale(1.14) translateY(-1.5%); } to { transform: scale(1) translateY(0); } }
    #intro-splash.intro-out { opacity: 0; transform: scale(1.06) translateY(-10px); filter: blur(10px); pointer-events: none; }
    .intro-orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.32; pointer-events: none; animation: introOrb 11s ease-in-out infinite alternate; }
    .intro-orb.o1 { width: 260px; height: 260px; background: #2563eb; top: -70px; left: -60px; }
    .intro-orb.o2 { width: 300px; height: 300px; background: #8b5cf6; bottom: -90px; right: -70px; animation-delay: -4s; }
    .intro-orb.o3 { width: 200px; height: 200px; background: #fbbf24; top: 40%; left: 70%; animation-delay: -7s; opacity: 0.16; }
    @keyframes introOrb { from { transform: translateY(-16px) scale(1); } to { transform: translateY(22px) scale(1.12); } }
    .intro-fade { opacity: 0; transform: translateY(18px); animation: introRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; }
    .del-02 { animation-delay: 0.2s; }
    .del-04 { animation-delay: 0.4s; }
    .del-06 { animation-delay: 0.6s; }
    .del-08 { animation-delay: 0.8s; }
    .del-095 { animation-delay: 0.95s; }
    .del-10 { animation-delay: 1s; }
    @keyframes introRise { to { opacity: 1; transform: translateY(0); } }
    .intro-logo { filter: drop-shadow(0 12px 32px rgba(37, 99, 235, 0.45)); }
    .intro-logo img { height: 72px; width: auto; display: block; animation: introLogoPulse 3.2s ease-in-out infinite; }
    @keyframes introLogoPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
    .intro-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px; background: rgba(251, 191, 36, 0.10); border: 1px solid rgba(251, 191, 36, 0.45); color: #fbbf24; font-size: 0.68rem; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; }
    .intro-highlight { font-size: clamp(0.98rem, 3.6vw, 1.28rem); font-weight: 600; line-height: 1.6; letter-spacing: 0.2px; max-width: 560px; margin: 0 auto; background: linear-gradient(100deg, #f8fafc 20%, #93c5fd 50%, #f8fafc 80%); -webkit-background-clip: text; background-clip: text; color: transparent; }
    .intro-features { display: flex; flex-direction: column; gap: 12px; width: min(440px, 100%); margin: 2px auto 0; }
    .intro-feature { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(148, 163, 184, 0.20); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: left; transition: transform 0.25s ease, border-color 0.25s ease; }
    .intro-feature:hover { transform: translateY(-4px); border-color: rgba(59, 130, 246, 0.55); box-shadow: 0 14px 34px rgba(37, 99, 235, 0.28); background: rgba(255, 255, 255, 0.07); }
    .intro-feature .ic { font-size: 1.5rem; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(37, 99, 235, 0.35)); }
    .intro-feature b { display: block; font-size: 0.84rem; font-weight: 800; line-height: 1.35; color: #f8fafc; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }
    .intro-feature span.sub { display: block; font-size: 0.7rem; line-height: 1.45; color: #bfdbfe; margin-top: 4px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
    .intro-progress { width: min(320px, 74%); height: 4px; margin: 10px auto 0; background: rgba(148, 163, 184, 0.18); border-radius: 4px; overflow: hidden; }
    .intro-progress-bar { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #2563eb, #38bdf8, #2563eb); animation: introBar 10s linear both; }
    @keyframes introBar { to { width: 100%; } }
    .intro-hint { font-size: 0.66rem; color: var(--text-muted); letter-spacing: 0.4px; }
    .intro-cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: min(440px, 100%); padding: 14px 22px; border: none; border-radius: 12px; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font-size: 0.9rem; font-weight: 800; letter-spacing: 1.2px; cursor: pointer; box-shadow: 0 14px 34px rgba(37, 99, 235, 0.45); transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s; text-transform: uppercase; }

    /* iOS Mobile Safari & PWA - Fixes for layout (v.1.0) */
    @media (max-width: 480px) {
      .sidebar {
        width: 250px;
        max-width: 90vw;
        padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0px)) 6px;
      }
      .sidebar .nav-tab {
        font-size: 0.72rem;
        padding: 8px 6px;
        gap: 6px;
      }
      .sidebar .nav-tab span {
        font-size: 0.72rem;
      }
      .sidebar .nav-badge {
        font-size: 0.62rem;
        padding: 2px 6px;
      }
      .sidebar-title {
        font-size: 0.65rem;
        padding-left: 4px;
        margin-bottom: 4px;
      }
      .content-area {
        padding-right: 2px;
        padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
      }
      .ai-floating-window {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
        right: 8px !important;
        left: 8px !important;
        width: calc(100vw - 16px) !important;
        max-width: none !important;
        height: 40dvh !important;
        max-height: 300px !important;
      }
      .ai-fab {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        right: 10px !important;
        width: 44px !important;
        height: 44px !important;
      }

      /* iPhone - User Profile Modal optimiert */
      #user-profile-modal {
        padding-top: env(safe-area-inset-top, 0px) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
      }
      #user-profile-modal > div {
        width: 100% !important;
        max-width: 100% !important;
        /* v. 3.4: 95dvh (duzy viewport iOS) przycinal naglowek profilu - teraz zawsze w widocznym obszarze */
        max-height: 100% !important;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 6px) !important;
        height: auto !important;
        border-radius: 0 !important;
        margin: 0 !important;
      }
      #user-profile-modal .user-profile-badge {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        font-size: 0.85rem;
      }
      #user-profile-modal .user-avatar {
        width: 44px !important;
        height: 44px !important;
        font-size: 0.9rem;
      }
      #user-profile-modal label {
        font-size: 0.75rem;
        margin-bottom: 4px;
      }
      #user-profile-modal input[type="text"],
      #user-profile-modal input[type="password"],
      #user-profile-modal .form-control {
        font-size: 16px !important; /* Verhindert Zoom auf iPhone */
        padding: 10px 12px !important;
      }
      #user-profile-modal button {
        font-size: 0.85rem;
        padding: 10px 16px;
        min-height: 44px;
      }

      /* iPhone - Haupt-Header Layout */
      header .user-profile-badge {
        padding: 6px 10px;
        font-size: 0.8rem;
      }
      header .user-avatar {
        width: 40px !important;
        height: 40px !important;
        font-size: 0.85rem;
      }
      .user-display-name {
        font-size: 0.82rem;
        max-width: 110px;
      }

      /* iPhone - Status-Popover */
      #status-popover {
        width: 220px !important;
        font-size: 0.8rem;
      }
      #status-popover .status-opt {
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 44px;
        display: flex;
        align-items: center;
      }
    }
    
    /* Fix intro splash on mobile */
    #intro-splash {
      padding: 20px 16px !important;
    }
    .intro-highlight {
      font-size: 1.1rem !important;
      line-height: 1.4;
    }
    .intro-cta:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(37, 99, 235, 0.55); filter: brightness(1.06); }
    .intro-cta:active { transform: scale(0.98); }
    #intro-skip-btn { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; padding: 9px 17px; border-radius: 999px; background: rgba(15, 23, 42, 0.78); border: 1px solid rgba(226, 232, 240, 0.65); color: #f8fafc; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.2px; cursor: pointer; box-shadow: 0 8px 22px rgba(2, 6, 23, 0.55); text-shadow: 0 1px 2px rgba(2, 6, 23, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background 0.2s, transform 0.15s, border-color 0.2s; }
    #intro-skip-btn:hover { background: rgba(30, 41, 59, 0.92); border-color: #ffffff; }
    #intro-skip-btn:active { transform: scale(0.96); }
    /* v.1.0: kompaktowy splash na mniejszych ekranach – kafelki w poziomym wierszu (ikona | tekst) */
    @media (max-width: 640px) {
      .intro-features { gap: 8px; width: min(420px, 92%); }
      .intro-feature { flex-direction: row; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; }
      .intro-feature .ic { font-size: 1.1rem; filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.3)); }
      .intro-feature b { font-size: 0.78rem; line-height: 1.3; }
      .intro-feature span.sub { font-size: 0.66rem; line-height: 1.35; margin-top: 2px; }
      .intro-cta { padding: 12px 18px; font-size: 0.84rem; }
      .intro-progress { margin-top: 8px; }
    }
    @media (max-width: 480px) {
      .intro-highlight { font-size: 1.02rem; }
      .intro-features { gap: 7px; width: min(400px, 94%); }
      .intro-feature { padding: 8px 10px; gap: 8px; border-radius: 11px; }
      .intro-feature .ic { font-size: 1rem; }
      .intro-feature b { font-size: 0.75rem; }
      .intro-feature span.sub { font-size: 0.63rem; margin-top: 1px; }
      .intro-logo img { height: 52px; }
      .intro-cta { padding: 11px 16px; font-size: 0.8rem; }
    }
    @media (prefers-reduced-motion: reduce) {
      .intro-orb, .intro-logo, .intro-progress-bar { animation: none; }
      .intro-progress-bar { width: 100%; }
      .intro-fade { animation-duration: 0.01s; animation-delay: 0s; }
      #intro-splash::before { animation: none; transform: none; }
    }
    /* ===== ROLE BADGES (v.1.0) ===== */
    .role-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; white-space: nowrap; }
    .role-badge.r-geschaeftsfuehrer { background: #111827; color: #fbbf24; border: 1px solid rgba(251,191,36,0.6); }
    .role-badge.r-admin { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; }
    .role-badge.r-bauleiter { background: #2563eb; color: #fff; }
    .role-badge.r-projektleiter { background: #3b82f6; color: #fff; }
    .role-badge.r-azubi { background: #facc15; color: #1f2937; }
    .role-badge.r-monteur { background: #16a34a; color: #fff; }
    .role-badge.r-buchhaltung { background: #f59e0b; color: #fff; }
    .role-badge.r-prokurist { background: #7c3aed; color: #fff; }
    .role-badge.r-planer { background: #64748b; color: #fff; }
    .role-badge.r-mitarbeiter { background: #64748b; color: #fff; }
    .role-chip { cursor: pointer; opacity: 0.45; }
    .role-chip.on { opacity: 1; box-shadow: 0 0 0 2px rgba(37,99,235,0.35); }
    .qa-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; cursor: pointer; text-align: center; transition: transform 0.15s, border-color 0.2s; }
    .qa-tile span { font-size: 1.5rem; }
    .qa-tile b { font-size: 0.7rem; color: var(--text); }
    .qa-tile:hover { border-color: var(--primary); transform: translateY(-2px); }
    .qa-tile:active { transform: scale(0.97); }

/* v.1.0: Kontakte - Suche mit Ikone/Clear + ausgegraute Aktionen */
.search-wrap { position: relative; }
.search-wrap .search-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 0.85rem; }
.search-wrap input.form-control { padding-left: 32px; padding-right: 34px; }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: transparent; cursor: pointer; font-size: 0.85rem; color: var(--text-muted); display: none; padding: 4px; }
.search-clear.on { display: block; }
.act-off { opacity: 0.35; pointer-events: none; }
    .contact-actions { min-width: 170px; justify-content: flex-end; gap: 6px; }
    .contact-actions .btn { min-width: 34px; text-align: center; }
    /* v.1.0: wyrazistsze ikony Quick Actions + spójne karty statystyk Startseite */
    .qa-tile span { font-size: 1.35rem; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28)); }
    .qa-tile b { font-weight: 700; }
    .stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
    @media (max-width: 900px) { .stat-grid-4 { grid-template-columns: repeat(2, 1fr); } }
    @media (max-width: 480px) { .stat-grid-4 { grid-template-columns: 1fr 1fr; } .stat-value { font-size: 1.25rem !important; } }
    /* v.1.0: KPI/PWA przyciski – inline na desktopie, pełna szerokość na telefonie */
    #section-startseite .designer-empty-card .btn { width: auto; min-width: 150px; }
    @media (max-width: 640px) { #section-startseite .designer-empty-card .btn { width: 100%; min-width: 0; } }
    .header-role-badges .role-badge { font-size: 0.55rem; padding: 1px 6px; }

    @media (max-width: 600px) { .header-role-badges { display: none !important; } }

    /* v.1.0: Dropdown profilu na telefonach – fixed pod headerem, scrollowalny, ciaśniejszy */
    @media (max-width: 640px) {
      .user-dropdown-menu {
        position: fixed !important;
        top: calc(86px + env(safe-area-inset-top));
        left: 6px;
        right: 6px;
        width: auto;
        max-width: none;
        /* v. 3.5: profil (menu) przewijalny gora-dol na malych ekranach - fallback 100vh + pas safe-area */
        max-height: calc(100vh - 96px);
        max-height: calc(100dvh - 96px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 8px);
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        overscroll-behavior: contain;
        min-height: 0;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
      }
      .dropdown-profile-header { padding: 12px 12px 8px 12px; }
      .dropdown-profile-avatar { width: 48px; height: 48px; margin: 0 auto 4px auto; font-size: 0.95rem; }
      .dropdown-profile-body { padding: 8px; gap: 6px; }
      .dropdown-item { padding: 8px 10px; font-size: 0.78rem; white-space: normal; line-height: 1.3; }
      .dropdown-item span { overflow-wrap: normal; }
      #notification-list { max-height: 140px !important; }
    }

    /* language switch – bezpośrednie dziecko #auth-screen; fixed = viewport (nie containing block karty) */
    .lang-switch { position: fixed !important; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 42100; display: none; pointer-events: auto; }
    body.lang-auth-on .lang-switch { display: block; }
    .lang-current { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px; border-radius: 10px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(56, 189, 248, 0.45); color: #e2f2ff; font-size: 0.8rem; font-weight: 800; cursor: pointer; line-height: 1.4; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); touch-action: manipulation; -webkit-tap-highlight-color: transparent; pointer-events: auto; }
    /* v.1.0: lista języków jako dropdown pod przyciskiem (absolute względem .lang-switch fixed top-right; brak containing-block na iOS) */
    .lang-list { display: none; position: absolute; top: calc(100% + 6px); right: 0; left: auto; bottom: auto; width: auto; min-width: 210px; max-width: 260px; max-height: 280px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; background: rgba(15, 23, 42, 0.97); border: 1px solid rgba(56, 189, 248, 0.45); border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); backdrop-filter: blur(16px); z-index: 42102; }
    .lang-list.open { display: block; }
    .lang-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; border: none; background: transparent; color: #e2f2ff; font-size: 0.85rem; font-weight: 700; cursor: pointer; border-radius: 10px; text-align: left; line-height: 1.5; white-space: nowrap; pointer-events: auto; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
    .lang-opt:hover { background: rgba(56, 189, 248, 0.14); }
    .lang-opt.active { background: rgba(56, 189, 248, 0.22); }
    .lang-flag-svg { width: 16px; height: 14px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); display: block; }
    .lang-code { font-weight: 800; letter-spacing: 0.5px; }
    .lang-name { font-weight: 600; }


/* v. 3.1: pewne przewijanie pionowe wszystkich widoków (PC + mobile) – dolne przyciski zawsze osiągalne */
.main-layout { min-height: 0; overflow: hidden; }
.content-area { overflow-y: auto !important; overflow-x: hidden; -webkit-overflow-scrolling: touch; min-height: 0; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; }
.app-section { padding-bottom: 24px; }
.app-section .card:last-child { margin-bottom: 12px; }
.app-section .table-responsive { max-height: none; overflow-x: auto; overflow-y: visible; }
@media (max-width: 900px) {
  .content-area { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* v. 3.1: DEFINITYWNY scroll pionowy – jawny łańcuch html/body > .main-layout > .content-area */
html { touch-action: pan-y !important; }
body { touch-action: pan-y !important; overscroll-behavior-y: none; }
.main-layout { flex: 1 1 auto !important; width: 100% !important; max-width: none !important; margin-left: 0 !important; margin-right: 0 !important; min-height: 0 !important; overflow: hidden !important; }
.content-area {
  flex: 1 1 0% !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: calc(100dvh - var(--app-chrome, 95px)) !important;
  max-height: calc(100dvh - var(--app-chrome, 95px)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  overscroll-behavior-y: contain;
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
}
.app-section { width: 100% !important; max-width: none !important; overflow: visible !important; min-height: 0; }
/* v. 3.1: plan-podglad (Planvergleich) nie przechwytuje gestow pionowych - swipe nad canvasem przewija strone */
#pdiff-canvas-wrap, #pdiff-canvas-base { touch-action: pan-y !important; }
@media print {
  .main-layout { overflow: visible !important; height: auto !important; }
  .content-area { height: auto !important; max-height: none !important; overflow: visible !important; }
}

/* v. 3.1: modal profilu – twarde ograniczenie szerokości na iOS (nic nie wychodzi za krawędź) */
#user-profile-modal { overflow-x: hidden !important; max-width: 100vw !important; box-sizing: border-box; }
#user-profile-modal > div { max-width: min(480px, 100vw) !important; box-sizing: border-box; overflow-x: hidden; }
#user-profile-modal * { min-width: 0; box-sizing: border-box; }
@media (max-width: 640px) {
  #user-profile-modal { padding-left: env(safe-area-inset-left, 0px) !important; padding-right: env(safe-area-inset-right, 0px) !important; }
  #user-profile-modal > div { width: 100% !important; max-width: 100vw !important; }
  #user-profile-modal .profile-2fa-row { flex-wrap: wrap !important; gap: 6px !important; }
  #user-profile-modal .profile-2fa-row label { margin-left: 0 !important; width: 100%; justify-content: space-between; }
  #user-profile-modal .profile-modal-footer { width: 100% !important; }
  #user-profile-modal .profile-modal-footer .btn { flex: 1 1 0 !important; min-width: 0 !important; width: auto !important; }
  #user-profile-modal .nitro-swatches { max-width: 100% !important; }
  #user-profile-modal input, #user-profile-modal select, #user-profile-modal textarea { max-width: 100% !important; }
}

/* v. 3.1.1: Planvergleich – podglad planu nie moze blokowac pionowego scrolla strony */
#section-plandiff { overflow: visible !important; max-height: none !important; height: auto !important; }
#pdiff-canvas-wrap { max-height: 62vh !important; overflow: auto !important; overscroll-behavior: auto !important; }
#pdiff-canvas-base { display: block; max-width: 100% !important; height: auto !important; }
#pdiff-canvas-overlay { pointer-events: none !important; }
.content-area { overscroll-behavior-y: auto !important; }

/* v. 3.1.1: Mobile/iOS – tabele (Nachunternehmer & Montageteams, Buchhaltung & Controlling) bez ucinania prawej kolumny */
#section-unternehmer .table-responsive, #section-buchhaltung .table-responsive, #section-angebot .table-responsive {
  width: 100% !important; max-width: 100% !important;
  overflow-x: auto !important; overflow-y: visible !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y !important;
}
#section-unternehmer .machine-table, #section-buchhaltung .machine-table { min-width: 520px !important; }
#section-unternehmer .machine-table th, #section-unternehmer .machine-table td,
#section-buchhaltung .machine-table th, #section-buchhaltung .machine-table td {
  white-space: normal !important; word-break: break-word; overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  /* Nachunternehmer / Buchhaltung: kompakt, ale bez sciskania komorek */
  #section-unternehmer .machine-table th, #section-unternehmer .machine-table td,
  #section-buchhaltung .machine-table th, #section-buchhaltung .machine-table td {
    padding: 6px 7px !important; font-size: 0.72rem !important;
  }
  /* Angebot: wiersz pozycji – wieksze pola, pierwsza kolumna szersza, pojedyncze przewijanie poziome */
  #section-angebot .table-responsive { overflow-x: auto !important; }
  #section-angebot .machine-table { min-width: 560px !important; }
  #section-angebot .machine-table td:first-child, #section-angebot .machine-table th:first-child { min-width: 132px; }
  #section-angebot #ang-items input, #section-angebot #ang-items select {
    font-size: 0.78rem !important; padding: 7px 6px !important; min-height: 34px;
  }
  #section-angebot #ang-items td { padding: 4px 3px !important; }
  /* KI-FAB nie zaslania dolnych elementow */
  .content-area { padding-bottom: calc(136px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* v. 3.1.1: Android/mobile – tabele, Angebot-Positionen, dolny margines KI, bez skoku ukladu */
@media (max-width: 768px) {
  #section-unternehmer .table-responsive, #section-buchhaltung .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y !important;
    width: 100% !important; max-width: 100% !important;
  }
  #section-unternehmer .machine-table, #section-buchhaltung .machine-table { min-width: 520px !important; }
  #section-unternehmer .machine-table th, #section-unternehmer .machine-table td,
  #section-buchhaltung .machine-table th, #section-buchhaltung .machine-table td {
    overflow-wrap: anywhere !important; word-break: break-word !important; white-space: normal !important;
  }
  #section-angebot #ang-items input, #section-angebot #ang-items select {
    min-height: 36px !important; font-size: 0.8rem !important; padding: 7px 6px !important;
  }
  #section-angebot .machine-table td:first-child, #section-angebot .machine-table th:first-child { min-width: 140px !important; }
  .content-area { padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* v. 3.1.1: dokumenty (E-Check, Baustellenprotokoll, Planvergleich, Kalender) – plynny scroll pionowy + zwijane bloki */
.app-section, .app-section .card, .app-section form, .app-section .form-group,
#section-echeck, #section-plandiff, #section-baustellenprotokoll, #section-aufgaben-kalender { touch-action: pan-y; }
.app-section .row, .app-section .table-responsive { touch-action: pan-y; }
.signature-pad { touch-action: none !important; }        /* rysowanie WYLACZNIE wewnatrz canvasa podpisu */
.signature-wrap { touch-action: pan-y; }
.doc-collapse { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px 8px; margin: 10px 0; background: var(--card-bg); }
.doc-collapse > summary { cursor: pointer; list-style: none; font-size: 0.78rem; font-weight: 800; color: var(--primary); padding: 9px 2px; display: flex; align-items: center; gap: 6px; touch-action: manipulation; }
.doc-collapse > summary::-webkit-details-marker { display: none; }
.doc-collapse > summary::after { content: '▾'; margin-left: auto; font-size: 0.8rem; transition: transform 0.2s; }
.doc-collapse[open] > summary::after { transform: rotate(180deg); }
.doc-collapse[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
@media print { .doc-collapse { display: block; } .doc-collapse > summary { display: none; } }

/* v. 3.1: dokumenty/protokoly VDE + Angebot – plynny scroll pionowy, rysowanie tylko w canvasie podpisu */
#section-wartung-anlagen, #section-wartung-sibe, #section-angebot, #section-protokolle-main { touch-action: pan-y; }
#section-wartung-anlagen .table-responsive, #section-wartung-sibe .table-responsive, #section-angebot .table-responsive { touch-action: pan-x pan-y; }
.signature-pad { touch-action: none !important; }
/* v. 3.2: awaryjny scroller – gdyby jakakolwiek sekcja trafiła poza #main-content-area,
   ma własne przewijanie (identycznie jak Startseite wewnątrz .content-area); mysz + dotyk */
.main-layout > .app-section {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: calc(100dvh - var(--app-chrome, 95px)) !important;
  max-height: calc(100dvh - var(--app-chrome, 95px)) !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: auto !important;
  touch-action: pan-y !important;
}


/* v. 3.2: Startseite - Plattform-Kacheln (.plt-*, SVG-Icons + Labels, Mega-Design) */
.plt-card { position: relative; overflow: hidden; }
.plt-card::after { content: ''; position: absolute; left: -10%; right: -10%; top: -50%; height: 70%; pointer-events: none;
  background: radial-gradient(60% 80% at 25% 0%, rgba(37, 99, 235, 0.18), transparent 70%), radial-gradient(45% 70% at 85% 0%, rgba(168, 85, 247, 0.14), transparent 70%); }
.plt-sub { position: relative; font-size: 0.78rem; color: var(--text-muted); line-height: 1.55; margin: 2px 0 14px; }
.plt-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 12px; }
.plt-tile { --plt-accent: #38bdf8; appearance: none; -webkit-appearance: none; font: inherit; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 120px; padding: 16px 10px 14px;
  border-radius: 18px; border: 1px solid var(--border); background: linear-gradient(170deg, rgba(148, 163, 184, 0.10), rgba(15, 23, 42, 0.72));
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04); touch-action: manipulation;
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease; }
.plt-tile-windows { --plt-accent: #3b82f6; }
.plt-tile-macos { --plt-accent: #a5b4fc; }
.plt-tile-chrome { --plt-accent: #22c55e; }
.plt-tile-android { --plt-accent: #84cc16; }
.plt-tile-ios { --plt-accent: #e5e7eb; }
.plt-tile-pwa { --plt-accent: #f59e0b; }
.plt-ico { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; color: var(--plt-accent);
  filter: drop-shadow(0 3px 10px rgba(56, 189, 248, 0.35)); transition: transform 0.2s ease; }
.plt-ico svg { width: 100%; height: 100%; display: block; }
.plt-name { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.2px; text-align: center; line-height: 1.25; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plt-tag { font-size: 0.58rem; font-weight: 900; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); }
.plt-tile:hover { transform: translateY(-3px); border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.3), 0 0 26px rgba(56, 189, 248, 0.22); }
.plt-tile:hover .plt-ico { transform: translateY(-2px) scale(1.06); }
.plt-tile:focus-visible { outline: 2px solid var(--plt-accent); outline-offset: 3px; }
.plt-tile.plt-active { border-color: var(--plt-accent);
  background: linear-gradient(170deg, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.82));
  box-shadow: 0 0 0 1px var(--plt-accent), 0 20px 40px rgba(2, 6, 23, 0.55), 0 0 30px rgba(56, 189, 248, 0.3); }
.plt-tile.plt-active .plt-tag { color: var(--plt-accent); }
.plt-detail { position: relative; margin-top: 14px; padding: 12px 14px; border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.45); background: rgba(2, 6, 23, 0.62); }
.plt-detail-head b { color: var(--text); }
.plt-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: 0.88rem; }
.plt-detail p { font-size: 0.8rem; color: var(--text); line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
.plt-pill { display: none; align-items: center; font-size: 0.58rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 999px; background: linear-gradient(135deg, #22c55e, #16a34a); color: #052e16; }
@media (max-width: 820px) {
  .plt-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .plt-tile { min-height: 110px; }
}
@media (max-width: 520px) {
  .plt-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .plt-tile { min-height: 104px; padding: 13px 8px 11px; border-radius: 16px; }
  .plt-ico { width: 32px; height: 32px; }
  .plt-name { font-size: 0.74rem; }
  .plt-tag { font-size: 0.54rem; letter-spacing: 0.6px; }
  .plt-detail { padding: 11px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .plt-tile, .plt-ico { transition: none; }
  .plt-tile:hover { transform: none; }
  .plt-tile:hover .plt-ico { transform: none; }
}

/* v. 3.5: tlo portalu = kolor motywu (bez czarnego #0b0f19 na html/body poza trybem dark) */
html { background-color: #ffffff; }
body { background-color: var(--bg, #ffffff); }
/* v. 3.5: na ciemnych ekranach (intro/login/splash) tlo dokumentu tez jest ciemne -
   na iPhone 17 nie odslania sie juz bialy pas w obszarze safe-area na samym dole */
html:has(body.dark-mode), html:has(body.lang-auth-on), html:has(#intro-splash), html:has(#cloud-loading-screen) { background-color: #0b0f19; }
body.dark-mode, body.lang-auth-on, body:has(#intro-splash), body:has(#cloud-loading-screen) { background-color: #0b0f19; }

/* v. 3.5: ciemne wypelnienie WYLACZNIE dla pasa safe-area na dole (kolor motywu = brak paska) */
@supports (padding: env(safe-area-inset-bottom)) {
  body::after {
    content: '';
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: env(safe-area-inset-bottom, 0px);
    background: var(--bg, #ffffff);
    pointer-events: none;
    /* v. 3.5: niski z-index - ciemne ekrany (intro/auth/splash) maluja sie NAD pasem,
       wiec na iPhone nie widac juz bialego paska na ekranie startowym */
    z-index: 1;
  }
  body.dark-mode::after,
  body.lang-auth-on::after,
  body:has(#intro-splash)::after,
  body:has(#cloud-loading-screen)::after { background: #0b0f19; }
}

/* multiline=ios-no-blur */
/* v. 3.4: ios-no-blur-fix - iOS komponuje strone w warstwie i przy backdrop-filter
   malowal rozmyty pasek na dole ekranu (widoczny juz od ekranu logowania).
   Na iOS wylaczamy rozmycie tla (glass), zachowujac identyczny uklad, kolory i scroll. */
@supports (-webkit-touch-callout: none) {
  header, .top-banner, .card, .designer-empty-card, .auth-card, .auth-logo-card, .login-stats,
  .intro-feature, #intro-skip-btn, .sidebar, .sidebar-overlay, .user-dropdown-menu, .lang-list,
  .ai-floating-window, #auth-screen, #cloud-loading-screen, #intro-splash, [id$="-modal"] {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* intro-skip-solid: na iOS (bez blur) przycisk startowy ma w pelni czytelne, kryjace tlo */
@supports (-webkit-touch-callout: none) {
  #intro-skip-btn { background: rgba(15, 23, 42, 0.92) !important; border-color: rgba(241, 245, 249, 0.75) !important; color: #ffffff !important; }
}

/* ios-fullheight-screens: intro/logowanie/splash siegaja samej dolnej krawedzi na iOS */
@supports (height: 100dvh) {
  #intro-splash, #auth-screen, #cloud-loading-screen { height: 100dvh; min-height: 100dvh; }
}
#intro-splash { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
#auth-screen { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

/* kalender-today-legend (v. 4.7.6): dzisiejszy dzien, wpisy Termin/Urlaub w siatce + legenda */
.cal-day { position: relative; }
.cal-day-empty { opacity: 0.2; }
.cal-daynum { font-weight: 800; }
.cal-entries { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.cal-day.has-entry { border-color: rgba(37, 99, 235, 0.45); background: rgba(37, 99, 235, 0.05); }
.cal-day.cal-today { border: 2px solid var(--primary); background: linear-gradient(160deg, rgba(37, 99, 235, 0.14), rgba(37, 99, 235, 0.04)); box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35), 0 6px 16px rgba(37, 99, 235, 0.18); }
.cal-day.cal-today .cal-daynum { color: var(--primary); font-size: 0.95rem; }
.cal-today-badge { position: absolute; top: -7px; right: -4px; background: var(--primary); color: #ffffff; font-size: 0.52rem; font-weight: 900; letter-spacing: 0.4px; text-transform: uppercase; padding: 2px 6px; border-radius: 999px; box-shadow: 0 3px 8px rgba(37, 99, 235, 0.45); }
.cal-vac-dot { background: var(--gold); color: #3b2406; font-size: 0.55rem; font-weight: 800; padding: 2px 4px; border-radius: 4px; margin-top: 2px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.68rem; color: var(--text-muted); }
.cal-leg { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.cal-leg-today { background: var(--primary); color: #ffffff; font-size: 0.52rem; font-weight: 900; text-transform: uppercase; padding: 2px 6px; border-radius: 999px; }
.cal-leg-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.cal-leg-dot.ev { background: var(--primary); }
.cal-leg-dot.vac { background: var(--gold); }

/* shop-filters (v. 4.7.6): jeden uporzadkowany panel filtrow + brak duplikatu paska celu w hero */
.shop-filters { background: rgba(37, 99, 235, 0.04); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.shop-filters-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.shop-filters-title { font-size: 0.8rem; font-weight: 900; color: var(--text); }
.shop-filters-hint { font-size: 0.66rem; color: var(--text-muted); }
.shop-filters .shop-badges-strip { margin-bottom: 0; padding-bottom: 6px; }
.shop-filters .shop-cats { margin: 4px 0 0; border-top: 1px dashed var(--border); padding-top: 8px; padding-bottom: 2px; }
.shop-next-reward { padding: 6px 10px; }
.shop-next-reward .shop-next-bar { display: none; }
.shop-next-reward .shop-next-row { margin-bottom: 0; font-size: 0.72rem; }

/* sibe-full-protocol (v. 4.7.6): pelny formularz Wartungs- und Pruefprotokoll SiBe + fotodokumentacja + podpisy */
.sibe-root { display: block; }
.sibe-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-left: 5px solid var(--sibe-accent, #f59e0b); }
.sibe-note { margin-top: 8px; font-size: 0.68rem; line-height: 1.5; color: var(--text-muted); background: rgba(37, 99, 235, 0.06); border-left: 3px solid var(--primary); border-radius: 8px; padding: 8px 10px; }
.sibe-title { color: var(--sibe-accent, #f59e0b); }
.sibe-item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.sibe-item:last-child { border-bottom: none; }
.sibe-q { flex: 1 1 260px; min-width: 0; font-size: 0.78rem; font-weight: 600; color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }
.sibe-yn { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.sibe-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 0.74rem; font-weight: 800; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; background: var(--card-bg); color: var(--text); user-select: none; }
.sibe-opt input { accent-color: var(--success); }
.sibe-opt:has(input:checked) { border-color: var(--success); background: rgba(22, 163, 74, 0.12); color: #166534; }
.sibe-opt.sibe-no:has(input:checked) { border-color: var(--danger); background: rgba(220, 38, 38, 0.12); color: #991b1b; }
.sibe-photo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sibe-file { display: none; }
.sibe-hint { font-size: 0.66rem; color: var(--text-muted); }
.sibe-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 10px; }
.sibe-photo-empty { font-size: 0.72rem; color: var(--text-muted); }
.sibe-photo-item { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card-bg); }
.sibe-photo-item img { width: 100%; height: 96px; object-fit: cover; display: block; }
.sibe-photo-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer; background: rgba(15, 23, 42, 0.72); color: #ffffff; font-size: 0.72rem; font-weight: 900; }
.sibe-photo-cap { width: 100%; border: none; border-top: 1px solid var(--border); padding: 5px 7px; font-size: 0.66rem; background: transparent; color: var(--text); }
.sibe-confirm { font-size: 0.74rem; line-height: 1.55; color: var(--text); background: rgba(37, 99, 235, 0.05); border-radius: 10px; padding: 9px 11px; margin-bottom: 10px; }
.sibe-sig-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sibe-sig-actions .btn { font-size: 0.68rem; }
.sibe-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sibe-actions .btn { flex: 1 1 200px; }
body.dark-mode .sibe-opt { background: #1e293b; }
/* sibe-head-v35: pasek z logo wysrodkowanym + tytul w osobnym kafelku */
.sibe-head { display: flex; align-items: center; justify-content: center; min-height: 86px; }
.sibe-headlogo { height: 62px; width: auto; object-fit: contain; margin: 0 auto; display: block; }
.sibe-titlecard { text-align: center; }
.sibe-titlemain { font-size: 1.12rem; font-weight: 900; color: #0f172a; margin: 0 0 4px; letter-spacing: 0.2px; }
.sibe-titlesub { font-size: 0.74rem; color: var(--text-muted); margin: 0 0 6px; }
.sibe-id { font-size: 0.7rem; color: var(--text); }
body.dark-mode .sibe-titlemain { color: #f8fafc; }

/* kpi-stable-v38: stabilny uklad kafelkow KPI (bez skokow wysokosci przy doczytywaniu danych) */
.widget-box.stat-card { min-height: 96px; display: flex; flex-direction: column; justify-content: center; }
.stat-value { min-height: 2rem; line-height: 2rem; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.stat-label { min-height: 1.1rem; }

/* ===== bento-ui-v40 (v. 4.7.6): nowoczesny Bento / dark-tech panel =====
   Zasieg: karty, kafelki, przyciski, naglowki, aktywne stany menu, liczby.
   Nie dotyka: #main-content-area, scrollery, .signature-pad, #plt-card, poprawek iOS. */
:root {
  --bento-radius: 18px;
  --bento-radius-sm: 12px;
  --bento-border: rgba(148, 163, 184, 0.22);
  --bento-border-strong: rgba(148, 163, 184, 0.38);
  --bento-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 18px rgba(15, 23, 42, 0.05);
  --bento-inner: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --bento-surface: none;
}

/* --- karty i panele (bez #plt-card) --- */
.card:not(#plt-card), .widget-box:not(#plt-card) {
  border-radius: var(--bento-radius) !important;
  border: 1px solid var(--bento-border) !important;
  background-image: var(--bento-surface);
  box-shadow: var(--bento-shadow), var(--bento-inner);
  padding: 16px 18px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:not(#plt-card):hover, .widget-box:not(#plt-card):hover { border-color: var(--bento-border-strong) !important; }
.designer-empty-card { border-radius: var(--bento-radius) !important; border: 1px solid var(--bento-border); box-shadow: var(--bento-shadow), var(--bento-inner); }

/* --- naglowki kart --- */
.card-title { min-height: 26px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.92rem !important; font-weight: 800 !important; letter-spacing: 0.2px; line-height: 1.3;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--bento-border); }
.card-title::before { content: ""; width: 4px; height: 1.05em; border-radius: 3px; flex: 0 0 auto;
  background: linear-gradient(180deg, #60a5fa, #2563eb); box-shadow: 0 0 12px rgba(59, 130, 246, 0.45); }
.widget-title { font-size: 0.85rem !important; font-weight: 800 !important; letter-spacing: 0.2px; }

/* --- przyciski: jeden jezyk wizualny --- */
.btn { border-radius: var(--bento-radius-sm) !important; font-weight: 800 !important; letter-spacing: 0.2px;
  border: 1px solid var(--bento-border) !important; box-shadow: 0 6px 16px rgba(2, 6, 23, 0.28), var(--bento-inner);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, border-color 0.16s ease; }
.btn:hover { transform: translateY(-1px); border-color: var(--bento-border-strong) !important; }
.btn:active { transform: translateY(0) scale(0.99); }
.btn-primary { background-image: linear-gradient(135deg, #3b82f6, #1d4ed8) !important; border-color: rgba(96, 165, 250, 0.5) !important; }
.btn:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }

/* --- menu: wyrazne stany aktywne --- */
.nav-tab { border-radius: var(--bento-radius-sm) !important; border: 1px solid transparent; transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease; }
.nav-tab:hover { background: rgba(59, 130, 246, 0.10); border-color: var(--bento-border); }
.nav-tab.active { border: 1px solid rgba(96, 165, 250, 0.55) !important;
  background-image: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(23, 37, 84, 0.95)) !important;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.35), var(--bento-inner) !important; }
.nav-group-header { border-radius: var(--bento-radius-sm) !important; letter-spacing: 0.4px; text-transform: uppercase; font-size: 0.68rem !important; opacity: 0.92; }
.nav-group-content { padding: 4px 2px 6px; }

/* bento-ui-v40 part2: liczby, formularze, tabele, mobile */
.stat-value, .kpi-bars, .kpi-bar-value, .machine-table td, .timer-display, #shop-hero-points, .shop-hero-points,
.nav-badge, #notification-count-badge, #shop-points-badge, .goal-progress-box, .cal-daynum, .shop-price, .shop-missing,
.stat-label, .role-badge, .chat-urgent-badge, .start-ticker-badge {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.form-control, select.form-control, textarea.form-control { border-radius: var(--bento-radius-sm) !important; border: 1px solid var(--bento-border) !important; }
.form-control:focus { border-color: rgba(96, 165, 250, 0.75) !important; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18) !important; }
.machine-table th, .machine-table td { border-color: var(--bento-border); }
.table-responsive { border-radius: var(--bento-radius-sm); }

.stat-card { border-radius: var(--bento-radius) !important; min-height: 96px; }
.nav-badge, .chat-urgent-badge { border-radius: 999px; font-weight: 900; letter-spacing: 0.2px; }

@media (max-width: 640px) {
  .card:not(#plt-card), .widget-box:not(#plt-card) { padding: 13px 13px; border-radius: 16px !important; }
  .card-title { font-size: 0.88rem !important; padding-bottom: 8px; margin-bottom: 10px; }
  .btn { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .card:not(#plt-card), .widget-box:not(#plt-card), .btn, .nav-tab { transition: none !important; }
  .btn:hover { transform: none; }
}

/* bento-dark-v40: w trybie ciemnym delikatne, ale nadal lekkie tlo kart */
body.dark-mode { --bento-surface: linear-gradient(168deg, rgba(255, 255, 255, 0.03), rgba(15, 23, 42, 0.22)); --bento-inner: inset 0 1px 0 rgba(255, 255, 255, 0.04); --bento-shadow: 0 8px 22px rgba(2, 6, 23, 0.35); }

/* startseite-instant-v40: Startseite i kafelki KPI zawsze w pelnym kryciu (brak efektu "przygaszenia" po logowaniu) */
#section-startseite, #section-startseite.active-section { animation: none !important; opacity: 1 !important; transform: none !important; }
#section-startseite .widget-box, #section-startseite .stat-card, #section-startseite .stat-value, #section-startseite .stat-label,
#section-startseite .card, #section-startseite .kpi-bar-row { opacity: 1 !important; }
#section-startseite .stat-value { transition: none !important; }

/* title-center-v40 (v. 4.7.6): glowne tytuly kart/sekcji ZAWSZE wysrodkowane.
   Przyciski/badge sa w warstwie absolute (prawa krawedz) i nie przesuwaja tytulu;
   symetryczny padding lewo/prawo trzyma idealny srodek. #plt-card nietkniety. */
.card:not(#plt-card) .card-title, .widget-box:not(#plt-card) .widget-title {
  position: relative !important;
  display: block !important;
  text-align: center !important;
  justify-content: center !important;
  padding: 0 104px 10px !important;
  min-height: 30px;
}
.card:not(#plt-card) .card-title::before { position: absolute !important; left: 0; top: 50%; transform: translateY(-50%); }
.card:not(#plt-card) .card-title > button:not(:first-child),
.card:not(#plt-card) .card-title > .btn:not(:first-child),
.card:not(#plt-card) .card-title > .no-print:not(:first-child),



.card:not(#plt-card) .card-title > span[id$="-badge"]:not(:first-child),
.card:not(#plt-card) .card-title > div:not(:first-child),
.card:not(#plt-card) .card-title > a:not(:first-child) {
  position: absolute !important;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0 !important;
  max-width: 132px;
}
/* drugi element boczny (badge + przycisk) - nie nachodza na siebie */
.card:not(#plt-card) .card-title > :nth-last-child(2):not(:first-child) { right: 96px; }
.card:not(#plt-card) .card-title > :nth-last-child(3):not(:first-child) { right: 186px; }
.widget-box:not(#plt-card) .widget-title { padding: 0 0 8px !important; }
.designer-empty-card h2, .app-section .card > h2, .app-section .card > h3 { text-align: center !important; }
.app-section .row > .form-group > label { text-align: left; } /* formularze pozostaja czytelne po lewej */
@media (max-width: 640px) {
  .card:not(#plt-card) .card-title { padding: 0 84px 8px !important; }
  .card:not(#plt-card) .card-title > :nth-last-child(2):not(:first-child) { right: 78px; }
  .card:not(#plt-card) .card-title > :nth-last-child(3):not(:first-child) { right: 150px; }
}

/* ===== startseite-stable-v411 (v. 4.7.6): Startseite na desktopie bez migniecia/przeskoku =====
   Stale zarezerwowane wysokosci (min-height) + skeleton w miejscu wartosci KPI oraz jednorazowe,
   w pelnym kontrascie pojawienie sie kafelkow Quick Actions (zadnego polprzezroczystego stanu posredniego).
   Nie rusza #main-content-area, scrollerow, .signature-pad, #plt-card ani poprawek iOS/safe-area. */
#section-startseite .stat-card { min-height: 96px; }
#section-startseite .stat-value { min-height: 2rem; line-height: 2rem; min-width: 3.4ch; }
#section-startseite .stat-label { min-height: 1.15rem; line-height: 1.15rem; }
#section-startseite #timer-summary-line,
#section-startseite #timer-status-line { min-height: 1.1rem; line-height: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#section-startseite .kpi-bars { min-height: 76px; }
#section-startseite .kpi-bar-row { min-height: 18px; }
/* skeleton: kafelki sa w pelnym kryciu, a wartosc jest schowana pod szarym paskiem (stala wysokosc => brak skoku) */
#section-startseite.startseite-loading .stat-value,
#section-startseite.startseite-loading #timer-summary-line,
#section-startseite.startseite-loading #timer-status-line,
#section-startseite.startseite-loading .kpi-bar-val,
#section-startseite.startseite-loading .kpi-bar-label { color: transparent !important; }
#section-startseite.startseite-loading .stat-card { position: relative; }
#section-startseite.startseite-loading .stat-card::after {
  content: ''; position: absolute; left: 50%; top: 30%; transform: translateX(-50%);
  width: 56px; height: 12px; border-radius: 7px; pointer-events: none;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.16) 25%, rgba(148, 163, 184, 0.42) 37%, rgba(148, 163, 184, 0.16) 63%);
  background-size: 300% 100%; animation: startseiteSkeleton 1.15s ease-in-out infinite;
}
#section-startseite.startseite-loading .kpi-bar-fill { background: rgba(148, 163, 184, 0.28) !important; }
@keyframes startseiteSkeleton { 0% { background-position: 130% 0; } 100% { background-position: -30% 0; } }
/* v. 4.7.6: Quick Actions immer voller Kontrast ab der ersten Frame (kein opacity/transition-auf-opacity) */
#section-startseite .qa-tile { opacity: 1 !important; pointer-events: auto !important; }
@media (prefers-reduced-motion: reduce) {
  #section-startseite.startseite-loading .stat-card::after { animation: none; }
  #section-startseite .qa-tile { transition: none !important; }
}
/* ===== theme-instant-v426 (v. 4.7.6): motyw i nakladki zmieniaja sie NATYCHMIAST (0 ms) =====
   1) kill-switch .no-theme-transition (zakladany na <html> przy starcie i przy kazdym przelaczeniu motywu),
   2) twarde usuniecie transition dla background-color/color/border-color na kluczowych kontenerach,
   3) #auth-screen znika bez zadnego fade (display: none z JS). */
html.no-theme-transition,
html.no-theme-transition body,
html.no-theme-transition *,
html.no-theme-transition *::before,
html.no-theme-transition *::after { transition: none !important; }
html, body { transition-property: none; }
.card, .widget-box, .sidebar, .topbar, header, .app-section { transition-property: transform, box-shadow, opacity, filter; }
#auth-screen, #intro-splash, #cloud-loading-screen, #pwa-splash-loader { transition: none !important; }

/* ===== startseite-actions-v427 (v. 4.7.6): symetryczny wiersz 2-kolumnowy =====
   Lewa kolumna: przycisk KPI Export CSV (polowa szerokosci), prawa: kafelek pogodowy na zywo.
   Identyczna wysokosc (min-height 52px), zaokraglenie 14px i proporcje 50/50 na telefonie i desktopie.
   Bez transition (regula 0 ms z v. 4.7.6 - zmiana motywu nie animuje kolorow). */
.startseite-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
  width: 100%;
  margin: 0 0 14px;
}
.startseite-actions-row > * { min-height: 52px !important; height: 52px !important; border-radius: 14px !important; box-sizing: border-box; }
#kpi-export-btn { width: 100%; justify-content: center; display: inline-flex; align-items: center; margin: 0; min-height: 52px !important; border-radius: 14px !important; }
.weather-tile {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin: 0;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.28) 0%, rgba(37, 99, 235, 0.10) 60%, rgba(226, 232, 240, 0.22) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 6px 16px rgba(2, 6, 23, 0.10);
  transition: none !important;
}
.weather-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.weather-tile:active { transform: scale(0.99); }
.weather-tile-icon { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.weather-tile-icon svg { width: 34px; height: 34px; display: block; filter: drop-shadow(0 2px 4px rgba(2, 6, 23, 0.18)); }
.weather-tile-body { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.05; }
.weather-tile-temp { font-size: 1.25rem; font-weight: 900; color: var(--text); letter-spacing: -0.02em; white-space: nowrap; }
.weather-tile-place { display: flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 700; color: var(--text-muted); max-width: 100%; overflow: hidden; }
.weather-tile-place > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weather-tile-pin { font-size: 0.7rem; flex: 0 0 auto; }
/* tryb ciemny: gleboki, elegancki odcien (bez animacji) */
body.dark-mode .weather-tile {
  border-color: rgba(96, 165, 250, 0.42);
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.55) 0%, rgba(15, 23, 42, 0.92) 65%, rgba(2, 6, 23, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 18px rgba(2, 6, 23, 0.45);
}
body.dark-mode .weather-tile-temp { color: #f8fafc; }
body.dark-mode .weather-tile-place { color: #cbd5e1; }
@media (max-width: 480px) {
  .startseite-actions-row { gap: 10px; }
  .weather-tile { padding: 8px 10px; gap: 8px; }
  .weather-tile-icon svg { width: 30px; height: 30px; }
  .weather-tile-temp { font-size: 1.1rem; }
  .weather-tile-place { font-size: 0.64rem; }
  #kpi-export-btn { font-size: 0.72rem; padding-left: 8px; padding-right: 8px; }
}


/* ===== startseite-weather-v428 (v. 4.7.6): opt-in GPS na kafelku pogodowym =====
   Badge przy nazwie miasta: "Standort aktivieren" (GPS off, domyslnie) <-> "GPS aktiv" (opt-in).
   Dialog potwierdzenia w stylu portalu. Zero transition (regula 0 ms z v. 4.2.6).
   Blok trzymany na EOF, aby bic pozniejsze reguly bento z !important. */
.weather-tile-place { min-width: 0; }
#weather-place { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weather-loc-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; margin-left: 2px;
  padding: 2px 7px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid rgba(37, 99, 235, 0.38); background: rgba(37, 99, 235, 0.12); color: var(--primary);
  font-size: 0.58rem !important; font-weight: 800 !important; line-height: 1.35; letter-spacing: 0.01em;
  min-height: 0 !important; height: auto !important;
  -webkit-tap-highlight-color: transparent; transition: none !important;
}
.weather-loc-btn .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; flex: 0 0 auto; }
.weather-loc-btn:hover { background: rgba(37, 99, 235, 0.2); }
.weather-loc-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.weather-loc-btn.is-on { border-color: rgba(34, 197, 94, 0.5); background: rgba(34, 197, 94, 0.14); color: #15803d; }
.weather-loc-btn.is-on .dot { opacity: 1; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22); }
body.dark-mode .weather-loc-btn { border-color: rgba(96, 165, 250, 0.45); background: rgba(37, 99, 235, 0.22); color: #93c5fd; }
body.dark-mode .weather-loc-btn:hover { background: rgba(37, 99, 235, 0.32); }
body.dark-mode .weather-loc-btn.is-on { border-color: rgba(74, 222, 128, 0.45); background: rgba(34, 197, 94, 0.22); color: #86efac; }
.weather-gps-modal {
  position: fixed !important; inset: 0; z-index: 40000; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: rgba(2, 6, 23, 0.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  transition: none !important;
}
.weather-gps-card {
  width: min(430px, 100%); max-height: 86dvh; overflow-y: auto;
  background: var(--card-bg, #ffffff); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px; box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}
.weather-gps-title { font-weight: 900; font-size: 0.95rem; margin-bottom: 8px; }
.weather-gps-text { font-size: 0.74rem; line-height: 1.5; color: var(--text-muted); margin-bottom: 14px; }
.weather-gps-text b { color: var(--text); }
.weather-gps-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
body.dark-mode .weather-gps-card { background: #111827; border-color: #334155; color: #f8fafc; }
@media (max-width: 480px) {
  .weather-loc-btn { padding: 3px 6px; gap: 0; }
  .weather-loc-btn .lbl { display: none; }
  .weather-loc-btn .dot { width: 7px; height: 7px; }
  .weather-gps-card { padding: 14px; }
}


/* ===== design-premium-v440 (v. 4.7.6): Bento / Precision UI - finalna warstwa wizualna =====
   Zasieg: powierzchnie i cienie, topbar (matowe szklo), zaokraglenia, typografia liczb (KPI/timer/pogoda),
   kapsuly statusow oraz wiersz KPI Export CSV + #startseite-weather-tile.
   NIE dotyka reguł 0 ms (html.no-theme-transition, html/body, #auth-screen/#intro-splash/
   #cloud-loading-screen/#pwa-splash-loader), safe-area (env(), --app-chrome), .signature-pad,
   #ai-fab-btn ani siatki 50/50 (grid-template-columns: 1fr 1fr pozostaje bez zmian).
   Transition WYLACZNIE dla stanow interaktywnych (:hover/:focus-visible/:active) i tylko
   transform / box-shadow / opacity - zmiana motywu Jasny<->Ciemny pozostaje natychmiastowa (0 ms). */

:root {
  --prem-surface: #ffffff;                                    /* snieznobiale karty */
  --prem-surface-2: #f8fafc;                                  /* kafelki wewnetrzne */
  --prem-border: rgba(15, 23, 42, 0.08);                      /* precyzyjne 1px */
  --prem-border-strong: rgba(15, 23, 42, 0.14);
  --prem-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -4px rgba(15, 23, 42, 0.06);
  --prem-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 14px 34px -8px rgba(15, 23, 42, 0.12);
  --prem-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --prem-glass: rgba(255, 255, 255, 0.86);                    /* matowe szklo topbaru */
  --prem-hairline: rgba(15, 23, 42, 0.08);
  --prem-track: rgba(15, 23, 42, 0.035);
}
body.dark-mode {
  --prem-surface: #111827;                                    /* karty w trybie ciemnym */
  --prem-surface-2: #161f33;                                  /* podwyzszona glebia */
  --prem-border: rgba(148, 163, 184, 0.14);
  --prem-border-strong: rgba(148, 163, 184, 0.24);
  --prem-shadow: 0 1px 2px rgba(2, 6, 23, 0.5), 0 10px 28px -6px rgba(2, 6, 23, 0.55);
  --prem-shadow-hover: 0 2px 6px rgba(2, 6, 23, 0.55), 0 18px 40px -10px rgba(2, 6, 23, 0.7);
  --prem-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);      /* delikatny gorny refleks */
  --prem-glass: rgba(9, 13, 22, 0.82);
  --prem-hairline: rgba(148, 163, 184, 0.14);
  --prem-track: rgba(148, 163, 184, 0.08);
}

/* --- 1) Topbar: matowe szklo (blur 12px) + subtelna linia oddzielajaca od tresci ---
   Wysokosc, marginesy i safe-area pozostaja nietkniete (zmieniamy tylko warstwe tla). */
header, .topbar {
  background-color: var(--prem-glass);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--prem-hairline) !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), 0 10px 26px -22px rgba(15, 23, 42, 0.35);
}
body.dark-mode header, body.dark-mode .topbar {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 14px 32px -24px rgba(0, 0, 0, 0.9);
}
/* iOS: bez rozmycia (ios-no-blur-fix) - tlo musi byc kryjace, inaczej tresc przebija przez topbar */
@supports (-webkit-touch-callout: none) {
  header, .topbar { background-color: var(--prem-surface); }
}

/* --- 2) Powierzchnie Bento: snieznobiale karty / antracyt w dark + wielowarstwowy cien --- */
.card:not(#plt-card), .widget-box:not(#plt-card) {
  background-color: var(--prem-surface) !important;
  background-image: none !important;
  border: 1px solid var(--prem-border) !important;
  border-radius: 16px !important;
  box-shadow: var(--prem-shadow), var(--prem-inset);
}
body.dark-mode .card:not(#plt-card), body.dark-mode .widget-box:not(#plt-card) {
  background-image: linear-gradient(168deg, rgba(255, 255, 255, 0.028), rgba(9, 13, 22, 0.18)) !important;
}
.designer-empty-card {
  background-color: var(--prem-surface) !important;
  border: 1px solid var(--prem-border) !important;
  border-radius: 16px !important;
  box-shadow: var(--prem-shadow), var(--prem-inset);
}
.stat-card, .widget-box.stat-card { border-radius: 16px !important; }
.chat-container { border: 1px solid var(--prem-border); box-shadow: var(--prem-shadow); }
.user-dropdown-menu, .sidebar { border-color: var(--prem-border) !important; }
/* kafelki wewnetrzne (12px) - bez zmiany ukladu */
.qa-tile, .plt-card, .badge-card, .kpi-bars, .table-responsive, .login-stats, .lang-list { border-radius: var(--radius-sm); }

/* --- 3) Przyciski i pola: jednolity jezyk 12px + akcent inzynieryjny --- */
.btn { border-radius: 12px !important; font-weight: 800; letter-spacing: 0.2px; }
.btn-secondary { background-color: var(--prem-surface) !important; border: 1px solid var(--prem-border-strong) !important; color: var(--text) !important; }
body.dark-mode .btn-secondary { background-color: #161f33 !important; }
.form-control, select.form-control, textarea.form-control { border-radius: 12px !important; border: 1px solid var(--prem-border) !important; background-color: var(--prem-surface); }
body.dark-mode .form-control, body.dark-mode select.form-control, body.dark-mode textarea.form-control { background-color: #0f172a !important; }
.form-control:focus, select.form-control:focus, textarea.form-control:focus { border-color: rgba(37, 99, 235, 0.55) !important; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16) !important; }


/* --- 4) Typografia inzynieryjna: ostre liczby bez "skakania" podczas odliczania (tabular-nums) ---
   Uwaga: font-size/font-weight kafelkow KPI i timera sa ustawiane INLINE w index.html -
   tutaj dokladamy wylacznie numeryke tabelaryczna i drobny tracking (bez zmiany rozmiarow). */
.stat-value, .stat-label, .kpi-bar-val, .kpi-bar-value, .timer-display, #timer-display,
#timer-summary-line, #timer-status-line, .weather-tile-temp, .nav-badge, #notification-count-badge,
#shop-points-badge, .shop-price, #shop-hero-points, .shop-hero-points, .cal-daynum, .goal-progress-box,
.role-badge, .chat-urgent-badge, .start-ticker-badge, .header-points-badge, .machine-table td, .stat-value strong {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.stat-value { letter-spacing: -0.02em; }
#timer-display, .timer-display { letter-spacing: -0.03em; }
.weather-tile-temp { letter-spacing: -0.03em; }
.kpi-bar-val, .kpi-bar-value { letter-spacing: -0.01em; }
.stat-label { font-weight: 700; letter-spacing: 0.02em; }

/* --- 5) Kapsuly statusow: 999px (badge) --- */
.nav-badge, .role-badge, .badge-in, .badge-out, .start-ticker-badge, .chat-urgent-badge,
.header-points-badge, #notification-count-badge, #shop-points-badge, .weather-loc-btn { border-radius: 999px !important; }
.nav-badge, .role-badge, .badge-in, .badge-out { letter-spacing: 0.01em; }

/* --- 6) Wiersz Startseite: KPI Export CSV + #startseite-weather-tile - IDENTYCZNY jezyk wizualny
   (ta sama wysokosc 52px, ten sam promien 12px, ten sam cien, ta sama waga pisma).
   Siatka pozostaje symetryczna 50/50 (grid-template-columns: 1fr 1fr z v. 4.7.6 - bez zmian). --- */
.startseite-actions-row > * {
  min-height: 52px !important; height: 52px !important; border-radius: 12px !important;
  font-weight: 800 !important; letter-spacing: 0.2px; box-sizing: border-box;
  box-shadow: var(--prem-shadow), var(--prem-inset);
}
#kpi-export-btn {
  width: 100%; margin: 0; display: inline-flex; align-items: center; justify-content: center;
  background-color: var(--prem-surface) !important;
  border: 1px solid var(--prem-border-strong) !important; color: var(--text) !important;
}
body.dark-mode #kpi-export-btn { background-color: #161f33 !important; }
.weather-tile {
  border: 1px solid var(--prem-border) !important; border-radius: 12px !important;
  background-image: linear-gradient(135deg, rgba(37, 99, 235, 0.07) 0%, rgba(15, 23, 42, 0.015) 100%) !important;
  background-color: var(--prem-surface) !important;
  box-shadow: var(--prem-shadow), var(--prem-inset) !important;
}
body.dark-mode .weather-tile {
  border-color: var(--prem-border) !important;
  background-image: linear-gradient(160deg, rgba(30, 58, 138, 0.34) 0%, rgba(9, 13, 22, 0.6) 100%) !important;
}
.weather-tile-icon svg { filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.14)); }
body.dark-mode .weather-tile-icon svg { filter: drop-shadow(0 1px 2px rgba(2, 6, 23, 0.5)); }

/* --- 7) Stany interaktywne: transition WYLACZNIE dla :hover/:focus-visible/:active
   i wylacznie transform / box-shadow / opacity (zmiana motywu pozostaje 0 ms - bez animacji kolorow). --- */
.card:not(#plt-card), .widget-box:not(#plt-card), .designer-empty-card, .stat-card,
.btn, #kpi-export-btn, .nav-tab, .qa-tile, .cal-day, .chat-msg, .badge-card {
  transition-property: transform, box-shadow, opacity;
  transition-duration: 0.16s;
  transition-timing-function: ease;
}
.card:not(#plt-card):hover, .widget-box:not(#plt-card):hover {
  box-shadow: var(--prem-shadow-hover), var(--prem-inset); transform: translateY(-2px);
}
.btn:hover, #kpi-export-btn:hover { transform: translateY(-1px); box-shadow: var(--prem-shadow-hover); }
.btn:active, #kpi-export-btn:active { transform: translateY(0) scale(0.99); }
.weather-tile:active { transform: scale(0.99); }
.btn:focus-visible, #kpi-export-btn:focus-visible, .weather-tile:focus-visible, .nav-tab:focus-visible,
.qa-tile:focus-visible, .form-control:focus-visible, .weather-loc-btn:focus-visible, .cal-day:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.7); outline-offset: 2px;
}
/* Startseite: kafelki KPI/Quick Actions bez animacji (regula pelnego krycia z v. 4.7.6) */
#section-startseite .stat-card, #section-startseite .stat-value, #section-startseite .qa-tile { transition: none !important; }
/* Kafelek pogodowy ma twarde "transition: none" (v. 4.7.6) - nie dodajemy mu animacji */
.weather-tile, .weather-tile * { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .card:not(#plt-card), .widget-box:not(#plt-card), .designer-empty-card, .btn, #kpi-export-btn, .nav-tab, .cal-day, .chat-msg, .badge-card,
  .card:not(#plt-card):hover, .widget-box:not(#plt-card):hover, .btn:hover, #kpi-export-btn:hover { transition: none !important; transform: none; }
}
@media (max-width: 480px) {
  .startseite-actions-row { gap: 10px; }
  .startseite-actions-row > * { border-radius: 12px !important; }
  .card:not(#plt-card), .widget-box:not(#plt-card) { border-radius: 16px !important; }
}

/* --- 8) Pływajacy przycisk ELSTEK AI Bot: zachowany wyglad bazowy (.ai-fab z v.1.0),
   dopracowany tylko cien i promien kapsuly (bez zmiany pozycji, rozmiaru i safe-area). --- */
.ai-fab { border-radius: 999px; box-shadow: 0 10px 26px -6px rgba(37, 99, 235, 0.45); }
.ai-fab:hover { box-shadow: 0 16px 34px -8px rgba(37, 99, 235, 0.55); }
body.dark-mode .ai-fab { box-shadow: 0 10px 26px -6px rgba(2, 6, 23, 0.75); }
.ai-floating-window { border-radius: 16px; box-shadow: var(--prem-shadow-hover); }
body.dark-mode .ai-floating-window { border: 1px solid var(--prem-border); }


/* ===== design-premium-v440 part2 (v. 4.7.6): ergonomia terenowa - przyciski, pola, tabele, pigulki statusu =====
   Nadal bez animacji kolorow: transition wylacznie dla stanow interaktywnych (:hover/:focus-visible/:active)
   i wylacznie transform / box-shadow / opacity - zmiana motywu pozostaje natychmiastowa (0 ms). */

/* --- Przyciski: gleboki ELSTEK Blue z subtelnym gradientem kierunkowym + wyrazna reakcja dotykowa --- */
.btn-primary {
  background-image: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: 1px solid rgba(29, 78, 216, 0.7) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 10px 22px -10px rgba(29, 78, 216, 0.55) !important;
}
.btn-primary:hover { box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16), 0 14px 30px -12px rgba(29, 78, 216, 0.65) !important; }
.btn-primary:active { transform: translateY(1px) !important; }
body.dark-mode .btn-primary {
  border-color: rgba(96, 165, 250, 0.55) !important;
  box-shadow: 0 1px 2px rgba(2, 6, 23, 0.5), 0 12px 26px -12px rgba(37, 99, 235, 0.7) !important;
}
/* przyciski drugorzedne: czyste 1px obramowanie + subtelne podswietlenie (bez gradientu szarego) */
.btn-secondary { background-image: none !important; }
.btn-secondary:hover { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 24px -12px rgba(15, 23, 42, 0.28); }
body.dark-mode .btn-secondary:hover { box-shadow: 0 1px 2px rgba(2, 6, 23, 0.5), 0 12px 26px -12px rgba(0, 0, 0, 0.8); }
/* ergonomia: 44px dla przyciskow akcji (warianty .btn-small / .btn-close pozostaja kompaktowe) */
.btn:not(.btn-small):not(.btn-close) { min-height: 44px; }
#kpi-export-btn { min-height: 52px !important; }

/* --- Pola formularzy: 44px pod palec, 12px promien, czyste tlo, wyrazny pierscien skupienia --- */
.form-control, select.form-control, textarea.form-control,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select, textarea {
  min-height: 44px;
  border-radius: 12px;
  background-color: var(--prem-surface);
  border: 1px solid var(--prem-border);
  color: var(--text);
}
body.dark-mode .form-control, body.dark-mode select, body.dark-mode textarea,
body.dark-mode input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) { background-color: #0f172a; color: #f8fafc; }
textarea, textarea.form-control { min-height: 92px; line-height: 1.45; }
.form-control::placeholder, input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.85; }
.form-control:focus, select:focus, textarea:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18) !important;
}
/* kompaktowe konteksty (czat, okno KI, filtry w tabelach) nie rosna do 44px - uklad bez zmian */
.chat-input-area .form-control, .ai-floating-footer .form-control, .table-responsive .form-control { min-height: 38px; }

/* --- Tabele i listy protokolow: wyrazne naglowki kolumn + czyste separatory wierszy --- */
table th, .machine-table th {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--text-muted);
  background-color: var(--prem-track);
}
body.dark-mode table th, body.dark-mode .machine-table th { color: #94a3b8; background-color: rgba(148, 163, 184, 0.06); }
table td, .machine-table td { border-color: var(--prem-border); }
.table-responsive table th, .table-responsive table td { padding-top: 8px; padding-bottom: 8px; }

/* --- Pigulki statusu: zielony (aktywne/OK), bursztynowy (zblizajace sie przeglady), czerwony (usterki) 999px --- */
.badge-in, .badge-out, .badge-warn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.66rem !important; font-weight: 800; letter-spacing: 0.02em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-in { background: rgba(16, 185, 129, 0.12); color: #047857; border-color: rgba(16, 185, 129, 0.3); }
.badge-out { background: rgba(239, 68, 68, 0.12); color: #b91c1c; border-color: rgba(239, 68, 68, 0.3); }
.badge-warn { background: rgba(245, 158, 11, 0.14); color: #b45309; border-color: rgba(245, 158, 11, 0.32); }
body.dark-mode .badge-in { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.36); }
body.dark-mode .badge-out { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border-color: rgba(239, 68, 68, 0.36); }
body.dark-mode .badge-warn { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border-color: rgba(245, 158, 11, 0.36); }

/* --- Wiersz Startseite: hierarchia kafelka pogodowego (ikona -> temperatura -> badge Standortu) --- */
.weather-tile { gap: 12px; }
.weather-tile-temp { font-weight: 900; }
.weather-tile-place { font-weight: 800; }
.weather-loc-btn { padding: 3px 9px; font-size: 0.6rem !important; color: #1d4ed8; border-color: rgba(29, 78, 216, 0.32); background: rgba(37, 99, 235, 0.1); }
.weather-loc-btn.is-on { color: #047857; border-color: rgba(16, 185, 129, 0.45); background: rgba(16, 185, 129, 0.14); }
body.dark-mode .weather-loc-btn { color: #bfdbfe; border-color: rgba(96, 165, 250, 0.45); background: rgba(37, 99, 235, 0.24); }
body.dark-mode .weather-loc-btn.is-on { color: #86efac; border-color: rgba(74, 222, 128, 0.45); background: rgba(34, 197, 94, 0.22); }


/* ===== profile-banner-v441 (v. 4.7.6): kontrast naglowka banera modalu profilu uzytkownika =====
   Modal #user-profile-modal (otwierany przez openUserProfileEditor()) ma granatowo-niebieski baner
   (background: var(--primary-gradient) + color: white). Imie i nazwisko (#modal-user-fullname) dostaje
   jednak od applyNitroToOwnName() klase .nitro-name, ktora ustawia background-clip: text oraz
   -webkit-text-fill-color: transparent (wielokolorowy gradient) - na ciemnym banerze dawalo to
   niski kontrast. Tutaj WYMUSZAMY krystalicznie bialy tytul oraz jasny podtytul/przycisk zamkniecia,
   w trybie jasnym i ciemnym (body.dark-mode). Zakres: wylacznie wnetrze #user-profile-modal.
   Bez nowych animacji - zmiana motywu pozostaje natychmiastowa (0 ms). */

/* Tytul: imie i nazwisko - zawsze bialy, bez gradientu "Nitro" */
#user-profile-modal .profile-modal-title,
#user-profile-modal #modal-user-fullname {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background-image: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  text-shadow: 0 1px 2px rgba(2, 6, 23, 0.28);
}
/* Podtytul (e-mail): jasny bialy odcien, bez dodatkowego wygaszenia opacity */
#user-profile-modal .profile-modal-subtitle,
#user-profile-modal #modal-user-email {
  color: rgba(255, 255, 255, 0.88) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.88) !important;
  opacity: 1 !important;
}
/* Przycisk zamkniecia w banerze */
#user-profile-modal .profile-modal-close {
  color: rgba(255, 255, 255, 0.88) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.88) !important;
}
#user-profile-modal .profile-modal-close:hover,
#user-profile-modal .profile-modal-close:focus-visible {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
#user-profile-modal .profile-modal-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
  border-radius: 8px;
}
/* v. 4.7.6: WYBRANY styl „Namensstil (Nitro)" ma pierwszeństwo nad wymuszonym białym tytułem
   (reguły wyżej celowo zerowały gradient na niebieskim banerze). Efekt: imię i nazwisko obok
   awatara natychmiast zmienia kolor po kliknięciu kółka w pickerze – 1:1 z paskiem u góry ekranu.
   Wyższa specyficzność + !important => wygrywa z #user-profile-modal #modal-user-fullname. */
#user-profile-modal .profile-modal-banner #modal-user-fullname.nitro-name,
body.dark-mode #user-profile-modal .profile-modal-banner #modal-user-fullname.nitro-name {
  color: inherit !important;
  background-image: var(--nitro-grad, var(--nitro-default)) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-size: 200% 100%;
  background-repeat: repeat;
  animation: nitroFlow 6s linear infinite;
  filter: brightness(1.22) saturate(1.08) drop-shadow(0 1px 1px rgba(2, 6, 23, 0.55));
}
@media (prefers-reduced-motion: reduce) {
  #user-profile-modal .profile-modal-banner #modal-user-fullname.nitro-name { animation: none; }
}
/* v. 4.7.6: etykieta wybranego stylu obok „Namensstil (Nitro):" – ten sam gradient co nazwa */
#nitro-current-label.nitro-name {
  background-image: var(--nitro-grad, var(--nitro-default));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* Tryb ciemny: baner jest ciemniejszy - te same wymuszone, jasne odcienie */
body.dark-mode #user-profile-modal .profile-modal-title,
body.dark-mode #user-profile-modal #modal-user-fullname {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
body.dark-mode #user-profile-modal .profile-modal-subtitle,
body.dark-mode #user-profile-modal #modal-user-email,
body.dark-mode #user-profile-modal .profile-modal-close {
  color: rgba(255, 255, 255, 0.88) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.88) !important;
}


/* ===== kommissionen-v445 (v. 4.7.6): badge Kommission Nr. + Bauvorhaben w liscie godzin =====
   Bez animacji kolorow (regula 0 ms z v. 4.2.6) - kapsula 999px w jezyku Precision UI. */
.komm-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.68rem !important; font-weight: 800; letter-spacing: 0.02em;
  border: 1px solid rgba(37, 99, 235, 0.32);
  background: rgba(37, 99, 235, 0.10);
  color: #1d4ed8; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
body.dark-mode .komm-badge {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
}
#komm-admin-panel summary { list-style: none; }
#komm-admin-panel summary::-webkit-details-marker { display: none; }
#komm-admin-panel summary::before { content: "▸ "; }
#komm-admin-panel[open] summary::before { content: "▾ "; }

/* ===== soll-ist-v447 (v. 4.7.6): pasek postępu Soll/Ist per Kommission Nr. =====
   Wysokość/szerokość ustawiane inline (kolory statusu), bez animacji kolorów (zasada 0 ms). */
.komm-prog {
  height: 7px; border-radius: 999px; border: 1px solid transparent;
  overflow: hidden; margin-top: 2px;
}
.komm-prog-bar { height: 100%; border-radius: 999px; transition: none; }
@media print { .komm-prog, .komm-prog-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ===== team-status-v447 (v. 4.7.6): Live Team- & Baustellenstatus (Baustellenstatus) =====
   Karty pracownikow, liczniki statusow, pigułki Kom.-Nr. i siatka aktywnych komisji.
   Bez animacji kolorów (zasada 0 ms), print-safe (kolory statusu zachowane na wydruku). */
.tstat-counters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.tstat-count {
  flex: 1 1 140px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
}
.tstat-count-num { font-size: 1.15rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.tstat-count-lbl { font-size: 0.7rem; font-weight: 800; color: var(--text); }
.tstat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
/* v. 4.7.6: kompaktowe, jednoliniowe wiersze pracownikow (Baustellenstatus) – subtelny Nitro-Akzent */
.bs-list { display: flex; flex-direction: column; gap: 6px; }
.bs-member-row {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--border);
  background: var(--card-bg); min-width: 0;
}
.bs-member-row::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background-image: var(--nitro-grad, linear-gradient(180deg, #94a3b8, #64748b));
}
.bs-member-row::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--nitro-grad, none); opacity: 0.06;
}
.bs-member-row > * { position: relative; z-index: 1; }
.bs-av {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--border); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 900; overflow: hidden;
}
.bs-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bs-mid { min-width: 0; flex: 1 1 auto; }
.bs-name {
  font-size: 0.8rem; font-weight: 800; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15;
}
.bs-sub { font-size: 0.66rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-since { color: var(--text-muted); font-weight: 600; }
.bs-right { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; }
.bs-kom {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 0.64rem; font-weight: 800; white-space: nowrap;
  border: 1px solid rgba(37,99,235,0.32); background: rgba(37,99,235,0.10); color: #1d4ed8;
  font-variant-numeric: tabular-nums; max-width: 132px; overflow: hidden; text-overflow: ellipsis;
}
.bs-kom-empty { border-color: var(--border); background: transparent; color: var(--text-muted); }
.bs-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
body.dark-mode .bs-kom { border-color: rgba(96,165,250,0.45); background: rgba(37,99,235,0.22); color: #bfdbfe; }
@media (max-width: 640px) {
  .bs-member-row { padding: 9px 10px; gap: 8px; }
  .bs-av { width: 34px; height: 34px; }
  .bs-kom { max-width: 104px; padding: 2px 6px; font-size: 0.6rem; }
}
@media print { .bs-member-row::after { opacity: 0.04; } }
.tstat-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 10px; background: var(--card-bg); min-width: 0;
}
.tstat-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.tstat-komm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.tstat-komm {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 10px; background: var(--card-bg); min-width: 0;
}
@media print {
  .tstat-dot, .tstat-count, .tstat-count-num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 640px) {
  .tstat-counters .tstat-count { flex: 1 1 45%; padding: 6px 8px; }
  .tstat-count-num { font-size: 1rem; }
  .tstat-grid, .tstat-komm-grid { grid-template-columns: 1fr; }
}

/* ===== feedback-v449 (v. 4.7.6): Feedback & Bug-Report (Karten, Status, Foto-Anhang, Bonus) =====
   Bez animacji kolorow (zasada 0 ms), print-safe, dwustopniowa siatka na mobile. */
.fb-bonus-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 800;
  border: 1px solid rgba(16,185,129,0.45); background: rgba(16,185,129,0.12); color: #0f766e;
}
.fb-bonus-pill.fb-bonus-wait {
  border-color: rgba(148,163,184,0.5); background: rgba(148,163,184,0.14); color: var(--text-muted);
}
.fb-hint { font-size: 0.66rem; color: var(--text-muted); margin-top: 4px; }
.fb-list { display: flex; flex-direction: column; gap: 8px; }
.fb-empty { font-size: 0.78rem; color: var(--text-muted); }
.fb-sum { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); margin-bottom: 2px; }
.fb-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; background: var(--card-bg); }
.fb-card-head { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fb-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.66rem; font-weight: 800; border: 1px solid var(--border); background: rgba(37,99,235,0.06); color: var(--text); }
.fb-badge.fb-status { border-width: 1px; }
.fb-badge.fb-bonus { border-color: rgba(198,150,60,0.45); background: rgba(198,150,60,0.14); color: #8a6d1f; }
.fb-meta { font-size: 0.66rem; color: var(--text-muted); margin-top: 4px; }
.fb-desc { font-size: 0.8rem; font-weight: 700; color: var(--text); margin-top: 4px; word-break: break-word; }
.fb-attach { margin-top: 6px; }
.fb-thumb {
  display: block; max-width: 220px; max-height: 150px; width: auto; height: auto;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: zoom-in;
}
.fb-photo-preview { margin-top: 6px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.fb-photo-meta { font-size: 0.66rem; color: var(--text-muted); }
.fb-reply { margin-top: 6px; padding: 6px 8px; border-left: 3px solid var(--success); background: rgba(16,185,129,0.07); border-radius: 4px; font-size: 0.76rem; color: var(--text); }
.fb-admin { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 6px; }
.fb-admin-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fb-reply-input { flex: 1 1 200px; min-height: 30px; padding: 3px 7px; font-size: 0.72rem; }
@media print { .fb-admin, .fb-bonus-pill { display: none !important; } }
@media (max-width: 640px) {
  .fb-thumb { max-width: 100%; }
  .fb-badge { font-size: 0.62rem; }
}

/* ===== v. 4.7.6: STATUS OFFLINE (⏳ zmiany do wyslania) ===== */
#offline-badge.sync-pending { background: var(--gold, #f59e0b) !important; color: #1f2937 !important; }
#offline-badge { transition: background .2s ease; }
#offline-badge.sync-pending { animation: elstekSyncPulse 1.8s ease-in-out infinite; }
@keyframes elstekSyncPulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

/* ===== v. 4.7.6: BANNER „Zum Home-Bildschirm” (PWA im Browser-Tab) ===== */
.pwa-install-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 9000;
  display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 12px;
  background: var(--card-bg, #111827); border: 1px solid var(--border, #334155);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .38); font-size: .74rem; color: var(--text, #e5e7eb);
}
.pwa-install-text { flex: 1 1 240px; line-height: 1.35; }
.pwa-install-actions { display: flex; gap: 6px; flex-shrink: 0; }
body.standalone-pwa .pwa-install-banner { display: none !important; }

/* ===== v. 4.7.6: CZYTELNOSC / DOTYK NA TERENIE (male ekrany; desktop bez zmian) ===== */
@media (max-width: 420px) {
  .nav-tab { min-height: 46px; display: flex; align-items: center; font-size: .82rem; }
  .btn { min-height: 44px; }
  .btn-small { min-height: 38px; }
  .dropdown-item { min-height: 46px; }
  #timer-display { font-size: 2.6rem !important; letter-spacing: .5px; }
  #timer-summary-line, #timer-status-line { font-size: .8rem !important; }
  .card { padding: 12px; }
  .tstat-card { padding: 8px; }
  .pwa-install-banner { left: 8px; right: 8px; bottom: 8px; font-size: .7rem; }
  /* iOS: pole 16 px zapobiega automatycznemu przyblizaniu przy fokusie */
  input, select, textarea { font-size: 16px !important; }
}
/* ===== v. 4.7.6: INTRO-SPLASH NAD LOADERAMI – „Portal öffnen” klikalny od razu =====
   Przyczyna usterki: #pwa-splash-loader i #cloud-loading-screen mialy z-index 999999,
   a #intro-splash tylko 900000 – klik w CTA trafial w niewidoczny jeszcze loader
   (ukrywany dopiero po ~4 s). Intro jest teraz najwyzej i zawsze przyjmuje klik. */
/* ===== v. 4.7.6: INTRO domyslnie UKRYTE (pokazuje je JS po podpieciu przyciskow) =====
   Dzieki temu nie ma okna, w ktorym widac przycisk bez handlera, a ciemne tlo zostaje
   (reguly body:has(#intro-splash) dzialaja na obecnosc elementu, nie na jego widocznosc). */
#intro-splash { z-index: 1000000 !important; pointer-events: auto; display: none; }
#intro-splash .intro-content { position: relative; z-index: 10; }
#intro-splash .intro-cta { position: relative; z-index: 20; pointer-events: auto; }
#intro-splash #intro-skip-btn { z-index: 30; pointer-events: auto; }
@media (max-width: 560px) {
  /* wygodne cele dotykowe takze na najszerszych telefonach (iPhone Pro Max / Plus) */
  #intro-splash #intro-skip-btn { min-height: 44px; padding: 11px 18px; }
  #intro-splash .intro-cta { min-height: 48px; }
  .password-toggle-btn { min-width: 44px; min-height: 44px; right: 4px; font-size: 1.25rem; }
}

/* ===== v. 4.7.6: natychmiastowa reakcja dotyku na kontrolkach splash/intro i panelu logowania =====
   Bez „touch-action: manipulation” iOS/Android moga dodawac opoznienie ~300 ms i double-tap zoom
   (zwlaszcza gdy pole/pzycisk jest maly), przez co dotkniecie „überspringen”, „Portal öffnen”
   albo ikony oka wydaje sie „nie reagowac” przy pierwszym razie. */
#intro-splash #intro-skip-btn,
#intro-splash .intro-cta,
.password-toggle-btn,
#auth-screen .btn,
#auth-screen .auth-options label,
#auth-screen .auth-options a,
#auth-screen #login-avatar-preview {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ===== v. 4.7.6: POLA 16 px na WSZYSTKICH telefonach (takze iPhone Pro Max 430/440 px) =====
   Wczesniejsze reguly konczyly sie na 400/420 px, wiec na najszerszych iPhone'ach fokus w polu
   nadal wywolywal auto-zoom Safari. Teraz reguła obejmuje cały zakres telefonow (<= 560 px). */
@media (max-width: 560px) {
  input, select, textarea, .form-control { font-size: 16px !important; }
}

/* ===== v. 4.7.6: BANNER PWA nie zaslania plywajacych elementow (FAB asystenta / okna) ===== */
body.has-pwa-banner .ai-fab,
body.has-pwa-banner #ai-fab-btn { bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important; }
body.has-pwa-banner .ai-floating-window { bottom: calc(158px + env(safe-area-inset-bottom, 0px)) !important; }

/* ===== v. 4.7.6: iOS standalone (black-translucent) – góra aplikacji pod paskiem statusu =====
   Na telefonach header mial height: 48px bez safe-area, a marquee (Aktuelles) padding bez insetu,
   przez co w trybie „Zum Home-Bildschirm” tresc wchodzila pod pasek statusu/notch i ucinala
   cele dotykowe. Regula przywraca inset takze w widoku mobilnym. */
@media (max-width: 560px) {
  .top-banner { padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  header { height: calc(48px + env(safe-area-inset-top, 0px)) !important; margin-top: calc(28px + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 420px) {
  #timer-display { font-size: 2.6rem !important; letter-spacing: .5px; }
}
@media (max-width: 360px) {
  #timer-display { font-size: 2.2rem !important; }
  .pwa-install-actions { width: 100%; justify-content: flex-end; }
}

