:root {
      --bg-main: #0B0F19;
      --bg-sidebar: #0E1424;
      --bg-card: rgba(17, 24, 39, 0.75);
      --bg-card-hover: rgba(30, 41, 59, 0.85);
      --border-color: rgba(255, 255, 255, 0.08);
      --border-highlight: rgba(99, 102, 241, 0.3);
      --text-primary: #F8FAFC;
      --text-secondary: #94A3B8;
      --text-muted: #64748B;
      
      --accent-indigo: #6366F1;
      --accent-violet: #8B5CF6;
      --accent-cyan: #06B6D4;
      --accent-emerald: #10B981;
      --accent-amber: #F59E0B;
      --accent-rose: #EF4444;
      --accent-blue: #3B82F6;

      --sidebar-width: 260px;
      --font-family: 'Inter', system-ui, -apple-system, sans-serif;
      --font-mono: 'JetBrains Mono', monospace;
    }

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

    body {
      background-color: var(--bg-main);
      color: var(--text-primary);
      font-family: var(--font-family);
      min-height: 100vh;
      overflow-x: hidden;
      line-height: 1.5;
    }

    .bg-glow {
      position: fixed;
      top: -120px;
      left: 25%;
      width: 700px;
      height: 700px;
      background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(11, 15, 25, 0) 70%);
      pointer-events: none;
      z-index: 0;
    }

    /* App Layout */
    .app-layout {
      display: flex;
      min-height: 100vh;
      position: relative;
      z-index: 1;
    }

    /* Left Sidebar */
    .sidebar {
      width: var(--sidebar-width);
      background: var(--bg-sidebar);
      border-right: 1px solid var(--border-color);
      position: fixed;
      top: 0;
      bottom: 0;
      left: 0;
      z-index: 40;
      display: flex;
      flex-direction: column;
      padding: 24px 16px;
      overflow-y: auto;
    }

    .sidebar-brand {
      display: flex;
      align-items: center;
      gap: 12px;
      padding-bottom: 22px;
      border-bottom: 1px solid var(--border-color);
      margin-bottom: 22px;
    }

    .sidebar-brand:hover .brand-logo-img {
      transform: scale(1.06);
      box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
    }

    .brand-logo-img {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
      background: #FFFFFF;
      padding: 2px;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
      flex-shrink: 0;
      transition: all 0.2s ease;
    }

    .brand-logo {
      width: 42px;
      height: 42px;
      background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      font-weight: 800;
      color: white;
      box-shadow: 0 4px 18px rgba(99, 102, 241, 0.4);
      flex-shrink: 0;
    }

    .brand-text h2 {
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -0.02em;
      color: #FFF;
      line-height: 1.2;
    }

    .brand-text p {
      font-size: 11px;
      color: var(--accent-cyan);
      font-weight: 500;
      margin-top: 2px;
    }

    .nav-section-title {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
      margin: 12px 8px 6px 8px;
    }

    .sidebar-nav {
      display: flex;
      flex-direction: column;
      gap: 4px;
      flex: 1;
    }

    .nav-btn {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 10px;
      background: transparent;
      border: 1px solid transparent;
      color: var(--text-secondary);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      text-align: left;
      transition: all 0.2s ease;
      width: 100%;
    }

    .nav-btn:hover {
      background: rgba(255, 255, 255, 0.04);
      color: var(--text-primary);
    }

    .nav-btn.active {
      background: rgba(99, 102, 241, 0.15);
      border-color: rgba(99, 102, 241, 0.4);
      color: #A5B4FC;
    }

    .nav-btn-left {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .nav-icon {
      font-size: 16px;
    }

    .nav-badge {
      font-size: 10px;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.08);
      color: var(--text-secondary);
    }

    .nav-badge.live {
      background: rgba(16, 185, 129, 0.2);
      color: #34D399;
      border: 1px solid rgba(16, 185, 129, 0.3);
      animation: pulseGlow 2s infinite;
    }

    @keyframes pulseGlow {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.6; }
    }

    .connector-card {
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid var(--border-color);
      border-radius: 12px;
      padding: 12px;
      margin-top: 10px;
    }

    .connector-title {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      margin-bottom: 8px;
    }

    .connector-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 11px;
      padding: 4px 0;
      color: var(--text-secondary);
      border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    }

    .connector-row:last-child {
      border-bottom: none;
    }

    .sidebar-footer {
      padding-top: 16px;
      border-top: 1px solid var(--border-color);
      margin-top: auto;
    }

    .db-status-pill {
      font-size: 11px;
      padding: 6px 10px;
      border-radius: 8px;
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid var(--border-color);
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;
    }

    /* Main Content Wrapper */
    .main-wrapper {
      margin-left: var(--sidebar-width);
      flex: 1;
      min-width: 0;
      padding: 24px 32px;
    }

    /* Global Header */
    header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-bottom: 20px;
      border-bottom: 1px solid var(--border-color);
      margin-bottom: 24px;
      flex-wrap: wrap;
      gap: 16px;
    }

    .page-heading h1 {
      font-size: 22px;
      font-weight: 700;
      letter-spacing: -0.02em;
    }

    .page-heading p {
      font-size: 13px;
      color: var(--text-secondary);
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    /* Database Switcher Segmented Control */
    .db-switcher-wrapper {
      display: flex;
      align-items: center;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--border-color);
      border-radius: 12px;
      padding: 3px;
      gap: 2px;
    }

    .db-toggle-btn {
      padding: 6px 12px;
      border-radius: 8px;
      border: none;
      background: transparent;
      color: var(--text-secondary);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s ease;
    }

    .db-toggle-btn:hover {
      color: var(--text-primary);
    }

    .db-toggle-btn.active.sqlite {
      background: rgba(245, 158, 11, 0.2);
      color: #FBBF24;
      border: 1px solid rgba(245, 158, 11, 0.4);
    }

    .db-toggle-btn.active.postgres {
      background: rgba(16, 185, 129, 0.2);
      color: #34D399;
      border: 1px solid rgba(16, 185, 129, 0.4);
    }

    .db-toggle-btn.active.auto {
      background: rgba(99, 102, 241, 0.2);
      color: #818CF8;
      border: 1px solid rgba(99, 102, 241, 0.4);
    }

    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 6px 12px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-color);
      border-radius: 20px;
      font-size: 12px;
      font-weight: 500;
    }

    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent-emerald);
      box-shadow: 0 0 10px var(--accent-emerald);
    }

    .status-dot.warning {
      background: var(--accent-amber);
      box-shadow: 0 0 10px var(--accent-amber);
    }

    .btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      border: none;
      text-decoration: none;
    }

    .btn-sm {
      padding: 6px 12px;
      font-size: 12px;
    }

    .btn-primary {
      background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
      color: white;
      box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    }

    .btn-primary:hover {
      opacity: 0.92;
      transform: translateY(-1px);
    }

    .btn-secondary {
      background: rgba(255, 255, 255, 0.06);
      color: var(--text-primary);
      border: 1px solid var(--border-color);
    }

    .btn-secondary:hover {
      background: rgba(255, 255, 255, 0.12);
      border-color: rgba(255, 255, 255, 0.2);
    }

    .btn-meta {
      background: #1877F2;
      color: white;
      box-shadow: 0 4px 14px rgba(24, 119, 242, 0.35);
    }

    .btn-meta:hover {
      background: #166fe5;
      transform: translateY(-1px);
    }

    /* Views */
    .view-tab {
      display: none;
    }

    .view-tab.active {
      display: block;
      animation: fadeIn 0.25s ease;
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* KPI Summary Cards */
    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }

    .kpi-card {
      background: var(--bg-card);
      backdrop-filter: blur(16px);
      border: 1px solid var(--border-color);
      border-radius: 16px;
      padding: 18px 20px;
      transition: transform 0.2s ease, border-color 0.2s ease;
      position: relative;
      overflow: hidden;
    }

    .kpi-card:hover {
      transform: translateY(-2px);
      border-color: var(--border-highlight);
    }

    .kpi-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: linear-gradient(90deg, var(--accent-indigo), var(--accent-violet));
    }

    .kpi-card.emerald::before { background: var(--accent-emerald); }
    .kpi-card.cyan::before { background: var(--accent-cyan); }
    .kpi-card.amber::before { background: var(--accent-amber); }
    .kpi-card.rose::before { background: var(--accent-rose); }
    .kpi-card.blue::before { background: var(--accent-blue); }

    .kpi-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      margin-bottom: 8px;
    }

    .kpi-value {
      font-size: 26px;
      font-weight: 800;
      color: var(--text-primary);
      letter-spacing: -0.02em;
    }

    .kpi-subtitle {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    /* Controls Panel */
    .controls-panel {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      flex-wrap: wrap;
      gap: 16px;
    }

    .filter-tabs {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .tab-btn {
      padding: 7px 14px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border-color);
      color: var(--text-secondary);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .tab-btn:hover, .tab-btn.active {
      background: var(--accent-indigo);
      border-color: var(--accent-indigo);
      color: white;
      box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }

    .search-inputs {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .search-box {
      padding: 9px 14px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-color);
      color: var(--text-primary);
      font-size: 13px;
      min-width: 240px;
      outline: none;
    }

    .search-box:focus {
      border-color: var(--accent-indigo);
    }

    .select-dropdown {
      padding: 9px 14px;
      border-radius: 10px;
      background: #111827;
      border: 1px solid var(--border-color);
      color: var(--text-primary);
      font-size: 13px;
      outline: none;
      cursor: pointer;
    }

    /* Table Component */
    .table-container {
      background: var(--bg-card);
      backdrop-filter: blur(16px);
      border: 1px solid var(--border-color);
      border-radius: 16px;
      overflow-x: auto;
      margin-bottom: 30px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
      font-size: 13px;
      white-space: nowrap;
    }

    th {
      background: rgba(15, 23, 42, 0.8);
      color: var(--text-secondary);
      font-weight: 600;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      padding: 12px 14px;
      border-bottom: 1px solid var(--border-color);
      cursor: pointer;
      user-select: none;
    }

    th:hover {
      color: var(--text-primary);
    }

    td {
      padding: 12px 14px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      color: var(--text-primary);
    }

    tr:hover td {
      background-color: var(--bg-card-hover);
    }

    /* Table column widths and tight spacing */
    th.col-product, td.col-product {
      width: 270px;
      max-width: 290px;
      padding-right: 6px !important;
    }

    th.col-category, td.col-category {
      width: 140px;
      max-width: 160px;
      padding-left: 6px !important;
    }

    .product-cell {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      max-width: 280px;
    }

    .product-img {
      width: 48px;
      height: 48px;
      border-radius: 10px;
      object-fit: cover;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-color);
      transition: transform 0.25s ease, box-shadow 0.25s ease;
      cursor: pointer;
      flex-shrink: 0;
    }

    .product-img:hover {
      transform: scale(1.6);
      z-index: 30;
      position: relative;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 12px rgba(99, 102, 241, 0.5);
    }

    .gallery-container {
      display: flex;
      gap: 12px;
      overflow-x: auto;
      padding: 10px 4px;
      align-items: center;
    }

    .gallery-thumb {
      width: 76px;
      height: 76px;
      border-radius: 10px;
      object-fit: cover;
      border: 1px solid var(--border-color);
      background: rgba(255, 255, 255, 0.05);
      transition: transform 0.2s ease, border-color 0.2s ease;
      cursor: pointer;
      flex-shrink: 0;
    }

    .gallery-thumb:hover {
      transform: scale(1.08);
      border-color: var(--accent-cyan);
      box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
    }

    .product-details {
      display: flex;
      flex-direction: column;
      min-width: 0;
      max-width: 220px;
      white-space: normal;
    }

    .product-title-link {
      color: var(--text-primary);
      font-weight: 600;
      text-decoration: none;
      transition: color 0.2s ease;
      line-height: 1.3;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
      word-break: break-word;
    }

    .product-title-link:hover {
      color: var(--accent-indigo);
    }

    tfoot tr {
      background: rgba(15, 23, 42, 0.95);
      border-top: 2px solid var(--border-highlight);
      font-weight: 700;
    }

    tfoot td {
      padding: 12px 14px;
      color: var(--text-primary);
      border-bottom: none;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      padding: 4px 10px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
    }

    .badge-star {
      background: rgba(16, 185, 129, 0.15);
      color: #34D399;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .badge-risk {
      background: rgba(239, 68, 68, 0.15);
      color: #F87171;
      border: 1px solid rgba(239, 68, 68, 0.3);
    }

    .badge-sink {
      background: rgba(245, 158, 11, 0.15);
      color: #FBBF24;
      border: 1px solid rgba(245, 158, 11, 0.3);
    }

    .badge-gem {
      background: rgba(6, 182, 212, 0.15);
      color: #22D3EE;
      border: 1px solid rgba(6, 182, 212, 0.3);
    }

    .badge-steady {
      background: rgba(148, 163, 184, 0.15);
      color: #94A3B8;
      border: 1px solid rgba(148, 163, 184, 0.3);
    }

    .details-row {
      display: none;
      background: rgba(15, 23, 42, 0.95);
    }

    .details-row.open {
      display: table-row;
    }

    .details-content {
      padding: 16px 20px;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 16px;
    }

    .detail-box {
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid var(--border-color);
      border-radius: 10px;
      padding: 14px;
    }

    .detail-box h4 {
      font-size: 12px;
      color: var(--accent-cyan);
      text-transform: uppercase;
      margin-bottom: 8px;
    }

    .meta-tag {
      display: inline-block;
      background: rgba(255, 255, 255, 0.06);
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 11px;
      margin-right: 4px;
      margin-bottom: 4px;
    }

    /* META ANALYTICS DEDICATED STYLES */
    .meta-identity-card {
      background: linear-gradient(135deg, rgba(24, 119, 242, 0.1), rgba(139, 92, 246, 0.05));
      border: 1px solid rgba(24, 119, 242, 0.3);
      border-radius: 16px;
      padding: 24px;
      margin-bottom: 24px;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 20px;
    }

    .meta-prop-item {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .meta-prop-label {
      font-size: 11px;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      font-weight: 600;
    }

    .meta-prop-val {
      font-size: 15px;
      font-weight: 700;
      color: var(--text-primary);
    }

    .meta-perm-badge {
      display: inline-block;
      padding: 3px 8px;
      border-radius: 6px;
      background: rgba(24, 119, 242, 0.15);
      border: 1px solid rgba(24, 119, 242, 0.3);
      color: #60A5FA;
      font-size: 11px;
      font-weight: 600;
      margin-right: 6px;
      margin-top: 4px;
    }

    .meta-section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin: 28px 0 16px 0;
      border-bottom: 1px solid var(--border-color);
      padding-bottom: 12px;
    }

    .meta-section-header h3 {
      font-size: 17px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .mono-code {
      font-family: var(--font-mono);
      font-size: 12px;
      color: #38BDF8;
      background: rgba(0, 0, 0, 0.4);
      padding: 2px 6px;
      border-radius: 4px;
      border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .filter-preview-box {
      max-width: 340px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-family: var(--font-mono);
      font-size: 11px;
      color: #94A3B8;
    }

    /* Modal dialog for Tunnel instructions */
    .modal-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.8);
      backdrop-filter: blur(8px);
      z-index: 100;
      align-items: center;
      justify-content: center;
    }

    .modal-overlay.open {
      display: flex;
    }

    .modal-card {
      background: #111827;
      border: 1px solid var(--accent-indigo);
      border-radius: 18px;
      padding: 30px;
      max-width: 620px;
      width: 90%;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    }

    .modal-card h3 {
      font-size: 18px;
      font-weight: 700;
      color: #F87171;
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .code-snippet {
      background: #030712;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      padding: 14px;
      font-family: monospace;
      font-size: 12px;
      color: #38BDF8;
      word-break: break-all;
      margin: 14px 0;
      position: relative;
    }

    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 12px;
      margin-top: 20px;
    }

    /* Sub Navigation */
    .subnav-container {
      display: flex;
      gap: 8px;
      background: rgba(17, 24, 39, 0.7);
      padding: 6px;
      border-radius: 12px;
      border: 1px solid var(--border-color);
      width: fit-content;
    }

    .subnav-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      border-radius: 8px;
      background: transparent;
      border: 1px solid transparent;
      color: var(--text-secondary);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .subnav-btn:hover {
      color: var(--text-primary);
      background: rgba(255, 255, 255, 0.05);
    }

    .subnav-btn.active {
      background: #1877F2;
      color: #FFFFFF;
      border-color: #1877F2;
      box-shadow: 0 4px 14px rgba(24, 119, 242, 0.35);
    }

    .badge-count {
      background: rgba(255, 255, 255, 0.2);
      color: #FFFFFF;
      padding: 2px 7px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
    }

    .meta-subview {
      display: none;
    }

    .meta-subview.active {
      display: block;
      animation: fadeIn 0.25s ease;
    }

    /* Platform Badges */
    .platform-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
    }

    .platform-badge.instagram {
      background: rgba(225, 48, 108, 0.15);
      color: #F472B6;
      border: 1px solid rgba(225, 48, 108, 0.3);
    }

    .platform-badge.facebook {
      background: rgba(24, 119, 242, 0.15);
      color: #60A5FA;
      border: 1px solid rgba(24, 119, 242, 0.3);
    }

    .platform-badge.audience-network {
      background: rgba(16, 185, 129, 0.15);
      color: #34D399;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .platform-badge.threads {
      background: rgba(255, 255, 255, 0.1);
      color: #E2E8F0;
      border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .platform-badge.messenger {
      background: rgba(6, 182, 212, 0.15);
      color: #22D3EE;
      border: 1px solid rgba(6, 182, 212, 0.3);
    }

    .platform-badge.multi {
      background: rgba(139, 92, 246, 0.15);
      color: #A78BFA;
      border: 1px solid rgba(139, 92, 246, 0.3);
    }

    @media (max-width: 900px) {
      .camp-chart-layout {
        grid-template-columns: 1fr !important;
      }
    }

    .investigation-card {
      box-shadow: 0 4px 24px -2px rgba(245, 158, 11, 0.08);
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .investigation-card:hover {
      border-color: rgba(245, 158, 11, 0.5) !important;
      box-shadow: 0 8px 30px -4px rgba(245, 158, 11, 0.15);
    }

    .mini-stat-pill {
      transition: transform 0.15s ease, background-color 0.15s ease;
    }

    .mini-stat-pill:hover {
      transform: translateY(-1px);
      background-color: rgba(30, 41, 59, 0.8) !important;
    }

    #meta-campaign-prod-table {
      table-layout: auto;
      width: 100%;
    }

    #meta-campaign-prod-table td {
      vertical-align: middle;
    }

    /* Ad Intelligence & Scoring (Phases 6 & 7) */
    .score-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-mono);
      font-weight: 800;
      border-radius: 8px;
      padding: 4px 8px;
      font-size: 13px;
      min-width: 44px;
    }

    .score-high {
      background: rgba(16, 185, 129, 0.18);
      color: #34D399;
      border: 1px solid rgba(16, 185, 129, 0.35);
    }

    .score-good {
      background: rgba(14, 165, 233, 0.18);
      color: #38BDF8;
      border: 1px solid rgba(14, 165, 233, 0.35);
    }

    .score-med {
      background: rgba(245, 158, 11, 0.18);
      color: #FBBF24;
      border: 1px solid rgba(245, 158, 11, 0.35);
    }

    .score-low {
      background: rgba(239, 68, 68, 0.18);
      color: #F87171;
      border: 1px solid rgba(239, 68, 68, 0.35);
    }

    .tier-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 4px 10px;
      border-radius: 20px;
      white-space: nowrap;
    }

    .tier-badge.scale {
      background: rgba(16, 185, 129, 0.15);
      color: #10B981;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .tier-badge.test {
      background: rgba(245, 158, 11, 0.15);
      color: #F59E0B;
      border: 1px solid rgba(245, 158, 11, 0.3);
    }

    .tier-badge.stop {
      background: rgba(239, 68, 68, 0.15);
      color: #EF4444;
      border: 1px solid rgba(239, 68, 68, 0.3);
    }

    .tier-badge.organic {
      background: rgba(6, 182, 212, 0.15);
      color: #06B6D4;
      border: 1px solid rgba(6, 182, 212, 0.3);
    }

    .tier-badge.potential {
      background: rgba(139, 92, 246, 0.15);
      color: #8B5CF6;
      border: 1px solid rgba(139, 92, 246, 0.3);
    }

    .action-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      font-weight: 600;
      padding: 4px 9px;
      border-radius: 6px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--text-primary);
      white-space: nowrap;
    }

    .mini-meter-bar {
      display: flex;
      gap: 2px;
      align-items: center;
      height: 6px;
      background: rgba(255, 255, 255, 0.06);
      border-radius: 3px;
      overflow: hidden;
      width: 100%;
      min-width: 80px;
    }

    .mini-meter-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 0.3s ease;
    }

    .filter-pill {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--text-secondary);
      border-radius: 20px;
      padding: 5px 12px;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .filter-pill:hover {
      background: rgba(255, 255, 255, 0.08);
      color: var(--text-primary);
    }

    .filter-pill.active {
      background: rgba(139, 92, 246, 0.2);
      border-color: #8B5CF6;
      color: #C4B5FD;
      font-weight: 600;
    }

    .kpi-card.selected-tier {
      transform: translateY(-2px);
      box-shadow: 0 0 20px rgba(139, 92, 246, 0.25) !important;
    }

    /* ==========================================================================
       AI Product Research & Strategy Assistant Styling
       ========================================================================== */
    .ai-research-container {
      display: flex;
      flex-direction: column;
      height: calc(100vh - 120px);
      max-width: 1200px;
      margin: 0 auto;
      gap: 16px;
    }

    .ai-header-card {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(30, 41, 59, 0.5) 100%);
      border: 1px solid rgba(16, 185, 129, 0.2);
      border-radius: 14px;
      padding: 16px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      backdrop-filter: blur(12px);
    }

    .ai-header-info {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .ai-avatar-badge {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      background: linear-gradient(135deg, #10B981, #059669);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
      flex-shrink: 0;
    }

    .ai-title-row {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .ai-title-row h3 {
      font-size: 16px;
      font-weight: 700;
      color: #F9FAFB;
      margin: 0;
    }

    .ai-status-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(16, 185, 129, 0.15);
      color: #34D399;
      border: 1px solid rgba(16, 185, 129, 0.3);
      font-size: 11px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 12px;
    }

    .live-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #10B981;
      animation: pulse-dot 1.8s infinite;
    }

    @keyframes pulse-dot {
      0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
      70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
      100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
    }

    .ai-subtitle {
      font-size: 12px;
      color: var(--text-secondary);
      margin: 3px 0 0 0;
    }

    .ai-header-actions {
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .ai-context-indicator {
      font-size: 12px;
      color: var(--text-secondary);
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border-color);
      padding: 4px 10px;
      border-radius: 8px;
    }

    /* Quick Prompts */
    .quick-prompts-section {
      display: flex;
      align-items: center;
      gap: 10px;
      overflow-x: auto;
      padding: 2px 0;
      scrollbar-width: none;
    }

    .quick-prompts-section::-webkit-scrollbar {
      display: none;
    }

    .quick-prompts-label {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-muted);
      white-space: nowrap;
    }

    .quick-prompts-scroll {
      display: flex;
      gap: 8px;
    }

    .quick-prompt-btn {
      background: rgba(30, 41, 59, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--text-secondary);
      border-radius: 20px;
      padding: 6px 14px;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.2s ease;
    }

    .quick-prompt-btn:hover {
      background: rgba(16, 185, 129, 0.12);
      border-color: rgba(16, 185, 129, 0.4);
      color: #34D399;
      transform: translateY(-1px);
    }

    /* Chat Messages Feed */
    .ai-chat-box {
      flex: 1;
      background: rgba(15, 23, 42, 0.4);
      border: 1px solid var(--border-color);
      border-radius: 14px;
      padding: 20px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 16px;
      backdrop-filter: blur(8px);
    }

    .ai-message {
      display: flex;
      gap: 14px;
      max-width: 90%;
      animation: fadeInMsg 0.2s ease;
    }

    @keyframes fadeInMsg {
      from { opacity: 0; transform: translateY(6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .ai-message.assistant {
      align-self: flex-start;
    }

    .ai-message.user {
      align-self: flex-end;
      flex-direction: row-reverse;
    }

    .message-avatar {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      flex-shrink: 0;
    }

    .ai-message.assistant .message-avatar {
      background: linear-gradient(135deg, #10B981, #059669);
      color: white;
    }

    .ai-message.user .message-avatar {
      background: linear-gradient(135deg, #3B82F6, #1D4ED8);
      color: white;
    }

    .message-content {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .message-sender {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      margin-left: 2px;
    }

    .ai-message.user .message-sender {
      text-align: right;
      margin-right: 2px;
    }

    .message-text {
      background: rgba(30, 41, 59, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.08);
      padding: 14px 18px;
      border-radius: 14px;
      font-size: 13.5px;
      line-height: 1.6;
      color: #E2E8F0;
    }

    .ai-message.user .message-text {
      background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.3) 100%);
      border-color: rgba(59, 130, 246, 0.35);
      color: #F8FAFC;
      border-bottom-right-radius: 4px;
    }

    .ai-message.assistant .message-text {
      border-bottom-left-radius: 4px;
    }

    .message-text p {
      margin: 0 0 10px 0;
    }

    .message-text p:last-child {
      margin-bottom: 0;
    }

    .message-text ul, .message-text ol {
      margin: 0 0 10px 0;
      padding-left: 20px;
    }

    .message-text table {
      width: 100%;
      border-collapse: collapse;
      margin: 12px 0;
      font-size: 12.5px;
      background: rgba(15, 23, 42, 0.5);
      border-radius: 8px;
      overflow: hidden;
    }

    .message-text th {
      background: rgba(255, 255, 255, 0.06);
      padding: 8px 12px;
      text-align: left;
      font-weight: 600;
      color: #CBD5E1;
      border-bottom: 1px solid var(--border-color);
    }

    .message-text td {
      padding: 8px 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      color: #94A3B8;
    }

    .message-text code {
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid rgba(255, 255, 255, 0.1);
      padding: 2px 6px;
      border-radius: 4px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 12px;
      color: #38BDF8;
    }

    .message-text pre {
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(255, 255, 255, 0.1);
      padding: 12px;
      border-radius: 8px;
      overflow-x: auto;
      margin: 10px 0;
    }

    .message-text pre code {
      background: none;
      border: none;
      padding: 0;
    }

    /* Input Card */
    .ai-input-wrapper {
      position: relative;
    }

    .ai-input-card {
      background: rgba(30, 41, 59, 0.8);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 14px;
      padding: 12px 16px;
      backdrop-filter: blur(12px);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .ai-textarea {
      width: 100%;
      background: transparent;
      border: none;
      outline: none;
      color: #F8FAFC;
      font-family: inherit;
      font-size: 14px;
      line-height: 1.5;
      resize: none;
      max-height: 140px;
      min-height: 24px;
    }

    .ai-textarea::placeholder {
      color: var(--text-muted);
    }

    .ai-input-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
      padding-top: 8px;
    }

    .ai-input-hint {
      font-size: 11px;
      color: var(--text-muted);
    }

    .ai-typing-cursor {
      display: inline-block;
      width: 6px;
      height: 14px;
      background: #34D399;
      vertical-align: middle;
      margin-left: 2px;
      animation: blinkCursor 0.8s infinite;
    }

    @keyframes blinkCursor {
      0%, 100% { opacity: 1; }
      50% { opacity: 0; }
    }

    /* Ad Intelligence AI Recommendations & Plan Card */
    .ai-budget-plan-card {
      transition: all 0.25s ease;
    }

    .ai-budget-plan-card:hover {
      border-color: rgba(139, 92, 246, 0.4);
      box-shadow: 0 4px 24px rgba(139, 92, 246, 0.12);
    }

    .ai-budget-plan-body h3 {
      font-size: 15px;
      font-weight: 700;
      color: #60A5FA;
      margin: 14px 0 6px 0;
    }

    .ai-budget-plan-body h4 {
      font-size: 14px;
      font-weight: 600;
      color: #A78BFA;
      margin: 12px 0 6px 0;
    }

    .ai-budget-plan-body p {
      margin: 0 0 10px 0;
      line-height: 1.6;
    }

    .ai-budget-plan-body ul {
      margin: 6px 0 12px 20px;
      padding: 0;
    }

    .ai-budget-plan-body li {
      margin-bottom: 6px;
      line-height: 1.5;
    }

    .ai-budget-plan-body strong {
      color: #F8FAFC;
    }

    .ai-diag-box {
      background: rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(139, 92, 246, 0.25);
      border-radius: 10px;
      padding: 14px;
    }

    .ad-hook-item {
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-left: 3px solid #8B5CF6;
      border-radius: 6px;
      padding: 8px 10px;
      margin: 6px 0;
      font-size: 11px;
      color: #E2E8F0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }

    .ad-hook-item:hover {
      border-color: rgba(139, 92, 246, 0.4);
      background: rgba(139, 92, 246, 0.08);
    }

    /* Modal Animation */
    @keyframes modalFadeIn {
      from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
      }
      to {
        opacity: 1;
        transform: scale(1) translateY(0);
      }
    }

    /* Toast Notification Animation */
    @keyframes toastSlideIn {
      from {
        opacity: 0;
        transform: translateX(30px);
      }
      to {
        opacity: 1;
        transform: translateX(0);
      }
    }