.keyword-battle-page {
  display: grid;
  gap: var(--space-3);
}

.keyword-battle-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
}

.keyword-battle-hero h2 {
  margin: 2px 0 var(--space-1);
  font-size: var(--fs-display);
  line-height: 1.25;
}

.keyword-battle-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--gray-500);
}

.keyword-battle-kicker {
  color: var(--primary);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.keyword-battle-config {
  flex: none;
  font-size: var(--fs-sm);
}

.keyword-battle-config.ok { color: var(--success-text); }
.keyword-battle-config.warn { color: var(--warning); }

.keyword-battle-create {
  display: grid;
  gap: 16px;
}

.keyword-battle-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.keyword-battle-form-grid label,
.keyword-battle-semantics label,
.keyword-battle-copy-grid label,
.keyword-battle-table-panel .panel-header label {
  display: grid;
  gap: 6px;
  color: var(--gray-600);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.keyword-battle-form-grid input,
.keyword-battle-form-grid select,
.keyword-battle-semantics textarea,
.keyword-battle-semantics input,
.keyword-battle-copy-grid textarea,
.keyword-battle-table-panel select {
  min-height: 38px;
  padding: 8px 10px;
  color: var(--control-text);
  background: var(--white);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-md);
  font: inherit;
}

.keyword-battle-file { grid-column: span 2; }

.keyword-battle-semantics {
  border-top: 1px solid var(--section-divider);
  padding-top: 12px;
}

.keyword-battle-semantics summary {
  cursor: pointer;
  color: var(--gray-800);
  font-weight: 600;
}

.keyword-battle-semantics > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.keyword-battle-semantics label small {
  color: var(--gray-500);
  font-weight: 400;
  line-height: 1.45;
}

.keyword-battle-diagnosis-config > div { grid-template-columns: repeat(2, 1fr); }
.keyword-battle-competitor-inputs > div { grid-template-columns: minmax(0, 1fr); }

.keyword-battle-competitor-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.keyword-battle-competitor-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.keyword-battle-competitor-row input { flex: 1 1 220px; }
.keyword-battle-competitor-row > span { flex: none; min-width: 18px; color: var(--gray-500); }
.keyword-battle-competitor-row .ui-btn { flex: none; }
.keyword-battle-competitor-row [data-keyword-battle-competitor-remove] { width: 38px; padding-inline: 0; }

.keyword-battle-workspace {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.keyword-battle-jobs {
  position: sticky;
  top: 16px;
}

.keyword-battle-job-list,
.keyword-battle-result {
  display: grid;
  gap: 10px;
}

.keyword-battle-job {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.keyword-battle-job:hover,
.keyword-battle-job.active {
  border-color: var(--primary-focus);
  box-shadow: inset 3px 0 var(--primary);
}

.keyword-battle-job span,
.keyword-battle-job small { color: var(--gray-500); }

.keyword-battle-section-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.keyword-battle-section-menu {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.keyword-battle-section-button {
  width: 100%;
  padding: 10px 12px;
  color: var(--gray-600);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.keyword-battle-section-button:hover { background: var(--gray-50); }
.keyword-battle-section-button.active { color: var(--primary); background: var(--primary-soft-hover); }
.keyword-battle-section-content { min-width: 0; }
.keyword-battle-section-panel { display: grid; gap: 10px; min-width: 0; }
.keyword-battle-section-panel[hidden] { display: none; }

.keyword-battle-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.keyword-battle-metrics article {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  background: var(--white);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
}

.keyword-battle-metrics span { color: var(--gray-500); font-size: var(--fs-sm); }
.keyword-battle-metrics strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.keyword-battle-window {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.keyword-battle-window div { display: grid; gap: 4px; }
.keyword-battle-window span { color: var(--gray-500); font-size: var(--fs-md); }

.keyword-battle-reconciliation { display: grid; gap: 12px; }
.keyword-battle-reconciliation.is-inconsistent { border-color: var(--danger); }
.keyword-battle-reconciliation.is-inconsistent .panel-header p { color: var(--danger); }
.keyword-battle-reconciliation-counts,
.keyword-battle-reconciliation-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 8px;
}

.keyword-battle-reconciliation article {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

.keyword-battle-reconciliation article span { color: var(--gray-500); font-size: var(--fs-xs); }
.keyword-battle-reconciliation article strong { font-variant-numeric: tabular-nums; }
.keyword-battle-reconciliation-table-wrap { overflow-x: auto; }
.keyword-battle-reconciliation-table { width: 100%; min-width: 620px; border-collapse: collapse; }
.keyword-battle-reconciliation-table th,
.keyword-battle-reconciliation-table td { padding: 8px 10px; border-bottom: 1px solid #e7ebe8; text-align: right; }
.keyword-battle-reconciliation-table th:first-child,
.keyword-battle-reconciliation-table td:first-child { text-align: left; }
.keyword-battle-reconciliation-table th { color: var(--gray-500); font-size: var(--fs-xs); }
.keyword-battle-reconciliation details summary { cursor: pointer; font-weight: 700; }
.keyword-battle-reconciliation details ul { display: grid; gap: 5px; margin: 10px 0 0; padding: 0; list-style: none; }
.keyword-battle-reconciliation details li { display: flex; gap: 8px; justify-content: space-between; }
.keyword-battle-reconciliation details li span { color: var(--gray-500); text-align: right; }

.keyword-battle-steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  gap: 7px;
}

.keyword-battle-step {
  display: grid;
  min-height: 76px;
  padding: 9px;
  background: #f6f8f6;
  border: 1px solid #e1e7e2;
  border-radius: 8px;
}

.keyword-battle-step > span { color: #8c978f; font-size: 11px; }
.keyword-battle-step strong { font-size: 12px; }
.keyword-battle-step small { align-self: end; color: #68746c; }
.keyword-battle-step.completed { background: #edf7f0; border-color: #bddbc6; }
.keyword-battle-step.partial { background: #fff8e8; border-color: #e5ce91; }
.keyword-battle-step.failed { background: #fff0ef; border-color: #efc0bc; }
.keyword-battle-step.running { background: #fff7e8; border-color: #ecd09a; }

.keyword-battle-step-details {
  margin-top: 6px;
  font-size: 11px;
}

.keyword-battle-step-details summary { cursor: pointer; color: #6b5740; }
.keyword-battle-step-details ul { display: grid; gap: 5px; margin: 7px 0 0; padding: 0; list-style: none; }
.keyword-battle-step-details li { display: grid; gap: 2px; min-width: 0; }
.keyword-battle-step-details li strong,
.keyword-battle-step-details li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.keyword-enrichment-status {
  display: inline-flex;
  max-width: 100%;
  padding: 3px 7px;
  overflow: hidden;
  color: #805f25;
  background: #fff6dd;
  border-radius: 999px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyword-enrichment-status.selected { color: #247145; background: #e8f6ed; }
.keyword-enrichment-status.neutral { color: #68746c; background: #edf0ee; }

.keyword-battle-table-panel { min-width: 0; overflow: hidden; }
.keyword-battle-table-panel .panel-header { align-items: flex-end; }
.keyword-battle-table-filters { display: flex; gap: 10px; }
.keyword-battle-table { width: 100%; min-width: 0; }
.keyword-battle-table-fallback { overflow-x: auto; }
.keyword-battle-table-panel.has-tabulator .keyword-battle-table-fallback { display: none; }
.keyword-battle-table-fallback table { width: 100%; min-width: 720px; border-collapse: collapse; white-space: nowrap; }
.keyword-battle-table-fallback th,
.keyword-battle-table-fallback td { padding: 8px; border-bottom: 1px solid #e7ebe8; text-align: left; }

.keyword-battle-table.tabulator {
  border: 1px solid #dfe5e1;
  border-radius: 9px;
  overflow: hidden;
  font-size: 12px;
}

.keyword-battle-table .tabulator-header { background: #f2f5f3; }
.keyword-battle-table .tabulator-row { min-height: 50px; }
.keyword-battle-table .tabulator-row:nth-child(even) { background: #fafbfa; }
.keyword-battle-table .tabulator-tableholder { overflow-x: auto; }
.keyword-battle-table .tabulator-col-title { text-align: center; }
.keyword-battle-table .tabulator-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keyword-battle-table .tabulator-cell.keyword-battle-advice-cell {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 16px;
  max-height: 32px;
  white-space: normal;
}
.keyword-battle-table .tabulator-col-group > .tabulator-col-content {
  color: #496255;
  background: #e9f0eb;
  font-weight: 800;
}

.keyword-trend-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.keyword-trend-cell svg {
  flex: 0 0 132px;
  width: 132px;
  height: 32px;
  overflow: visible;
}

.keyword-trend-cell polyline {
  fill: none;
  stroke: #397a52;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.keyword-trend-cell circle {
  fill: #397a52;
  stroke: #fff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.keyword-trend-latest {
  display: inline-flex;
  min-width: 70px;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
}

.keyword-trend-latest strong { color: #273d31; font-size: 12px; }
.keyword-trend-latest small { color: #78827c; font-size: 9px; }

.keyword-trend-weeks {
  position: absolute;
  top: 1px;
  right: 1px;
  padding: 0 4px;
  color: #8b5b12;
  background: #fff4d8;
  border: 1px solid #ecd39d;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 15px;
}

.keyword-trend-missing,
.keyword-trend-empty {
  color: #8a6d46;
  font-size: 11px;
  white-space: nowrap;
}

.keyword-top-asins {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.keyword-top-monopoly {
  display: inline-grid;
  flex: 0 0 112px;
  gap: 3px;
}

.keyword-top-monopoly > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.keyword-top-monopoly i {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: #edf0ee;
  border-radius: 999px;
}

.keyword-top-monopoly b {
  display: block;
  height: 100%;
  background: #e99825;
  border-radius: inherit;
}

.keyword-top-asins-list {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.keyword-top-asins-list > span,
.keyword-suggested-bid {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.keyword-top-asins-list strong,
.keyword-top-monopoly strong,
.keyword-suggested-bid strong { font-size: 11px; }
.keyword-top-asins-list small,
.keyword-top-monopoly small,
.keyword-suggested-bid small { color: #728078; font-size: 10px; }

.keyword-rank-comparison {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.keyword-rank-comparison > span {
  display: inline-flex;
  min-width: 62px;
  flex-direction: column;
  line-height: 1.15;
}

.keyword-rank-comparison > span:last-child { min-width: 105px; }
.keyword-rank-comparison small { overflow: hidden; color: #77827b; font-size: 9px; text-overflow: ellipsis; }
.keyword-rank-comparison strong { color: #397a52; font-size: 12px; }
.keyword-rank-comparison em { color: #9da5a0; font-size: 10px; font-style: normal; }

.keyword-competitor-image {
  display: inline-grid;
  width: 30px;
  height: 28px;
  overflow: hidden;
  background: #eef2ef;
  border: 1px solid #d8dfda;
  border-radius: 5px;
  place-items: center;
}

.keyword-competitor-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.keyword-competitor-image-placeholder {
  color: #7b877f;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.keyword-advice {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.keyword-advice.deny { color: #a82f2f; background: #fde9e7; }
.keyword-advice.bid { color: #9a5a08; background: #fff0d5; }
.keyword-advice.graduate { color: #267044; background: #e4f5e9; }
.keyword-advice.observe { color: #5d675f; background: #edf0ee; }
.keyword-advice.opportunity { color: #25649b; background: #e4f0fb; }

.keyword-battle-report-section {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.keyword-battle-static-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.keyword-battle-static-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  white-space: nowrap;
}

.keyword-battle-static-table th,
.keyword-battle-static-table td {
  min-width: 110px;
  padding: 9px 10px;
  border-bottom: 1px solid #e7ebe8;
  text-align: left;
  vertical-align: middle;
}

.keyword-battle-static-table th {
  color: var(--gray-600);
  text-align: center;
  background: var(--gray-50);
  font-size: var(--fs-sm);
}

.keyword-battle-organic-table { min-width: 980px; }
.keyword-battle-profile-table { min-width: 1120px; }
.keyword-battle-negative-table { min-width: 1320px; }
.keyword-battle-ad-plan-table { min-width: 900px; }
.keyword-battle-root-table { min-width: 720px; }
.keyword-image-matrix { min-width: 1380px; white-space: normal; }
.keyword-image-matrix th:first-child,
.keyword-image-matrix td:first-child { position: sticky; left: 0; z-index: 1; width: 180px; background: #fff; }
.keyword-image-matrix td { min-width: 210px; vertical-align: top; }
.keyword-image-matrix td:first-child strong,
.keyword-image-matrix td:first-child small { display: block; }
.keyword-image-matrix td:first-child small { margin-top: 4px; color: var(--gray-500); }

.keyword-image-checklist { display: grid; grid-column: 1 / -1; gap: 12px; padding: 14px; border: 1px solid var(--panel-border); border-radius: var(--radius-lg); background: var(--gray-50); }
.keyword-image-checklist-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.keyword-image-checklist-head div { display: grid; gap: 3px; }
.keyword-image-checklist-head small { color: var(--gray-500); }
.keyword-image-checklist-rows { display: grid; gap: 8px; }
.keyword-image-checklist-row { display: grid; grid-template-columns: 28px 1.1fr 1fr 150px 1.5fr 38px; align-items: center; gap: 8px; }
.keyword-image-checklist-row > span { color: var(--gray-500); font-weight: 800; text-align: center; }
.keyword-image-checklist-row input,
.keyword-image-checklist-row select { min-width: 0; }
.keyword-image-intents { display: grid; gap: 7px; }
.keyword-image-intents > div { display: flex; flex-wrap: wrap; gap: 8px; }
.keyword-image-intents label { display: inline-flex; align-items: center; gap: 4px; }
.keyword-image-intents label input { width: 150px; }
.keyword-image-confirm { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }

.keyword-image-factor { display: grid; gap: 7px; }
.keyword-image-factor img,
.keyword-image-empty { width: 100%; height: 118px; object-fit: contain; border: 1px solid var(--panel-border); border-radius: var(--radius-md); background: #f7f8f7; }
.keyword-image-empty { display: grid; color: var(--gray-500); place-items: center; }
.keyword-image-factor strong { font-size: 15px; }
.keyword-image-factor em { width: fit-content; padding: 2px 7px; border-radius: 999px; color: #80601b; background: #fff2c9; font-size: 11px; font-style: normal; font-weight: 800; }
.keyword-image-factor small { color: var(--gray-600); line-height: 1.5; white-space: normal; }
.keyword-image-factor.is-visual strong { color: #238047; }
.keyword-image-factor.is-text strong { color: #a56b00; }
.keyword-image-factor.is-unanswered strong { color: #a23d3d; }
.keyword-image-factor.is-uncertain strong,
.keyword-image-factor.is-missing strong { color: #6f7772; }
.keyword-image-benchmark { display: block; color: #16866f; }
.keyword-image-matrix td:last-child p { margin: 8px 0 0; color: var(--gray-600); line-height: 1.6; white-space: normal; }
.keyword-main-checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.keyword-main-checks h4 { grid-column: 1 / -1; margin: 0; }
.keyword-main-checks span { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--panel-border); border-radius: var(--radius-md); background: #fff; }
.keyword-main-checks small { color: var(--gray-500); }
.keyword-battle-manual-review ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.keyword-battle-manual-review li { display: flex; gap: 9px; padding: 9px 10px; border-radius: var(--radius-md); background: #fff7e6; }

.keyword-battle-delta-up { color: #25649b; font-weight: 700; }
.keyword-battle-delta-down { color: #7a5b33; font-weight: 700; }
.keyword-battle-delta-same { color: #5d675f; font-weight: 700; }

.keyword-battle-profile-sales {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.keyword-battle-profile-sales small {
  color: var(--gray-500);
  font-size: var(--fs-xs);
}

.keyword-battle-benchmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.keyword-battle-benchmark img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
}

.keyword-battle-root-section,
.keyword-battle-manual-review {
  display: grid;
  gap: 8px;
}

.keyword-battle-root-section h4,
.keyword-battle-manual-review h4 { margin: 0; }
.keyword-battle-root-section p { margin: 0; color: var(--gray-500); }
.keyword-battle-root-choice { display: inline-flex; align-items: center; gap: 7px; }

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

.keyword-battle-copy-grid textarea {
  width: 100%;
  resize: vertical;
}

@media (max-width: 1280px) {
  .keyword-battle-form-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .keyword-battle-workspace { grid-template-columns: 1fr; }
  .keyword-battle-jobs { position: static; }
  .keyword-battle-metrics { grid-template-columns: repeat(3, 1fr); }
  .keyword-battle-steps { grid-template-columns: repeat(4, 1fr); }
  .keyword-battle-section-layout { grid-template-columns: 1fr; }
  .keyword-battle-section-menu { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  .keyword-battle-hero { align-items: flex-start; flex-direction: column; }
  .keyword-battle-form-grid,
  .keyword-battle-semantics > div,
  .keyword-battle-copy-grid,
  .keyword-battle-window { grid-template-columns: 1fr; }
  .keyword-battle-file { grid-column: auto; }
  .keyword-battle-metrics { grid-template-columns: repeat(2, 1fr); }
  .keyword-battle-steps { grid-template-columns: repeat(2, 1fr); }
  .keyword-battle-reconciliation-counts,
  .keyword-battle-reconciliation-totals { grid-template-columns: repeat(2, 1fr); }
}
