
        :root {
            --primary: #2563eb;
            --danger: #ef4444;
            --success: #10b981;
            --warning: #f59e0b;
            --gray-100: #f1f5f9;
            --gray-200: #e5e7eb;
            --gray-400: #9ca3af;
            --gray-500: #6b7280;
            --gray-700: #374151;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { background: #f8fafc; }
        .navbar { background: white; border-bottom: 1px solid var(--gray-200); padding: 1rem 0; }
        .navbar .container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; display: flex; justify-content: space-between; align-items: center; }
        .nav-brand { font-size: 1.25rem; font-weight: 700; text-decoration: none; color: #1e293b; }
        .nav-links { display: flex; gap: 1.5rem; }
        .nav-links a { text-decoration: none; color: #64748b; font-weight: 500; }
        .nav-links a.active { color: var(--primary); }
        
        .container { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
        .header { margin-bottom: 2rem; }
        .header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
        .header p { color: var(--gray-500); }
        
        .filters { background: white; padding: 1.5rem; border-radius: 12px; margin-bottom: 2rem; display: flex; gap: 1rem; align-items: center; }
        .filters select { padding: 0.75rem; border: 2px solid var(--gray-200); border-radius: 8px; min-width: 200px; }
        
        .history-grid { display: grid; gap: 1rem; }
        .history-card { background: white; border-radius: 12px; padding: 1.5rem; border: 2px solid var(--gray-200); transition: all 0.3s; }
        .history-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1); }
        
        .history-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 1rem; }
        .history-title { font-size: 1.1rem; font-weight: 600; color: var(--gray-700); word-break: break-all; overflow-wrap: break-word; max-width: 100%; }
        .history-score { font-size: 2rem; font-weight: 700; }
        .score-good { color: var(--success); }
        .score-ok { color: var(--warning); }
        .score-bad { color: var(--danger); }
        
        .history-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--gray-400); margin-top: 1rem; }
        .history-meta span { display: flex; align-items: center; gap: 0.25rem; }
        
        .history-actions { display: flex; gap: 0.5rem; }
        .btn { padding: 0.5rem 1rem; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; transition: all 0.2s; }
        .btn-primary { background: var(--primary); color: white; }
        .btn-danger { background: var(--danger); color: white; }
        .btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
        
        .empty-state { text-align: center; padding: 4rem 2rem; color: var(--gray-400); }
        .empty-state-icon { font-size: 4rem; margin-bottom: 1rem; }
        
        .upgrade-banner { background: linear-gradient(135deg, #f093fb, #f5576c); color: white; padding: 1.5rem; border-radius: 12px; margin-bottom: 2rem; text-align: center; }
    
        .comparison-widget { background: white; border-radius: 12px; padding: 1.5rem; margin-bottom: 2rem; border: 2px solid var(--gray-200); }
        .comparison-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
        .comparison-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 2rem; align-items: center; }
        .comparison-score { text-align: center; }
        .comparison-score-value { font-size: 3rem; font-weight: 700; }
        .comparison-score-label { color: var(--gray-500); font-size: 0.9rem; margin-top: 0.5rem; }
        .comparison-arrow { font-size: 2rem; display: flex; flex-direction: column; align-items: center; }
        .trend-improved { color: var(--success); }
        .trend-declined { color: var(--danger); }
        .trend-stable { color: var(--gray-400); }
        .trend-badge { padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; }
        .trend-improved .trend-badge { background: #d1fae5; color: #065f46; }
        .trend-declined .trend-badge { background: #fee2e2; color: #991b1b; }
        .trend-stable .trend-badge { background: var(--gray-100); color: var(--gray-600); }

    
        .btn-delete {
            background: transparent;
            border: none;
            color: var(--gray-400);
            cursor: pointer;
            font-size: 1.2rem;
            padding: 0.5rem;
            border-radius: 6px;
            transition: all 0.2s;
        }
        
        .btn-delete:hover {
            background: var(--danger-light);
            color: var(--danger);
            transform: scale(1.1);
        }

    /* History Page Mobile Optimizations */
    @media (max-width: 767px) {
        /* Filters */
        .filters {
            flex-direction: column;
            gap: 0.75rem;
        }
        
        .filters select {
            width: 100%;
            font-size: 16px;
            min-height: 44px;
        }
        
        /* Comparison widget */
        .comparison-widget {
            padding: 1.25rem;
        }
        
        .comparison-grid {
            gap: 0.75rem;
        }
        
        /* History cards */
        .history-card {
            padding: 1.25rem;
        }
        
        .history-card-content {
            flex-direction: column;
            gap: 1rem;
        }
        
        .history-score {
            width: 100%;
            text-align: center;
            padding: 1rem;
        }
        
        .history-info {
            width: 100%;
        }
        
        /* Action buttons */
        .history-actions {
            flex-direction: column;
            gap: 0.5rem;
            width: 100%;
        }
        
        .history-actions button {
            width: 100%;
            min-height: 44px;
        }
    }

    
/* === Phase D1: User Nav Dropdown === */
.pro-nav-user { position: relative; cursor: pointer; }
.pro-nav-user-dropdown {
  display: none; position: absolute; top: 100%; right: 0;
  background: white; border: 1px solid #e2e8f0;
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 200px; padding: 8px 0; z-index: 1001;
}
.pro-nav-user-dropdown.open { display: block; }
.pro-nav-user-dropdown a {
  display: block; padding: 10px 16px; color: #334155;
  text-decoration: none; font-size: 14px; transition: background 0.15s;
}
.pro-nav-user-dropdown a:hover { background: #f1f5f9; }
.pro-nav-user-dropdown hr { border: none; border-top: 1px solid #e2e8f0; margin: 4px 0; }
.pro-nav-user-dropdown .logout-link { color: #dc2626; }


/* === Phase D2: History URL truncation === */
.history-url {
  display: block;
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
/* === Phase D2: Detail panel === */
.detail-toggle-btn {
  background: none;
  border: 1px solid var(--primary, #2563eb);
  color: var(--primary, #2563eb);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.detail-toggle-btn:hover { background: #eff6ff; }
.detail-panel { margin-top: 0.75rem; }
.detail-panel-inner {
  background: var(--gray-50, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--gray-600, #475569); }
.detail-value { font-weight: 600; }
.detail-score { color: var(--primary, #2563eb); font-size: 1rem; }
.detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.detail-action-btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background: var(--primary, #2563eb);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.detail-action-btn:hover { background: #1d4ed8; }
/* === Phase D2: Delete confirmation dialog === */
.delete-confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.delete-confirm-overlay[hidden] {
  display: none !important;
}
.delete-confirm-modal {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.delete-confirm-modal h3 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.delete-confirm-modal p { margin: 0 0 0.5rem; color: #475569; font-size: 0.95rem; }
.delete-confirm-url {
  font-weight: 600; color: #1e293b;
  word-break: break-all;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
}
.delete-confirm-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }
.delete-confirm-cancel {
  padding: 0.5rem 1.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 0.95rem;
}
.delete-confirm-cancel:hover { background: #f1f5f9; }
.delete-confirm-ok {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #dc2626;
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
}
.delete-confirm-ok:hover { background: #b91c1c; }


/* === Phase D4 Task A: Mobile Responsive === */
@media (max-width: 767px) {
  .pro-nav-links { display: none; }
  .pro-navbar { padding: 10px 16px; }
  .pro-nav-user-name { display: none; }
  .pro-nav-user-plan { font-size: 10px; }
  .main-content, .dashboard-content, .settings-container, .billing-container { padding: 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-number { font-size: 22px; }
  .main-grid { grid-template-columns: 1fr; gap: 16px; }
  .welcome-banner { padding: 20px 16px; border-radius: 12px; }
  .welcome-banner h2 { font-size: 18px; }
  .card { border-radius: 10px; }
  .card-header { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .history-card { padding: 14px; }
  .history-url, .history-card a[href] { font-size: 12px; }
  .detail-panel-inner { padding: 12px; }
  .detail-actions { flex-direction: column; }
  .plan-badge-large { font-size: 12px; padding: 4px 10px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .seo-task-item { font-size: 13px; padding: 10px; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stat-card .stat-number { font-size: 20px; }
}

/* === Phase D4 Task B: Dashboard Hamburger === */
.dashboard-hamburger {
  display: none; background: none; border: none; cursor: pointer;
  padding: 8px; flex-direction: column; gap: 5px; margin-left: auto;
}
.dashboard-hamburger span {
  display: block; width: 22px; height: 2px;
  background: #374151; border-radius: 2px; transition: all 0.3s;
}
.dashboard-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.dashboard-hamburger.active span:nth-child(2) { opacity: 0; }
.dashboard-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
@media (max-width: 767px) {
  .dashboard-hamburger { display: flex; }
}
.dashboard-mobile-menu { background: #fff; border-bottom: 1px solid #E5E7EB; box-shadow: 0 4px 12px rgba(0,0,0,0.08); padding: 8px 0; }
.dashboard-mobile-menu[hidden] { display: none; }
.dash-mobile-link { display: block; padding: 12px 20px; font-size: 15px; color: #374151; text-decoration: none; transition: background 0.15s; }
.dash-mobile-link:hover, .dash-mobile-link:active { background: #F3F4F6; }
.dash-mobile-divider { border: none; border-top: 1px solid #E5E7EB; margin: 4px 16px; }
.dash-mobile-logout { color: #DC2626; }

/* === Phase D4 Task C: Toast === */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 10000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: #1F2937; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  pointer-events: auto; opacity: 0; transform: translateY(16px);
  transition: opacity 0.3s, transform 0.3s; max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { background: #059669; }
.toast.toast-error { background: #DC2626; }
.toast.toast-warning { background: #D97706; }
@media (max-width: 767px) {
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: 100%; }
}

/* === Phase D4 Task D: Skeleton === */
.skeleton {
  background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px;
}
.skeleton-text { height: 16px; margin-bottom: 8px; width: 80%; }
.skeleton-text-short { height: 16px; width: 40%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

