:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f8fc;
  --surface-3: #eff1f7;
  --text: #1f2430;
  --muted: #687086;
  --border: #e1e4ec;
  --primary: #7047eb;
  --primary-dark: #5732cf;
  --primary-soft: #eee9ff;
  --success: #16835b;
  --success-soft: #e4f6ef;
  --warning: #b66a08;
  --warning-soft: #fff4d7;
  --danger: #c43e52;
  --danger-soft: #ffeaee;
  --info: #1769aa;
  --info-soft: #e8f3ff;
  --shadow: 0 12px 40px rgba(28, 31, 44, .08);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 21px; letter-spacing: -.02em; }
h3 { margin-bottom: 8px; font-size: 16px; }
p { line-height: 1.55; }
small, .muted { color: var(--muted); }

.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto 0;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 218px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #b547eb);
  color: white;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(112, 71, 235, .25);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 1px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.topbar-context { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chip, .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
button.chip:hover { border-color: var(--primary); color: var(--primary); }
.badge-primary { border-color: transparent; background: var(--primary-soft); color: var(--primary-dark); }
.badge-success { border-color: transparent; background: var(--success-soft); color: var(--success); }
.badge-warning { border-color: transparent; background: var(--warning-soft); color: var(--warning); }
.badge-danger { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
.badge-info { border-color: transparent; background: var(--info-soft); color: var(--info); }
.badge-muted { border-color: transparent; background: #eef1f6; color: #6b7280; }

/* Downtrend analysis (inline on the Keywords view) */
.downtrend-card { margin-top: 20px; }
.downtrend-asin-summary { display: flex; flex-direction: column; gap: 12px; }
.downtrend-status-line { display: flex; align-items: center; gap: 12px; font-weight: 700; color: #42485a; }
.downtrend-card td.trend-positive { color: var(--success); font-weight: 700; }
.downtrend-card td.trend-negative { color: var(--danger); font-weight: 700; }
.downtrend-query-table th.th-group { text-align: center; border-bottom: 2px solid var(--primary-soft); font-size: 12px; letter-spacing: .03em; }
.downtrend-query-table td { font-size: 12px; white-space: nowrap; }
.icon-button, .avatar-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
.icon-button:hover, .avatar-button:hover { border-color: #bdb5dc; background: var(--primary-soft); }
.avatar-button { border: 0; border-radius: 50%; background: #25283a; color: white; font-weight: 700; }
.notification-count {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid white;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  line-height: 13px;
}

.app-frame { min-height: 100vh; padding-top: 68px; }
.sidebar {
  position: fixed;
  z-index: 40;
  top: 68px;
  bottom: 0;
  left: 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.nav-label {
  margin: 10px 10px 6px;
  color: #969bad;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 39px;
  margin: 2px 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-item > span:first-child { width: 18px; text-align: center; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.nav-count { margin-left: auto; padding: 2px 6px; border-radius: 999px; background: var(--surface-3); font-size: 10px; }
.workflow-nav { position: relative; }
.workflow-nav::before {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 19px;
  width: 1px;
  background: var(--border);
  content: "";
}
.workflow-nav .nav-item { position: relative; font-size: 12px; }
.workflow-nav .step-marker {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: white;
  color: transparent;
  font-size: 9px;
}
.workflow-nav .complete .step-marker { border-color: var(--success); background: var(--success); color: white; }
.workflow-nav .active .step-marker { border-color: var(--primary); box-shadow: inset 0 0 0 4px white; background: var(--primary); }
.sidebar-footer { margin-top: auto; padding-top: 16px; }
.mini-plan { padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.mini-plan span, .mini-plan strong { display: block; }
.mini-plan span { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.mini-plan strong { font-size: 12px; }
.progress-track { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #a455eb); }
.button-reset { font: inherit; cursor: pointer; }

.main-content { min-height: calc(100vh - 68px); margin-left: 250px; padding: 28px; }
.page { width: min(1500px, 100%); margin: 0 auto; animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.page-header p { margin-bottom: 0; color: var(--muted); }
.page-actions, .toolbar, .inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 23, 34, .02);
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3, .card-header p { margin-bottom: 0; }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: 270px minmax(0, 1fr); }
.stack { display: grid; gap: 16px; }
.spacer-top { margin-top: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
}
.btn:hover { border-color: #b9b0db; background: var(--surface-2); }
.btn-primary { border-color: var(--primary); background: var(--primary); color: white; box-shadow: 0 6px 16px rgba(112, 71, 235, .18); }
.btn-primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.btn-success { border-color: var(--success); background: var(--success); color: white; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 31px; padding: 5px 10px; font-size: 11px; }
.btn-lg { min-height: 46px; padding: 12px 18px; font-size: 14px; }
.btn-icon { width: 38px; padding: 0; }

.field { display: grid; gap: 6px; }
.field label, .field-label { color: #42485a; font-size: 11px; font-weight: 700; }
.input, .select, .textarea {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-sm, .select-sm { min-height: 33px; padding: 6px 9px; font-size: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 30px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: 0; }

.stat {
  position: relative;
  min-height: 122px;
  padding: 18px;
  overflow: hidden;
}
.stat::after {
  position: absolute;
  right: -12px;
  bottom: -34px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--primary-soft);
  content: "";
}
.stat-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { display: block; margin: 9px 0 5px; font-size: 28px; letter-spacing: -.04em; }
.stat-detail { color: var(--muted); font-size: 11px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

.table-wrap { width: 100%; overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafafe; }
.table-compact th { padding: 8px; }
.table-compact td { padding: 7px 8px; }
.cell-title { max-width: 310px; }
.cell-title strong, .cell-title small { display: block; }
.cell-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title small { margin-top: 3px; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.row-actions { display: flex; align-items: center; gap: 5px; }

.notice { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; border: 1px solid #d6ccff; border-radius: 12px; background: var(--primary-soft); color: #463187; }
.notice-warning { border-color: #f1d690; background: var(--warning-soft); color: #744607; }
.notice-danger { border-color: #fac6ce; background: var(--danger-soft); color: #8f2939; }
.notice-info { border-color: #bbddfa; background: var(--info-soft); color: #125287; }
.notice strong { display: block; margin-bottom: 2px; }

.workflow-strip { display: flex; align-items: flex-start; margin-bottom: 22px; overflow-x: auto; padding: 15px 18px; }
.workflow-step { position: relative; min-width: 115px; flex: 1; color: var(--muted); text-align: center; font-size: 10px; }
.workflow-step::before { display: block; width: 22px; height: 22px; margin: 0 auto 7px; border: 2px solid var(--border); border-radius: 50%; background: white; content: ""; }
.workflow-step::after { position: absolute; z-index: 0; top: 11px; right: 50%; width: 100%; height: 2px; background: var(--border); content: ""; }
.workflow-step:first-child::after { display: none; }
.workflow-step.complete::before { position: relative; z-index: 1; border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 5px var(--success); }
.workflow-step.complete::after { background: var(--success); }
.workflow-step.active { color: var(--primary); font-weight: 800; }
.workflow-step.active::before { position: relative; z-index: 1; border-color: var(--primary); box-shadow: inset 0 0 0 5px white; background: var(--primary); }

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 155px;
  padding: 20px;
  border: 2px dashed #cbc6db;
  border-radius: 13px;
  background: var(--surface-2);
  text-align: center;
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone.drag-over { border-color: var(--primary); border-style: solid; background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(112,71,235,.15); }
.upload-zone-featured { min-height: 190px; border-color: #b9a9f5; background: linear-gradient(145deg, #fbfaff, #f4f8ff); }
.upload-icon { font-size: 25px; }
.upload-replace-btn { margin-top: 8px; }
.file-summary { display: flex; align-items: center; gap: 11px; margin-top: 12px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; }
.file-summary > div:nth-child(2) { min-width: 0; flex: 1; }
.file-summary strong, .file-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-type { display: grid; place-items: center; width: 34px; height: 38px; border-radius: 7px; background: var(--success-soft); color: var(--success); font-size: 10px; font-weight: 800; }

.pipeline { display: grid; gap: 0; }
.pipeline-item { position: relative; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; min-height: 58px; }
.pipeline-item:not(:last-child)::after { position: absolute; top: 27px; bottom: -4px; left: 14px; width: 2px; background: var(--border); content: ""; }
.pipeline-icon { z-index: 1; display: grid; place-items: center; width: 29px; height: 29px; border: 2px solid var(--border); border-radius: 50%; background: white; color: var(--muted); font-size: 10px; font-weight: 800; }
.pipeline-item.complete .pipeline-icon { border-color: var(--success); background: var(--success); color: white; }
.pipeline-item.running .pipeline-icon { border-color: var(--primary); color: var(--primary); animation: pulse 1.5s infinite; }
.pipeline-item.failed .pipeline-icon { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.pipeline-copy strong, .pipeline-copy small { display: block; }
.pipeline-copy small { margin-top: 3px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px var(--primary-soft); } }
.progress-large { height: 10px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.progress-large span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #b04fe4); transition: width .35s ease; }

.product-group-list { display: grid; gap: 6px; }
.group-button { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 11px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); text-align: left; }
.group-button:hover, .group-button.active { border-color: #d8d0fa; background: var(--primary-soft); color: var(--primary-dark); }
.product-thumb {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: linear-gradient(135deg, #f4f0ff, #edf7ff);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.product-thumb-large { width: 64px; height: 64px; font-size: 13px; }
.product-summary-image { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #f5f4f7; }
.asin-review-card { overflow: hidden; }
.asin-review-header { background: linear-gradient(90deg, #fbfaff, white); }
.asin-review-header h2 { max-width: 720px; margin-top: 3px; font-size: 16px; }
.search-term-review-table th:last-child,
.search-term-review-table td:last-child { width: 190px; text-align: right; }
.search-term-review-table tr.term-negated { color: #8c8a95; background: #fff8f8; }
.search-term-review-table tr.term-negated td:first-child { text-decoration: line-through; }
.term-decision { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 5px; min-width: 165px; }

.wizard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 16px; }
.wizard-section { position: relative; overflow: visible; }
.wizard-section-number {
  position: absolute;
  z-index: 2;
  top: 20px;
  left: -14px;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 800;
}
.wizard-section-header { padding-left: 28px; }
.product-selector-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; align-items: center; gap: 9px; }
.product-selector-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.product-select-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 98px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  text-align: left;
}
.product-select-card:hover { border-color: #b9a9f5; background: #fcfbff; }
.product-select-card.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.product-select-copy, .product-select-copy > strong, .product-select-copy > small { display: block; min-width: 0; }
.product-select-copy > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-select-copy > small { margin: 4px 0 8px; }
.selection-check { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid var(--border); border-radius: 50%; background: white; color: var(--primary); font-weight: 800; }
.product-select-card.selected .selection-check { border-color: var(--primary); background: var(--primary); color: white; }
.period-groups { display: grid; gap: 20px; }
.period-group-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.period-grid { display: grid; gap: 7px; }
.period-card { display: grid; grid-template-columns: auto minmax(180px, 1fr) 90px 90px; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: white; text-align: left; }
.period-card:hover, .period-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.period-card strong, .period-card small { display: block; }
.period-radio { width: 17px; height: 17px; border: 2px solid #b6b9c6; border-radius: 50%; background: white; }
.period-card.selected .period-radio { border-color: var(--primary); box-shadow: inset 0 0 0 4px white; background: var(--primary); }
.analysis-summary-card { position: sticky; top: 84px; }
.summary-product { display: flex; gap: 10px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.summary-product > div { min-width: 0; }
.summary-product strong, .summary-product small { display: block; }
.summary-list { display: grid; gap: 0; }
.summary-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.summary-list span { color: var(--muted); }
.summary-list strong { text-align: right; }
.btn.disabled { pointer-events: none; opacity: .5; }

.current-version-notice { display: grid; grid-template-columns: auto 1fr auto; align-items: center; }
.upload-guide-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); align-items: start; gap: 16px; }
.instruction-steps { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.instruction-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.instruction-steps li > span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); font-size: 11px; font-weight: 800; }
.instruction-steps strong, .instruction-steps small { display: block; }
.settings-requirements { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.settings-requirements > div { padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.settings-requirements small, .settings-requirements strong { display: block; }
.settings-requirements strong { margin-top: 4px; font-size: 12px; }
.columns-required { padding: 13px; border-radius: 10px; background: var(--surface-2); }
.settings-screenshot-placeholder { display: flex; align-items: center; gap: 12px; min-height: 120px; margin-top: 18px; padding: 20px; border: 1px dashed #b9bcc8; border-radius: 11px; background: linear-gradient(135deg, #f8f9fc, #eff1f7); }
.settings-screenshot-placeholder > span { font-size: 34px; color: var(--primary); }
.settings-screenshot-placeholder strong, .settings-screenshot-placeholder small { display: block; }
.upload-report-card { position: sticky; top: 84px; }
.validation-checklist { display: grid; gap: 7px; }
.validation-checklist > div { display: grid; grid-template-columns: 25px 1fr; gap: 9px; padding: 9px; border-radius: 9px; background: var(--surface-2); }
.validation-checklist > div > span { color: var(--success); font-weight: 800; }
.validation-checklist strong, .validation-checklist small { display: block; }

.autosave-status { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 12px; font-weight: 700; transition: color .3s; }
.autosave-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); transition: background .3s, box-shadow .3s; }
.autosave-status.saving { color: var(--warning); }
.autosave-status.saving i { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); animation: pulse-save .8s ease-in-out infinite; }
@keyframes pulse-save { 0%,100% { transform: scale(1); } 50% { transform: scale(1.4); } }
.review-summary { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(90px, .65fr)) minmax(170px, 1fr); align-items: center; gap: 0; padding: 14px; }
.review-summary-product { display: flex; align-items: center; gap: 11px; padding-right: 14px; }
.review-summary-product strong, .review-summary-product small { display: block; }
.review-summary-stat { min-height: 58px; padding: 8px 12px; border-left: 1px solid var(--border); }
.review-summary-stat small, .review-summary-stat strong { display: block; }
.review-summary-stat strong { margin-top: 5px; font-size: 20px; }
.review-summary-stat.danger strong { color: var(--danger); }
.review-summary-keepa { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--border); }
.review-summary-keepa small, .review-summary-keepa strong, .review-summary-keepa span { display: block; }
.review-summary-keepa .idle { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }
.review-summary-keepa span:last-child { color: var(--muted); font-size: 10px; }
.progress-compact { width: 100%; height: 4px; background: var(--surface-3); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.progress-compact > span { display: block; height: 100%; background: var(--primary); border-radius: 2px; transition: width .4s ease; }
.keepa-scrape-gate {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, .9fr);
  gap: 22px;
  align-items: stretch;
  padding: 22px;
  margin-top: 14px;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, .08), transparent 42%),
    var(--surface);
}
.keepa-scrape-gate-copy {
  display: grid;
  gap: 10px;
  align-content: start;
}
.keepa-scrape-gate-copy h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}
.keepa-scrape-gate-copy > p {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
}
.keepa-scrape-status {
  margin-top: 8px;
}
.keepa-scrape-gate-actions {
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
}
.keepa-scrape-gate-actions strong {
  font-size: 14px;
}
.keepa-scrape-gate-actions > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.keepa-scrape-gate-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
@media (max-width: 900px) {
  .keepa-scrape-gate {
    grid-template-columns: 1fr;
  }
}
.review-workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 14px; }
.review-panel { min-width: 0; overflow: hidden; }
.review-panel-toolbar { display: grid; grid-template-columns: minmax(170px, 1fr) auto; gap: 8px; padding: 11px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.review-panel-toolbar .bulk-actions { grid-column: 1 / -1; }
.bulk-actions { display: flex; align-items: center; gap: 6px; }
.bulk-actions small { margin-right: 4px; text-transform: uppercase; letter-spacing: .08em; }
.review-scroll { max-height: 665px; overflow: auto; }
.query-review-table td:first-child strong, .query-review-table td:first-child small { display: block; }
.query-review-table .term-decision, .competitor-review-row .term-decision { min-width: 72px; }
.competitor-review-list { padding: 0 12px; }
.competitor-review-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.competitor-review-row.negated { opacity: .55; background: #fffafa; }
.competitor-row-copy { min-width: 0; }
.competitor-row-copy > strong, .competitor-row-copy > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.competitor-facts { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.manual-competitors { border-top: 1px solid var(--border); background: #fbfaff; }
.manual-competitors summary { padding: 13px; color: var(--primary-dark); font-weight: 800; cursor: pointer; }
.manual-competitor-body { display: grid; gap: 10px; padding: 0 13px 13px; }
.duplicate-preview { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 9px; border-radius: 9px; background: var(--success-soft); color: var(--success); }
.duplicate-preview strong, .duplicate-preview small { display: block; }
.review-footer { position: sticky; z-index: 8; bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 13px 16px; border: 1px solid #cfc3f8; border-radius: 13px; background: rgba(255, 255, 255, .96); box-shadow: 0 10px 35px rgba(39, 31, 68, .14); backdrop-filter: blur(12px); }
.review-footer strong, .review-footer span { display: block; }
.review-footer span { color: var(--muted); font-size: 11px; }

.selection-console { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(480px, 1.1fr); overflow: hidden; }
.product-browser, .period-browser { min-width: 0; padding: 20px; }
.product-browser { border-right: 1px solid var(--border); background: #fbfcfe; }
.selection-console-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.selection-console-header h2 { margin: 4px 0; }
.selection-console-header p { margin: 0; color: var(--muted); }
.selection-kicker, .subsection-label { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.product-selector-toolbar.compact { grid-template-columns: 1fr 150px; }
.selector-tabs { display: flex; gap: 2px; margin-top: 9px; padding: 3px; border-radius: 9px; background: var(--surface-3); }
.selector-tabs button { flex: 1; padding: 7px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; }
.selector-tabs button.active { background: white; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(31, 36, 48, .08); font-weight: 800; }
.product-browser-list { display: grid; gap: 6px; max-height: 570px; margin-top: 12px; overflow-y: auto; }
.product-browser-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid transparent; border-radius: 11px; background: transparent; text-align: left; }
.product-browser-row:hover { border-color: var(--border); background: white; }
.product-browser-row.selected { border-color: #cdbff8; background: white; box-shadow: 0 6px 20px rgba(64, 47, 116, .08); }
.product-browser-copy { min-width: 0; }
.product-browser-copy strong, .product-browser-copy span, .product-browser-copy small { display: block; }
.product-browser-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-browser-copy span { margin: 3px 0; color: var(--muted); font-size: 11px; }
.selected-product-inline { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 11px; border: 1px solid #d9cff9; border-radius: 10px; background: var(--primary-soft); }
.selected-product-inline > div { min-width: 0; }
.selected-product-inline strong, .selected-product-inline small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.integrated-periods { display: grid; gap: 20px; }
.integrated-period-row { display: grid; grid-template-columns: auto minmax(150px, 1fr) 90px 120px; align-items: center; gap: 10px; width: 100%; margin-top: 6px; padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: white; text-align: left; }
.integrated-period-row:hover, .integrated-period-row.selected { border-color: var(--primary); background: #fbfaff; }
.integrated-period-row strong, .integrated-period-row small { display: block; }
.selection-summary-bar, .reports-ready-bar { position: sticky; z-index: 8; bottom: 10px; display: grid; grid-template-columns: minmax(280px, 1fr) auto auto; align-items: center; gap: 18px; margin-top: 14px; padding: 13px 16px; border: 1px solid #cfc3f8; border-radius: 13px; background: rgba(255, 255, 255, .97); box-shadow: 0 12px 36px rgba(39, 31, 68, .13); backdrop-filter: blur(12px); }
.summary-confirmation, .reports-ready-bar > div { display: flex; align-items: center; gap: 11px; }
.summary-confirmation strong, .summary-confirmation span, .reports-ready-bar strong, .reports-ready-bar span { display: block; }
.summary-confirmation span, .reports-ready-bar span { color: var(--muted); font-size: 11px; }
.summary-lock-note { color: var(--muted); font-size: 11px; }

.dual-report-card { overflow: hidden; }
.dual-report-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, #fbfaff, white); }
.dual-report-heading > div { display: flex; align-items: center; gap: 12px; }
.dual-report-heading h2 { margin: 3px 0; }
.dual-report-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.report-number { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--primary); color: white; font-size: 11px; font-weight: 800; }
.dual-report-grid { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(250px, .8fr) minmax(300px, 1fr); }
.dual-report-grid > section { min-width: 0; padding: 18px; }
.dual-report-grid > section + section { border-left: 1px solid var(--border); }
.report-instructions .instruction-steps { margin-top: 13px; }
.report-settings { display: grid; gap: 0; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.report-settings > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.report-settings > div span { color: var(--muted); }
.report-reference { background: var(--surface-2); }
.report-reference .settings-screenshot-placeholder { min-height: 150px; margin: 13px 0; padding: 15px; }
.report-dropzone { min-height: 145px; margin-top: 13px; }
.report-dropzone strong, .report-dropzone small { display: block; margin-top: 4px; }
.upload-progress-row { display: flex; justify-content: space-between; margin-top: 12px; font-size: 11px; }
.detected-data { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.detected-data span { padding: 5px 7px; border-radius: 7px; background: var(--success-soft); color: var(--success); font-size: 10px; }
.reports-ready-bar { grid-template-columns: 1fr auto; }

.review-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: 620px; margin: 16px auto; padding: 4px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-3); }
.review-mode-switch button { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 15px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; }
.review-mode-switch button span, .review-mode-switch button small { display: block; }
.review-mode-switch button span { font-weight: 800; }
.review-mode-switch button.active { background: white; color: var(--primary-dark); box-shadow: 0 4px 14px rgba(34, 36, 48, .1); }
.full-review-workspace { overflow: visible; }
.full-review-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.full-review-heading h2 { margin: 4px 0; }
.full-review-heading p { margin: 0; color: var(--muted); }
.competitor-review-heading { align-items: flex-start; padding-bottom: 22px; border-bottom: 3px solid var(--text); }
.competitor-heading-actions { display: grid; justify-items: end; gap: 8px; }
.competitor-search-row { padding: 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.competitor-search-row .input { width: min(100%, 620px); }
.competitor-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}
.filter-match-count {
  font-size: 0.9rem;
  white-space: nowrap;
}
.full-review-toolbar { display: grid; grid-template-columns: minmax(250px, 1fr) auto auto auto; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.bulk-action-cluster { display: flex; align-items: center; gap: 6px; padding-left: 8px; border-left: 1px solid var(--border); }
.bulk-action-cluster > span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.full-review-table { max-height: 640px; min-height: 280px; overflow: auto; }
.full-review-table.filter-menu-open { overflow: visible; }
.review-data-table { min-width: 900px; }
.review-data-table th { position: sticky; z-index: 2; top: 0; background: white; }
.review-data-table th:has(.excel-filter-menu) { z-index: 40; overflow: visible; }
.review-data-table thead { position: relative; z-index: 30; }
.review-data-table td:first-child, .review-data-table th:first-child { width: 42px; text-align: center; }
.review-data-table .row-check {
    width: 16px;
    height: 16px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1.5px solid #c4c2cc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    vertical-align: middle;
    box-sizing: border-box;
}
.review-data-table .row-check:hover { border-color: var(--primary); }
.review-data-table .row-check.is-checked {
    border-color: var(--primary);
    background: var(--primary);
}
.review-data-table .row-check.is-checked::after {
    content: "";
    width: 8px;
    height: 4px;
    margin-top: -2px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}
.review-data-table td:nth-child(2) strong, .review-data-table td:nth-child(2) small { display: block; }
.review-data-table .row-actions { white-space: nowrap; }
.row-actions { display: inline-flex; gap: 5px; }
.row-actions .decision-button { min-width: 62px; }
.competitor-data-table { min-width: 1180px; }
.manual-import-hint { display: flex; justify-content: space-between; gap: 15px; padding: 9px 20px; border-bottom: 1px solid #dceaf7; background: var(--info-soft); color: var(--info); font-size: 11px; }

.tabs { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.tab { min-height: 30px; padding: 5px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.tab.active { background: white; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(31, 36, 48, .07); }

.competitor-card { padding: 15px; }
.competitor-head { display: flex; gap: 11px; }
.competitor-card .product-thumb { width: 58px; height: 58px; }
.competitor-meta { min-width: 0; flex: 1; }
.competitor-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 12px; }
.decision-group-2 { grid-template-columns: repeat(2, 1fr); }
.decision-button { padding: 7px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--muted); font-size: 10px; font-weight: 700; }
.decision-button.active.keep { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.decision-button.active.negate { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.decision-button.active.remove { border-color: var(--warning); background: var(--warning-soft); color: var(--warning); }
.representative { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

.keyword-card { overflow: hidden; }
.optimize-content-cta { box-shadow: 0 8px 20px rgba(100, 63, 206, .22); }
.background-status {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 340px);
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid #d8d0fa;
  border-radius: 12px;
  background: #fbfaff;
}
.background-status > div:first-child { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; }
.background-status strong { font-size: 12px; }
.background-status small { grid-column: 2; color: var(--muted); }
.background-status.complete { border-color: #addbc8; background: var(--success-soft); }
.keyword-toolbar { padding: 13px; border-bottom: 1px solid var(--border); }
.keyword-matrix-split {
  --left-width: 420px;
  --matrix-height: 992px;
  --meta-height: 280px;
  --comp-col-width: 96px;
  position: relative;
  display: grid;
  grid-template-columns: var(--left-width) minmax(0, 1fr);
  height: var(--matrix-height);
  max-height: var(--matrix-height);
  border-top: 1px solid var(--border);
  background: #fff;
}
.keyword-left-col,
.keyword-right-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.keyword-left-col {
  border-right: 2px solid #111827;
  position: relative;
}
.keyword-hscroll-rail {
  flex: 0 0 14px;
  height: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #eef2f7;
  border-bottom: 1px solid var(--border);
}
.keyword-hscroll-rail-spacer {
  overflow: hidden;
  pointer-events: none;
}
.keyword-hscroll-spacer {
  height: 1px;
}
.keyword-meta-pane {
  flex: 0 0 var(--meta-height);
  height: var(--meta-height);
  max-height: var(--meta-height);
  overflow: auto;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.keyword-right-meta {
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: none;
}
.keyword-right-meta::-webkit-scrollbar {
  display: none;
}
.keyword-left-meta {
  overflow-x: hidden;
  overflow-y: auto;
}
.matrix-splitter {
  position: relative;
  flex: 0 0 10px;
  height: 10px;
  background: #e8edf5;
  border-top: 1px solid #c5d0e0;
  border-bottom: 1px solid #c5d0e0;
  cursor: row-resize;
  z-index: 8;
}
.matrix-splitter-right {
  pointer-events: none;
}
.matrix-splitter-handle {
  position: absolute;
  left: calc(100% - 14px);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 14px;
  border-radius: 4px;
  background: #3b82f6;
  box-shadow: 0 1px 4px rgba(37, 99, 235, .35);
  pointer-events: auto;
  cursor: row-resize;
}
.matrix-splitter-handle::before,
.matrix-splitter-handle::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 1.5px;
  border-radius: 1px;
  background: #fff;
}
.matrix-splitter-handle::before { top: 4px; }
.matrix-splitter-handle::after { bottom: 4px; }
.matrix-splitter-right .matrix-splitter-handle {
  left: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: .9;
}
.matrix-resize-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  cursor: row-resize;
}
.keyword-term-header {
  flex: 0 0 auto;
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  overflow: hidden;
  background: #f8fafc;
  border-bottom: 2px solid #111827;
  z-index: 5;
}
.keyword-right-term-header {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.keyword-right-term-header::-webkit-scrollbar {
  display: none;
}
.keyword-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  height: 0; /* force flex child to take remaining space and scroll */
  overflow-y: scroll;
  scrollbar-gutter: stable;
  background: #fff;
  overscroll-behavior: contain;
}
.keyword-left-pane.keyword-scroll-body {
  overflow-x: hidden;
}
.keyword-right-pane.keyword-scroll-body {
  /* Keep overflow-x scrollable for column sync; hide the H-scrollbar so left/right
     vertical row heights stay locked (horizontal scrolling uses the top rail). */
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.keyword-right-pane.keyword-scroll-body::-webkit-scrollbar:horizontal {
  height: 0;
  display: none;
}
.keyword-right-pane {
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-width: thin;
}
.keyword-right-pane::-webkit-scrollbar:horizontal {
  height: 8px;
}
.keyword-left-table,
.keyword-right-table {
  border-collapse: separate;
  border-spacing: 0;
}
.keyword-left-table {
  width: 100%;
  table-layout: fixed;
}
.keyword-left-table .kw-term-col { width: auto; }
.keyword-left-table .kw-vol-col { width: 88px; }
.keyword-left-table .kw-cum-col { width: 92px; }
.keyword-right-table {
  table-layout: fixed;
  width: max-content;
}
.keyword-left-table th,
.keyword-left-table td {
  height: 42px;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.keyword-meta-pane .keyword-left-table th {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.relevancy-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.relevancy-high { color: #0f766e; }
.relevancy-mid { color: #a16207; }
.relevancy-low { color: #b91c1c; }
.content-keyword-row .relevancy-score { margin-left: 6px; }
.keyword-left-table .kw-rel-col { width: 72px; }
.keyword-left-table th:nth-child(2),
.keyword-left-table td:nth-child(2),
.keyword-left-table th:nth-child(3),
.keyword-left-table td:nth-child(3),
.keyword-left-table th:nth-child(4),
.keyword-left-table td:nth-child(4) {
  text-align: right;
}
.keyword-right-table th,
.keyword-right-table td {
  box-sizing: border-box;
  height: 42px;
  width: var(--comp-col-width);
  min-width: var(--comp-col-width);
  max-width: var(--comp-col-width);
  padding: 4px 4px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.keyword-meta-pane .keyword-right-table th {
  background: var(--surface-2);
}
.keyword-meta-pane .matrix-image-row th { height: 72px; white-space: normal; }
.keyword-meta-pane .matrix-brand-row th,
.keyword-meta-pane .matrix-asin-row th,
.keyword-meta-pane .matrix-rating-row th,
.keyword-meta-pane .matrix-reviews-row th,
.keyword-meta-pane .matrix-price-row th,
.keyword-meta-pane .matrix-bought-row th,
.keyword-meta-pane .matrix-age-row th {
  height: 34px;
  font-size: 10px;
}
.keyword-term-header .matrix-keyword-header-row th {
  height: 58px;
  background: #f8fafc;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 800;
  white-space: normal;
  vertical-align: middle;
}
.keyword-left-term-header .matrix-keyword-header-row th {
  font-size: 11px;
}
.matrix-term-sort {
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-align: inherit;
}
.matrix-term-sort:hover {
  color: #1d4ed8;
}
.matrix-term-sort-icon {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--muted);
}
.keyword-left-table th:nth-child(2) .matrix-term-sort,
.keyword-left-table th:nth-child(3) .matrix-term-sort,
.keyword-left-table th:nth-child(4) .matrix-term-sort {
  justify-content: flex-end;
}
/* Keep competitor meta + term header fixed; only the term body grows/scrolls. */
.keyword-matrix-split .keyword-meta-pane,
.keyword-matrix-split .matrix-splitter,
.keyword-matrix-split .keyword-term-header,
.keyword-matrix-split .keyword-hscroll-rail {
  flex-shrink: 0;
}
.keyword-matrix-split .keyword-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
}
.matrix-meta-label-cell {
  display: flex !important;
  align-items: center;
  gap: 6px;
  text-align: left !important;
}
.matrix-meta-label-text {
  flex: 1 1 auto;
  min-width: 0;
}
.matrix-pin-btn {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.matrix-pin-btn:hover {
  background: #e2e8f0;
}
.matrix-pin-icon {
  width: 10px;
  height: 10px;
  border: 1.5px solid #64748b;
  border-radius: 1px 1px 2px 2px;
  transform: rotate(45deg);
  position: relative;
}
.matrix-pin-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 1.5px;
  height: 4px;
  background: #64748b;
  transform: translateX(-50%);
}
.matrix-pin-btn.is-pinned .matrix-pin-icon {
  border-color: #2563eb;
  background: #93c5fd;
}
.matrix-pin-btn.is-pinned .matrix-pin-icon::after {
  background: #2563eb;
}
.matrix-hidden-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.matrix-restore-metric {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  cursor: pointer;
}
.matrix-image-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 56px;
}
.matrix-comp-check {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 3;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}
.matrix-comp-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}
.matrix-comp-check-spacer {
  display: none;
}
.matrix-brand-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}
.competitor-rank.hero-rank {
  background: #166534;
  color: #fff;
}
.keyword-table-wrap { max-height: 610px; overflow: auto; }
.keyword-table { min-width: 1220px; table-layout: fixed; }
.keyword-table th, .keyword-table td { height: 42px; padding: 6px 8px; text-align: center; }
.keyword-table th:first-child, .keyword-table td:first-child {
  position: sticky;
  z-index: 4;
  left: 0;
  width: 230px;
  background: white;
  text-align: left;
}
.keyword-table th:nth-child(2), .keyword-table td:nth-child(2) {
  position: sticky;
  z-index: 4;
  left: 230px;
  width: 105px;
  background: white;
  text-align: right;
}
.keyword-table th:nth-child(3), .keyword-table td:nth-child(3) {
  position: sticky;
  z-index: 4;
  left: 335px;
  width: 78px;
  border-right: 2px solid var(--border);
  background: white;
}
.keyword-table thead th { z-index: 6; height: 78px; }
.keyword-table thead th:first-child, .keyword-table thead th:nth-child(2), .keyword-table thead th:nth-child(3) { z-index: 8; background: var(--surface-2); }
.keyword-term { display: flex; justify-content: space-between; gap: 8px; }
.keyword-term button { border: 0; background: transparent; color: #a4a8b5; }
.keyword-term button:hover { color: var(--danger); }
.comp-header { min-width: 112px; text-align: center; }
.comp-avatar { display: grid; place-items: center; width: 27px; height: 27px; margin: 0 auto 4px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.comp-header strong, .comp-header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-header strong { font-size: 9px; }
.comp-header small { font-size: 8px; }
.heat { border-left: 1px solid white; font-weight: 800; }
.heat-5 { background: #17875d !important; color: white; }
.heat-4 { background: #68a95d !important; color: white; }
.heat-3 { background: #f3b31a !important; color: #4b3500; }
.heat-2 { background: #f18336 !important; color: #4e2108; }
.heat-1 { background: #fee3e4 !important; color: #8a3340; }
.heat-0 { color: #b1b5c1; }
.delta { display: inline-block; margin-left: 3px; font-size: 8px; font-weight: 800; }
.delta.up { color: #0d7e52; }
.delta.down { color: #c23b50; }
.heat-5 .delta, .heat-4 .delta { color: rgba(255, 255, 255, .8); }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 10px 14px; color: var(--muted); font-size: 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; }

.content-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.content-panel { padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.content-panel.suggested { border-color: #d7cdfb; background: #fbfaff; }
.content-copy { min-height: 90px; padding: 12px; border-radius: 9px; background: white; line-height: 1.6; }
.keyword-highlight { padding: 1px 3px; border-radius: 4px; background: #e5dcff; color: #4f2bbd; }
.impact-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.content-jump-nav {
  position: sticky;
  z-index: 7;
  top: 68px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px;
}
.content-jump-nav a { padding: 7px 10px; border-radius: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.content-jump-nav a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.optimization-section { scroll-margin-top: 120px; overflow: hidden; }
.recommendation-reason { padding: 14px; border-left: 3px solid var(--primary); border-radius: 8px; background: var(--primary-soft); }
.recommendation-reason p { margin: 5px 0 0; }
.impact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.impact-grid > div { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: white; }
.impact-grid small, .impact-grid strong, .evidence-row small { display: block; }
.impact-grid strong { margin-top: 5px; font-size: 13px; color: var(--primary-dark); }
.evidence-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 4px; }
.image-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.listing-image { display: grid; place-items: center; min-height: 120px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: linear-gradient(145deg, #eef0f6, #fff); text-align: center; font-weight: 800; }
.listing-image.suggested-image { border-color: #c9bafb; background: linear-gradient(145deg, #eee7ff, #f8fcff); color: var(--primary-dark); }
.bulk-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compact-upload { min-height: 90px; padding: 12px; cursor: pointer; }
.compact-upload strong, .compact-upload small { display: block; }
.section-accordion { overflow: hidden; }
.accordion-header { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--border); background: white; text-align: left; }
.accordion-content { padding: 18px; }

.report-cover { padding: 32px; color: white; background: linear-gradient(135deg, #25213f, #6b43dc 58%, #ad50db); }
.report-cover .eyebrow { color: #d8cbff; }
.report-cover p { color: #e4dcff; }
.priority-list { display: grid; gap: 10px; }
.priority-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 11px; border: 1px solid var(--border); border-radius: 10px; }
.priority-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 800; }

.activity-drawer {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 94vw);
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -20px 0 50px rgba(20, 23, 34, .14);
  transform: translateX(105%);
  transition: transform .22s ease;
}
.activity-drawer.open { transform: none; }
.drawer-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.drawer-header h2 { margin-bottom: 0; }
.drawer-backdrop { position: fixed; z-index: 90; inset: 0; visibility: hidden; background: rgba(26, 27, 38, .3); opacity: 0; transition: .2s; }
.drawer-backdrop.open { visibility: visible; opacity: 1; }
.activity-section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.log-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.log-list li { display: grid; grid-template-columns: 55px 1fr; gap: 8px; color: var(--muted); font-family: Consolas, monospace; font-size: 10px; line-height: 1.45; }
.log-list time { color: #a1a5b2; }

dialog { width: min(650px, calc(100vw - 32px)); max-height: 86vh; overflow-y: auto; padding: 0; border: 0; border-radius: 18px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(25, 26, 38, .45); backdrop-filter: blur(2px); }
.modal-close { position: absolute; z-index: 2; top: 13px; right: 13px; }
.modal-content { padding: 24px; }
.modal-content h2 { padding-right: 38px; }

.toast-region { position: fixed; z-index: 150; top: 80px; right: 18px; display: grid; gap: 8px; width: min(350px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; background: white; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast strong, .toast span { display: block; }
.toast span { margin-top: 2px; color: var(--muted); font-size: 11px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } }
.empty-state { display: grid; place-items: center; min-height: 240px; padding: 30px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--text); }
.mobile-only { display: none; }

@media (max-width: 1050px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sidebar { grid-template-columns: 1fr; }
  .content-compare { grid-template-columns: 1fr; }
  .topbar-context { display: none; }
  .wizard-layout, .upload-guide-layout, .review-workspace { grid-template-columns: 1fr; }
  .analysis-summary-card, .upload-report-card { position: static; }
  .review-summary { grid-template-columns: repeat(3, 1fr); }
  .review-summary-product { grid-column: 1 / -1; padding-bottom: 12px; }
  .review-summary-keepa { border-left: 0; }
  .selection-console, .dual-report-grid { grid-template-columns: 1fr; }
  .product-browser { border-right: 0; border-bottom: 1px solid var(--border); }
  .dual-report-grid > section + section { border-left: 0; border-top: 1px solid var(--border); }
  .full-review-toolbar { grid-template-columns: 1fr 1fr; }
  .bulk-action-cluster { border-left: 0; }
}

@media (max-width: 760px) {
  .mobile-only { display: grid; }
  .topbar { gap: 10px; padding: 0 12px; }
  .brand { min-width: auto; }
  .brand > span:last-child, #subscription-chip { display: none; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; padding: 18px 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .background-status, .impact-grid, .evidence-row, .bulk-upload-grid { grid-template-columns: 1fr; }
  .content-jump-nav { top: 60px; overflow-x: auto; flex-wrap: nowrap; }
  .image-strip { grid-template-columns: 1fr; }
  .product-selector-toolbar, .product-selector-grid, .settings-requirements { grid-template-columns: 1fr; }
  .period-card { grid-template-columns: auto 1fr; }
  .period-card > span:nth-last-child(-n+2) { display: none; }
  .review-summary { grid-template-columns: 1fr 1fr; }
  .review-summary-product, .review-summary-keepa { grid-column: 1 / -1; }
  .review-summary-stat { border-left: 0; border-top: 1px solid var(--border); }
  .review-panel-toolbar { grid-template-columns: 1fr; }
  .review-panel-toolbar .bulk-actions { grid-column: auto; flex-wrap: wrap; }
  .review-footer { position: static; display: grid; }
  .integrated-period-row { grid-template-columns: auto 1fr; }
  .integrated-period-row > span:nth-last-child(-n+2) { display: none; }
  .selection-summary-bar, .reports-ready-bar { position: static; grid-template-columns: 1fr; }
  .summary-lock-note { display: none; }
  .full-review-toolbar, .review-mode-switch { grid-template-columns: 1fr; }
  .review-mode-switch { max-width: none; }
  .manual-import-hint { display: grid; }
  .page-header { display: grid; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .workflow-strip { padding-inline: 10px; }
  .workflow-step { min-width: 90px; }
}

/* Analysis workflow upgrade */
.analysis-meta-card { margin-bottom: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.segmented button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  font-weight: 700;
}
.segmented button.active {
  background: white;
  color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(28, 31, 44, .08);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 26, 38, .45);
  backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative;
  width: min(560px, 100%);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
}
.image-preview-modal { width: min(720px, 100%); padding: 24px; }
.preview-image-lg { width: 100%; border-radius: 12px; display: block; }
.competitor-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  padding: 14px;
}
.comp-image-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}
.comp-image-md {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.comp-brand {
  display: block;
  font-weight: 800;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
  margin-bottom: 2px;
}
.manual-competitors textarea { width: 100%; resize: vertical; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.capitalize { text-transform: capitalize; }

/* Simplified analysis creation */
.create-analysis-page { max-width: 1180px; margin-inline: auto; }
.create-analysis-header { margin-bottom: 22px; }
.create-analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 18px;
}
.create-analysis-form { overflow: hidden; }
.create-form-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(120deg, #fbfaff, white);
}
.create-form-intro h2, .create-form-intro p { margin: 0; }
.create-form-intro p { margin-top: 4px; color: var(--muted); }
.create-step-number {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-weight: 900;
  box-shadow: 0 9px 22px rgba(112, 71, 235, .22);
}
.create-fields { display: grid; gap: 26px; padding: 28px 30px 32px; }
.create-field { margin: 0; padding: 0; border: 0; }
.create-field > span, .create-field > legend {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}
.input-lg { min-height: 48px; padding-inline: 14px; font-size: 15px; }
.period-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.period-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: white;
  text-align: left;
}
.period-choice:hover { border-color: #b9a9f5; background: #fcfbff; }
.period-choice.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.period-choice strong, .period-choice small { display: block; }
.period-choice small { margin-top: 3px; }
.period-choice-mark {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  border: 2px solid #b6b9c6;
  border-radius: 50%;
  background: white;
}
.period-choice.selected .period-choice-mark { border-color: var(--primary); box-shadow: inset 0 0 0 4px white; background: var(--primary); }
.asin-input-wrap { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; }
.asin-input-wrap > span:first-child {
  z-index: 1;
  margin-right: -1px;
  padding: 15px 12px;
  border: 1px solid var(--border);
  border-radius: 10px 0 0 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.asin-input-wrap .input { border-radius: 0 10px 10px 0; letter-spacing: .08em; }
.asin-valid { position: absolute; right: 14px; color: var(--success); font-weight: 900; }
.create-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.create-form-footer strong, .create-form-footer span { display: block; }
.create-form-footer span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.create-analysis-summary { position: sticky; top: 84px; padding: 24px; text-align: center; }
.summary-hero-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 18px auto 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary-soft), #f7eaff);
  color: var(--primary-dark);
  font-size: 20px;
  font-weight: 900;
}
.create-analysis-summary h3 { overflow-wrap: anywhere; }
.create-summary-list, .confirm-summary { margin: 20px 0; }
.create-summary-list > div, .confirm-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.create-summary-list dt, .confirm-summary dt { color: var(--muted); }
.create-summary-list dd, .confirm-summary dd { margin: 0; font-weight: 800; text-align: right; }

/* Navigable workflow */
.workflow-step:hover { color: var(--primary); }
.workflow-step.complete { cursor: pointer; }

/* Competitor comparison table */
.competitor-table-wrap { max-height: 680px; }
.competitor-data-table { min-width: 1180px; }
.competitor-data-table th, .competitor-data-table td { vertical-align: middle; }
.competitor-data-table th:nth-child(2),
.competitor-data-table td:nth-child(2) {
  width: var(--comp-title-width, 220px);
  max-width: var(--comp-title-width, 220px);
  min-width: 160px;
}
.comp-title-col { position: relative; }
.comp-title-header {
  position: relative;
  display: block;
  padding-right: 10px;
}
.comp-title-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  z-index: 5;
}
.comp-title-resize-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 2px;
  border-radius: 2px;
  background: #cbd5e1;
}
.comp-title-resize-handle:hover::after,
.competitor-data-table.title-expanded .comp-title-resize-handle::after {
  background: var(--primary);
}
.comp-title-resize-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  cursor: col-resize;
}
.competitor-data-table th:nth-child(7) { min-width: 120px; }
.competitor-data-table th:last-child,
.competitor-data-table td:last-child {
  width: 88px;
  min-width: 88px;
  max-width: 96px;
  white-space: nowrap;
  position: sticky;
  right: 0;
  z-index: 1;
  background: #fff;
  box-shadow: -6px 0 10px rgba(15, 23, 42, 0.04);
}
.competitor-data-table thead th:last-child {
  z-index: 3;
  background: white;
}
.input-xs { min-height: 30px; padding: 4px 7px; font-size: 10px; }
.competitor-data-table thead th { vertical-align: top; }
.competitor-data-table thead th > span { display: block; margin-bottom: 6px; }
.header-filter { width: 100%; background: white; font-weight: 400; }
.excel-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 5px; min-width: 105px; }
.excel-header-label { margin: 0 !important; white-space: nowrap; }
.excel-header-actions { display: flex; align-items: center; gap: 1px; }
.header-icon { width: 24px; height: 24px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.header-icon:hover { border-color: var(--border); background: white; color: var(--ink); }
.header-icon.active { background: #dbeafe; color: var(--primary); border-color: #93c5fd; }
.excel-filter-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 7px;
  width: 230px;
  max-height: min(80vh, 640px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .18);
  color: var(--ink);
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}
.excel-filter-menu-wide {
  width: 300px;
}
.excel-filter-menu-path {
  min-width: 320px;
}
.excel-menu-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 0 0 6px 0;
  background:
    linear-gradient(135deg, transparent 55%, #94a3b8 55%, #94a3b8 70%, transparent 70%),
    linear-gradient(135deg, transparent 75%, #94a3b8 75%, #94a3b8 90%, transparent 90%);
  cursor: nwse-resize;
}
.excel-menu-resize-capture {
  position: fixed;
  inset: 0;
  z-index: 90;
  cursor: nwse-resize;
}
.excel-distinct-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.excel-distinct-toolbar {
  display: grid;
  gap: 6px;
}
.excel-distinct-negate-bar {
  display: grid;
  gap: 4px;
}
.excel-distinct-list {
  display: grid;
  gap: 4px;
  max-height: var(--excel-distinct-height, 220px);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
}
.excel-distinct-list-path {
  max-height: var(--excel-distinct-height, 340px);
}
.excel-distinct-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin: 0;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.excel-distinct-item-path {
  padding: 6px 2px;
  border-bottom: 1px solid #e2e8f0;
}
.excel-distinct-item-negate {
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  align-items: center;
}
.excel-distinct-item-path:last-child {
  border-bottom: 0;
}
.excel-distinct-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.excel-distinct-plain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.excel-distinct-leaf {
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
}
.excel-distinct-trail {
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  color: #64748b;
  white-space: normal;
  overflow-wrap: anywhere;
}
.excel-distinct-full {
  display: block;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
  color: #475569;
  white-space: normal;
  overflow-wrap: anywhere;
}
.excel-distinct-count {
  min-width: 1.6rem;
  padding: 1px 5px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}
.excel-distinct-negate {
  padding: 2px 7px;
  font-size: 10px;
  white-space: nowrap;
}
.btn-xs {
  padding: 2px 7px;
  font-size: 10px;
  line-height: 1.3;
}
.excel-distinct-item input {
  margin: 2px 0 0;
}
.browse-node-cell {
  min-width: 140px;
  max-width: 220px;
  vertical-align: top;
}
.browse-node-leaf {
  display: block;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.3;
}
.browse-node-path {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.25;
  font-weight: 500;
}
.query-role-cell { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.query-role-btn {
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
}
.query-role-btn.active.primary { border-color: var(--primary); background: #ede9fe; color: var(--primary-dark); }
.query-role-btn.active.secondary { border-color: #0f766e; background: #ccfbf1; color: #0f766e; }
.content-keyword-panel { margin-top: 16px; }
.content-keyword-list { display: grid; gap: 8px; margin-top: 12px; }
.content-keyword-list-scroll { max-height: min(55vh, 520px); overflow: auto; }
.content-keyword-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .45);
}
.modal-panel {
  width: min(920px, 100%);
  max-height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
.modal-panel .card-header,
.modal-panel .card-body,
.modal-panel .modal-footer {
  padding: 16px 18px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.ads-full-modal { width: min(1100px, 100%); }
.ads-full-scroll { overflow: auto; max-height: min(68vh, 640px); }
.ads-campaign-block { margin-bottom: 18px; }
.ads-campaign-block h3 {
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #111827;
  font-size: 15px;
}
.ads-adgroup-block {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.ads-adgroup-block h4 {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 13px;
}
.keyword-right-table.pin-ours th:first-child,
.keyword-right-table.pin-ours td:first-child {
  position: sticky;
  left: 0;
  z-index: 6;
  background: #fff8eb;
  box-shadow: 2px 0 0 #f59e0b, 6px 0 12px rgba(15, 23, 42, .08);
}
.keyword-right-table.pin-ours .matrix-image-row td:first-child,
.keyword-right-table.pin-ours .matrix-metadata-row td:first-child {
  background: #fff8eb;
}
.matrix-pin-ours-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 2px 6px;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  background: #fffbeb;
  color: #92400e;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}
.matrix-pin-ours-btn.unpinned {
  border-color: var(--border);
  background: white;
  color: var(--muted);
}
.excel-menu-action { padding: 7px 8px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.excel-menu-action:hover { background: var(--surface-2); }
.excel-menu-divider { border-top: 1px solid var(--border); }
.excel-menu-buttons { display: flex; justify-content: flex-end; gap: 6px; }
.competitor-product-cell {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  max-width: var(--comp-title-width, 220px);
}
.competitor-product-cell strong,
.competitor-product-cell .competitor-pdp-link {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.35;
  font-size: 12px;
  font-weight: 700;
  word-break: break-word;
}
.competitor-data-table.title-expanded .competitor-product-cell strong,
.competitor-data-table.title-expanded .competitor-product-cell .competitor-pdp-link {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
  text-overflow: unset;
}
.competitor-pdp-link { color: var(--primary-dark); font-weight: 800; text-decoration: none; }
.competitor-pdp-link:hover { text-decoration: underline; }
.competitor-pdp-link.asin-link,
.competitor-data-table .asin-link {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.comp-table-image {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
}
.competitor-asin-input { width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* Keyword analysis sections */
.keyword-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.keyword-section-heading h2, .keyword-section-heading h3 { margin: 4px 0; }
.keyword-section-heading p { margin: 0; color: var(--muted); }
.keyword-section-heading.compact { padding-block: 14px; }
.keyword-master-heading { border-bottom: 5px solid #111827; box-shadow: 0 2px 0 rgba(17, 24, 39, .12); }
.keyword-controls { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 8px; }
.keyword-filter-analysis-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.keyword-filter-input { width: min(100%, 420px); flex: 0 1 420px; }
.keyword-analysis-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 10px 18px; }
.keyword-analysis-controls .control-label { margin: 0; }
.keyword-control-group { display: grid; gap: 5px; }
.inline-field { display: grid; gap: 3px; }
.inline-field > span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.control-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.competitor-rank {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 22px;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-size: 8px;
  font-weight: 900;
}
.comp-header { position: relative; }
.comp-header.compact { min-width: 110px; }
.matrix-column-header { position: relative; display: grid; justify-items: center; gap: 2px; width: 100%; max-width: 100%; min-width: 0; padding: 2px 18px 2px 2px; box-sizing: border-box; }
.matrix-product-image { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--border); }
.matrix-product-metrics { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 7px; max-width: 145px; color: var(--text-muted); }
.matrix-product-metrics small { white-space: nowrap; font-size: 8px; }
.matrix-header-actions { position: absolute; top: 2px; right: 0; display: grid; gap: 0; }
.matrix-header-actions .header-icon { width: 18px; height: 18px; font-size: 10px; }
.keyword-table thead { position: sticky; z-index: 7; top: 0; }
.keyword-table thead th { height: 28px; padding-block: 4px; background: #fff; }
.keyword-table thead .matrix-image-row th { height: 62px; }
.keyword-table thead .matrix-keyword-header-row th { height: 62px; background: var(--surface-2); border-top: 2px solid var(--border); }
.matrix-metadata-label { color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.matrix-metadata-value { position: relative; min-width: 0; border-left: 1px solid var(--border); text-align: center; }
.matrix-metadata-spacer, .matrix-metadata-action { background: #fff; }
.matrix-pdp-image-link { position: relative; display: inline-grid; place-items: center; color: inherit; text-decoration: none; }
.matrix-pdp-image-link:hover .matrix-product-image { border-color: var(--primary); box-shadow: 0 4px 14px rgba(79, 70, 229, .16); }
.matrix-pdp-image-link .competitor-rank { top: -4px; left: -8px; right: auto; }
.matrix-image-cell .competitor-rank.hero-rank { left: auto; right: -4px; top: -4px; }
.asin-link { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.keyword-search-link { color: var(--primary-dark); font-weight: 800; text-decoration: none; }
.keyword-search-link:hover { text-decoration: underline; }
.matrix-filter-menu { top: calc(100% + 6px); right: 0; justify-items: stretch; }
.keyword-analysis-section { margin-top: 18px; overflow: hidden; }
.trend-method-bar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.trend-method-bar .control-label { margin: 0; }
.trend-heatmap td.trend-positive { background: #dbeafe; color: #1e3a8a; font-weight: 800; text-align: center; }
.trend-heatmap td.trend-negative { background: #ffedd5; color: #9a3412; font-weight: 800; text-align: center; }
.trend-heatmap td.trend-neutral { background: #f1f5f9; color: #475569; text-align: center; }
.trend-heatmap td.trend-strong { box-shadow: inset 0 0 0 999px rgba(59, 130, 246, .08); }
.trend-heatmap td.trend-negative.trend-strong { box-shadow: inset 0 0 0 999px rgba(234, 88, 12, .08); }
.keyword-secondary-analysis { margin-top: 28px; }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.section-title-row h2 { margin: 4px 0; }
.section-title-row p { margin: 0; color: var(--muted); }
.standalone-analysis { margin-top: 48px; padding-top: 28px; border-top: 2px solid var(--border); }
.standalone-analysis-card { overflow: hidden; }
.content-asset-card { border-color: #bfdbfe; }
.content-current-image { display: block; width: min(100%, 360px); max-height: 320px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: white; }
.content-image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.content-gallery-item { margin: 0; display: grid; gap: 6px; }
.content-gallery-item img { width: 100%; aspect-ratio: 1; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.content-gallery-item figcaption { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }
.content-asset-empty { display: grid; place-items: center; min-height: 150px; padding: 20px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); text-align: center; }
.content-asset-empty > span { font-size: 30px; color: var(--primary); }
.decision-filter-tabs { flex-wrap: nowrap; }
.competitor-picker { display: block; padding: 14px 16px; margin: 0; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.competitor-picker-heading { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(240px, 380px) auto; align-items: end; gap: 14px; margin-bottom: 12px; }
.competitor-picker-heading > div { display: grid; gap: 4px; }
.competitor-picker-heading small { color: var(--muted); }
.competitor-picker-table-wrap { max-height: 350px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.competitor-picker-table { min-width: 900px; }
.competitor-picker-table thead th { position: sticky; z-index: 2; top: 0; background: #f8fafc; }
.competitor-picker-table th, .competitor-picker-table td { white-space: nowrap; vertical-align: middle; }
.picker-product-image { display: block; width: 38px; height: 38px; object-fit: contain; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.content-generation-progress { overflow: hidden; }
.content-generation-progress span { width: 38%; animation: content-progress 1.2s ease-in-out infinite alternate; }
@keyframes content-progress {
  from { transform: translateX(-15%); }
  to { transform: translateX(165%); }
}

.content-image-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.content-image-slot-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.content-image-slot-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.content-generated-preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.ba-compare {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  outline: none;
}
.ba-compare:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
}
.ba-compare img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
.ba-compare-after {
  z-index: 1;
}
.ba-compare-before {
  z-index: 2;
}
.ba-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  z-index: 3;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18), 0 1px 6px rgba(15, 23, 42, 0.2);
  pointer-events: none;
  display: grid;
  place-items: center;
  transition: box-shadow 0.15s ease;
}
.ba-compare:hover .ba-compare-handle,
.ba-compare-active .ba-compare-handle {
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28), 0 2px 10px rgba(15, 23, 42, 0.28);
}
.ba-compare-grip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease;
  position: relative;
}
.ba-compare-grip::before,
.ba-compare-grip::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  transform: translateY(-50%);
}
.ba-compare-grip::before {
  left: 6px;
  border-width: 4px 5px 4px 0;
  border-color: transparent var(--primary) transparent transparent;
}
.ba-compare-grip::after {
  right: 6px;
  border-width: 4px 0 4px 5px;
  border-color: transparent transparent transparent var(--primary);
}
.ba-compare:hover .ba-compare-grip,
.ba-compare-active .ba-compare-grip {
  transform: scale(1.08);
}
.ba-compare-label {
  position: absolute;
  top: 10px;
  z-index: 4;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: 6px;
  pointer-events: none;
  line-height: 1.2;
}
.ba-compare-label-new {
  left: 10px;
  color: #fff;
  background: color-mix(in srgb, var(--primary) 88%, #0f172a);
}
.ba-compare-label-current {
  right: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
}

.content-image-prompt {
  white-space: pre-wrap;
  font-size: 11px;
  max-height: 160px;
  overflow: auto;
  margin: 0;
  padding: 8px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
}
@media (max-width: 900px) {
  .content-image-slot-grid { grid-template-columns: 1fr; }
}

.brand-kit-card .card-header { align-items: flex-start; }
.brand-kit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.brand-kit-grid label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.brand-kit-grid input,
.brand-kit-grid select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}
.brand-kit-span-2 { grid-column: 1 / -1; }
.setup-accordion {
  display: grid;
  gap: 12px;
}
.setup-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.setup-panel.locked { opacity: .55; }
.setup-panel.done { border-color: #9ad7b0; }
.setup-panel.open {
  border-color: var(--accent, #2f6fed);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #2f6fed) 22%, transparent);
}
.setup-panel-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  padding: 14px 16px;
  border: 0;
  background: var(--surface-2, #f7f8fa);
  cursor: pointer;
  font: inherit;
}
.setup-panel-header:disabled { cursor: not-allowed; }
.setup-panel-header > div {
  display: grid;
  gap: 2px;
}
.setup-panel-body {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.setup-panel.open .setup-panel-header { background: #fff; }
.color-input-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: center;
}
.color-swatch-input {
  width: 48px !important;
  min-height: 40px;
  padding: 2px !important;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}
.keepa-identity-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.keepa-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
}
.keepa-image-pick {
  margin: 0;
  padding: 4px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.keepa-image-pick.selected {
  border-color: var(--accent, #2f6fed);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #2f6fed) 25%, transparent);
}
.keepa-image-pick img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}
.brand-logo-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.brand-logo-preview {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.brand-logo-upload {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.brand-logo-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.brand-kit-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.content-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.content-theme-card {
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.content-theme-card:hover:not(:disabled) {
  border-color: #c4b5fd;
  box-shadow: 0 8px 20px rgba(100, 63, 206, .12);
  transform: translateY(-1px);
}
.content-theme-card.selected {
  border-color: var(--primary);
  background: #fbfaff;
  box-shadow: 0 0 0 1px var(--primary);
}
.content-theme-card:disabled { opacity: .55; cursor: not-allowed; }
.content-theme-card .eyebrow { text-transform: uppercase; letter-spacing: .04em; }
.content-theme-headline { color: var(--primary-dark); font-size: 13px; font-weight: 700; }
.content-theme-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.content-theme-card ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}
@media (max-width: 900px) {
  .brand-kit-grid,
  .content-theme-grid { grid-template-columns: 1fr; }
  .brand-logo-panel { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .create-analysis-layout { grid-template-columns: 1fr; }
  .create-analysis-summary { position: static; }
  .keyword-section-heading { display: grid; }
  .keyword-controls { justify-content: flex-start; }
  .keyword-filter-analysis-row { display: grid; }
  .keyword-analysis-controls { justify-content: flex-start; }
  .competitor-picker-heading { grid-template-columns: 1fr; }
  .competitor-review-heading { display: grid; }
  .competitor-heading-actions { justify-items: start; }
  .section-title-row { display: grid; align-items: start; }
}
@media (max-width: 620px) {
  .period-choice-grid { grid-template-columns: 1fr; }
  .create-fields { padding: 22px 18px; }
  .create-form-footer { align-items: stretch; flex-direction: column; }
}

/* —— Tracking keyword rank heatmap —— */
.tracking-page .tracking-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  margin: 12px 0 16px;
}
.tracking-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rank-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.08);
  display: inline-block;
}
.heatmap-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.heatmap-scroll {
  overflow: auto;
  max-height: min(70vh, 760px);
}
.heatmap-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  font-size: 12px;
}
.heatmap-table th,
.heatmap-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f1f5f9;
  text-align: center;
  white-space: nowrap;
}
.heatmap-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left !important;
  min-width: 220px;
  max-width: 280px;
  background: #fff;
  box-shadow: 4px 0 8px rgba(15, 23, 42, .04);
}
.heatmap-table thead th.heatmap-sticky-col,
.heatmap-table thead th.heatmap-meta-col,
.heatmap-table thead th.heatmap-day-col,
.heatmap-table thead th.heatmap-week-col {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
}
.heatmap-table thead th.heatmap-sticky-col { z-index: 4; }
.heatmap-meta-col { min-width: 64px; color: var(--muted); }
.heatmap-day-col,
.heatmap-week-col { min-width: 42px; }
.rank-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  cursor: default;
}
.rank-1-10 { background: #86efac; color: #14532d; }
.rank-11-20 { background: #bbf7d0; color: #166534; }
.rank-21-50 { background: #fef08a; color: #854d0e; }
.rank-51-plus { background: #fdba74; color: #9a3412; }
.rank-missing { background: #f1f5f9; color: #94a3b8; font-weight: 500; }
.week-chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.week-chip.active,
.week-chip:hover {
  border-color: var(--primary);
  background: #ede9fe;
  color: var(--primary-dark);
}
.tracking-weekly-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .9fr);
  gap: 16px;
  align-items: start;
}
.week-drilldown { position: sticky; top: 12px; }
.rank-improved { color: var(--success); font-weight: 700; }
.rank-declined { color: var(--danger); font-weight: 700; }
.tracking-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin: 0 0 14px;
}
.tracking-filter-bar .input { width: min(100%, 280px); }
.heatmap-sort-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}
.heatmap-sort-group .btn.active {
  border-color: var(--primary);
  background: #ede9fe;
  color: var(--primary-dark);
}
.heatmap-header-sort {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.tracking-upload-card { margin-bottom: 8px; }
.tracking-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tracking-upload-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tracking-upload-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tracking-dropzone { min-height: 88px; }
@media (max-width: 1100px) {
  .tracking-weekly-layout { grid-template-columns: 1fr; }
  .week-drilldown { position: static; }
  .tracking-upload-grid { grid-template-columns: 1fr; }
}

/* Content Studio */
.studio-setup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, #f8f9fc, #fff);
}
.studio-setup-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.studio-check {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
}
.studio-check.done {
  background: #e8f8ef;
  color: #0d7e52;
}
.studio-check.pending {
  background: #fff6e8;
  color: #9a6700;
}
.setup-collapse-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 4px;
}
.content-studio {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  overflow: hidden;
  animation: studio-fade .22s ease;
}
@keyframes studio-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.studio-toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
}
.studio-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.studio-tab {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px 14px;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}
.studio-tab.active {
  background: white;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(20, 24, 40, .08);
}
.studio-toolbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.studio-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.studio-body {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  min-height: 520px;
}
.studio-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--border);
  background: #fafbfe;
}
.studio-rail-btn {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  position: relative;
}
.studio-rail-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.studio-rail-btn.active {
  background: white;
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--primary);
}
.studio-rail-btn.accepted::after {
  content: "✓";
  float: right;
  color: #0d7e52;
  font-size: 11px;
}
.studio-workspace { padding: 16px 18px 22px; }
.studio-create-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.studio-create-header h2 { margin: 4px 0 0; font-size: 20px; }
.studio-create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, .8fr);
  gap: 16px;
}
.studio-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fcfcff;
}
.studio-textarea { min-height: 280px; font-family: inherit; line-height: 1.55; }
.studio-suggested {
  min-height: 220px;
  padding: 14px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--border);
  line-height: 1.6;
}
.studio-create-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.studio-create-actions .btn {
  flex: 0 0 auto;
  align-self: center;
  height: auto;
  min-height: 32px;
  writing-mode: horizontal-tb;
}
.studio-meta {
  display: grid;
  gap: 12px;
  align-content: start;
}
.studio-meta-block {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.studio-meta-block p { margin: 8px 0 0; line-height: 1.5; }
.studio-empty-current { margin: 8px 0 0; }
.studio-current { margin: 8px 0 0; }
.studio-compare { display: grid; gap: 12px; }

/* Create Images / A+: Current vs New split */
.studio-image-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
.studio-image-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fcfcff;
  min-width: 0;
}
.studio-image-panel-new { background: #fff; }
.studio-image-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.studio-new-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.studio-new-image-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.studio-aplus-brief {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.studio-aplus-brief summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.studio-aplus-gen-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.studio-aplus-thumb {
  aspect-ratio: auto;
  max-height: 220px;
  width: 100%;
  object-fit: contain;
}
.studio-aplus-layout-plan {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--info, #1769aa);
  background: var(--info-soft, #e8f3ff);
  border-radius: 0 10px 10px 0;
}
.studio-aplus-layout-plan-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
}
.studio-aplus-layout-plan p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, #687086);
}
.studio-aplus-empty-plan {
  margin-bottom: 12px;
  gap: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Amazon-style gallery viewer */
.img-gallery {
  min-width: 0;
}
.img-gallery-body {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.img-gallery-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 2px;
}
.img-gallery-thumb {
  display: grid;
  gap: 4px;
  width: 64px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}
.img-gallery-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.img-gallery-thumb-label {
  font-size: 10px;
  line-height: 1.2;
  padding: 0 4px 4px;
  color: var(--muted, #6b7280);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.img-gallery-thumb.active {
  border-color: #e47911;
  box-shadow: 0 0 0 1px #e47911;
}
.img-gallery-main {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  min-height: 280px;
}
.img-gallery-main img {
  width: 100%;
  max-width: 420px;
  max-height: 420px;
  object-fit: contain;
  border-radius: 8px;
}
.img-gallery-caption {
  font-size: 12px;
}
.img-gallery-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 220px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted, #6b7280);
  background: #fff;
}
.img-gallery-empty span { font-size: 28px; opacity: 0.45; }

/* Amazon PDP preview */
.pdp-preview-shell { padding: 14px 16px 22px; }
.pdp-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.pdp-seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.pdp-seg-btn {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 750;
  color: var(--muted);
  cursor: pointer;
}
.pdp-seg-btn.active {
  background: white;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(20, 24, 40, .08);
}
.pdp-frame {
  border: 1px solid #d5d9d9;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  animation: studio-fade .25s ease;
}
.pdp-frame-mobile {
  max-width: 390px;
  margin-inline: auto;
}
.pdp-topbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #131921;
  color: #fff;
  font-weight: 800;
  letter-spacing: .02em;
}
.pdp-breadcrumb { padding: 10px 14px 0; font-size: 12px; }
.pdp-main {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
  padding: 14px;
}
.pdp-frame-mobile .pdp-main { grid-template-columns: 1fr; }
.pdp-gallery { display: grid; gap: 10px; }
.pdp-gallery-main {
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 1px solid #e7e7e7;
  border-radius: 4px;
  background: #fff;
}
.pdp-gallery-main img {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
}
.pdp-gallery-empty {
  color: #888;
  font-size: 13px;
}
.pdp-gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pdp-thumb {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid #d5d9d9;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}
.pdp-thumb.active { border-color: #e47911; box-shadow: 0 0 0 1px #e47911; }
.pdp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pdp-buybox { display: grid; gap: 8px; align-content: start; }
.pdp-asin { margin: 0; font-size: 12px; }
.pdp-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  color: #0f1111;
}
.pdp-highlights {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f7fafa;
  border: 1px solid #e7e7e7;
  font-size: 13px;
}
.pdp-rating, .pdp-price { margin: 0; }
.pdp-price { font-size: 22px; font-weight: 700; color: #0f1111; }
.pdp-bullets {
  margin: 4px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}
.pdp-bullets li { line-height: 1.45; font-size: 14px; }
.pdp-fake-btn {
  margin-top: 8px;
  width: fit-content;
  padding: 8px 18px;
  border: 0;
  border-radius: 20px;
  background: #ffd814;
  color: #0f1111;
  font-weight: 700;
  opacity: .55;
  cursor: default;
}
.pdp-section {
  padding: 8px 14px 18px;
  border-top: 1px solid #eee;
}
.pdp-section h3 { margin: 0 0 8px; font-size: 16px; }
.pdp-description { margin: 0; white-space: pre-wrap; line-height: 1.55; }
.pdp-aplus-stack { display: grid; gap: 12px; }
.pdp-aplus-module {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #e7e7e7;
  border-radius: 6px;
  background: #fafafa;
}
.pdp-frame-mobile .pdp-aplus-module { grid-template-columns: 1fr; }
.pdp-aplus-visual {
  min-height: 88px;
  border-radius: 4px;
  background: linear-gradient(145deg, #eceff3, #f8fafc);
  overflow: hidden;
}
.pdp-aplus-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 88px;
  object-fit: cover;
}
.pdp-aplus-module p { margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: #333; }

@media (max-width: 900px) {
  .studio-body { grid-template-columns: 1fr; }
  .studio-rail {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .studio-rail-btn { white-space: nowrap; }
  .studio-create-grid { grid-template-columns: 1fr; }
  .studio-image-split { grid-template-columns: 1fr; }
  .img-gallery-body { grid-template-columns: 1fr; }
  .img-gallery-thumbs {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .pdp-main { grid-template-columns: 1fr; }
  .studio-toolbar { flex-wrap: wrap; }
}


