/* ==========================================
   Qurmy Overview tab: AI visibility overview
   Markup: site.html #section-overview > .ov-page (static skeleton)
   Logic:  src/site-detail-ai.js
   .ov-page[data-state] is loading | empty | live. Live is the default
   look; .ov-only-empty / .ov-only-live swap the first-run variants.
   ========================================== */

.ov-page [hidden] { display: none !important; }
.ov-page:not([data-state="empty"]) .ov-only-empty { display: none !important; }
.ov-page[data-state="empty"] .ov-only-live { display: none !important; }

.ov-page { display: flex; flex-direction: column; gap: var(--sr-space-lg); color: var(--sr-text); }

/* Shared links: same green as the rest of the dashboard's inline links */
.ov-link { font-size: 13px; font-weight: 500; color: var(--sr-green-600); text-decoration: none; white-space: nowrap; }
.ov-link:hover { text-decoration: underline; }

.ov-empty-slot { list-style: none; padding: var(--sr-space-xs) 0; }

/* Primary button: --sr-green-600 so white text clears 4.5:1 */
.ov-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sr-space-xs);
    height: 46px;
    padding: 0 22px;
    border: none;
    border-radius: 10px;
    background: var(--sr-green-600);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow var(--sr-transition);
}
.ov-btn-primary:hover { box-shadow: var(--sr-shadow-md); }
.ov-btn-primary:focus-visible { outline: none; box-shadow: var(--sr-focus-ring); }

/* ---------- Header: title + health chips ---------- */
.ov-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sr-space-md); }
.ov-head-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ov-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.ov-subline { margin: 0; font-size: 14px; color: var(--sr-text-muted); }

.ov-health { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sr-space-xs); }
.ov-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--sr-gray-700);
    background: var(--sr-card-bg);
    border: 1px solid var(--sr-border);
    border-radius: 999px;
    padding: 5px 10px;
    white-space: nowrap;
}
.ov-chip-label { color: var(--sr-text-muted); }
.ov-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ov-chip.is-online { font-weight: 500; color: var(--sr-green-600); background: var(--sr-green-50); border-color: var(--sr-green-100); }
.ov-chip.is-online .ov-chip-dot { background: var(--sr-green); }
.ov-chip.is-warn { color: var(--sr-warning-text); background: var(--sr-warning-bg); border-color: var(--sr-warning-bg); }
.ov-chip.is-warn .ov-chip-label { color: var(--sr-warning-text); }
.ov-chip.is-bad { color: var(--sr-danger); border-color: var(--sr-danger-border); font-weight: 500; }
.ov-chip.is-bad .ov-chip-label { color: var(--sr-danger); }
.ov-chip.is-pending { color: var(--sr-text-muted); border: 1px dashed var(--sr-border-strong); }

/* ---------- Body: main column + rail ---------- */
/* Desktop: hero and main stacked on the left, rail spanning both rows on the right.
   Rows are auto + 1fr so a tall rail stretches the main row, never the hero row. */
.ov-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 384px);
    grid-template-rows: auto 1fr;
    grid-template-areas: "hero rail" "main rail";
    gap: var(--sr-space-lg);
}
.ov-hero { grid-area: hero; }
.ov-main { grid-area: main; align-self: start; min-width: 0; display: flex; flex-direction: column; gap: var(--sr-space-lg); container: ovmain / inline-size; }
.ov-rail { grid-area: rail; align-self: start; min-width: 0; display: flex; flex-direction: column; gap: var(--sr-space-lg); }
.ov-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sr-space-lg); }

/* Panels */
.ov-panel {
    background: var(--sr-card-bg);
    border: 1px solid var(--sr-border);
    border-radius: var(--sr-radius-lg);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.ov-page[data-state="empty"] .ov-main .ov-panel { border: 1px dashed var(--sr-border-strong); }
.ov-panel-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sr-space-sm); }
.ov-panel-row.is-top { align-items: flex-start; }
.ov-panel-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ov-panel-title { margin: 0; font-size: 16px; font-weight: 600; }
.ov-panel-title.is-sm { font-size: 15px; }
.ov-panel-sub { font-size: 13px; color: var(--sr-text-muted); }
.ov-panel-note { margin: 0; font-size: 13px; color: var(--sr-text-muted); line-height: 1.5; }

/* ---------- Hero ---------- */
.ov-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sr-space-2xl);
    padding: var(--sr-space-2xl) 36px;
    background: var(--sr-dark);
    color: #fff;
    border-radius: var(--sr-radius-lg);
    container: ovhero / inline-size;
}
.ov-hero-deco { position: absolute; border-radius: 50%; background: var(--sr-green); pointer-events: none; }
.ov-hero-deco.is-a { right: -80px; top: -80px; width: 320px; height: 320px; opacity: 0.10; }
.ov-hero-deco.is-b { right: 120px; bottom: -140px; width: 260px; height: 260px; opacity: 0.06; }

.ov-ring { position: relative; width: 148px; height: 148px; flex: 0 0 148px; }
.ov-ring-svg { display: block; }
.ov-ring-svg circle { fill: none; }
.ov-ring-track { stroke: #fff; stroke-opacity: 0.12; stroke-width: 10; }
.ov-ring-arc { stroke: var(--sr-green-light); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ov-ring-dashed { stroke: #fff; stroke-opacity: 0.18; stroke-width: 10; stroke-dasharray: 3 7; stroke-linecap: round; }
.ov-ring-inner { stroke: var(--sr-green-light); stroke-opacity: 0.35; stroke-width: 1.5; stroke-dasharray: 2 6; }
.ov-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.ov-ring-score { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; }
.ov-page[data-state="empty"] .ov-ring-score { font-size: 40px; opacity: 0.5; }
.ov-ring-max { font-size: 12px; opacity: 0.7; margin-top: 4px; }

.ov-hero-body { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ov-hero-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sr-green-light); }
.ov-hero-headline { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.ov-page[data-state="empty"] .ov-hero-headline { font-size: 30px; }
.ov-hero-text { margin: 0; font-size: 15px; line-height: 1.55; opacity: 0.78; max-width: 56ch; }
.ov-hero-chips { display: flex; flex-wrap: wrap; gap: var(--sr-space-xs); margin-top: 6px; }
.ov-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 5px 10px;
}
.ov-hero-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sr-gray-400); }
.ov-hero-chip-dot.is-good,
.ov-hero-chip-dot.is-run  { background: var(--sr-green-light); }
.ov-hero-chip-dot.is-bad  { background: var(--sr-danger); }
.ov-hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: var(--sr-space-xs); }
.ov-hero-helper { font-size: 13px; opacity: 0.75; }

.ov-hero-trend { position: relative; flex: 0 0 200px; display: flex; flex-direction: column; gap: var(--sr-space-xs); }
.ov-hero-trend-label { font-size: 12px; opacity: 0.7; }
.ov-hero-trend-box {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--sr-space-sm);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 12px;
    text-align: center;
    opacity: 0.75;
}

/* ---------- Metric cards ---------- */
.ov-metric-label { font-size: 13px; font-weight: 600; color: var(--sr-text-muted); }
.ov-metric-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.ov-metric-value { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.ov-page[data-state="empty"] .ov-metric-value { color: var(--sr-border-strong); }
.ov-metric-unit { font-size: 13px; color: var(--sr-text-muted); }

.ov-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--sr-gray-100); }
.ov-bar:empty { display: none; }
.ov-bar-seg { height: 100%; }
.ov-bar-seg.is-you   { background: var(--sr-green); }
.ov-bar-seg.is-c1    { background: var(--sr-teal); }
.ov-bar-seg.is-c2    { background: var(--sr-purple); }
.ov-bar-seg.is-ghost { background: var(--sr-border); }
.ov-bar-seg.is-gap   { background: var(--sr-card-bg); width: 2%; }
.ov-bar-seg.is-w34 { width: 34%; }
.ov-bar-seg.is-w22 { width: 22%; }
.ov-bar-seg.is-w18 { width: 18%; }

.ov-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--sr-gray-700); }
.ov-legend:empty { display: none; }
.ov-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ov-legend-item.is-muted,
.ov-legend-hint { color: var(--sr-text-muted); }
.ov-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.ov-swatch.is-you,
.ov-swatch.is-hit  { background: var(--sr-green); }
.ov-swatch.is-c1   { background: var(--sr-teal); }
.ov-swatch.is-c2   { background: var(--sr-purple); }
.ov-swatch.is-rest,
.ov-swatch.is-miss { background: var(--sr-border); }

/* ---------- Where you show up ---------- */
.ov-platforms,
.ov-topics { gap: 14px; }
.ov-pp-list { display: flex; flex-direction: column; }
.ov-pp-row { display: flex; flex-direction: column; gap: var(--sr-space-xs); padding: var(--sr-space-sm) var(--sr-space-xs); border-bottom: 1px solid var(--sr-gray-100); border-radius: 10px; }
.ov-pp-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sr-space-xs); font-size: 14px; }
.ov-pp-name { display: inline-flex; align-items: center; gap: var(--sr-space-xs); font-weight: 500; }
.ov-pp-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--sr-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--sr-gray-600);
}
.ov-pp-icon.is-chatgpt { background: var(--sr-dark); }
.ov-pp-icon.is-gemini  { background: var(--sr-info); }
.ov-pp-val { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ov-pp-bar { height: 8px; border-radius: 4px; background: var(--sr-gray-100); overflow: hidden; }
.ov-pp-fill { height: 100%; background: var(--sr-green); }
.ov-pp-meta { font-size: 12px; color: var(--sr-text-muted); }
.ov-pp-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sr-space-sm);
    padding: var(--sr-space-sm) var(--sr-space-xs) 0;
    font-size: 13px;
    color: var(--sr-text-muted);
}
.ov-tag { font-size: 12px; font-weight: 600; color: var(--sr-green-600); background: var(--sr-green-50); border-radius: 999px; padding: 3px 8px; }

/* ---------- Tracked topics ---------- */
.ov-topics-hit { color: var(--sr-green-600); font-weight: 600; }
.ov-topics-grid { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 5px; }
.ov-topic-cell { aspect-ratio: 1; border-radius: 4px; background: var(--sr-border); }
.ov-topic-cell.is-hit   { background: var(--sr-green); }
.ov-topic-cell.is-ghost { background: none; border: 1px dashed var(--sr-border); box-sizing: border-box; }
.ov-empty-slot.is-span { grid-column: 1 / -1; }
.ov-wins { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--sr-gray-100); padding-top: var(--sr-space-sm); }
.ov-wins-title { font-size: 12px; font-weight: 600; color: var(--sr-text-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.ov-win { display: flex; justify-content: space-between; gap: var(--sr-space-sm); font-size: 13px; }
.ov-win-topic { min-width: 0; overflow-wrap: anywhere; }
.ov-win-meta { color: var(--sr-green-600); font-weight: 500; white-space: nowrap; }

/* ---------- Rail: What to do next / What happens next ---------- */
.ov-next { padding: 0; gap: 0; overflow: hidden; }
.ov-next-head { padding: 22px 24px 16px; display: flex; flex-direction: column; gap: var(--sr-space-sm); border-bottom: 1px solid var(--sr-gray-100); }
.ov-rail-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.ov-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--sr-green-600);
    background: var(--sr-green-50);
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
}

.ov-actions { list-style: none; margin: 0; padding: var(--sr-space-xs); display: flex; flex-direction: column; }
.ov-actions > .ov-empty-slot { padding: var(--sr-space-sm) var(--sr-space-md); }
.ov-action { display: flex; gap: var(--sr-space-sm); align-items: flex-start; padding: 14px 16px; border-radius: var(--sr-space-sm); }
.ov-action:hover { background: var(--sr-surface-alt); }
.ov-action-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ov-action-title { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ov-action-why { font-size: 13px; color: var(--sr-text-muted); line-height: 1.4; }
.ov-action-body .ov-link { margin-top: 4px; align-self: flex-start; }
.ov-prio {
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--sr-radius-sm);
    padding: 4px 7px;
}
.ov-prio.is-high { color: var(--sr-warning-text); background: var(--sr-warning-bg); }
/* Review would be --sr-info on --sr-info-bg, but that is 4.24:1, so it uses the Medium style */
.ov-prio.is-med,
.ov-prio.is-review { color: var(--sr-gray-700); background: var(--sr-gray-100); }
.ov-next-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sr-space-sm) 24px 18px;
    border-top: 1px solid var(--sr-gray-100);
    font-size: 13px;
    color: var(--sr-text-muted);
}

.ov-steps { list-style: none; margin: 0; padding: 16px 24px 8px; display: flex; flex-direction: column; }
.ov-step { position: relative; display: flex; gap: 14px; align-items: flex-start; padding-bottom: 18px; }
.ov-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 30px;
    bottom: 0;
    width: 2px;
    background: var(--sr-border);
}
.ov-step:last-child { padding-bottom: 10px; }
.ov-step-num {
    position: relative;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    box-sizing: border-box;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--sr-gray-700);
    background: var(--sr-card-bg);
    border: 2px solid var(--sr-border-strong);
}
.ov-step.is-done .ov-step-num,
.ov-step.is-current .ov-step-num { color: #fff; background: var(--sr-dark); border-color: var(--sr-dark); }
.ov-step.is-done:not(:last-child)::before { background: var(--sr-dark); }
.ov-step-body { display: flex; flex-direction: column; gap: 2px; }
.ov-step-title { font-size: 14px; font-weight: 600; }
.ov-step-text { font-size: 13px; color: var(--sr-text-muted); line-height: 1.4; }

.ov-wait {
    margin: var(--sr-space-xs) 24px 20px;
    padding: 14px 16px;
    border-radius: var(--sr-space-sm);
    background: var(--sr-green-50);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ov-wait-title { font-size: 13px; font-weight: 600; color: var(--sr-green-600); }
.ov-wait-link { display: flex; justify-content: space-between; font-size: 13px; color: var(--sr-green-600); text-decoration: none; }
.ov-wait-link:hover { text-decoration: underline; }

/* ---------- Recent activity ---------- */
.ov-activity { padding: 20px 24px; gap: var(--sr-space-sm); }
.ov-activity-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sr-space-sm); font-size: 13px; }
.ov-activity-item { display: flex; gap: 10px; align-items: flex-start; }
.ov-activity-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--sr-gray-400); }
.ov-activity-dot.is-good { background: var(--sr-green); }
.ov-activity-dot.is-info { background: var(--sr-info); }
.ov-activity-dot.is-warn { background: var(--sr-warning); }
.ov-activity-dot.is-bad  { background: var(--sr-danger); }
.ov-activity-text { flex: 1; min-width: 0; line-height: 1.4; overflow-wrap: anywhere; }
.ov-activity-time { color: var(--sr-text-muted); white-space: nowrap; }

/* ---------- Responsive ---------- */
/* Hero narrower than 760px: body takes a 260px basis beside the ring, and the trend
   slot becomes a full-width strip under the body instead of a box under the ring.
   Container queries measure the content box: 760 - 2 x 36px padding = 688. */
@container ovhero (max-width: 687px) {
    .ov-hero-body { flex: 1 1 260px; }   /* ring 148 + gap 32 + 260 = 440, fits the 496px content box at 1280 */
    .ov-hero-trend { flex: 1 1 100%; flex-direction: row; align-items: center; gap: var(--sr-space-sm); }
    .ov-hero-trend-box { flex: 1; height: 40px; }
}
/* Main column too narrow for two cards side by side (only between ~1100 and ~1200px) */
@container ovmain (max-width: 519px) {
    .ov-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
/* Single column in reading order: hero, rail, main */
@media (max-width: 1100px) {
    .ov-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        grid-template-areas: "hero" "rail" "main";
    }
}
@media (max-width: 900px) {
    .ov-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .ov-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
    .ov-hero { padding: var(--sr-space-xl); gap: var(--sr-space-xl); }
    .ov-hero-headline,
    .ov-page[data-state="empty"] .ov-hero-headline { font-size: 22px; }
    .ov-topics-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}
