:root {
    --navy-950: #07111d;
    --navy-900: #0b1726;
    --navy-800: #12233a;
    --navy-700: #1d3552;
    --green-500: #27d17f;
    --green-600: #17b86b;
    --green-100: #dcf9e9;
    --cream: #f7f7f3;
    --surface: #ffffff;
    --slate-700: #3b4a5d;
    --slate-500: #68778a;
    --slate-300: #cdd5df;
    --slate-200: #e2e7ed;
    --slate-100: #edf1f4;
    --danger: #c94d59;
    --warning: #b87919;
    --shadow: 0 18px 50px rgba(8, 22, 38, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--navy-900); background: var(--cream); }
body { margin: 0; min-height: 100vh; background: var(--cream); }
a { color: inherit; }
button, input { font: inherit; }

.app-frame { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 30px 22px 24px; color: #fff; background: linear-gradient(155deg, var(--navy-950), var(--navy-900) 60%, #0d2631); overflow-x: hidden; overflow-y: auto; }
.sidebar::after { content: ""; position: absolute; width: 230px; height: 230px; right: -130px; bottom: 70px; border: 1px solid rgba(39, 209, 127, .18); transform: rotate(45deg); }
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-logo { display: block; width: auto; max-width: 100%; height: auto; object-fit: contain; }
.brand-logo-sidebar { width: 190px; }
.brand-logo-mobile { width: 105px; max-height: 54px; }
.brand-logo-login { width: min(390px, 72vw); }
.side-nav { position: relative; z-index: 1; display: grid; gap: 8px; margin-top: 30px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 15px; border-radius: 12px; color: #aab5c3; text-decoration: none; font-weight: 650; font-size: 14px; transition: .18s ease; }
.side-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.side-nav a.active { color: #fff; background: rgba(39, 209, 127, .13); box-shadow: inset 3px 0 var(--green-500); }
.nav-icon { width: 22px; color: var(--green-500); font-size: 19px; text-align: center; }
.sidebar-footer { position: relative; z-index: 1; margin-top: auto; padding: 18px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; background: rgba(255, 255, 255, .035); }
.sidebar-footer strong { display: block; margin-top: 6px; font-size: 13px; line-height: 1.4; }
.eyebrow { color: var(--slate-500); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.sidebar .eyebrow { color: #75869a; }
.logout-button { margin-top: 15px; padding: 0; border: 0; background: transparent; color: #aab5c3; font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.main-content { min-width: 0; }
.content-wrap { max-width: 1460px; margin: 0 auto; padding: 42px 44px 60px; }
.topbar { display: flex; justify-content: space-between; gap: 30px; align-items: flex-start; margin-bottom: 30px; }
.topbar h1 { margin: 6px 0 0; font-size: clamp(28px, 3vw, 42px); line-height: 1.08; letter-spacing: -.045em; }
.page-intro { max-width: 650px; margin: 10px 0 0; color: var(--slate-500); font-size: 15px; line-height: 1.55; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--slate-200); border-radius: 30px; background: rgba(255, 255, 255, .75); }
.user-chip > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--navy-800); color: #fff; font-weight: 800; }
.user-chip div { display: grid; }
.user-chip small { color: var(--slate-500); font-size: 9px; }
.user-chip strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.mobile-header { display: none; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card, .panel { border: 1px solid rgba(205, 213, 223, .8); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-card { position: relative; min-height: 154px; padding: 23px; overflow: hidden; }
.metric-card > span { color: var(--slate-500); font-size: 12px; font-weight: 700; }
.metric-card > strong { display: block; margin: 14px 0 7px; color: var(--navy-900); font-size: 36px; line-height: 1; letter-spacing: -.05em; }
.metric-card > small { color: var(--slate-500); font-size: 11px; }
.accent-card::after { content: "↗"; position: absolute; right: 18px; top: 16px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--green-100); color: var(--green-600); font-weight: 900; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); gap: 18px; margin-bottom: 18px; }
.panel { padding: 25px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.panel-heading h2, .panel h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.025em; }
.panel-heading a { color: var(--green-600); font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.recommendation-feature h3 { max-width: 700px; margin: 16px 0 8px; font-size: 22px; letter-spacing: -.025em; }
.recommendation-feature p { max-width: 780px; color: var(--slate-500); line-height: 1.6; }
.recommendation-feature small { color: var(--slate-500); }
.run-panel { display: flex; flex-direction: column; align-items: flex-start; background: var(--navy-900); color: #fff; }
.run-panel .eyebrow { color: var(--green-500); }
.run-panel h2 { font-size: 16px; }
.run-panel .run-date { margin-top: auto; padding-top: 34px; font-size: 24px; }
.run-panel > span:not(.eyebrow), .run-panel p { margin-top: 7px; color: #9cabbc; font-size: 12px; line-height: 1.5; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-heading { padding: 25px 25px 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 13px 18px; border-top: 1px solid var(--slate-200); border-bottom: 1px solid var(--slate-200); background: #f9fafb; color: var(--slate-500); font-size: 9px; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 17px 18px; border-bottom: 1px solid var(--slate-100); color: var(--slate-700); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td strong { color: var(--navy-900); font-size: 12px; }
.rank-value { color: var(--navy-900) !important; font-weight: 850; }
.rank-value.not-found { color: var(--slate-500) !important; font-size: 11px; }
.movement, .type-pill, .status { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 20px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.movement-improved, .movement-newly_found { color: #087949; background: var(--green-100); }
.movement-declined { color: var(--danger); background: #fdebed; }
.movement-unchanged, .movement-no_data { color: var(--slate-500); background: var(--slate-100); }
.movement-not_found { color: var(--warning); background: #fff4dc; }
.type-pill { color: var(--navy-700); background: #eaf0f7; font-weight: 700; }
.status { color: var(--navy-700); background: var(--slate-100); text-transform: uppercase; letter-spacing: .06em; }
.status-new, .status-accepted, .status-completed { color: #087949; background: var(--green-100); }
.status-rejected, .status-superseded { color: var(--slate-500); background: var(--slate-100); }
.inline-empty { padding: 30px; color: var(--slate-500); text-align: center; }

.empty-state { display: grid; justify-items: center; padding: 58px 24px; text-align: center; }
.empty-state .empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 14px; background: var(--green-100); color: var(--green-600); font-size: 22px; font-weight: 900; }
.empty-state h2, .empty-state h3 { margin: 4px 0 6px; }
.empty-state p { max-width: 590px; margin: 0; color: var(--slate-500); line-height: 1.6; }
.compact-empty { justify-items: start; padding: 15px 0 5px; text-align: left; }
.compact-empty .empty-icon { width: 38px; height: 38px; font-size: 17px; }
.compact-empty h3 { font-size: 17px; }
.large-empty { min-height: 370px; align-content: center; }
.large-empty code { margin-top: 20px; padding: 10px 14px; border-radius: 8px; background: var(--navy-900); color: var(--green-500); }
.history-panel { margin-top: 18px; }
.history-controls, .trend-panel { margin-top: 18px; }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.filter-grid label { display: grid; gap: 7px; color: var(--slate-500); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.filter-grid input, .filter-grid select { width: 100%; padding: 11px 12px; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--surface); color: var(--navy-900); font: inherit; text-transform: none; }
.filter-actions { display: flex; align-items: end; gap: 16px; }
.button-primary { padding: 12px 16px; border: 0; border-radius: 10px; background: var(--green-500); color: var(--navy-950); cursor: pointer; font-weight: 850; }
.table-panel > .panel-heading a.button-primary { color: #000; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--slate-500); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.legend-organic { background: var(--green-500); }
.legend-local { background: #4f77c8; }
.trend-wrap { overflow-x: auto; padding-bottom: 6px; }
.trend-chart { width: 100%; min-width: 680px; display: block; }
.chart-axis { stroke: #718096; stroke-width: 1.5; }
.chart-grid { stroke: #dce3e8; stroke-width: 1; }
.not-found-axis { stroke: #9aa8b3; stroke-dasharray: 5 5; }
.chart-label { fill: var(--slate-500); font-size: 12px; }
.trend-line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.trend-organic { stroke: var(--green-500); }
.trend-local { stroke: #4f77c8; }
.trend-point { stroke: var(--surface); stroke-width: 2; }
.point-organic { fill: var(--green-500); }
.point-local { fill: #4f77c8; }
.not-found-point { font-size: 18px; font-weight: 900; text-anchor: middle; }
.organic-not-found { fill: var(--green-600); }
.local-not-found { fill: #4f77c8; }
.record-range { margin: 5px 0 0; color: var(--slate-500); font-size: 11px; }
.history-table { min-width: 1375px; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 16px 22px; border-top: 1px solid var(--slate-100); color: var(--slate-500); font-size: 12px; }
.pagination a { color: var(--green-600); font-weight: 750; text-decoration: none; }
.pagination a:last-child { text-align: right; }

.recommendation-list { display: grid; gap: 16px; }
.recommendation-card { padding: 28px; }
.recommendation-meta { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.recommendation-meta time { color: var(--slate-500); font-size: 11px; }
.recommendation-card h2 { margin-top: 18px; }
.recommendation-action { color: var(--slate-700); line-height: 1.65; }
.rationale { margin-top: 20px; padding: 18px; border-left: 3px solid var(--green-500); border-radius: 0 10px 10px 0; background: #f6faf8; }
.rationale strong { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.rationale p { margin: 7px 0 0; color: var(--slate-500); line-height: 1.6; }
.recommendation-card footer { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--slate-100); color: var(--slate-500); font-size: 11px; }
.evidence-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.evidence-grid > div { padding: 14px; border-radius: 10px; background: var(--slate-100); }
.evidence-grid strong { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.evidence-grid p { margin: 6px 0 0; color: var(--slate-700); font-size: 12px; }
.action-controls, .action-controls form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.action-controls input { min-width: 220px; padding: 10px; border: 1px solid var(--slate-200); border-radius: 9px; }
.message-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.message { padding: 12px 16px; border: 1px solid var(--slate-200); border-radius: 10px; background: #fff; }
.message-success { border-color: var(--green-500); background: #f2fbf7; }
.message-error { border-color: #d48a8a; background: #fff5f5; }
.workflow-controls { padding: 24px; margin-bottom: 18px; }
.workflow-control-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.workflow-control-grid form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--slate-200); border-radius: 10px; }
.workflow-control-grid h3, .workflow-control-grid p { margin: 0; }
.workflow-control-grid label { display: grid; gap: 6px; font-size: 12px; }
.source-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.source-summary > div { padding: 16px; border: 1px solid var(--slate-200); border-radius: 10px; overflow-wrap: anywhere; }
.source-summary p, .source-summary small { display: block; margin: 7px 0; }
.setup-panel { padding: 24px; }
.wrapped-reference, .wrapped-reference a { overflow-wrap: anywhere; word-break: break-word; }
.import-help { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--slate-200); border-radius: 10px; }
.import-help summary { cursor: pointer; font-weight: 750; color: var(--navy-700); }
.import-help ol { margin: 12px 0; padding-left: 22px; }
.import-help li { margin: 7px 0; line-height: 1.5; }
.setup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.setup-field { display: grid; gap: 7px; color: var(--slate-700); font-size: 12px; }
.setup-field.wide { grid-column: 1 / -1; }
.setup-field input, .setup-field select, .setup-field textarea { width: 100%; padding: 11px; border: 1px solid var(--slate-200); border-radius: 9px; background: #fff; }
.setup-field textarea { min-height: 90px; resize: vertical; }
.field-error { color: #a33; }
@media (max-width: 900px) { .workflow-control-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .setup-grid { grid-template-columns: 1fr; } .setup-field.wide { grid-column: auto; } }
.failure-summary { padding: 24px; border-left: 4px solid #b04a4a; }
.debug-details { margin-top: 18px; padding: 14px; border: 1px solid var(--slate-200); border-radius: 10px; }
.debug-details summary { cursor: pointer; font-weight: 750; }
.debug-details dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; }
.debug-details dt { font-weight: 750; }
.debug-details dd { margin: 0; overflow-wrap: anywhere; }
.pipeline { display: grid; gap: 10px; }
.pipeline-stage { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 12px; border-left: 3px solid var(--slate-200); }
.pipeline-stage strong, .pipeline-stage small { display: block; }
.pipeline-stage small { margin-top: 3px; color: var(--slate-500); }
.pipeline-stage p { margin: 5px 0 0; }
.pipeline-completed { border-color: var(--green-500); }
.pipeline-failed { border-color: #b04a4a; background: #fff7f7; }
.pipeline-skipped { opacity: .65; }
.active-run-banner { position: sticky; top: 10px; z-index: 20; display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 15px 18px; border: 1px solid #d4a72c; border-radius: 12px; background: #fff9e8; box-shadow: 0 8px 24px rgba(11, 23, 38, .08); }
.active-run-banner p { margin: 5px 0 0; }
.active-run-banner a { align-self: center; white-space: nowrap; }
.run-submission-notice { margin: 10px 0 0; padding: 10px; border-radius: 8px; background: #fff9e8; }
.run-initiation-button:disabled { cursor: not-allowed; opacity: .65; }
.keyword-manager { padding: 24px; }
.keyword-add-form { display: flex; align-items: end; gap: 12px; }
.keyword-add-form label { flex: 1; display: grid; gap: 7px; color: var(--slate-700); font-size: 12px; }
.keyword-add-form input { width: 100%; padding: 11px; border: 1px solid var(--slate-200); border-radius: 9px; }
.keyword-card-list { display: grid; gap: 12px; margin-top: 16px; }
.keyword-card { display: flex; justify-content: space-between; gap: 20px; padding: 20px 24px; }
.keyword-card h2, .keyword-card p { margin: 7px 0; }
.keyword-card small { display: block; color: var(--slate-500); }
.keyword-inactive { opacity: .78; }
.keyword-pill-list { display: flex; flex-wrap: wrap; gap: 10px; }
.keyword-pill-list a { display: grid; gap: 4px; padding: 11px 13px; border: 1px solid var(--slate-200); border-radius: 9px; color: inherit; text-decoration: none; }
.keyword-pill-list span, .inactive-label, .limit-note { color: var(--slate-500); font-size: 11px; }
.inactive-label { display: block; margin-top: 3px; }
@media (max-width: 700px) { .keyword-add-form, .keyword-card { align-items: stretch; flex-direction: column; } }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f5f8f6; }
.work-tabs { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px; }
.work-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; border: 1px solid var(--slate-200); border-radius: 10px; background: #fff; color: var(--slate-700); font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.work-tabs a.active { border-color: var(--green-500); background: var(--green-100); color: #087949; }
.work-tabs span { min-width: 20px; padding: 2px 6px; border-radius: 12px; background: rgba(11, 23, 38, .08); text-align: center; }
.work-list { display: grid; gap: 14px; }
.work-card { padding: 22px 24px; }
.work-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.work-card-heading h2 { margin-top: 12px; }
.work-priority { margin-left: 8px; color: var(--slate-500); font-size: 11px; }
.next-action { color: var(--green-600); font-size: 12px; white-space: nowrap; }
.work-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.work-summary div { display: grid; gap: 5px; padding: 11px; border-radius: 9px; background: var(--slate-100); }
.work-summary strong { color: var(--slate-500); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.work-summary span { font-size: 12px; }
.work-details { margin-top: 15px; border-top: 1px solid var(--slate-100); padding-top: 13px; }
.work-details summary { cursor: pointer; color: var(--navy-700); font-size: 12px; font-weight: 750; }
.work-detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; padding-top: 12px; }
.work-detail-grid h3 { margin: 12px 0 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.work-detail-grid p { margin: 0; color: var(--slate-500); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
@media (max-width: 780px) { .work-summary { grid-template-columns: repeat(2, 1fr); } .work-card-heading { display: block; } .next-action { display: block; margin-top: 8px; } }
@media (max-width: 520px) { .work-summary, .work-detail-grid { grid-template-columns: 1fr; } }
.timeline { display: grid; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 150px 1fr; gap: 20px; }
.timeline-item time { color: var(--slate-500); font-size: 11px; }
.timeline-item h2 { margin-top: 8px; }

.login-page { background: var(--navy-950); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr); }
.login-brand-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(38px, 6vw, 86px); overflow: hidden; color: #fff; background: linear-gradient(145deg, #07111d 10%, #0c1d30 65%, #0b302c); }
.login-brand-panel::after { content: ""; position: absolute; width: 460px; height: 460px; right: -270px; bottom: -160px; border: 1px solid rgba(39, 209, 127, .2); border-radius: 80px; transform: rotate(45deg); }
.login-brand { position: relative; z-index: 2; }
.login-brand-panel .brand-logo { filter: drop-shadow(0 18px 36px rgba(0, 0, 0, .22)); }
.login-tagline { max-width: 540px; margin: 110px 0 14px; font-size: clamp(38px, 5vw, 68px); font-weight: 850; line-height: .98; letter-spacing: -.06em; }
.login-description { max-width: 430px; color: #9eadbd; font-size: 16px; line-height: 1.65; }
.growth-lines { position: absolute; right: 12%; bottom: 9%; display: flex; align-items: flex-end; gap: 10px; opacity: .34; transform: skew(-12deg); }
.growth-lines i { width: 14px; height: 40px; background: var(--green-500); border-radius: 3px; }
.growth-lines i:nth-child(2) { height: 70px; }.growth-lines i:nth-child(3) { height: 108px; }.growth-lines i:nth-child(4) { height: 155px; }
.login-form-panel { display: grid; place-items: center; padding: 35px; background: var(--cream); }
.login-card { width: min(430px, 100%); }
.login-card h1 { margin: 8px 0; font-size: 38px; letter-spacing: -.045em; }
.login-card > p { margin: 0 0 28px; color: var(--slate-500); }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 9px; color: var(--navy-800); font-size: 11px; font-weight: 800; }
.login-form input { width: 100%; height: 49px; padding: 0 14px; border: 1px solid var(--slate-300); border-radius: 10px; background: #fff; color: var(--navy-900); outline: none; }
.login-form input:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(39, 209, 127, .14); }
.primary-button { height: 51px; display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding: 0 17px; border: 0; border-radius: 10px; background: var(--green-500); color: var(--navy-950); font-weight: 850; cursor: pointer; box-shadow: 0 12px 25px rgba(39, 209, 127, .2); }
.form-alert { margin-bottom: 18px; padding: 12px 14px; border-radius: 9px; background: #fdebed; color: #962e3a; font-size: 12px; line-height: 1.5; }
.security-note { display: block; margin-top: 18px; color: var(--slate-500); text-align: center; }

@media (max-width: 1080px) {
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-wrap { padding-inline: 28px; }
    .sidebar { width: 235px; }
    .app-frame { grid-template-columns: 235px minmax(0, 1fr); }
}

@media (max-width: 780px) {
    .app-frame { display: block; }
    .sidebar { display: none; }
    .mobile-header { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 10px 18px; background: var(--navy-950); color: #fff; }
    .brand-logo-mobile { width: 92px; max-height: 48px; }
    .mobile-menu { position: relative; }
    .mobile-menu summary { padding: 9px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; cursor: pointer; font-size: 12px; list-style: none; }
    .mobile-menu-panel { position: absolute; right: 0; top: 46px; width: 210px; display: grid; padding: 8px; border: 1px solid var(--slate-200); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
    .mobile-menu-panel a, .mobile-menu-panel button { display: block; width: 100%; padding: 11px; border: 0; border-radius: 7px; background: transparent; color: var(--navy-900); font-size: 13px; text-align: left; text-decoration: none; }
    .mobile-menu-panel a:hover, .mobile-menu-panel button:hover { background: var(--slate-100); }
    .content-wrap { padding: 28px 17px 45px; }
    .topbar { align-items: center; }
    .user-chip div { display: none; }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .metric-card { min-height: 138px; padding: 18px; }
    .metric-card > strong { font-size: 30px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .run-panel .run-date { margin-top: 18px; padding-top: 0; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { min-height: 280px; padding: 32px; }
    .brand-logo-login { width: min(300px, 78vw); }
    .login-tagline { margin-top: 65px; font-size: 44px; }
    .login-description { font-size: 14px; }
    .growth-lines { display: none; }
    .login-form-panel { padding: 44px 24px; }
    .filter-grid { grid-template-columns: 1fr; }
    .evidence-grid { grid-template-columns: 1fr; }
    .chart-legend { margin-top: 10px; }
}

@media (max-width: 620px) {
    .topbar { align-items: flex-start; }
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .metric-card { min-height: 126px; }
    .metric-card > small { display: none; }
    .panel { padding: 20px; }
    .table-panel { padding: 0; }
    .table-panel > .panel-heading { padding: 20px 20px 0; }
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { padding: 14px 18px; border-top: 1px solid var(--slate-200); }
    .data-table td { display: grid; grid-template-columns: 115px 1fr; gap: 12px; padding: 7px 0; border: 0; }
    .data-table td::before { content: attr(data-label); color: var(--slate-500); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
    .inline-empty { display: block !important; padding: 22px 0 !important; }
}
/* Keyword opportunities */
.opportunity-summary { margin-bottom: 1rem; }
.opportunity-list { display: grid; gap: .85rem; }
.opportunity-card { border: 1px solid var(--border, #d8dee8); border-radius: 12px; padding: 1rem; display: grid; gap: .9rem; background: #fff; }
.opportunity-card-main { display: flex; gap: .75rem; align-items: flex-start; }
.opportunity-card-main h3 { margin: 0 0 .35rem; }
.opportunity-card-main h3 span { color: #526173; font-weight: 600; }
.opportunity-meta { color: #526173; }
.opportunity-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.opportunity-actions form { display: flex; gap: .4rem; align-items: center; margin: 0; }
.opportunity-actions .button-secondary { min-height: 38px; padding: 8px 12px; border: 1px solid #b9d5ee; border-radius: 9px; background: #e8f3fc; color: var(--navy-900); cursor: pointer; font-weight: 750; }
.opportunity-actions .button-secondary:hover { background: #d8eafa; border-color: #9fc4e5; }
.status-pill { border-radius: 999px; background: #e9f0f8; padding: .3rem .65rem; font-size: .8rem; font-weight: 700; }
.evidence-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .8rem; }
.evidence-grid dt { font-weight: 700; }
@media (max-width: 700px) { .opportunity-actions, .opportunity-actions form { align-items: stretch; flex-direction: column; } }

/* Geographic research */
.workflow-steps { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.workflow-steps li { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--slate-200); border-radius: 999px; background: var(--surface); color: var(--slate-500); font-size: 11px; font-weight: 750; }
.workflow-steps li > span { display: inline-grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; background: var(--slate-100); color: var(--slate-700); }
.workflow-steps li.is-complete { border-color: #b7dfca; color: #087949; }
.workflow-steps li.is-current { border-color: var(--green-500); background: var(--green-100); color: #087949; }
.workflow-steps li.is-current > span, .workflow-steps li.is-complete > span { background: var(--green-500); color: var(--navy-950); }
.geographic-builder { display: grid; gap: 18px; }
.geographic-workspace { display: grid; grid-template-columns: minmax(300px, 35%) minmax(0, 65%); gap: 24px; align-items: start; }
.geographic-controls, .geographic-map-column { display: grid; gap: 16px; min-width: 0; }
.map-instruction { margin: 0; color: var(--slate-700); font-size: 12px; line-height: 1.45; }
.map-instruction:focus { outline: 3px solid #1677c8; outline-offset: 4px; border-radius: 4px; }
.geographic-map { width: 100%; height: clamp(520px, 62vh, 620px); border: 1px solid var(--slate-200); border-radius: 14px; background: var(--slate-100); overflow: hidden; }
.geometry-invalid .geographic-map { border: 3px solid #b33; }
.geometry-errors { padding: 11px 13px; border-left: 3px solid #b33; background: #fff5f5; color: #8a2929; font-size: 12px; font-weight: 750; }
.geometry-errors[hidden] { display: none; }
.geometry-errors .errorlist { margin: 0; padding: 0; list-style: none; }
.geographic-map-detail { height: clamp(480px, 58vh, 580px); }
/* Leaflet owns the dimensions and positioning of its internal images and controls. */
.geographic-map .leaflet-tile,
.geographic-map .leaflet-marker-icon,
.geographic-map .leaflet-marker-shadow { width: auto; max-width: none !important; max-height: none !important; height: auto; object-fit: fill; border-radius: 0; }
.geographic-map .leaflet-control a { color: #000; text-decoration: none; }
.geographic-map .leaflet-control a:focus-visible { outline: 3px solid #1677c8; outline-offset: 2px; }
.geographic-map-error { display: grid; place-items: center; padding: 24px; color: #8a2929; text-align: center; }
.location-search { display: grid; gap: 7px; }
.location-search label, .wide-field { color: var(--slate-500); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.location-search > div { display: flex; gap: 8px; }
.location-search input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--slate-200); border-radius: 10px; }
.location-search button, .action-controls button, .geographic-form > button { min-height: 42px; padding: 9px 14px; border: 1px solid var(--slate-300); border-radius: 10px; background: #fff; color: var(--navy-900); cursor: pointer; font-weight: 750; }
.location-search button:disabled, .location-search input:disabled { cursor: not-allowed; opacity: .6; }
.location-search p { min-height: 18px; margin: 0; color: var(--slate-500); font-size: 12px; }
.location-search button[aria-busy="true"] { cursor: wait; }
.geocoder-unavailable { margin: -6px 0 0; padding: 11px 13px; border-left: 3px solid #5c7fa5; background: #f3f7fb; color: var(--slate-700); font-size: 12px; line-height: 1.5; }
.location-search-results { display: grid; gap: 6px; }
.location-search-results button { width: 100%; min-height: 0; padding: 9px 11px; text-align: left; }
.geometry-validation { font-weight: 700; }
.geometry-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin: 0; }
.geometry-summary div { padding: 14px; border-radius: 11px; background: var(--slate-100); }
.geometry-summary dt { margin-bottom: 6px; color: var(--slate-500); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.geometry-summary dd { margin: 0; color: var(--slate-700); font-size: 13px; line-height: 1.45; }
.geometry-summary .status-info { color: #355d82; }
.geometry-summary .status-valid { color: #087949; }
.geometry-summary .status-warning { color: #8a6100; }
.geometry-summary .status-error { color: #a33; }
.geographic-form { display: grid; gap: 16px; }
.geographic-form .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.geographic-form textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--slate-200); border-radius: 10px; resize: vertical; }
.geographic-form details { padding: 12px 14px; border: 1px solid var(--slate-200); border-radius: 10px; }
.geographic-form details summary { cursor: pointer; font-weight: 750; }
.geographic-form details label { display: grid; gap: 7px; margin-top: 12px; }
.geographic-form > .button-primary, .action-controls .button-primary { border: 0; background: var(--green-500); color: var(--navy-950); }
.compact-metric { font-size: 22px !important; line-height: 1.2 !important; }
.evidence-category { margin-top: 14px; }
.evidence-category article { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--slate-100); }
.evidence-category h3 { margin: 0 0 7px; font-size: 15px; }
.evidence-category p { color: var(--slate-700); }
.evidence-category small, .unresearched { color: var(--slate-500); }
@media (max-width: 980px) { .geographic-workspace { grid-template-columns: 1fr; } .geographic-map { height: clamp(420px, 58vh, 520px); } }
@media (max-width: 780px) { .geographic-map { height: clamp(360px, 52vh, 460px); } .geographic-form .filter-grid { grid-template-columns: 1fr; } .workflow-steps { gap: 7px; } .workflow-steps li { padding: 7px 9px; } }

/* Activity Log */
.ranking-schedule-card { display: grid; grid-template-columns: minmax(240px, 1.3fr) minmax(360px, 2fr) auto; gap: 20px; align-items: center; margin-bottom: 18px; border-left: 4px solid #6e91b4; }
.ranking-schedule-card.status-failed, .ranking-schedule-card.status-overdue { border-left-color: #b33; }.ranking-schedule-card.status-partial { border-left-color: #d59b22; }.ranking-schedule-card dl { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 12px; margin: 0; }.ranking-schedule-card dl div { padding: 10px; background: var(--slate-100); border-radius: 8px; }.ranking-schedule-card dt { color: var(--slate-500); font-size: 10px; font-weight: 800; text-transform: uppercase; }.ranking-schedule-card dd { margin: 5px 0 0; font-weight: 700; }.stale-warning { color: #9b2828; font-weight: 750; }.operation-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 14px 0; border-top: 1px solid var(--slate-200); }.operation-row p { margin: 5px 0 0; }
.page-actions { display: flex; justify-content: flex-end; margin: -54px 0 24px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.activity-filters { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 13px; margin-bottom: 20px; padding: 18px; }
.activity-filters label, .activity-form label { display: grid; gap: 6px; color: var(--slate-500); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.activity-filters input, .activity-filters select, .activity-form input, .activity-form select, .activity-form textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--slate-200); border-radius: 9px; background: #fff; color: var(--navy-900); font: inherit; letter-spacing: normal; text-transform: none; }
.activity-list { display: grid; gap: 12px; }
.activity-card { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 22px; padding: 20px 24px; }
.activity-card.is-archived { opacity: .72; }
.activity-date { display: flex; flex-direction: column; color: var(--slate-700); font-weight: 750; }
.activity-date small, .activity-meta { color: var(--slate-500); font-size: 12px; }
.activity-card h2 { margin: 7px 0 5px; font-size: 17px; }.activity-card h2 a { color: var(--navy-900); text-decoration: none; }.activity-card p { margin: 0 0 8px; }
.activity-pills { display: flex; flex-wrap: wrap; gap: 7px; }.type-pill.subdued { background: var(--slate-100); color: var(--slate-700); }.type-pill.warning { background: #fff0c8; color: #765200; }
.measurement-summary { margin-top: 10px; padding: 9px 11px; border-left: 3px solid #6e91b4; background: #f2f7fb; color: var(--slate-700); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }.form-grid .wide { grid-column: 1 / -1; }.featured-field textarea { font-size: 16px; line-height: 1.55; }.form-grid fieldset { padding: 14px; border: 1px solid var(--slate-200); border-radius: 10px; }.form-grid fieldset ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 8px 0 0; padding: 0; list-style: none; }.checkbox-field { display: flex !important; flex-direction: row; align-items: center; }.checkbox-field input { width: auto; }.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 22px; }.form-actions form { margin: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(270px, 1fr); gap: 18px; margin-bottom: 18px; }.compact-timeline { display: grid; gap: 12px; padding-left: 20px; }.compact-timeline time { display: block; color: var(--slate-500); font-size: 12px; }.warning-panel { border-left: 4px solid #d59b22; }.pagination { display: flex; justify-content: center; gap: 15px; margin: 22px 0; }
@media (max-width: 900px) { .activity-filters { grid-template-columns: repeat(2, 1fr); }.detail-grid { grid-template-columns: 1fr; }.page-actions { margin: 0 0 18px; justify-content: flex-start; } }
@media (max-width: 900px) { .ranking-schedule-card { grid-template-columns: 1fr; }.ranking-schedule-card dl { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .activity-filters, .form-grid { grid-template-columns: 1fr; }.form-grid .wide { grid-column: auto; }.activity-card { grid-template-columns: 1fr; gap: 8px; }.activity-date { flex-direction: row; gap: 8px; }.form-grid fieldset ul { grid-template-columns: 1fr; } }

.surface-identity { display: inline-flex; align-items: center; justify-content: center; margin: 4px 20px 16px; padding: 7px 12px; border: 2px solid var(--green-500); border-radius: 7px; color: var(--green-500); font-size: 13px; font-weight: 900; letter-spacing: .16em; }
.surface-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.surface-links a { padding: 7px 10px; border: 1px solid var(--slate-200); border-radius: 8px; background: #fff; color: var(--navy-900); font-size: 12px; font-weight: 750; text-decoration: none; }
.admin-top-actions { display: flex; gap: 16px; align-items: center; }
.admin-health-grid { display: grid; grid-template-columns: repeat(5, minmax(100px, 1fr)); gap: 10px; }
.admin-health-grid div { padding: 12px; border-radius: 9px; background: var(--slate-100); }
.admin-health-grid dt { color: var(--slate-500); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.admin-health-grid dd { margin: 4px 0 0; font-size: 18px; font-weight: 800; }
.mobile-header .surface-identity { margin: 0; }
.mobile-header .surface-links { display: none; }
@media (max-width: 900px) { .admin-top-actions > .surface-links { display: none; }.admin-health-grid { grid-template-columns: repeat(2, 1fr); }.mobile-header .surface-links { display: flex; }.mobile-header { gap: 10px; }.surface-links.compact a { padding: 5px 7px; font-size: 10px; } }

.ranking-progress-panel .panel-heading { align-items: end; }
.ranking-progress-table { min-width: 820px; }
.ranking-progress-table th { white-space: nowrap; }
.ranking-progress-table td { vertical-align: middle; }
.ranking-keyword, .ranking-location { display: block; }
.ranking-keyword { color: var(--navy-900); text-transform: capitalize; }
.ranking-location { margin-top: 4px; color: var(--slate-500); font-size: 11px; }
.ranking-progress-table .rank-value { font-size: 15px; font-weight: 800; white-space: nowrap; }
.ranking-change { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 999px; background: var(--slate-100); color: var(--slate-700); font-size: 11px; font-weight: 800; white-space: nowrap; }
.ranking-change-improved, .ranking-change-newly_found { background: #e0f5e9; color: #087949; }
.ranking-change-declined, .ranking-change-not_found { background: #fff0ed; color: #a33; }
.ranking-change-no_ranking { background: #f0f3f7; color: var(--slate-500); }
.subdued { color: var(--slate-500); }

/* Ops fulfillment shell */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ops-brand { justify-content: center; }
.ops-brand .brand-logo-sidebar { width: 145px; }
.ops-sidebar-head { position: relative; z-index: 1; display: grid; gap: 7px; margin: 6px 0 17px; text-align: center; }
.ops-title { color: var(--green-500); font-size: 20px; font-weight: 950; letter-spacing: .14em; }
.ops-client-name { color: #fff; font-size: 14px; line-height: 1.35; }
.client-switcher select { width: 100%; padding: 8px 28px 8px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 12px; }
.client-switcher option { color: var(--navy-900); }
.ops-sidebar-head + .side-nav { margin-top: 0; }
.workflow-heading { margin: 2px 10px 0; }
.side-nav .workflow-link { min-height: 43px; padding: 5px 10px; gap: 9px; }
.workflow-link > span:last-child { display: grid; line-height: 1.15; }
.workflow-link b { color: #8292a5; font-size: 11px; }
.workflow-link small { margin-top: 3px; color: #718298; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.workflow-state { display: inline-flex; flex: 0 0 25px; width: 25px; height: 25px; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 50%; color: #91a0b1; font-weight: 900; font-size: 12px; }
.state-healthy .workflow-state, .workflow-state.state-healthy { color: #23c77a; }
.state-needs_attention .workflow-state, .workflow-state.state-needs_attention { color: #f0b743; }
.state-in_progress .workflow-state, .workflow-state.state-in_progress { color: #6eb5eb; }
.state-blocked .workflow-state, .state-error .workflow-state, .workflow-state.state-blocked, .workflow-state.state-error { color: #ef7a72; }
.side-nav .state-healthy { opacity: .72; }
.side-nav .state-healthy:hover, .side-nav .state-healthy.active { opacity: 1; }
.signed-in-label { display: block; margin-bottom: 10px; color: #8796a8; }
.ops-health-hero { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; margin-bottom: 18px; padding: 24px 28px; border-left: 5px solid #6e91b4; border-radius: 14px; background: var(--navy-900); color: #fff; }
.ops-health-hero.state-needs_attention { border-left-color: #f0b743; }.ops-health-hero.state-error { border-left-color: #ef7a72; }.ops-health-hero.state-healthy { border-left-color: var(--green-500); }
.ops-health-hero h2 { margin: 5px 0; color: #fff; }.ops-health-hero p { margin: 0; color: #c4cfda; }.ops-health-hero > div:last-child { display: grid; text-align: right; }.ops-health-hero > div:last-child strong { font-size: 34px; }.ops-health-hero a { color: var(--green-500); font-weight: 800; }
.next-action-panel { display: flex; justify-content: space-between; gap: 28px; align-items: center; margin-bottom: 18px; border-left: 4px solid #f0b743; }.next-action-panel h2 { margin: 5px 0; }.next-action-panel p { margin: 5px 0 0; }
.dependency-warning { padding: 9px 12px; border-left: 3px solid #d59b22; background: #fff8e7; color: #765200; font-size: 12px; }
.fulfillment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.fulfillment-card { padding: 17px; border: 1px solid var(--slate-200); border-left: 4px solid #95a2b0; border-radius: 11px; }.fulfillment-card.state-healthy { border-left-color: #23a967; background: #f8fcfa; }.fulfillment-card.state-needs_attention { border-left-color: #d59b22; }.fulfillment-card.state-error, .fulfillment-card.state-blocked { border-left-color: #b33; }.fulfillment-card.state-in_progress { border-left-color: #4188bd; }
.fulfillment-card header { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }.fulfillment-card h3 { margin: 2px 0 0; font-size: 16px; }.fulfillment-card h3 a { color: var(--navy-900); text-decoration: none; }.fulfillment-card header small { color: var(--slate-500); }.fulfillment-card > p { color: var(--slate-700); font-size: 13px; }.fulfillment-card details summary { cursor: pointer; color: var(--slate-500); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.criteria-list { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }.criteria-list li { display: flex; gap: 8px; color: var(--slate-700); font-size: 13px; }.criteria-list .complete span { color: #087949; }.criteria-list .incomplete span { color: #9a6b00; }
.stage-summary { border-left: 4px solid #6e91b4; }.stage-summary.state-needs_attention { border-left-color: #d59b22; }.stage-summary.state-error, .stage-summary.state-blocked { border-left-color: #b33; }.stage-summary.state-healthy { border-left-color: #23a967; }
.admin-org-health { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 18px; border-radius: 11px; background: var(--slate-100); }.admin-org-health h2 { margin: 5px 0; }.admin-org-health p { margin: 0; }.compact-health-row { display: grid; grid-template-columns: repeat(8, minmax(80px,1fr)); gap: 8px; margin: 15px 0; }.compact-health-row a { display: grid; place-items: center; gap: 5px; padding: 10px 5px; border: 1px solid var(--slate-200); border-radius: 8px; color: var(--navy-900); text-align: center; text-decoration: none; }.compact-health-row a > span { font-weight: 900; }.compact-health-row small { font-size: 9px; }.portfolio-table .workflow-state { width: 22px; height: 22px; }
@media (max-width: 900px) { .fulfillment-grid { grid-template-columns: 1fr; }.ops-health-hero, .next-action-panel, .admin-org-health { display: grid; grid-template-columns: 1fr; }.ops-health-hero > div:last-child { text-align: left; }.compact-health-row { grid-template-columns: repeat(4, 1fr); } }
.setup-sections { display: grid; gap: 18px; }.setup-sections fieldset { margin: 0; padding: 18px; border: 1px solid var(--slate-200); border-radius: 12px; }.setup-sections legend { padding: 0 8px; color: var(--navy-900); font-weight: 850; }.setup-sections textarea { min-height: 90px; }.readiness-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 10px; margin: 16px 0; }.readiness-grid div { display: grid; gap: 5px; padding: 14px; border: 1px solid var(--slate-200); border-radius: 10px; }.readiness-grid span { color: var(--slate-500); font-size: 12px; }
