@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
    --bg-body:        #f0f4f8;
    --bg-card:        #ffffff;
    --bg-card-hover:  #f8fafc;
    --sidebar-bg:     #0f172a;
    --sidebar-hover:  #1e293b;
    --sidebar-active: #1e3a5f;
    --sidebar-text:   #cbd5e1;
    --sidebar-label:  #475569;
    --text-main:      #1a202c;
    --text-muted:     #64748b;
    --border:         #e2e8f0;
    --primary:        #3b82f6;
    --primary-dark:   #2563eb;
    --success:        #22c55e;
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --info:           #06b6d4;
    --purple:         #8b5cf6;
    --radius-sm:      4px;
    --radius-md:      8px;
    --radius-lg:      12px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.12);
    --font:           'Inter', sans-serif;
    --sidebar-width:  260px;
    --transition:     0.18s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg-body); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-brand {
    padding: 1.5rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid #1e293b;
}
.sidebar-brand .brand-icon { font-size: 1.5rem; }
.sidebar-brand .brand-name { font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.sidebar-brand .brand-ver  { font-size: 0.65rem; color: var(--sidebar-label); margin-top: 1px; }

/* Project Switcher */
.project-switcher { padding: 0.75rem 1.25rem; border-bottom: 1px solid #1e293b; }
.project-switcher label { font-size: 0.65rem; color: var(--sidebar-label); text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: 0.4rem; }
.project-select {
    width: 100%; padding: 0.45rem 0.6rem;
    background: #1e293b; color: #e2e8f0;
    border: 1px solid #334155; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 0.8rem;
    margin-bottom: 0.5rem;
}
.project-actions { display: flex; gap: 0.4rem; }
.btn-add {
    flex: 1; padding: 0.4rem 0;
    background: transparent; border: 1px dashed #334155;
    color: #64748b; border-radius: var(--radius-sm);
    font-size: 0.72rem; font-weight: 600;
    transition: var(--transition);
}
.btn-add:hover { background: #1e293b; color: #94a3b8; }
.btn-recrawl {
    flex: 1; padding: 0.4rem 0;
    background: #1e3a5f; border: 1px solid #2d5a8e;
    color: #90cdf4; border-radius: var(--radius-sm);
    font-size: 0.72rem; font-weight: 600;
    transition: var(--transition);
}
.btn-recrawl:hover { background: #1e4976; }
.btn-delete {
    padding: 0.4rem 0.6rem;
    background: #3b1515; border: 1px solid #742a2a;
    color: #fc8181; border-radius: var(--radius-sm);
    font-size: 0.72rem; font-weight: 600;
    transition: var(--transition);
}
.btn-delete:hover { background: #4a1c1c; }

/* Navigation */
.nav-group-label {
    padding: 0.9rem 1.25rem 0.3rem;
    font-size: 0.62rem;
    color: var(--sidebar-label);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.65rem 1.25rem;
    color: var(--sidebar-text);
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: var(--transition);
    user-select: none;
}
.nav-item:hover  { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); border-left-color: var(--primary); color: #fff; }
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #1e293b;
}
.btn-export-csv {
    display: block; width: 100%;
    padding: 0.5rem; text-align: center;
    background: #1e293b; border: 1px solid #334155;
    color: #94a3b8; border-radius: var(--radius-sm);
    font-size: 0.75rem; font-weight: 600;
    transition: var(--transition);
}
.btn-export-csv:hover { background: #263148; color: #fff; }

/* ===== MAIN CONTENT ===== */
.main { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.page-header {
    padding: 1.25rem 1.75rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.page-header h1 { font-size: 1.15rem; font-weight: 700; }
.page-header .subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Crawl Status Banner */
#crawl-banner {
    display: none;
    background: linear-gradient(90deg, #1e3a5f, #1e293b);
    color: #90cdf4;
    padding: 0.6rem 1.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
#crawl-banner.show { display: flex; }
.spinner {
    width: 14px; height: 14px;
    border: 2px solid #334155;
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.content-area { flex: 1; min-height: 0; overflow-y: auto; padding: 1.5rem 1.75rem; }
.view-section { display: none; }
.view-section.active { display: block; }

/* ===== CARDS & GRIDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.card-title {
    font-size: 0.9rem; font-weight: 700;
    margin-bottom: 0.9rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.5rem;
}

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.25rem; }

/* ===== METRIC CARDS ===== */
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.metric-card .metric-icon { font-size: 1.6rem; margin-bottom: 0.5rem; }
.metric-card .metric-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.metric-card .metric-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; font-weight: 500; }
.metric-card .metric-trend { font-size: 0.7rem; margin-top: 0.35rem; font-weight: 600; }
.metric-card.c-blue   { border-top: 3px solid var(--primary); }
.metric-card.c-green  { border-top: 3px solid var(--success); }
.metric-card.c-red    { border-top: 3px solid var(--danger); }
.metric-card.c-yellow { border-top: 3px solid var(--warning); }
.metric-card.c-purple { border-top: 3px solid var(--purple); }
.metric-card.c-info   { border-top: 3px solid var(--info); }

/* ===== SCORE GAUGE ===== */
.score-gauge-wrap { text-align: center; padding: 1rem 0; }
.score-gauge-num  { font-size: 3rem; font-weight: 800; line-height: 1; }
.score-gauge-label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem; }
.score-gauge-bar  { width: 100%; height: 8px; background: var(--border); border-radius: 4px; margin-top: 0.75rem; overflow: hidden; }
.score-gauge-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 0.18rem 0.55rem; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-muted   { background: #f1f5f9; color: #475569; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th { background: #f8fafc; color: var(--text-muted); font-weight: 600; padding: 0.65rem 0.9rem; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: var(--bg-card-hover); }
.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }

/* ===== ISSUE CARDS ===== */
.issue-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.6rem;
    overflow: hidden;
}
.issue-card-header {
    padding: 0.65rem 0.9rem;
    background: #fef9f9;
    display: flex; align-items: center; gap: 0.5rem;
    cursor: pointer;
    font-weight: 600; font-size: 0.82rem;
}
.issue-card-body { padding: 0.75rem 1rem; background: #fff; font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; border-top: 1px solid var(--border); }

/* ===== DATA ROW (key-value) ===== */
.data-row { display: flex; justify-content: space-between; padding: 0.45rem 0; border-bottom: 1px dashed var(--border); font-size: 0.83rem; }
.data-row:last-child { border-bottom: none; }
.data-label { color: var(--text-muted); font-weight: 500; }
.data-value { font-weight: 600; text-align: right; max-width: 60%; word-break: break-word; }

/* ===== FORMS ===== */
.input-field {
    width: 100%; padding: 0.65rem 0.8rem;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-family: var(--font); font-size: 0.9rem;
    outline: none; transition: var(--transition);
    margin-bottom: 0.75rem;
}
.input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.select-field {
    width: 100%; padding: 0.65rem 0.8rem;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-family: var(--font); font-size: 0.85rem;
    background: #fff; margin-bottom: 1rem;
}
.btn-primary {
    background: var(--primary); color: #fff;
    border: none; padding: 0.7rem 1.5rem;
    border-radius: var(--radius-md); font-weight: 700;
    font-size: 0.9rem; transition: var(--transition);
    width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    background: var(--bg-body); color: var(--text-muted);
    border: 1px solid var(--border); padding: 0.65rem 1.2rem;
    border-radius: var(--radius-md); font-weight: 600;
    font-size: 0.85rem; transition: var(--transition);
    margin-top: 0.5rem; width: 100%;
}
.btn-secondary:hover { background: var(--border); }

/* ===== MODAL ===== */
.modal-overlay {
    display: none; position: fixed;
    inset: 0; background: rgba(15,23,42,0.6);
    z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    width: 420px; max-width: 95vw;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--text-muted); cursor: pointer; }
.modal-close:hover { color: var(--danger); }

/* ===== FILTER TABS ===== */
.filter-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-tab {
    padding: 0.35rem 0.9rem;
    border-radius: 20px; border: 1px solid var(--border);
    background: var(--bg-card); font-size: 0.78rem; font-weight: 600;
    color: var(--text-muted); transition: var(--transition); cursor: pointer;
}
.filter-tab:hover  { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== SEARCH BAR ===== */
.search-bar {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-family: var(--font); font-size: 0.85rem;
    width: 280px; margin-bottom: 1rem;
}
.search-bar:focus { outline: none; border-color: var(--primary); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

/* ===== FIX TRACKER ===== */
.tracker-status-fixed      { color: #166534; background: #dcfce7; }
.tracker-status-new        { color: #991b1b; background: #fee2e2; }
.tracker-status-persistent { color: #854d0e; background: #fef9c3; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-fixed      { background: var(--success); }
.dot-new        { background: var(--danger); }
.dot-persistent { background: var(--warning); }

/* ===== SECTION TITLE ===== */
.section-title { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 1.25rem 0 0.75rem; padding-bottom: 0.4rem; border-bottom: 2px solid var(--border); }

/* ===== CHECKLIST ===== */
.checklist-row { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px dashed var(--border); font-size: 0.82rem; }
.checklist-row:last-child { border-bottom: none; }
.check-label { display: flex; align-items: center; gap: 0.5rem; }

/* ===== PROGRESS BAR ===== */
.progress-wrap { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; margin-top: 0.4rem; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }

/* =====================================================
   PAGESPEED & CORE WEB VITALS SUITE STYLES
   ===================================================== */
.psi-control-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.psi-control-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.psi-cache-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}
.psi-cache-banner.fresh {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.psi-scores-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
    .psi-scores-grid { grid-template-columns: repeat(2, 1fr); }
}

.psi-score-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.psi-score-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.psi-gauge-wrapper {
    position: relative;
    width: 105px;
    height: 105px;
    margin-bottom: 0.85rem;
}
.psi-gauge-svg {
    transform: rotate(-90deg);
    width: 105px;
    height: 105px;
}
.psi-gauge-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}
.psi-gauge-val {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease;
}
.psi-gauge-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
}
.psi-score-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}
.psi-score-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Color definitions */
.color-good { color: #16a34a !important; stroke: #16a34a !important; }
.color-warn { color: #d97706 !important; stroke: #d97706 !important; }
.color-poor { color: #dc2626 !important; stroke: #dc2626 !important; }
.badge-good { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-warn { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.badge-poor { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* CWV Cards */
.cwv-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 1100px) {
    .cwv-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
    .cwv-grid { grid-template-columns: 1fr; }
}

.cwv-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.cwv-abbr {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cwv-val {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0.4rem 0 0.5rem;
}
.cwv-target {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Diagnostics Tabs */
.psi-tabs-header {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}
.psi-tab-btn {
    padding: 0.55rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.psi-tab-btn:hover { color: var(--primary); }
.psi-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #f8fafc;
}
.psi-tab-pane { display: none; }
.psi-tab-pane.active { display: block; }

.lcp-code-box {
    background: #0f172a;
    color: #38bdf8;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #1e293b;
}

/* CrUX Real User Experience Card */
.crux-container {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.crux-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.crux-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}
.crux-metric-box {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
}
.crux-metric-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}
.crux-metric-val {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0.25rem 0;
}

/* Resource Weight Summary */
.resource-weight-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.resource-weight-bar {
    display: flex;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    margin: 0.75rem 0 1rem;
    background: #e2e8f0;
}
.resource-segment {
    height: 100%;
    transition: width 0.3s ease;
}
.resource-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.resource-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
}
.resource-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Category Audit Explorer */
.audit-explorer-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.cat-pills-row {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}
.cat-pill-btn {
    padding: 0.6rem 1.1rem;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid transparent;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.cat-pill-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.cat-pill-btn.active {
    background: var(--primary);
    color: #ffffff;
}
.cat-pill-count {
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.1);
}
.cat-pill-btn.active .cat-pill-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.audit-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.audit-search-input {
    flex: 1;
    min-width: 220px;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
}
.filter-btn-group {
    display: flex;
    gap: 0.35rem;
}
.filter-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
}
.filter-btn.active {
    background: #1e293b;
    color: #ffffff;
    border-color: #1e293b;
}

.audit-item-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.6rem;
    overflow: hidden;
    background: #ffffff;
    transition: all 0.15s ease;
}
.audit-item-row:hover {
    border-color: #94a3b8;
}
.audit-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    gap: 0.75rem;
}
.audit-item-title {
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.audit-item-body {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    font-size: 0.8rem;
    color: #334155;
    line-height: 1.5;
    display: none;
}
.audit-item-body.open {
    display: block;
}

/* =====================================================
   EXECUTIVE PDF PRINT STYLES
   ===================================================== */
#printable-audit-report {
    display: none;
}

@media print {
    body {
        background: #ffffff !important;
        color: #0f172a !important;
        height: auto !important;
        overflow: visible !important;
        display: block !important;
        font-size: 9pt !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .sidebar,
    .page-header,
    #crawl-banner,
    .psi-control-card,
    .psi-cache-banner,
    .psi-tabs-header,
    .modal-overlay,
    .sidebar-footer,
    button,
    .btn-primary,
    .btn-secondary,
    /* Hide ALL interactive screen elements inside view-pagespeed to avoid UI leaks */
    #view-pagespeed > .psi-overview-card,
    #view-pagespeed > #psi-crux-section,
    #view-pagespeed > #psi-metrics-grid,
    #view-pagespeed > #psi-resource-card,
    #view-pagespeed > .audit-explorer-card {
        display: none !important;
    }
    .main {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    .content-area {
        padding: 0 !important;
    }
    .view-section {
        display: none !important;
    }
    #view-pagespeed {
        display: block !important;
    }
    #printable-audit-report {
        display: block !important;
        padding: 8px 12px !important;
        background: #fff !important;
        width: 100% !important;
    }
    .print-page-break {
        page-break-before: always !important;
        break-before: page !important;
    }
    .print-section-title {
        font-size: 11pt !important;
        font-weight: 800 !important;
        margin: 16px 0 8px !important;
        color: #0f172a !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
    .print-card {
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
        padding: 10px 14px !important;
        margin-bottom: 12px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        background: #ffffff !important;
    }
    .print-table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8.5pt !important;
        margin-bottom: 14px !important;
    }
    .print-table th, .print-table td {
        border: 1px solid #e2e8f0 !important;
        padding: 6px 8px !important;
        text-align: left !important;
        vertical-align: top !important;
    }
    .print-table th {
        background: #f1f5f9 !important;
        font-weight: 700 !important;
        color: #1e293b !important;
    }
    .print-table tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .print-badge-pass {
        color: #15803d !important;
        font-weight: 700 !important;
    }
    .print-badge-warn {
        color: #b45309 !important;
        font-weight: 700 !important;
    }
    .print-badge-fail {
        color: #b91c1c !important;
        font-weight: 700 !important;
    }
    .print-badge-info {
        color: #0369a1 !important;
        font-weight: 600 !important;
    }
}
