:root {
  --canvas: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f0f3f8;
  --ink: #101828;
  --muted: #667085;
  --line: #e1e7f0;
  --accent: #3157e9;
  --accent-dark: #2144c7;
  --accent-soft: #edf1ff;
  --orange: #f27b2b;
  --green: #247a57;
  --green-soft: #e1f4eb;
  --red: #b54745;
  --shadow: 0 18px 50px rgba(28, 46, 86, 0.08);
  --radius: 18px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.55 var(--font); }
button, input, textarea, select { font: inherit; }
button, a, select, input, textarea { -webkit-tap-highlight-color: transparent; }
button, a { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.app-frame { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: 0 0 248px; min-height: 100vh; padding: 28px 18px 20px; background: #1b261f; color: #eef3ed; display: flex; flex-direction: column; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; padding: 3px 10px 23px; }
.brand-mark { width: 32px; height: 32px; }
.brand-name { font-size: 20px; letter-spacing: -0.05em; font-weight: 750; }
.brand-name span { color: var(--orange); }
.sidebar-intro { display: flex; gap: 8px; align-items: center; color: #9dad9f; font-size: 12px; padding: 0 10px 19px; }
.status-dot { width: 8px; height: 8px; display: inline-block; border-radius: 99px; background: #79bf91; box-shadow: 0 0 0 4px rgba(121, 191, 145, .12); }
.new-research { margin: 0 0 26px; }
.nav-label { color: #7f9183; font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; margin: 0 10px 7px; }
.nav-label-spaced { margin-top: 27px; }
.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-item { width: 100%; color: #b9c5ba; border: 0; background: transparent; display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 10px; text-align: left; font-size: 13px; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: rgba(255,255,255,.08); color: #e6b58e; font-size: 11px; font-weight: 750; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 7px; }
.logout-button { border: 0; background: transparent; color: #93a196; text-align: left; padding: 10px; font-size: 13px; }
.logout-button:hover { color: #fff; }

.main-content { min-width: 0; flex: 1; max-width: 1260px; margin: 0 auto; padding: 38px clamp(24px, 4vw, 62px) 70px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 40px; }
.topbar h1 { font-size: clamp(24px, 3vw, 36px); line-height: 1.12; letter-spacing: -.05em; margin: 5px 0 0; max-width: 700px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.usage-chip { min-width: 142px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 9px 11px; text-align: left; color: var(--ink); display: grid; gap: 2px; box-shadow: 0 5px 20px rgba(30, 39, 31, .03); }
.usage-chip-label, .usage-chip strong { font-size: 11px; }
.usage-chip-label { color: var(--muted); }
.usage-chip strong { font-weight: 750; }
.mini-progress, .progress { background: var(--surface-soft); overflow: hidden; display: block; border-radius: 99px; }
.mini-progress { height: 4px; margin-top: 5px; }
.mini-progress span, .progress span { height: 100%; display: block; background: var(--accent); border-radius: inherit; width: 0; transition: width .35s ease; }
.icon-button { display: none; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .11em; text-transform: uppercase; font-weight: 750; margin: 0; }
.accent-eyebrow { color: var(--accent-dark); }
.muted { color: var(--muted); }
.small-copy { font-size: 12px; }
.page-lead { max-width: 690px; margin-bottom: 28px; }
.page-lead h2, .panel h2 { margin: 5px 0 5px; letter-spacing: -.045em; line-height: 1.15; }
.page-lead h2 { font-size: clamp(25px, 3vw, 38px); }
.page-lead p:last-child { color: var(--muted); margin: 0; max-width: 620px; }

.hero-panel { min-height: 250px; border-radius: 24px; padding: 38px 42px; background: #e6eee6; display: flex; align-items: center; justify-content: space-between; overflow: hidden; position: relative; }
.hero-panel h2 { font-size: clamp(32px, 5vw, 60px); letter-spacing: -.07em; line-height: .98; margin: 10px 0 14px; max-width: 560px; }
.hero-copy { color: #59695c; max-width: 510px; margin: 0; font-size: 16px; }
.hero-signal { width: 215px; height: 170px; align-self: flex-end; position: relative; opacity: .8; }
.hero-signal span { position: absolute; display: block; border: 2px solid #b9d0bc; border-radius: 50%; width: 54px; height: 54px; }
.hero-signal span:nth-child(1) { top: 75px; left: 2px; }
.hero-signal span:nth-child(2) { top: 42px; left: 63px; width: 72px; height: 72px; border-color: #d59b73; }
.hero-signal span:nth-child(3) { top: 0; right: 17px; width: 92px; height: 92px; border-color: #91b99b; }
.hero-signal span:nth-child(4) { right: 0; bottom: 0; width: 48px; height: 48px; border-color: #d59b73; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin: 14px 0 28px; }
.quick-card { text-align: left; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-height: 163px; background: var(--surface); display: flex; flex-direction: column; align-items: flex-start; transition: transform .2s, box-shadow .2s, border-color .2s; }
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c9c8bc; }
.quick-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--accent-dark); background: var(--accent-soft); font-size: 12px; font-weight: 750; margin-bottom: 16px; }
.quick-card strong { font-size: 16px; letter-spacing: -.02em; }
.quick-card span:not(.quick-icon) { font-size: 12px; color: var(--muted); margin-top: 5px; }
.quick-card em { font-style: normal; color: var(--accent-dark); font-size: 12px; font-weight: 700; margin-top: auto; padding-top: 15px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, .9fr); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 23px; box-shadow: 0 4px 22px rgba(30, 39, 31, .025); }
.panel-large { min-height: 290px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-heading h2 { font-size: 18px; }
.text-button { border: 0; background: transparent; color: var(--accent-dark); padding: 4px 0; font-weight: 700; font-size: 12px; }
.text-button:hover { text-decoration: underline; }
.report-list { display: grid; gap: 9px; }
.report-row { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.report-row-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; background: var(--surface-soft); color: var(--accent-dark); font-weight: 750; font-size: 12px; }
.report-row-main { min-width: 0; flex: 1; }
.report-row-main strong, .report-row-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-row-main strong { font-size: 13px; }
.report-row-main span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.report-row-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.domain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 9px; }
.domain-grid .report-row { align-items: flex-start; }
code { font-family: var(--mono); font-size: 10px; color: var(--accent-dark); background: var(--surface-soft); border-radius: 5px; padding: 2px 4px; }
.empty-state { min-height: 125px; display: grid; place-content: center; gap: 5px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state strong { color: var(--ink); }
.skeleton-line { height: 42px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), #f7f7f3, var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-line.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.usage-panel { display: flex; flex-direction: column; }
.usage-ring { width: 150px; height: 150px; border: 12px solid var(--surface-soft); border-top-color: var(--accent); border-right-color: var(--accent); border-radius: 50%; margin: 7px auto 20px; display: grid; place-content: center; text-align: center; transform: rotate(20deg); }
.usage-ring span, .usage-ring small { transform: rotate(-20deg); display: block; }
.usage-ring span { font-size: 29px; font-weight: 750; letter-spacing: -.06em; }
.usage-ring small { color: var(--muted); font-size: 11px; }
.usage-breakdown { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.usage-breakdown div, .safety-list div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.usage-breakdown span, .safety-list span { color: var(--muted); }

.research-form { max-width: 950px; }
label { display: block; color: var(--ink); font-size: 12px; font-weight: 700; margin-bottom: 7px; }
input, textarea, select { width: 100%; color: var(--ink); background: var(--surface); border: 1px solid #d4d5ca; border-radius: 10px; padding: 11px 12px; outline: none; }
textarea { resize: vertical; min-height: 128px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(195, 107, 49, .13); }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-top: 17px; }
.single-control { grid-template-columns: minmax(180px, 240px); }
.toggle-field { align-self: end; padding: 11px 0 1px; }
.toggle-field label { display: flex; align-items: center; gap: 7px; margin: 0; }
.toggle-field input { width: 15px; height: 15px; accent-color: var(--accent); }
.toggle-field small { display: block; color: var(--muted); font-size: 10px; margin: 4px 0 0 23px; }
.form-actions, .input-action, .modal-actions, .secret-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-actions { margin-top: 22px; }
.form-note { color: var(--muted); font-size: 11px; margin: 0; }
.compact-form { max-width: 720px; }
.input-action input { flex: 1; }
.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; font-size: 12px; font-weight: 750; white-space: nowrap; transition: transform .2s, background .2s, border-color .2s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 7px 18px rgba(195, 107, 49, .18); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.button-secondary:hover { background: var(--surface-soft); }
.button-danger { color: #fff; background: var(--red); border-color: var(--red); }
.button-wide { width: 100%; }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.inline-status { max-width: 950px; padding: 11px 13px; border-radius: 10px; color: var(--muted); background: var(--surface-soft); font-size: 12px; margin: 14px 0; }
.inline-status.error { color: var(--red); background: #fae9e6; }
.inline-status.success { color: var(--green); background: var(--green-soft); }
.provider-status { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface-soft); font-size: 11px; }
.provider-status.ready { color: var(--green); border-color: #b7dec8; background: var(--green-soft); }
.provider-status.warning { color: #9a5a16; border-color: #f1cf9f; background: #fff5e6; }
.results-stack { display: grid; gap: 13px; margin-top: 16px; }
.keyword-card { overflow: hidden; }
.keyword-card-top { display: flex; align-items: flex-start; gap: 18px; justify-content: space-between; }
.keyword-card h3 { font-size: 18px; letter-spacing: -.03em; margin: 0; }
.keyword-meta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pill, .metric-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 5px 8px; font-size: 10px; font-weight: 750; background: var(--green-soft); color: var(--green); }
.pill.neutral, .metric-badge { background: var(--surface-soft); color: var(--muted); }
.pill.warn { background: var(--accent-soft); color: var(--accent-dark); }
.keyword-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 18px 0; }
.keyword-metric { background: var(--surface-soft); border-radius: 10px; padding: 11px; }
.keyword-metric span, .keyword-metric strong { display: block; }
.keyword-metric span { color: var(--muted); font-size: 10px; }
.keyword-metric strong { font-size: 14px; margin-top: 3px; }
.result-details { border-top: 1px solid var(--line); padding-top: 14px; }
.result-details summary { color: var(--accent-dark); font-size: 12px; font-weight: 750; cursor: pointer; }
.result-details table { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 12px; }
th { color: var(--muted); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; font-weight: 750; }
td a { color: var(--accent-dark); text-decoration: none; }
td a:hover { text-decoration: underline; }
.table-empty { text-align: center; color: var(--muted); padding: 30px; }
.site-summary { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr); gap: 14px; }
.site-score { display: flex; gap: 16px; align-items: center; }
.score-number { font-size: 48px; font-weight: 800; letter-spacing: -.08em; color: var(--green); }
.site-checks { display: grid; gap: 8px; }
.site-check { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 12px; }
.site-check strong.good { color: var(--green); }
.site-check strong.warn { color: var(--accent-dark); }
.site-title { margin: 0 0 5px; font-size: 18px; }
.site-url { color: var(--muted); font-family: var(--mono); font-size: 11px; word-break: break-all; }
.recommendation-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.recommendation-list li { display: flex; gap: 9px; color: var(--muted); font-size: 12px; }
.recommendation-list li::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; background: var(--accent); border-radius: 50%; margin-top: 7px; }
.agent-hero { display: flex; justify-content: space-between; gap: 20px; align-items: center; background: #e6eee6; margin-bottom: 14px; }
.agent-hero h2 { font-size: 21px; }
.agent-hero p:not(.eyebrow) { color: #59695c; max-width: 580px; margin: 0; font-size: 13px; }
.connection-status { border: 1px solid #bdd7c3; background: rgba(255,255,255,.5); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; }
.agent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.secret-banner { display: grid; gap: 5px; padding: 13px; margin-top: 18px; border: 1px solid #b9d8c4; background: var(--green-soft); border-radius: 12px; }
.secret-banner strong { color: var(--green); font-size: 13px; }
.secret-banner span { color: var(--muted); font-size: 11px; }
.secret-banner code { display: block; overflow: auto; background: #fff; color: var(--ink); padding: 10px; border: 1px solid #c5dfcc; border-radius: 8px; font: 11px/1.5 var(--mono); margin-top: 5px; }
.secret-actions { justify-content: flex-start; }
.code-block { background: #202922; color: #dfeee1; border-radius: 10px; padding: 13px; min-height: 112px; overflow: auto; white-space: pre-wrap; font: 11px/1.6 var(--mono); margin: 15px 0 10px; }
.tool-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.tool-card { border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.tool-card strong, .tool-card span { display: block; }
.tool-card strong { font: 11px var(--mono); color: var(--accent-dark); }
.tool-card span { color: var(--muted); font-size: 11px; margin-top: 6px; }
.usage-overview { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; background: #e6eee6; }
.usage-total { text-align: right; }
.usage-total strong { display: block; font-size: 48px; letter-spacing: -.08em; }
.usage-total span { color: var(--muted); font-size: 11px; }
.usage-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.usage-meter-card > strong { display: block; font-size: 36px; letter-spacing: -.06em; margin-top: 7px; }
.usage-meter-card > span { font-size: 11px; }
.progress { height: 8px; margin: 17px 0 10px; }
.safety-list { display: grid; gap: 12px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.setting-row:first-child { padding-top: 0; }
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-row div { display: grid; gap: 4px; }
.setting-row strong { font-size: 13px; }
.setting-row span { color: var(--muted); font-size: 11px; }
.setting-row select { width: 180px; }

.overlay, .modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(21, 30, 24, .74); backdrop-filter: blur(10px); }
.login-card, .modal-card { width: min(100%, 420px); padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 70px rgba(0,0,0,.2); }
.login-card { text-align: center; }
.login-mark { width: 58px; height: 58px; margin-bottom: 15px; }
.login-card h1, .modal-card h2 { margin: 5px 0 6px; letter-spacing: -.05em; }
.login-card > .muted { margin: 0 0 25px; }
.stack-form { display: grid; gap: 9px; text-align: left; }
.stack-form label { margin: 0; }
.stack-form .button { margin-top: 7px; }
.form-error { color: var(--red); background: #fae9e6; border-radius: 8px; padding: 8px; font-size: 12px; margin: 2px 0; }
.modal { z-index: 30; }
.modal-card { position: relative; }
.modal-card > .muted { font-size: 13px; margin: 0 0 20px; }
.modal-close { border: 0; color: var(--muted); background: transparent; position: absolute; top: 18px; right: 20px; font-size: 11px; }
.modal-actions { justify-content: flex-end; margin-top: 20px; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 40; display: grid; gap: 8px; width: min(360px, calc(100vw - 44px)); }
.toast { background: #1b261f; color: #eef3ed; padding: 12px 14px; border-radius: 11px; box-shadow: var(--shadow); font-size: 12px; }
.toast.error { background: var(--red); }

body.dark { --canvas: #101611; --surface: #182019; --surface-soft: #222d24; --ink: #edf4ed; --muted: #9cad9e; --line: #304035; --accent-soft: #3b2a20; --green-soft: #1d392b; --shadow: 0 18px 50px rgba(0,0,0,.2); }
body.dark .hero-panel, body.dark .agent-hero, body.dark .usage-overview { background: #203126; }
body.dark input, body.dark textarea, body.dark select { background: #182019; color: var(--ink); border-color: var(--line); }
body.dark .code-block { background: #0a0f0c; }

@media (max-width: 960px) {
  .sidebar { width: 215px; flex-basis: 215px; }
  .main-content { padding-left: 28px; padding-right: 28px; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .keyword-metrics { grid-template-columns: repeat(3, 1fr); }
  .tool-list { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app-frame { display: block; }
  .sidebar { width: 100%; min-height: auto; padding: 12px 16px; flex-direction: row; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; }
  .brand { padding: 0; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-name { font-size: 18px; }
  .sidebar-intro, .new-research, .nav-label, .sidebar-bottom { display: none; }
  .nav-list { margin-left: auto; flex-direction: row; gap: 4px; }
  .nav-item { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .nav-item:not(.active) { display: none; }
  .nav-item.active { display: flex; }
  .nav-item.active::after { content: ""; }
  .nav-item.active { font-size: 0; }
  .nav-icon { width: 28px; height: 28px; }
  .sidebar.mobile-open { flex-wrap: wrap; align-items: flex-start; }
  .sidebar.mobile-open .nav-list { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin: 4px 0 0; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
  .sidebar.mobile-open .nav-item:not(.active) { display: flex; width: 100%; justify-content: flex-start; font-size: 12px; height: 38px; }
  .sidebar.mobile-open .nav-label { display: block; grid-column: span 2; margin: 8px 10px 0; }
  .main-content { padding: 23px 16px 50px; }
  .topbar { margin-bottom: 27px; align-items: center; }
  .topbar h1 { font-size: 24px; }
  .usage-chip { display: none; }
  .icon-button { display: block; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 10px; border-radius: 9px; font-size: 11px; }
  .hero-panel { min-height: 300px; padding: 28px 24px; align-items: flex-start; }
  .hero-panel h2 { font-size: 39px; }
  .hero-signal { position: absolute; right: -34px; bottom: -10px; opacity: .55; }
  .quick-grid, .dashboard-grid, .agent-grid, .usage-cards, .site-summary { grid-template-columns: 1fr; }
  .quick-card { min-height: 145px; }
  .panel { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions, .input-action, .agent-hero, .usage-overview, .setting-row { align-items: stretch; flex-direction: column; }
  .form-actions .button, .input-action .button { width: 100%; }
  .keyword-card-top { display: block; }
  .keyword-meta { justify-content: flex-start; margin-top: 12px; }
  .keyword-metrics { grid-template-columns: repeat(2, 1fr); }
  .keyword-metric:last-child { grid-column: span 2; }
  .connection-status { align-self: flex-start; }
  .usage-total { text-align: left; }
  .setting-row select { width: 100%; }
  .modal-card, .login-card { padding: 25px 20px; }
}

/* Refined shell and dense research table. */
.sidebar { width: 232px; flex-basis: 232px; padding: 22px 14px 17px; background: #111a2b; }
.brand { padding: 3px 10px 20px; }
.new-research { height: 40px; margin: 0 4px 22px; background: var(--orange); border-color: var(--orange); box-shadow: 0 7px 18px rgba(242, 123, 43, .22); }
.new-research:hover { background: #d96518; }
.nav-list { gap: 2px; }
.nav-label { margin: 0 10px 6px; }
.nav-label-spaced { margin-top: 21px; }
.nav-item { min-height: 38px; padding: 8px 10px; gap: 10px; border-radius: 9px; font-size: 12px; text-decoration: none; }
.nav-item:hover, .nav-item.active { background: #1e2c48; }
.nav-item.active { box-shadow: inset 3px 0 0 var(--accent); }
.nav-icon { width: 22px; height: 22px; flex: 0 0 22px; }
.sidebar-bottom { gap: 3px; }
.logout-button { padding: 8px 10px; font-size: 12px; }
.usage-chip { min-width: 0; border: 0; background: transparent; padding: 5px 0 5px 8px; box-shadow: none; display: flex; align-items: center; gap: 8px; }
.usage-chip-label { font-size: 11px; }
.usage-chip strong { font-size: 11px; }
.mini-progress { width: 54px; margin-top: 0; }
.main-content { padding-top: 22px; }
.panel { padding: 20px; }
.panel-heading { margin-bottom: 15px; }
.keyword-results-panel { padding: 0; }
.results-summary { padding: 18px 20px 15px; }
.results-summary h2 { font-size: 20px; }
.results-summary-stats { display: flex; align-items: flex-end; gap: 24px; margin-top: 13px; }
.results-summary-stat { display: grid; gap: 1px; }
.results-summary-stat strong { font-size: 18px; letter-spacing: -.04em; }
.results-summary-stat span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.results-toolbar { padding: 11px 20px; }
.keyword-table { min-width: 980px; }
.keyword-table th, .keyword-table td { padding: 10px 12px; }
.keyword-table th:first-child, .keyword-table td:first-child { width: 38px; padding-right: 2px; }
.keyword-table th:nth-child(2) { min-width: 270px; }
.keyword-table th { position: sticky; top: 0; z-index: 1; }
.keyword-table tbody tr { border-bottom: 1px solid var(--line); }
.keyword-table tbody tr:last-child { border-bottom: 0; }
.keyword-name { white-space: nowrap; }
.keyword-name strong { font-size: 12px; }
.keyword-select, #keyword-select-all { width: 14px; height: 14px; accent-color: var(--accent); }
.expand-keyword { width: 21px; height: 21px; margin-right: 7px; padding: 0; border: 0; border-radius: 5px; color: var(--muted); background: var(--surface-soft); font-size: 16px; line-height: 18px; vertical-align: -2px; }
.keyword-row.expanded .expand-keyword { color: var(--accent-dark); background: var(--accent-soft); }
.intent-chip { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 5px; background: #dceaf7; color: #275d88; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.difficulty-chip { display: inline-grid; place-items: center; min-width: 30px; height: 23px; padding: 0 5px; border-radius: 5px; font-size: 11px; font-weight: 800; }
.difficulty-easy { color: #2d7659; background: #dcefdc; }
.difficulty-medium { color: #916b19; background: #f7edbd; }
.difficulty-hard { color: #a34a3e; background: #f6d1ca; }
.trend-spark { display: block; width: 68px; height: 22px; }
.trend-empty { color: var(--muted); font-size: 11px; }
.opportunity-strong { color: var(--green); font-weight: 800; }
.table-footnote { padding: 11px 20px 15px; }
.toggle-field { align-self: start; padding: 0; display: flex; flex-direction: column; justify-content: flex-start; }
.toggle-field label { min-height: 34px; display: flex; align-items: center; gap: 8px; margin: 0; }
.toggle-field input { margin: 0; }
.toggle-field small { margin: 0 0 0 23px; line-height: 1.35; }
.report-row-action { cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.report-row-action:hover, .report-row-action:focus { background: var(--accent-soft); border-color: #bdcafa; outline: none; transform: translateY(-1px); }
.report-row-arrow { color: var(--accent); font-size: 21px; line-height: 1; }
.secret-value { display: flex; align-items: center; gap: 8px; }
.secret-value code { flex: 1; min-width: 0; }
.copy-icon-button { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--accent-dark); background: var(--surface); cursor: pointer; }
.copy-icon-button:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.copy-icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.key-name-cell { display: grid; gap: 3px; }
.key-name-cell .small-copy { line-height: 1.2; }
.key-cell, .key-actions { display: flex; align-items: center; gap: 7px; }
.key-cell code { white-space: nowrap; }
.key-icon-button { width: 28px; height: 28px; padding: 0; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--accent); cursor: pointer; }
.key-icon-button:hover:not(:disabled) { background: var(--accent-soft); border-color: #bdcafa; }
.key-icon-button:disabled { color: var(--muted); opacity: .45; cursor: not-allowed; }
.key-icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.report-modal-card { width: min(900px, 100%); }
.report-modal-content { max-height: 48vh; overflow: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: 11px; }
.saved-report-summary { display: flex; gap: 20px; padding: 12px 14px; color: var(--muted); background: var(--surface-soft); font-size: 11px; }
.saved-report-table { min-width: 680px; }
.saved-report-table th, .saved-report-table td { padding: 10px 12px; }
.saved-report-facts { display: grid; gap: 0; }
.saved-report-facts div { display: grid; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.saved-report-facts div:last-child { border-bottom: 0; }
.saved-report-facts span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.saved-report-facts strong { font-size: 12px; font-weight: 650; }
body.dark { --canvas: #0e1524; --surface: #151f33; --surface-soft: #1d2a40; --ink: #f4f7fb; --muted: #a4b0c2; --line: #2b3a54; --accent: #6d8bff; --accent-dark: #9ab0ff; --accent-soft: #24345f; --orange: #f99a4d; --shadow: 0 18px 50px rgba(0,0,0,.2); }
body.dark .sidebar { background: #09111f; }
body.dark .new-research { background: var(--orange); border-color: var(--orange); }
body.dark .nav-item:hover, body.dark .nav-item.active { background: #172744; }
body.dark .usage-ring::before { background: var(--surface); }

@media (min-width: 721px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; height: 100vh; min-height: 0; overflow-y: auto; z-index: 10; }
  .main-content { width: calc(100% - 232px); max-width: none; margin: 0 0 0 232px; }
}

@media (max-width: 720px) {
  .sidebar { width: 100%; flex-basis: auto; padding: 11px 14px; }
  .new-research { margin: 0; }
  .usage-chip-label { display: none; }
  .usage-chip { margin-left: auto; }
  .results-summary-stats { gap: 15px; overflow-x: auto; }
  .report-row { min-width: 0; }
  .report-row-time { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* Focused research surfaces: one action first, dense data second. */
.topbar { min-height: 0; margin-bottom: 22px; justify-content: flex-end; }
.topbar-spacer { flex: 1; }
.overview-command { max-width: 900px; margin: 52px auto 34px; text-align: center; }
.overview-command h1 { margin: 9px 0 10px; font-size: clamp(37px, 6vw, 68px); line-height: .98; letter-spacing: -.075em; }
.overview-copy { color: var(--muted); margin: 0 auto 26px; max-width: 550px; font-size: 15px; }
.overview-search-form { max-width: 760px; margin: 0 auto; text-align: left; }
.overview-search-box { display: flex; gap: 8px; padding: 7px; background: var(--surface); border: 1px solid #cfd1c6; border-radius: 14px; box-shadow: 0 13px 34px rgba(30, 39, 31, .08); }
.overview-search-box input { border: 0; box-shadow: none; padding: 12px 13px; font-size: 15px; }
.overview-search-box input:focus { box-shadow: none; }
.overview-search-box .button { padding-inline: 20px; }
.overview-search-meta { display: flex; align-items: flex-end; gap: 14px; margin: 12px 8px 0; }
.overview-search-meta label { width: 145px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.overview-search-meta select { margin-top: 4px; padding: 7px 9px; font-size: 12px; text-transform: none; letter-spacing: 0; }
.overview-search-meta .form-note { margin-left: auto; padding-bottom: 8px; }
.overview-dashboard { max-width: 1100px; margin: 0 auto; }
.usage-ring { position: relative; border: 0; padding: 12px; background: conic-gradient(var(--accent) var(--usage-progress, 0%), var(--surface-soft) 0); transform: none; }
.usage-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.usage-ring > div { position: relative; z-index: 1; }
.usage-ring span, .usage-ring small { transform: none; }
.keyword-form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 8px; }
.keyword-form-head label { margin-bottom: 0; }
.engine-field { width: 150px; color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.engine-field select { margin-top: 4px; padding: 7px 9px; font-size: 12px; letter-spacing: 0; text-transform: none; }
.keyword-results-panel { padding: 0; overflow: hidden; }
.results-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 23px; border-bottom: 1px solid var(--line); }
.results-summary h2 { margin: 6px 0 3px; }
.results-summary p { margin: 0; font-size: 12px; }
.results-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 15px 23px; background: var(--surface-soft); }
.results-toolbar label { width: min(330px, 100%); margin: 0; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.results-toolbar input { margin-top: 5px; background: var(--surface); padding: 8px 10px; font-size: 12px; }
.results-count { color: var(--muted); font-size: 11px; padding-bottom: 9px; }
.keyword-table { min-width: 850px; }
.keyword-table th, .keyword-table td { padding: 13px 16px; vertical-align: middle; }
.keyword-table th { background: var(--surface); }
.sort-button { border: 0; background: transparent; color: inherit; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.sort-button:hover { color: var(--accent-dark); }
.keyword-row { cursor: pointer; transition: background .15s; }
.keyword-row:hover, .keyword-row:focus, .keyword-row.expanded { background: var(--accent-soft); outline: none; }
.keyword-row td:first-child { color: var(--ink); }
.intent-label { color: var(--muted); text-transform: capitalize; }
.source-label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.keyword-detail-row td { background: var(--surface-soft); padding: 0; }
.keyword-detail { display: grid; gap: 13px; padding: 17px 22px 20px; }
.keyword-detail > div:first-child { display: grid; gap: 3px; }
.keyword-detail > div:first-child span { color: var(--muted); font-size: 11px; }
.serp-table { min-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.serp-table th, .serp-table td { padding: 9px 11px; }
.table-footnote { margin: 0; padding: 13px 23px 17px; color: var(--muted); font-size: 11px; }
.agent-connection { max-width: 820px; margin-bottom: 14px; }
.agent-actions { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.agent-actions .text-button { margin-left: auto; }
.docs-link { text-decoration: none; }
.allocation-panel { margin-bottom: 14px; }
.allocation-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 460px; margin: 18px 0 12px; }
.allocation-fields label, .limit-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.allocation-fields input, .limit-grid input { margin-top: 0; text-transform: none; letter-spacing: 0; }
.allocation-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.allocation-preview-card { display: grid; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.allocation-preview-card strong { font-size: 17px; }
.allocation-preview-card span { color: var(--muted); font-size: 11px; }
.allocation-preview-card.warning { border-color: #e8b4a8; background: #fff2ee; }
.limit-grid { display: grid; gap: 11px; }
.limit-grid label { font-size: 9px; }
.limit-grid .form-note { font-size: 10px; text-transform: none; letter-spacing: 0; }
.key-limit-cell { display: grid; gap: 2px; white-space: nowrap; }
.key-limit-cell strong { font-size: 11px; }
.key-limit-cell span { color: var(--muted); font-size: 10px; }
.edit-key { white-space: nowrap; }

@media (max-width: 720px) {
  .topbar { margin-bottom: 10px; }
  .overview-command { margin: 25px auto 28px; text-align: left; }
  .overview-command h1 { font-size: 43px; }
  .overview-copy { margin-left: 0; }
  .overview-search-box { display: block; padding: 6px; }
  .overview-search-box .button { width: 100%; margin-top: 5px; }
  .overview-search-meta { align-items: flex-start; flex-wrap: wrap; margin-inline: 0; }
  .overview-search-meta .form-note { width: 100%; margin: 0; }
  .keyword-form-head { display: block; }
  .engine-field { width: 100%; margin-top: 15px; }
  .results-summary, .results-toolbar { display: block; }
  .results-summary .button { width: 100%; margin-top: 15px; }
  .results-count { display: block; padding: 12px 0 0; }
  .agent-actions .text-button { margin-left: 0; }
  .allocation-fields, .allocation-preview { grid-template-columns: 1fr; }
}
