/* REACH — Mobile Styles */
/* Only active at max-width: 768px — desktop is unaffected */

@media (max-width: 768px) {

  /* Kein horizontaler Overflow auf der ganzen Seite */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  #app, .mobile-page, .main-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Sidebar ausblenden */
  .sidebar { display: none !important; }
  .main-content {
    margin-left: 0 !important;
    padding: 0 0 72px 0 !important;
    background: #F4F4F4;
  }

  /* Mobile Page Container */
  .mobile-page {
    min-height: calc(100vh - 72px);
  }

  /* Mobile Header */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 12px;
    background: white;
    border-bottom: 1px solid #F0F0F0;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .mobile-header-title {
    font-family: Syne, sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: #1A1A1A;
    letter-spacing: -0.5px;
  }
  .mobile-header-sub {
    font-size: 13px;
    color: #6B7280;
    margin-top: 2px;
  }

  /* KPI Grid */
  .mobile-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
  }
  .mobile-kpi-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  .mobile-kpi-card.mobile-kpi-danger {
    border: 1px solid #fca5a5;
  }
  .mobile-kpi-label {
    font-size: 11px;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
  }
  .mobile-kpi-value {
    font-family: Syne, sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #1A1A1A;
    letter-spacing: -1px;
  }

  /* Sections */
  .mobile-section {
    margin: 8px 16px;
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  .mobile-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .mobile-streak {
    font-size: 12px;
    font-weight: 700;
    color: #1A1A1A;
    background: #D4F01E;
    padding: 2px 10px;
    border-radius: 20px;
    text-transform: none;
    letter-spacing: 0;
  }

  /* Goal Bars */
  .mobile-goal-item { margin-bottom: 12px; }
  .mobile-goal-item:last-child { margin-bottom: 0; }
  .mobile-goal-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
  }
  .mobile-goal-count { font-weight: 600; }
  .mobile-goal-bar {
    height: 6px;
    background: #F3F4F6;
    border-radius: 100px;
    overflow: hidden;
  }
  .mobile-goal-fill {
    height: 100%;
    background: #D4F01E;
    border-radius: 100px;
    transition: width 0.4s ease;
  }

  /* Lead Cards */
  .mobile-lead-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #F9FAFB;
    cursor: pointer;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  .mobile-lead-card:active { background: #F9FAFB; }
  .mobile-lead-card:last-child { border-bottom: none; }
  .mobile-lead-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #F3F4F6;
    color: #6B7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
  }
  .mobile-lead-info { flex: 1; min-width: 0 !important; overflow: hidden !important; }
  .mobile-lead-card > div:last-child { flex-shrink: 0 !important; max-width: 80px !important; }
  .mobile-lead-name {
    font-weight: 600;
    font-size: 14px;
    color: #1A1A1A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-lead-company {
    font-size: 12px;
    color: #6B7280;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-lead-next {
    font-size: 11px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-lead-action {
    font-size: 11px;
    color: #D4F01E;
    margin-top: 3px;
  }

  /* Score Pills */
  .mobile-score-pill {
    font-family: Syne, sans-serif;
    font-weight: 800;
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 20px;
    flex-shrink: 0;
  }
  .mobile-score-hot { background: #D4F01E; color: #1A1A1A; }
  .mobile-score-warm { background: #FEF9C3; color: #854D0E; }
  .mobile-score-cool { background: #F3F4F6; color: #6B7280; }

  /* Search */
  .mobile-search-wrap {
    padding: 12px 16px 8px;
    background: white;
    border-bottom: 1px solid #F0F0F0;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .mobile-search {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #E8E8E8;
    border-radius: 100px;
    font-size: 16px;
    background: #F9FAFB;
    outline: none;
    -webkit-appearance: none;
    box-sizing: border-box !important;
    max-width: 100% !important;
  }
  .mobile-search:focus { border-color: #D4F01E; background: white; }

  /* Filter Pills */
  .mobile-filter-pills {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
    background: white;
    border-bottom: 1px solid #F0F0F0;
    max-width: 100vw !important;
  }
  .mobile-filter-pills::-webkit-scrollbar { display: none; }
  .mobile-pill {
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid #E8E8E8;
    background: white;
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-pill.active {
    background: #1A1A1A;
    color: #D4F01E;
    border-color: #1A1A1A;
  }

  /* List Container */
  .mobile-list {
    background: white;
    margin: 8px 0;
  }

  /* FAB */
  .mobile-fab {
    position: fixed;
    bottom: 84px;
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #D4F01E;
    color: #1A1A1A;
    font-size: 24px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(212,240,30,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-fab-inline {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #D4F01E;
    color: #1A1A1A;
    font-size: 20px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Pipe Styles */
  .mobile-pipe-stage {
    margin: 8px 16px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  }
  .mobile-pipe-stage-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #F9FAFB;
  }
  .mobile-pipe-stage-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .mobile-pipe-stage-name {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .mobile-pipe-stage-count {
    font-size: 11px;
    background: #F3F4F6;
    color: #6B7280;
    padding: 1px 8px;
    border-radius: 20px;
    font-weight: 600;
  }
  .mobile-opp-card {
    padding: 14px 16px;
    border-bottom: 1px solid #F9FAFB;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-opp-card:active { background: #F9FAFB; }
  .mobile-opp-card:last-child { border-bottom: none; }
  .mobile-brand-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 8px;
  }
  .mobile-brand-animotion { background: #DCFCE7; color: #166534; }
  .mobile-brand-advox { background: #EDE9FE; color: #4C1D95; }
  .mobile-brand-agencylife { background: #FFF7ED; color: #9A3412; }
  .mobile-brand-both { background: #FEF9C3; color: #854D0E; }

  /* AI Box */
  .mobile-ai-box {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-ai-load-btn {
    padding: 10px 24px;
    border-radius: 100px;
    background: #D4F01E;
    color: #1A1A1A;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
  }
  .mobile-ai-loading {
    font-size: 13px;
    color: #9CA3AF;
  }
  .mobile-ai-text {
    font-size: 13px;
    color: #374151;
    line-height: 1.7;
    white-space: pre-wrap;
  }

  /* Detail Panel: Fullscreen auf Mobile */
  .detail-panel {
    width: 100% !important;
    left: 0 !important;
  }

  /* Detail Panel Header sticky */
  .detail-panel > div:first-child {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: var(--color-background-primary) !important;
  }

  /* NUR der Close Button (×) — letzter Button im Header */
  .detail-panel > div:first-child button:last-child {
    position: fixed !important;
    top: 12px !important;
    right: 12px !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    border-radius: 50% !important;
    background: var(--color-background-secondary) !important;
    border: 1px solid var(--color-border-tertiary) !important;
    z-index: 100 !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Bearbeiten + Als Opportunity Buttons: wieder normal */
  .detail-panel > div:first-child button:not(:last-child) {
    min-width: unset !important;
    min-height: unset !important;
    width: auto !important;
    height: auto !important;
    font-size: inherit !important;
    border-radius: var(--border-radius-md) !important;
  }

  /* Empty State */
  .mobile-empty {
    padding: 48px 24px;
    text-align: center;
  }
  .mobile-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: #6B7280;
  }

  /* Skeleton */
  .mobile-skeleton-list {
    height: 200px;
    background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
    margin: 16px;
  }
  @keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  /* Input fix: kein iOS Zoom */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Modals auf Mobile: Bottom Sheet */
  .modal {
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-backdrop {
    align-items: flex-end !important;
  }

}
