/* Pulse — Ops Command Center
   DM Sans (body) + JetBrains Mono (data)
   Light gray base, warm amber accent, jewel site tones */

:root {
    --bg-base: #f7f8fa;
    --bg-raised: #ffffff;
    --bg-surface: #f0f1f5;
    --bg-hover: #e8e9ef;
    --bg-overlay: rgba(0, 0, 0, 0.4);

    --text-primary: #1a1b23;
    --text-secondary: #5f6068;
    --text-tertiary: #93949e;

    --accent: #c08a2e;
    --accent-dim: rgba(192, 138, 46, 0.12);
    --accent-glow: rgba(192, 138, 46, 0.06);

    --border: #dcdde3;
    --border-subtle: #e8e9ef;

    --green: #2d8a4e;
    --green-dim: rgba(45, 138, 78, 0.10);
    --rose: #c0392b;
    --rose-dim: rgba(192, 57, 43, 0.10);
    --sky: #2874a6;
    --sky-dim: rgba(40, 116, 166, 0.10);
    --violet: #7d3c98;
    --violet-dim: rgba(125, 60, 152, 0.10);

    --site-upjourney: #b8860b;
    --site-enlightio: #2874a6;
    --site-coloringhub: #c0392b;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;

    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    --sidebar-width: 380px;
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
}

/* ---- Navigation ---- */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fb 100%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 52px;
    max-width: 100%;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    color: var(--accent);
    font-size: 14px;
}

.brand-text {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    position: relative;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 16px 0;
    transition: color 0.15s;
}

.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active { color: var(--text-primary); }

.nav-link-indicator { display: none; }
.nav-links a.active .nav-link-indicator {
    display: block;
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-logout {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.15s;
}
.nav-logout:hover { color: var(--text-primary); }

.nav-status {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
}

/* ---- Main Layout with Sidebar ---- */
.container {
    padding: 24px 28px 80px;
    max-width: 100%;
}

.main-layout {
    display: flex;
    gap: 0;
    position: relative;
}

.main-content {
    flex: 1;
    min-width: 0;
    transition: margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.sidebar-open {
    margin-right: calc(var(--sidebar-width) + 16px);
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.page-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--bg-surface);
    border-color: var(--border);
}

.btn-accent {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    font-weight: 600;
}
.btn-accent:hover {
    background: #a67824;
    border-color: #a67824;
    color: #ffffff;
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* ---- Summary Cards ---- */
.summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-md);
    padding: 14px 16px 12px;
    transition: border-color 0.15s;
    animation: fadeIn 0.3s ease both;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.summary-card:nth-child(2) { animation-delay: 0.05s; }
.summary-card:nth-child(3) { animation-delay: 0.1s; }
.summary-card:hover { border-color: var(--border); }

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.card-site-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.site-upjourney .card-site-dot { background: var(--site-upjourney); }
.site-enlightio .card-site-dot { background: var(--site-enlightio); }
.site-coloringhub .card-site-dot { background: var(--site-coloringhub); }

.card-site-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 8px;
    margin-bottom: 10px;
}

.card-metric {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.2;
}

.metric-label {
    font-size: 9px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 1px;
}

.metric-value.scoring-pending {
    color: var(--accent);
    font-size: 11px;
    font-weight: 500;
    font-family: var(--font-body);
}

.card-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 3px;
    background: var(--bg-base);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-group label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-weight: 500;
}

.filter-group select,
.filter-group input,
.filter-group textarea {
    background: var(--bg-raised);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 12px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: border-color 0.15s;
    outline: none;
}

.filter-group select:hover,
.filter-group input:hover,
.filter-group textarea:hover {
    border-color: var(--border);
}

.filter-group select:focus,
.filter-group input:focus,
.filter-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.filter-search {
    flex: 1;
    min-width: 160px;
}
.filter-search input { width: 100%; }

/* Score quick buttons */
.score-buttons {
    display: flex;
    gap: 2px;
}

.score-btn {
    padding: 6px 10px;
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 500;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.score-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.score-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.score-btn:not(:first-child) { border-left: none; }
.score-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.score-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}
.score-btn.active + .score-btn { border-left-color: var(--accent); }

/* Filter chips */
.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    min-height: 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 10px;
    background: var(--accent-dim);
    border: 1px solid rgba(212, 162, 78, 0.25);
    border-radius: 12px;
    font-size: 11px;
    color: var(--accent);
    font-weight: 500;
}

.chip-x {
    cursor: pointer;
    opacity: 0.6;
    font-size: 13px;
    line-height: 1;
    transition: opacity 0.1s;
}
.chip-x:hover { opacity: 1; }

/* ---- Table ---- */
.table-wrapper {
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

/* Tabulator overrides */
.tabulator {
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-md) !important;
    background: var(--bg-raised) !important;
    font-family: var(--font-body) !important;
    font-size: 12px !important;
}

.tabulator .tabulator-header {
    background: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border) !important;
}

.tabulator .tabulator-header .tabulator-col {
    background: transparent !important;
    border-right-color: var(--border-subtle) !important;
    padding: 0 !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
    padding: 8px 10px !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    font-size: 9px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    color: var(--text-tertiary) !important;
}

.tabulator .tabulator-tableholder {
    background: var(--bg-raised) !important;
}

.tabulator .tabulator-row {
    border-bottom: 1px solid var(--border-subtle) !important;
    transition: background 0.1s !important;
    cursor: pointer;
}

.tabulator .tabulator-row:hover {
    background: var(--bg-hover) !important;
}

.tabulator .tabulator-row.tabulator-selected,
.tabulator .tabulator-row.tabulator-highlight {
    background: var(--accent-glow) !important;
}

.tabulator .tabulator-row .tabulator-cell {
    border-right: none !important;
    padding: 6px 10px !important;
}

.tabulator .tabulator-row .tabulator-cell.tabulator-editing {
    border: 1px solid var(--accent) !important;
    padding: 3px 8px !important;
}

.tabulator .tabulator-placeholder {
    background: var(--bg-raised) !important;
}

.tabulator .tabulator-placeholder span {
    color: var(--text-tertiary) !important;
    font-size: 13px !important;
}

.tabulator .tabulator-footer {
    background: var(--bg-surface) !important;
    border-top: 1px solid var(--border) !important;
    padding: 6px 12px !important;
}

/* Header filter inputs */
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
    background: var(--bg-base) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    padding: 3px 8px !important;
    font-size: 11px !important;
    font-family: var(--font-body) !important;
    outline: none !important;
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input:focus {
    border-color: var(--accent) !important;
}

/* Tabulator editor dropdown */
.tabulator-edit-select-list {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
}
.tabulator-edit-select-list .tabulator-edit-select-list-item {
    color: var(--text-primary) !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
}
.tabulator-edit-select-list .tabulator-edit-select-list-item:hover,
.tabulator-edit-select-list .tabulator-edit-select-list-item.active {
    background: var(--bg-hover) !important;
    color: var(--accent) !important;
}

/* ---- Cell Formatters ---- */
.score-pill {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    background: hsl(var(--score-hue, 0) 50% 92%);
    color: hsl(var(--score-hue, 0) 65% 35%);
    letter-spacing: -0.02em;
}

.score-null {
    color: var(--text-tertiary);
    font-size: 11px;
}

.site-badge {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: -0.01em;
}
.site-badge.site-upjourney { color: var(--site-upjourney); }
.site-badge.site-enlightio { color: var(--site-enlightio); }
.site-badge.site-coloringhub { color: var(--site-coloringhub); }

.lang-badge {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.url-link {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    font-family: var(--font-mono);
    font-size: 11px;
    transition: color 0.1s;
}
.url-link:hover { color: var(--accent) !important; }

.cell-title {
    font-size: 12px;
    color: var(--text-primary);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-num {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

.cell-revenue { color: var(--green); }
.pos-good { color: var(--green); }
.pos-ok { color: var(--accent); }
.pos-bad { color: var(--rose); }

.idx-yes { color: var(--green); font-weight: 700; font-size: 14px; }
.idx-no { color: var(--rose); font-weight: 700; font-size: 14px; }
.idx-unknown { color: var(--text-tertiary); font-weight: 500; font-size: 12px; }

/* Crawl freshness colors */
.crawl-fresh { color: var(--green); }    /* <7 days */
.crawl-stale { color: var(--accent); }   /* 7-30 days */
.crawl-old { color: var(--rose); }       /* >30 days */
.crawl-never { color: var(--text-tertiary); } /* Never crawled */

.cell-empty {
    color: var(--text-tertiary);
    font-size: 11px;
}

.cell-date {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.status-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--tag-color) 15%, transparent);
    color: var(--tag-color);
}

.class-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--tag-color) 12%, transparent);
    color: var(--tag-color);
}

.assigned-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ---- Right Sidebar ---- */
.sidebar {
    position: fixed;
    top: 52px;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 80;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
}

.sidebar.is-open {
    transform: translateX(0);
}

.sidebar-inner {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.sidebar-header-text {
    min-width: 0;
    flex: 1;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 3px;
    line-height: 1.3;
}

.sidebar-url {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.15s;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-url:hover { color: var(--accent); }

/* Score + Classification row */
.sidebar-score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.score-badge-lg {
    font-size: 36px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
    letter-spacing: -0.04em;
    line-height: 1;
}

.score-badge-lg-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Sidebar metrics grid */
.sidebar-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

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

.sidebar-metric-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.sidebar-metric-value {
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Score breakdown in sidebar */
.sidebar-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    padding-top: 4px;
    border-top: 1px solid var(--border-subtle);
}

.factor-bars {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.factor-row {
    display: grid;
    grid-template-columns: 110px 1fr 48px;
    align-items: center;
    gap: 8px;
}

.factor-name {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.factor-name-muted {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 400;
    font-style: italic;
}

.factor-bar-track {
    height: 5px;
    background: var(--bg-base);
    border-radius: 3px;
    overflow: hidden;
}

.factor-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.fill-amber { background: var(--accent); }
.fill-emerald { background: var(--green); }
.fill-rose { background: var(--rose); }
.fill-sky { background: var(--sky); }
.fill-violet { background: var(--violet); }
.fill-slate { background: var(--text-tertiary); }

.factor-value {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-align: right;
}

.factor-coming-soon {
    font-size: 10px;
    color: var(--text-tertiary);
    font-style: italic;
    text-align: right;
}

/* Sidebar quick edit */
.sidebar-edit-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-edit-group label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-weight: 500;
}

.sidebar-edit-group select {
    background: var(--bg-raised);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 12px;
    font-family: var(--font-body);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}
.sidebar-edit-group select:hover { border-color: var(--border); }
.sidebar-edit-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }

.sidebar-edits {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-loading {
    display: flex;
    justify-content: center;
    padding: 8px 0 2px;
}

.sidebar-chart-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-chart-card {
    padding: 10px;
}

.sidebar-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.sidebar-compare-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.sidebar-compare-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.sidebar-compare-current {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    margin-top: 2px;
}

.sidebar-compare-prior {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.sidebar-compare-change {
    margin-top: 4px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.sidebar-compare-change.is-positive {
    color: var(--green);
}

.sidebar-compare-change.is-negative {
    color: var(--rose);
}

.sidebar-note {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.sidebar-query-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.sidebar-query-row {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 7px 8px;
}

.sidebar-query-text {
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 5px;
    line-height: 1.35;
}

.sidebar-query-metrics {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    margin-top: 4px;
}

.sidebar-annotation-toggle {
    margin-bottom: 8px;
}

.sidebar-annotation-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    margin-bottom: 10px;
}

.sidebar-annotation-form .btn {
    justify-content: center;
}

.sidebar-edit-group input,
.sidebar-edit-group textarea {
    background: var(--bg-base);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font-size: 12px;
    font-family: var(--font-body);
    outline: none;
    width: 100%;
    resize: vertical;
}

.sidebar-edit-group input:focus,
.sidebar-edit-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.sidebar-annotations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.sidebar-annotation-item {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.sidebar-annotation-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-annotation-type {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: var(--accent-dim);
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
}

.sidebar-annotation-meta {
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 10px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.sidebar-annotation-desc {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ---- Bulk Action Bar ---- */
.bulk-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 95;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.bulk-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    font-family: var(--font-mono);
}

.bulk-bar select {
    background: var(--bg-raised);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 11px;
    font-family: var(--font-body);
    cursor: pointer;
    outline: none;
}

.bulk-bar .btn-close {
    width: 24px;
    height: 24px;
    font-size: 14px;
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    animation: toastIn 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-success {
    background: color-mix(in srgb, var(--green) 20%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
    color: var(--green);
}

.toast-error {
    background: color-mix(in srgb, var(--rose) 20%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, var(--rose) 30%, transparent);
    color: var(--rose);
}

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

/* ---- Loading Overlay ---- */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius-md);
    backdrop-filter: blur(2px);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Login Page ---- */
.login-card {
    max-width: 360px;
    margin: 80px auto;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.login-card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.login-card input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-body);
    margin-bottom: 12px;
    outline: none;
}
.login-card input:focus {
    border-color: var(--accent);
}

.login-card button {
    width: 100%;
    padding: 9px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--bg-base);
    border: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

/* ---- Crawl Health Panel ---- */
.crawl-health-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.crawl-health-toggle .btn {
    font-size: 11px;
    padding: 5px 10px;
}

.crawl-health-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.crawl-health-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.crawl-health-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.crawl-health-card-header .card-site-dot {
    width: 6px;
    height: 6px;
}

.crawl-health-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.crawl-health-metric {
    display: flex;
    flex-direction: column;
}

.crawl-health-metric-value {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.crawl-health-metric-value.clickable {
    cursor: pointer;
    transition: color 0.15s;
}
.crawl-health-metric-value.clickable:hover {
    color: var(--accent);
}

.crawl-health-metric-label {
    font-size: 9px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.crawl-health-metric-value.good { color: var(--green); }
.crawl-health-metric-value.warning { color: var(--accent); }
.crawl-health-metric-value.bad { color: var(--rose); }

/* Crawl health source rows (Google/Bing split) */
.crawl-health-source-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.crawl-health-source-row:first-of-type {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.crawl-health-source-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 44px;
    flex-shrink: 0;
}

.crawl-health-source-metrics {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crawl-health-inline-metric {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.crawl-health-inline-metric.clickable {
    cursor: pointer;
    transition: color 0.15s;
}
.crawl-health-inline-metric.clickable:hover {
    color: var(--accent);
}

.crawl-health-inline-metric.bad {
    color: var(--rose);
}

.metric-icon {
    font-size: 10px;
    line-height: 1;
}

.metric-icon.idx-yes { color: var(--green); }
.metric-icon.idx-no { color: var(--rose); }
.metric-icon.idx-unknown { color: var(--text-tertiary); }
.metric-icon.crawl-old { color: var(--accent); }
.metric-icon.warning { color: var(--accent); }
.metric-icon.bad { color: var(--rose); }

/* ---- Cannibalization Page ---- */
.cannibalization-controls {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.query-group {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
}

.query-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-surface);
    cursor: pointer;
    transition: background 0.1s;
}
.query-group-header:hover { background: var(--bg-hover); }

.query-keyword {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.query-source-badge {
    font-size: 10px;
    font-family: var(--font-mono);
    font-weight: 500;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--accent-dim);
    color: var(--accent);
}

.query-page-count {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.query-group-pages {
    border-top: 1px solid var(--border-subtle);
}

.query-page-row {
    display: grid;
    grid-template-columns: 1fr 70px 80px 60px;
    gap: 12px;
    padding: 8px 14px 8px 28px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.query-page-row:last-child { border-bottom: none; }

.query-page-url {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.query-page-metric {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

/* ---- Chart Container ---- */
.chart-container {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chart-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.chart-body {
    position: relative;
    min-height: 200px;
}

/* ---- Reports Page ---- */
.report-tabs {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: none;
    overflow: visible;
}

.report-tab-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0;
    border: none;
}

.group-label,
.report-tab-group-label {
    width: 100%;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 0 0 4px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border-subtle);
    display: block;
}

.report-tab {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: var(--font-body);
}

.report-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.report-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.report-controls {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.report-subtitle {
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-bottom: 12px;
}

.report-panel {
    min-height: 300px;
}

.intent-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.intent-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid transparent;
}

.intent-summary-pill strong {
    font-family: var(--font-mono);
    font-size: 10px;
}

.intent-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 10px;
    font-family: var(--font-mono);
    text-transform: capitalize;
    border: 1px solid transparent;
}

.intent-transactional {
    color: #1e7a3e;
    background: rgba(45, 138, 78, 0.10);
    border-color: rgba(45, 138, 78, 0.30);
}

.intent-commercial {
    color: #8a6210;
    background: rgba(192, 138, 46, 0.10);
    border-color: rgba(192, 138, 46, 0.30);
}

.intent-navigational {
    color: #1a5d8a;
    background: rgba(40, 116, 166, 0.10);
    border-color: rgba(40, 116, 166, 0.30);
}

.intent-informational {
    color: #4a4f5c;
    background: rgba(100, 110, 130, 0.10);
    border-color: rgba(100, 110, 130, 0.30);
}

.intent-added {
    color: #1e7a3e;
    background: rgba(45, 138, 78, 0.10);
    border-color: rgba(45, 138, 78, 0.30);
}

.intent-removed {
    color: #a82315;
    background: rgba(192, 57, 43, 0.10);
    border-color: rgba(192, 57, 43, 0.30);
}

.intent-modified {
    color: #8a6210;
    background: rgba(212, 162, 78, 0.15);
    border-color: rgba(212, 162, 78, 0.35);
}

.rank-up {
    color: var(--green);
}

.rank-down {
    color: var(--rose);
}

.rank-flat {
    color: var(--text-secondary);
}

/* ---- Top Movers Widget ---- */
.top-movers-widget {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.top-movers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.top-movers-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.top-movers-period {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
}

.top-movers-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.top-movers-column-title {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    font-weight: 600;
}

.top-movers-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    gap: 8px;
}

.top-movers-url {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.top-movers-change {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.top-movers-change.positive { color: var(--green); }
.top-movers-change.negative { color: var(--rose); }

.top-movers-abs {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.insights-text {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

[x-cloak] {
    display: none !important;
}

/* ---- Shared Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    padding: 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.modal-title {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ---- Changelog Timeline ---- */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 24px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: linear-gradient(180deg, var(--border), rgba(220, 221, 227, 0.3));
}

.timeline-item {
    position: relative;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-base);
    box-shadow: 0 0 0 1px var(--border);
}

.timeline-dot.type-annotation {
    background: var(--sky);
}

.timeline-dot.type-test {
    background: var(--accent);
}

.timeline-dot.type-refresh {
    background: var(--green);
}

.timeline-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.timeline-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
}

.timeline-title {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.35;
}

.timeline-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.timeline-badge-annotation {
    color: #1a5d8a;
    border-color: rgba(40, 116, 166, 0.35);
    background: rgba(40, 116, 166, 0.12);
}

.timeline-badge-test {
    color: #8a6210;
    border-color: rgba(192, 138, 46, 0.35);
    background: rgba(192, 138, 46, 0.12);
}

.timeline-badge-refresh {
    color: #1e7a3e;
    border-color: rgba(45, 138, 78, 0.35);
    background: rgba(45, 138, 78, 0.12);
}

/* ---- Dashboard / Groups Helpers ---- */
.dashboard-grid {
    display: grid;
    gap: 16px;
}

.groups-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
}

@media (max-width: 1080px) {
    .groups-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .report-controls {
        flex-wrap: wrap;
    }

    .summary-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 680px) {
    .summary-row {
        grid-template-columns: 1fr;
    }

    .nav-inner {
        padding: 0 12px;
    }

    .nav-left {
        gap: 12px;
    }

    .nav-links {
        gap: 10px;
        overflow-x: auto;
        max-width: 70vw;
    }
}
