/* ─────────────────────────────────────────────────────────
   DESIGN TOKENS
───────────────────────────────────────────────────────── */
:root {
    /* Base */
    --bg: #060912;
    --bg-soft: #090d18;
    --bg-panel: rgba(9, 13, 22, 0.97);
    --bg-panel-strong: rgba(11, 16, 26, 0.99);
    --bg-subtle: rgba(255, 255, 255, 0.018);
    --bg-subtle-strong: rgba(255, 255, 255, 0.032);

    /* Borders */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --border-accent: rgba(74, 222, 128, 0.22);

    /* Text */
    --text: #eaf0f8;
    --text-soft: #9fb0c5;
    --muted: #546880;

    /* Accent — green */
    --accent: #4ade80;
    --accent-strong: #6ee7a0;
    --accent-alt: #34d399;
    --accent-dim: rgba(74, 222, 128, 0.1);
    --accent-glow: 0 0 28px rgba(74, 222, 128, 0.18);
    --accent-glow-sm: 0 0 14px rgba(74, 222, 128, 0.13);

    /* Secondary — indigo hint */
    --indigo: #818cf8;
    --indigo-dim: rgba(129, 140, 248, 0.08);

    /* Status */
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;

    /* Shadows */
    --shadow-xl: 0 40px 100px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.42);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.26);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.18);

    /* Radii */
    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 7px;

    /* Fonts */
    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

/* ─────────────────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────────────────── */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(ellipse 90% 55% at 15% -5%, rgba(74, 222, 128, 0.055), transparent),
        radial-gradient(ellipse 70% 45% at 85% 105%, rgba(129, 140, 248, 0.045), transparent),
        radial-gradient(ellipse 50% 35% at 50% 50%, rgba(52, 211, 153, 0.02), transparent),
        linear-gradient(160deg, #06080f 0%, #060912 50%, #090c16 100%);
}

/* Subtle dot grid texture */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 1;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
    background-size: 28px 28px;
}

/* ─────────────────────────────────────────────────────────
   AMBIENT GLOWS
───────────────────────────────────────────────────────── */
.backdrop-glow {
    position: fixed;
    width: 26rem;
    height: 26rem;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    opacity: 0.09;
}

.backdrop-glow--left {
    top: -10rem;
    left: -8rem;
    background: rgba(74, 222, 128, 0.6);
}

.backdrop-glow--right {
    right: -8rem;
    bottom: -10rem;
    background: rgba(129, 140, 248, 0.55);
}

/* ─────────────────────────────────────────────────────────
   SHELL / LAYOUT
───────────────────────────────────────────────────────── */
.shell {
    position: relative;
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px;
}

.app-shell {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* ─────────────────────────────────────────────────────────
   SHARED PANEL BASE
───────────────────────────────────────────────────────── */
.sidebar,
.topbar,
.card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Top-edge shimmer */
.sidebar::before,
.topbar::before,
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
    z-index: 1;
}

.sidebar,
.topbar {
    border-radius: var(--radius-xl);
}

/* ─────────────────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────────────────── */
.sidebar {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 14px;
    padding: 16px;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 2px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 11px;
    border: 1px solid rgba(74, 222, 128, 0.2);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.12), rgba(74, 222, 128, 0.04));
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-title {
    font-size: 13.5px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

/* Sidebar info card */
.sidebar-card,
.sidebar-footer {
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.055);
    background: var(--bg-subtle);
}

.sidebar-card__label,
.sidebar-footer__label,
.eyebrow,
.form-section__title,
.stage-routing__title {
    display: inline-flex;
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-card__value {
    display: block;
    margin-top: 9px;
    font-size: 13px;
    line-height: 1.55;
    font-weight: 600;
    color: var(--text);
}

.sidebar-card__text,
.sidebar-footer__value {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

/* ─────────────────────────────────────────────────────────
   SIDEBAR NAVIGATION
───────────────────────────────────────────────────────── */
.sidebar-nav {
    display: grid;
    gap: 4px;
}

.dashboard-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 11px 12px 11px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
    position: relative;
    overflow: hidden;
}

.dashboard-tab::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 2.5px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity 180ms ease, transform 180ms ease;
    transform: scaleY(0.6);
}

.dashboard-tab:hover {
    background: rgba(255, 255, 255, 0.032);
    border-color: var(--border);
}

.dashboard-tab:focus-visible {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.08);
}

.dashboard-tab.is-active {
    border-color: rgba(74, 222, 128, 0.18);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(74, 222, 128, 0.03));
    box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.04);
}

.dashboard-tab.is-active::before {
    opacity: 1;
    transform: scaleY(1);
}

.dashboard-tab__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.dashboard-tab.is-active .dashboard-tab__icon {
    color: var(--accent);
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.18);
}

.dashboard-tab__copy {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.dashboard-tab__title {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-soft);
    transition: color 160ms ease;
}

.dashboard-tab.is-active .dashboard-tab__title {
    color: var(--text);
}

.dashboard-tab__meta {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-tab__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.02em;
}

.dashboard-tab.is-active .dashboard-tab__badge {
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.18);
    color: var(--accent);
}

/* ─────────────────────────────────────────────────────────
   WORKSPACE
───────────────────────────────────────────────────────── */
.workspace {
    display: grid;
    gap: 16px;
}

/* ─────────────────────────────────────────────────────────
   TOPBAR
───────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
}

.topbar-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.topbar-copy__row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.2rem, 1.7vw, 1.45rem);
    letter-spacing: -0.03em;
    font-weight: 700;
}

.topbar p {
    margin: 0;
    max-width: 52rem;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.65;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   PILLS / CHIPS / STATUS
───────────────────────────────────────────────────────── */
.command-pill,
.chip,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-soft);
    font-size: 10.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.command-pill {
    font-family: var(--font-mono);
}

.chip--accent {
    color: var(--accent);
    border-color: rgba(74, 222, 128, 0.2);
    background: rgba(74, 222, 128, 0.07);
}

/* ─────────────────────────────────────────────────────────
   USER AREA IN TOPBAR
───────────────────────────────────────────────────────── */
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.025);
}

.topbar-user__copy {
    display: grid;
    gap: 1px;
}

.topbar-user__label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

#current-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

#current-user-role {
    color: var(--muted);
    font-size: 11px;
}

/* ─────────────────────────────────────────────────────────
   WORKSPACE BODY
───────────────────────────────────────────────────────── */
.workspace-body {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.tab-panel {
    display: none;
}

.tab-panel[hidden] {
    display: none !important;
}

.tab-panel.is-active {
    display: block;
    animation: panel-fade 200ms ease;
}

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

/* ─────────────────────────────────────────────────────────
   GRID LAYOUTS
───────────────────────────────────────────────────────── */
.page-grid {
    display: grid;
    gap: 16px;
}

.page-grid--overview {
    grid-template-columns: 1fr;
}

.overview-shell,
.pipeline-shell,
.sites-shell,
.access-shell,
.settings-shell {
    display: grid;
    gap: 16px;
    align-items: start;
}

.overview-shell {
    grid-template-columns: 1fr;
}

.overview-column,
.settings-rail {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.overview-column--primary .card--ideas,
.overview-column--side .card--models {
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    min-height: 0;
}

.overview-column--side .card--models {
    grid-template-rows: auto minmax(0, 1fr);
}

.overview-column--primary .panel-scroll--compact,
.overview-column--side .panel-scroll--compact {
    max-height: none;
    min-height: 0;
}

.pipeline-shell {
    grid-template-columns: minmax(0, 1.28fr) minmax(340px, 0.82fr);
}

.pipeline-shell .card,
.settings-shell .card--workspace-health,
.settings-shell .card--workspace-tokens,
.settings-shell .card--workspace-defaults {
    display: grid;
    grid-template-rows: auto minmax(0, auto);
    min-height: 0;
}

.pipeline-shell .card-head {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.pipeline-shell .card-note {
    max-width: none;
    text-align: left;
    font-size: 12px;
    line-height: 1.5;
}

.pipeline-shell .panel-scroll {
    max-height: min(68vh, 58rem);
    padding-right: 10px;
}

.card--activity,
.card--runs {
    min-width: 0;
}

.sites-shell {
    grid-template-columns: 1fr;
}

.access-shell {
    grid-template-columns: 1fr;
}

.settings-shell {
    grid-template-columns: 1fr;
}

.settings-workspace-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    min-width: 0;
}

.settings-shell .card--settings-form {
    grid-column: 1 / -1;
}

/* ─────────────────────────────────────────────────────────
   CARD
───────────────────────────────────────────────────────── */
.card {
    border-radius: var(--radius-xl);
    padding: 18px;
    background: var(--bg-panel-strong);
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.card-head__side {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.card h2 {
    margin: 6px 0 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.card-note {
    max-width: 20rem;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
}

.inline-control {
    display: grid;
    gap: 6px;
    min-width: 10rem;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.45;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.inline-control select {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    color: var(--text);
    font: inherit;
    letter-spacing: normal;
    text-transform: none;
}

.inline-control select:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.07);
}

/* ─────────────────────────────────────────────────────────
   SITE FILTERS
───────────────────────────────────────────────────────── */
.site-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 16px;
}

.ahrefs-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.ahrefs-summary-card {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 12px 13px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.ahrefs-summary-card span {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ahrefs-summary-card strong {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.035em;
}

.ahrefs-toolbar-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-control--compact {
    min-width: 11rem;
}

#sites-sort {
    min-width: 12.5rem;
}

.ahrefs-insights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.ahrefs-insight-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.ahrefs-insight-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ahrefs-insight-card__meta {
    display: grid;
    justify-items: end;
    gap: 8px;
    flex-shrink: 0;
}

.ahrefs-insight-card__head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.ahrefs-insight-card__head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.ahrefs-insight-list {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ahrefs-insight-list li {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ahrefs-insight-list li:first-child {
    padding-top: 0;
    border-top: none;
}

.ahrefs-insight-list strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.ahrefs-insight-list span,
.ahrefs-insight-empty {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.ahrefs-insight-action {
    white-space: nowrap;
}

body.has-modal {
    overflow: hidden;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    align-items: start;
    justify-items: center;
    overflow: auto;
    padding: 24px;
}

.modal-shell[hidden] {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 14, 0.74);
    backdrop-filter: blur(8px);
}

.modal-dialog {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-strong);
    background: rgba(10, 14, 24, 0.96);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
    overflow: hidden;
}

.modal-dialog--wide {
    width: min(900px, calc(100vw - 32px));
}

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

.modal-head h3 {
    margin: 8px 0 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.modal-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

.modal-body {
    overflow: auto;
    min-height: 0;
    padding-right: 4px;
    overscroll-behavior: contain;
}

.ahrefs-modal-list {
    display: grid;
    gap: 12px;
    padding-bottom: 4px;
}

.ahrefs-modal-site {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.ahrefs-modal-site__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ahrefs-modal-site__head > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.ahrefs-modal-site__head h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.ahrefs-modal-site__head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.ahrefs-modal-site__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.ahrefs-modal-site__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--muted);
    font-size: 11px;
}

.ahrefs-modal-site__note {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.7;
}

.ahrefs-modal-site__link a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-word;
}

.ahrefs-modal-site__link a:hover {
    color: var(--accent-strong);
    text-decoration: underline;
}

.ahrefs-table-shell {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.018);
}

.ahrefs-table {
    width: 100%;
    min-width: 1540px;
    border-collapse: collapse;
}

.ahrefs-table th,
.ahrefs-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 12px;
    line-height: 1.55;
}

.ahrefs-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(7, 11, 19, 0.98);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ahrefs-table tr:last-child td {
    border-bottom: none;
}

.ahrefs-table td {
    color: var(--text-soft);
}

.ahrefs-table__empty {
    color: var(--muted);
}

.ahrefs-site,
.ahrefs-status-cell {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.ahrefs-site strong {
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}

.ahrefs-site span {
    color: var(--muted);
    font-size: 11px;
}

.ahrefs-site a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-word;
}

.ahrefs-site a:hover {
    color: var(--accent-strong);
    text-decoration: underline;
}

.ahrefs-signal-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ahrefs-signal-pill {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.ahrefs-signal-pill p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.65;
}

.ahrefs-detail-shell {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.ahrefs-detail-grid {
    display: grid;
    gap: 12px;
}

.ahrefs-detail-card,
.ahrefs-detail-empty {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.ahrefs-detail-card__head h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.ahrefs-detail-card__head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.ahrefs-detail-table-shell {
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.ahrefs-detail-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.ahrefs-detail-table th,
.ahrefs-detail-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    text-align: left;
    vertical-align: top;
    font-size: 11.5px;
    line-height: 1.55;
}

.ahrefs-detail-table th {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.ahrefs-detail-table tr:last-child td {
    border-bottom: none;
}

.pill-info {
    background: rgba(96, 165, 250, 0.18);
    border-color: rgba(96, 165, 250, 0.35);
    color: #bfdbfe;
}

.pill-muted {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-soft);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.filter-chip:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.038);
}

.filter-chip.is-active {
    border-color: var(--border-accent);
    background: var(--accent-dim);
    color: var(--accent);
}

.filter-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    font-family: var(--font-mono);
    font-size: 9.5px;
}

/* ─────────────────────────────────────────────────────────
   DIVIDER & SUBSECTION
───────────────────────────────────────────────────────── */
.card-divider {
    height: 1px;
    margin: 16px 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.subsection-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.subsection-head h3 {
    margin: 6px 0 0;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ─────────────────────────────────────────────────────────
   FORMS
───────────────────────────────────────────────────────── */
.run-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.import-form {
    display: grid;
    gap: 12px;
    align-content: start;
}

.run-form label,
.import-form label,
.config-form label,
.stage-routing label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.run-form span,
.import-form span,
.config-form span,
.stage-routing label span {
    color: var(--text-soft);
    font-size: 12.5px;
}

.run-form input,
.run-form textarea,
.run-form select,
.import-form input,
.import-form textarea,
.import-form select,
.config-form input,
.config-form select,
.stage-routing select {
    width: 100%;
    min-height: 44px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.022);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.run-form textarea {
    min-height: 110px;
    resize: vertical;
}

.import-form textarea {
    min-height: 110px;
    resize: vertical;
}

.run-form input:focus,
.run-form textarea:focus,
.run-form select:focus,
.import-form input:focus,
.import-form textarea:focus,
.import-form select:focus,
.config-form input:focus,
.config-form select:focus,
.stage-routing select:focus {
    outline: none;
    border-color: var(--border-accent);
    background: rgba(255, 255, 255, 0.038);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.07);
}

.run-form__wide,
.toggle,
.run-form__hint,
.run-form__status,
.hosting-capacity,
.import-form__wide {
    grid-column: span 2;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 13px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.toggle:hover {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.028);
}

.toggle input {
    width: 16px;
    height: 16px;
    min-height: auto;
    margin: 0;
    accent-color: var(--accent);
}

.run-form__hint {
    padding: 12px 13px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.055);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────
   INLINE NOTICES
───────────────────────────────────────────────────────── */
.inline-notice {
    padding: 11px 13px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    font-size: 12px;
    line-height: 1.6;
}

.inline-notice--hidden {
    display: none;
}

.inline-notice--muted {
    color: var(--text-soft);
}

.inline-notice--success {
    color: var(--success);
    background: rgba(74, 222, 128, 0.07);
    border-color: rgba(74, 222, 128, 0.16);
}

.inline-notice--warning {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.07);
    border-color: rgba(251, 191, 36, 0.15);
}

.inline-notice--danger {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.07);
    border-color: rgba(248, 113, 113, 0.15);
}

.hosting-capacity {
    display: grid;
    gap: 8px;
    padding: 12px 13px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.hosting-capacity--hidden {
    display: none;
}

.hosting-capacity--muted {
    color: var(--text-soft);
}

.hosting-capacity--warning {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.07);
    border-color: rgba(251, 191, 36, 0.15);
}

.hosting-capacity--danger {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.07);
    border-color: rgba(248, 113, 113, 0.15);
}

.hosting-capacity__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.hosting-capacity__title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hosting-capacity__metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hosting-capacity__metrics span {
    padding: 6px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.025);
    font-size: 11px;
    line-height: 1.2;
    color: inherit;
}

.hosting-capacity__detail {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-soft);
}

/* ─────────────────────────────────────────────────────────
   FORM ACTIONS
───────────────────────────────────────────────────────── */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.form-actions--split {
    align-items: center;
    justify-content: space-between;
}

.form-actions__note {
    max-width: 32rem;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.6;
}

.form-actions--sticky {
    position: sticky;
    bottom: 0;
    padding-top: 16px;
    background: linear-gradient(180deg, transparent, rgba(9, 13, 22, 0.97) 44%);
}

/* ─────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease, border-color 160ms ease, background 160ms ease;
    white-space: nowrap;
}

.button svg {
    flex-shrink: 0;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:active:not(:disabled) {
    transform: translateY(0);
}

.button:disabled {
    opacity: 0.55;
    cursor: progress;
    transform: none;
}

.button--primary {
    color: #050d0a;
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.button--primary:hover:not(:disabled) {
    box-shadow: 0 10px 28px rgba(74, 222, 128, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.button--ghost {
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.028);
    border-color: var(--border);
}

.button--ghost:hover:not(:disabled) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-strong);
}

.button--danger {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.07);
    border-color: rgba(248, 113, 113, 0.18);
}

.button--danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.12);
}

.button--small {
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* ─────────────────────────────────────────────────────────
   METRICS GRID
───────────────────────────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.metric-card {
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    position: relative;
    overflow: hidden;
    transition: border-color 160ms ease, transform 160ms ease;
}

.metric-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74, 222, 128, 0.2), transparent);
}

.metric-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.metric-card__label,
.metric-card__hint {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.metric-card__value {
    display: block;
    margin: 10px 0 7px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────────────────────
   IDEA TOOLBAR & CONTROLS
───────────────────────────────────────────────────────── */
.idea-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.idea-toolbar__meta {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.idea-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.idea-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.idea-controls label {
    display: grid;
    gap: 7px;
    padding: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.idea-controls span {
    color: var(--text-soft);
    font-size: 12.5px;
}

.idea-controls select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.022);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.idea-controls select:focus {
    outline: none;
    border-color: var(--border-accent);
    background: rgba(255, 255, 255, 0.038);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.07);
}

.idea-controls small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.idea-grid {
    display: grid;
    gap: 10px;
}

/* ─────────────────────────────────────────────────────────
   IDEA CARD
───────────────────────────────────────────────────────── */
.idea-card {
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    transition: border-color 160ms ease;
}

.idea-card:hover {
    border-color: var(--border-strong);
}

.idea-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.idea-card__selection {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.idea-card__selection input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

.idea-card__top h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.idea-card__form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.idea-card__form label {
    display: grid;
    gap: 6px;
}

.idea-card__form label > span {
    color: var(--muted);
    font-size: 11.5px;
}

.idea-card__wide {
    grid-column: span 2;
}

.idea-card__form input,
.idea-card__form textarea,
.idea-card__form select {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.022);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.idea-card__form textarea {
    min-height: 88px;
    resize: vertical;
}

.idea-card__form input:focus,
.idea-card__form textarea:focus,
.idea-card__form select:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.07);
}

/* ─────────────────────────────────────────────────────────
   SCROLL PANELS
───────────────────────────────────────────────────────── */
.panel-scroll {
    max-height: 42rem;
    overflow: auto;
    padding-right: 8px;
}

.panel-scroll--compact {
    max-height: 28rem;
}

.panel-scroll--tall {
    max-height: min(72vh, 65rem);
}

.panel-scroll::-webkit-scrollbar {
    width: 5px;
}

.panel-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 999px;
}

.panel-scroll::-webkit-scrollbar-thumb {
    background: rgba(74, 222, 128, 0.18);
    border-radius: 999px;
}

.panel-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 222, 128, 0.3);
}

/* ─────────────────────────────────────────────────────────
   SHARED CARD ITEMS (runs, activity, sites, models, secrets)
───────────────────────────────────────────────────────── */
.runs-list,
.activity-list,
.site-grid,
.model-stack,
.secret-status {
    display: grid;
    gap: 10px;
}

.run-card,
.activity-item,
.site-card,
.model-card,
.secret-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    padding: 14px;
    transition: border-color 160ms ease;
    min-width: 0;
}

.run-card:hover,
.activity-item:hover,
.site-card:hover,
.model-card:hover {
    border-color: var(--border-strong);
}

.run-card__top,
.site-card__top,
.model-card__top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.activity-item .run-card__top {
    flex-wrap: wrap;
    min-width: 0;
}

.run-card h3,
.site-card h3,
.model-card h3,
.secret-card h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.activity-item h3 {
    flex: 1 1 220px;
    min-width: 0;
}

.run-progress {
    height: 5px;
    margin-top: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.run-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-alt));
    transition: width 300ms ease;
}

.run-decisions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.run-decision {
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
}

.run-decision__top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.run-decision__top h4 {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.run-decision__top p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.run-decision__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.run-meta,
.site-meta,
.model-meta,
.secret-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────
   SITE GRID & GROUPS
───────────────────────────────────────────────────────── */
.site-card {
    display: grid;
    gap: 12px;
}

.site-card__selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.site-card__selection-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.3;
    cursor: pointer;
}

.site-card__selection-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

.site-card__selection-state {
    color: var(--accent-soft);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.site-card__header {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.site-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-groups {
    display: grid;
    gap: 16px;
    overflow-anchor: none;
}

.site-group {
    display: grid;
    gap: 12px;
}

.site-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.site-group__title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.site-group__title h3 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.site-group__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    font-family: var(--font-mono);
    font-size: 10px;
}

.site-group__note {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.55;
    text-align: right;
}

.site-group__grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(74, 222, 128, 0.16);
    background: linear-gradient(180deg, rgba(74, 222, 128, 0.06), rgba(74, 222, 128, 0.03));
}

.site-bulk-bar--hidden {
    display: none;
}

.site-bulk-bar__copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.site-bulk-bar__title {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.site-bulk-bar__note {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.5;
}

.site-bulk-bar__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.site-card p,
.activity-item p,
.secret-card p,
.model-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.activity-list {
    align-content: start;
}

.activity-item .status-pill {
    flex: 0 0 auto;
    margin-left: auto;
}

.activity-item .run-meta {
    margin-top: 10px;
    min-width: 0;
}

.site-card__summary {
    margin: 0;
    color: var(--text-soft);
    font-size: 12.5px;
    line-height: 1.7;
}

.site-card__note {
    margin: 0;
    padding: 10px 11px;
    border-radius: var(--radius-sm);
    background: rgba(251, 191, 36, 0.07);
    border: 1px solid rgba(251, 191, 36, 0.15);
    color: var(--warning);
    font-size: 11.5px;
    line-height: 1.55;
}

.site-card__stable-url {
    display: grid;
    gap: 8px;
    padding: 11px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(74, 222, 128, 0.18);
    background: rgba(74, 222, 128, 0.045);
}

.site-card__stable-url-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.site-card__stable-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(74, 222, 128, 0.18);
    background: rgba(74, 222, 128, 0.08);
    color: var(--success);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.site-card__stable-state {
    color: var(--text-soft);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
}

.site-card__stable-copy {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.6;
}

.site-card__growth-watch {
    display: grid;
    gap: 8px;
    padding: 11px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(56, 189, 248, 0.18);
    background: rgba(56, 189, 248, 0.05);
}

.site-card__growth-watch-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.site-card__growth-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.18);
    background: rgba(56, 189, 248, 0.1);
    color: #7dd3fc;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.site-card__growth-state {
    color: var(--text-soft);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
}

.site-card__growth-copy {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.6;
}

.site-card__preview {
    margin: -14px -14px 14px;
    aspect-ratio: 16 / 10;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.site-card__preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.site-card__links {
    display: grid;
    gap: 8px;
}

.site-card__link {
    display: grid;
    gap: 5px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.022);
    color: inherit;
    text-decoration: none;
    word-break: break-word;
    transition: border-color 160ms ease, background 160ms ease;
}

.site-card__link:hover {
    border-color: var(--border-accent);
    background: rgba(74, 222, 128, 0.04);
}

.site-card__link-label,
.site-card__fact-label {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.site-card__link-value {
    color: var(--accent);
    font-size: 12px;
    line-height: 1.55;
}

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

.site-card__fact {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.site-card__fact-value {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text);
    word-break: break-word;
}

.site-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.site-meta--primary {
    margin-top: 0;
}

.site-meta--scores span {
    color: var(--text-soft);
}

/* ─────────────────────────────────────────────────────────
   MODEL / SECRET CARDS
───────────────────────────────────────────────────────── */
.model-stack,
.secret-status {
    grid-template-columns: 1fr;
}

.secret-card strong {
    display: block;
    margin-top: 7px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.035em;
}

/* ─────────────────────────────────────────────────────────
   SETTINGS / WORKSPACE HEALTH
───────────────────────────────────────────────────────── */
.workspace-provider-status,
.workspace-onboarding,
.workspace-deployments {
    display: grid;
    gap: 10px;
}

.settings-scope {
    display: grid;
    gap: 10px;
}

.settings-scope__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.settings-scope__row span {
    color: var(--text-soft);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.settings-scope__row strong {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.provider-status-card,
.onboarding-item,
.deployment-mini {
    display: grid;
    gap: 7px;
    padding: 12px 13px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.provider-status-card__top,
.deployment-mini__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.provider-status-card h4,
.onboarding-item h4,
.deployment-mini h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.provider-status-card p,
.onboarding-item p,
.deployment-mini p {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.6;
}

.provider-status-card__meta,
.deployment-mini__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.provider-status-card__meta span,
.deployment-mini__meta span {
    color: var(--text-soft);
    font-size: 10.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.onboarding-item {
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 9px 10px;
}

.onboarding-item__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.07);
}

.onboarding-item--success .onboarding-item__icon {
    color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.onboarding-item--warning .onboarding-item__icon {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
}

.onboarding-item--danger .onboarding-item__icon {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
}

.deployment-mini a {
    color: var(--accent);
    font-size: 12px;
    line-height: 1.55;
    word-break: break-word;
    text-decoration: none;
}

.deployment-mini a:hover {
    color: var(--accent-strong);
    text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────
   STAGE ROUTING
───────────────────────────────────────────────────────── */
.stage-routing {
    display: grid;
    gap: 12px;
}

.stage-routing__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-section {
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.055);
    background: var(--bg-subtle);
}

.form-section__title,
.stage-routing__title {
    margin-bottom: 12px;
}

.form-section__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.config-form {
    display: grid;
    gap: 14px;
}

/* ─────────────────────────────────────────────────────────
   IMPORT UPLOAD
───────────────────────────────────────────────────────── */
.import-upload {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.065);
    background: rgba(255, 255, 255, 0.016);
}

.import-upload__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.import-upload__head h4 {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.import-upload__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.import-upload__note {
    max-width: none;
    margin: 0;
    text-align: left;
}

.import-upload-dropzone {
    display: grid;
    gap: 5px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(74, 222, 128, 0.22);
    background: rgba(74, 222, 128, 0.03);
    color: var(--text-soft);
    font-size: 12.5px;
    line-height: 1.6;
    text-align: center;
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease, transform 160ms ease;
}

.import-upload-dropzone strong {
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
}

.import-upload-dropzone.is-drag-active {
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(74, 222, 128, 0.08);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.06);
    transform: scale(1.005);
}

.import-upload-list {
    display: grid;
    gap: 8px;
}

.import-upload-empty,
.import-upload-item {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
}

.import-upload-empty {
    padding: 12px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
}

.import-upload-item {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.import-upload-item__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.import-upload-item__title {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
}

.import-upload-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.5;
}

.import-upload-item__meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
}

.import-upload-item__remove {
    align-self: start;
}

/* ─────────────────────────────────────────────────────────
   STATUS COLOR CLASSES
───────────────────────────────────────────────────────── */
.pill-success {
    color: var(--success);
}

.pill-warning {
    color: var(--warning);
}

.pill-danger {
    color: var(--danger);
}

/* ─────────────────────────────────────────────────────────
   USERS LIST
───────────────────────────────────────────────────────── */
.users-list {
    display: grid;
    gap: 14px;
}

.user-card__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.user-card__grid label {
    display: grid;
    gap: 6px;
}

.user-card__grid span {
    font-size: 11.5px;
    color: var(--muted);
}

.user-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.toggle--compact {
    gap: 8px;
    padding: 0;
    border: none;
    background: transparent;
}

.toggle--compact span {
    font-size: 12px;
}

/* ─────────────────────────────────────────────────────────
   AUTH PAGE
───────────────────────────────────────────────────────── */
.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-shell {
    position: relative;
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    gap: 16px;
}

.auth-card,
.auth-aside {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 28px;
}

.auth-card::before,
.auth-aside::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.auth-kicker {
    display: inline-flex;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.auth-title {
    margin: 12px 0 9px;
    font-size: clamp(32px, 4vw, 50px);
    line-height: 0.97;
    letter-spacing: -0.055em;
    font-weight: 800;
}

.auth-copy,
.auth-points {
    color: var(--muted);
    line-height: 1.7;
}

.auth-points {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.auth-points strong {
    display: block;
    margin-bottom: 3px;
    color: var(--text);
    font-size: 13.5px;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form label {
    display: grid;
    gap: 6px;
}

.auth-form span {
    color: var(--muted);
    font-size: 12px;
}

.auth-error {
    margin-bottom: 14px;
}

/* ─────────────────────────────────────────────────────────
   SIDEBAR FOOTER
───────────────────────────────────────────────────────── */
.sidebar-footer__label {
    margin-bottom: 5px;
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────── */
@media (max-width: 1360px) {
    .app-shell {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .overview-shell,
    .pipeline-shell,
    .access-shell,
    .settings-shell,
    .settings-workspace-form {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

    .sidebar {
        position: static;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .metrics-grid,
    .ahrefs-summary,
    .ahrefs-insights,
    .ahrefs-signal-overview,
    .site-grid,
    .site-group__grid,
    .site-card__facts,
    .form-section__grid,
    .stage-routing__grid,
    .user-card__grid,
    .idea-card__form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .idea-toolbar {
        flex-direction: column;
    }

    .idea-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .idea-toolbar__actions {
        justify-content: flex-start;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .shell {
        padding: 12px;
    }

    .topbar-copy__row,
    .card-head,
    .site-group__header,
    .form-actions,
    .provider-status-card__top,
    .deployment-mini__top,
    .settings-scope__row,
    .topbar-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-head__side {
        width: 100%;
        justify-items: stretch;
    }

    .card-note {
        max-width: none;
        text-align: left;
    }

    .settings-scope__row strong {
        text-align: left;
    }

    .run-form,
    .metrics-grid,
    .ahrefs-summary,
    .ahrefs-insights,
    .ahrefs-signal-overview,
    .site-grid,
    .site-group__grid,
    .site-card__facts,
    .form-section__grid,
    .stage-routing__grid,
    .user-card__grid,
    .idea-card__form {
        grid-template-columns: 1fr;
    }

    .site-card__stable-url-top {
        align-items: flex-start;
    }

    .run-form__wide,
    .toggle,
    .run-form__hint,
    .run-form__status,
    .idea-card__wide,
    .import-form__wide {
        grid-column: span 1;
    }

    .import-upload__head,
    .import-upload-item__top {
        flex-direction: column;
    }

    .import-upload__actions {
        justify-content: flex-start;
    }

    .panel-scroll,
    .panel-scroll--compact,
    .panel-scroll--tall {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .overview-shell,
    .pipeline-shell,
    .access-shell,
    .settings-shell,
    .settings-workspace-form {
        grid-template-columns: 1fr;
    }

.idea-controls {
    grid-template-columns: 1fr;
}
}

.growth-shell {
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
}

.growth-transfer-shell {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.growth-transfer-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(56, 189, 248, 0.16);
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.06), rgba(56, 189, 248, 0.03));
}

.growth-transfer-card__copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.growth-transfer-card__title {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.growth-transfer-card__note {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.55;
}

.growth-transfer-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.card--growth-affiliate,
.card--growth-content,
.card--growth-jobs {
    min-width: 0;
}

.card--growth-jobs {
    grid-column: 1 / -1;
}

.growth-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

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

.growth-config-form {
    display: grid;
    gap: 18px;
}

.growth-section {
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(131, 152, 210, 0.1);
    background: rgba(255, 255, 255, 0.018);
}

.growth-site-picker {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.growth-site-picker__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.growth-site-picker__head .card-note {
    max-width: 520px;
}

.growth-site-picker__count {
    flex-shrink: 0;
    min-width: 92px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(127, 151, 206, 0.18);
    background: rgba(255, 255, 255, 0.03);
    color: var(--accent-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
}

.growth-site-picker__toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.growth-site-picker__toolbar input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
}

.growth-site-picker__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.button--small {
    min-height: 38px;
    padding: 9px 14px;
    font-size: 12px;
}

.growth-site-picker__list {
    display: grid;
    gap: 10px;
    min-height: 260px;
    max-height: 360px;
    overflow: auto;
    padding: 4px 6px 4px 0;
}

.growth-site-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(131, 152, 210, 0.12);
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
    cursor: pointer;
    min-width: 0;
}

.growth-site-option:hover {
    border-color: rgba(149, 218, 122, 0.28);
    background: rgba(255, 255, 255, 0.032);
    transform: translateY(-1px);
}

.growth-site-option--selected {
    border-color: rgba(149, 218, 122, 0.32);
    background: rgba(149, 218, 122, 0.06);
    box-shadow: inset 0 0 0 1px rgba(149, 218, 122, 0.08);
}

.growth-site-option__checkbox {
    width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    min-width: 18px !important;
    margin: 3px 0 0 !important;
    padding: 0 !important;
    border-radius: 6px;
    accent-color: var(--accent);
    justify-self: start;
}

.growth-site-option__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.growth-site-option__body,
.growth-site-option__identity {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.growth-site-option__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.growth-site-option__slug {
    color: var(--text-muted);
    font-size: 12px;
    word-break: break-all;
}

.growth-site-option__target {
    flex-shrink: 0;
}

.growth-site-option__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.growth-site-option__meta span {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1;
}

.growth-site-option__empty {
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed rgba(131, 152, 210, 0.18);
    color: var(--text-muted);
    text-align: center;
}

.growth-settings-block {
    display: grid !important;
    gap: 12px !important;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(131, 152, 210, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.growth-settings-block > small {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.growth-field {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(131, 152, 210, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.growth-field--wide {
    padding: 16px;
}

.growth-field--compact input[type="number"] {
    max-width: 160px;
}

.growth-post-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.growth-post-controls .toggle {
    height: 100%;
}

.form-section__span-2 {
    grid-column: span 2;
}

.growth-jobs-list {
    display: grid;
    gap: 14px;
}

.growth-job-card {
    display: grid;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(131, 152, 210, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.growth-job-card__top,
.growth-job-result__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.growth-job-meta,
.growth-job-result__meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 12px;
}

.growth-job-results {
    display: grid;
    gap: 10px;
}

.growth-job-result {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(131, 152, 210, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.growth-job-result__summary {
    color: var(--text-muted);
    font-size: 13px;
}

.growth-job-result__summary code {
    font-size: 12px;
}

@media (max-width: 1380px) {
    .growth-shell {
        grid-template-columns: 1fr;
    }

    .card--growth-jobs {
        grid-column: span 1;
    }
}

@media (max-width: 980px) {
    .growth-shell,
    .checkbox-grid,
    .growth-form-grid,
    .growth-post-controls {
        grid-template-columns: 1fr;
    }

    .growth-site-picker__toolbar,
    .growth-site-picker__head,
    .growth-site-option__top {
        grid-template-columns: 1fr;
        display: grid;
    }

    .card--growth-jobs,
    .form-section__span-2 {
        grid-column: span 1;
    }

    .growth-field--compact input[type="number"] {
        max-width: none;
    }
}
