:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d9e0e7;
  --accent: #0f766e;
  --accent-soft: #e6fffb;
  --direct: #047857;
  --indirect: #b45309;
  --review: #6d28d9;
  --non: #b42318;
  --target: #0369a1;
  --shadow: 0 14px 35px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-frame {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
  width: min(1760px, calc(100vw - 32px));
  margin: 20px auto;
  align-items: start;
  transition: grid-template-columns 0.18s ease;
}

.app-frame:has(.app-nav:hover) {
  grid-template-columns: 220px minmax(0, 1fr);
}

.app-nav {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 8px;
  padding: 12px;
  min-height: calc(100vh - 40px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.nav-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  cursor: default;
}

.nav-brand {
  display: grid;
  gap: 5px;
  padding: 8px 8px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.nav-brand strong {
  font-size: 15px;
  line-height: 1.3;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 34px 150px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #475467;
  text-align: left;
  font-weight: 700;
  overflow: hidden;
}

.nav-item span:last-child {
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.12s ease;
}

.app-nav:hover .nav-brand,
.app-nav:hover .nav-item span:last-child {
  opacity: 1;
  pointer-events: auto;
}

.nav-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item:disabled {
  cursor: default;
  opacity: 0.72;
}

.nav-item[hidden],
.nav-divider[hidden],
.nav-group-label[hidden],
.app-nav [hidden] {
  display: none !important;
}

.nav-index {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.app-shell {
  min-width: 0;
}

.app-view[hidden] {
  display: none;
}

.app-view {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 5px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
}

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

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

.traffic-analysis-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.traffic-analysis-panel .keyword-charts {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

.traffic-sourcebar {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.traffic-sourcebar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.traffic-sourcebar .status,
.traffic-source-status {
  margin: 0;
  min-width: 0;
}

.traffic-source-head {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 280px) auto;
  gap: 12px 16px;
  align-items: end;
}

.traffic-source-head .sortbar-title {
  align-self: center;
}

.traffic-project-field {
  min-width: 0;
}

.traffic-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.traffic-source-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft, #f8fafc);
}

.traffic-source-card header {
  display: grid;
  gap: 2px;
}

.traffic-source-card header b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.traffic-source-card header span {
  color: var(--muted);
  font-size: 11px;
}

.traffic-source-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.traffic-source-card-body > label {
  flex: 1 1 220px;
  min-width: 0;
}

.traffic-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.traffic-file-picker {
  cursor: pointer;
  margin: 0;
}

.traffic-upload-name {
  flex: 1 1 140px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.traffic-source-status {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 12px;
}

@media (max-width: 980px) {
  .traffic-source-head {
    grid-template-columns: 1fr;
  }

  .traffic-source-actions {
    justify-content: flex-start;
  }

  .traffic-source-grid {
    grid-template-columns: 1fr;
  }
}

.keyword-upload {
  position: static;
}

.keyword-source-panel {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 16px;
}

.project-name-input {
  width: 210px;
  min-height: 38px;
}

.project-select {
  width: 230px;
  min-height: 38px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-actions .btn.primary {
  flex: 1;
}

.format-note {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.format-note b {
  color: var(--ink);
}

.keyword-panel {
  overflow: hidden;
}

.keyword-charts {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.chart-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.chart-tabs button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 700;
}

.chart-tabs button.active {
  background: var(--accent);
  color: white;
}

.chart-title-line {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chart-info {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #98a2b3;
  border-radius: 50%;
  color: #475467;
  font-size: 11px;
  font-weight: 800;
  cursor: help;
}

.chart-interpretation {
  position: absolute;
  z-index: 25;
  top: 24px;
  left: 0;
  display: none;
  width: min(360px, calc(100vw - 40px));
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  box-shadow: var(--shadow);
  color: #475467;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}

.chart-interpretation b {
  color: var(--ink);
}

.chart-info:hover .chart-interpretation,
.chart-info:focus .chart-interpretation,
.chart-info:focus-within .chart-interpretation {
  display: block;
}

.bubble-chart {
  position: relative;
  min-height: 390px;
  padding: 10px 12px 0;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfc 100%);
}

.bubble-chart svg {
  display: block;
  width: 100%;
  height: 380px;
}

.bubble-chart .grid-line {
  stroke: #e8edf2;
  stroke-width: 1;
}

.bubble-chart .axis-line {
  stroke: #98a2b3;
  stroke-width: 1;
}

.bubble-chart .axis-label,
.bubble-chart .tick-label {
  fill: #667085;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0;
}

.bubble-chart .axis-label {
  fill: #344054;
  font-size: 12px;
  font-weight: 700;
}

.bubble-chart .bubble {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.5;
  opacity: 0.72;
  transition: opacity 0.12s ease, stroke-width 0.12s ease;
}

.bubble-chart .bubble:hover {
  opacity: 1;
  stroke: #1f2937;
  stroke-width: 2;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 370px;
  color: var(--muted);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 40px;
  padding: 8px 14px 12px;
  color: var(--muted);
  font-size: 12px;
}

.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 11px 14px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.axis-range-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.axis-range-filter {
  min-width: 0;
}

.coverage-range-last {
  padding-top: 12px;
  border-top: 1px dashed #d0d5dd;
}

.chart-keyword-results {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.chart-keyword-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 8px;
}

.chart-keyword-results-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.chart-keyword-results-head span {
  color: var(--muted);
  font-size: 12px;
}

.chart-keyword-list {
  max-height: 250px;
  overflow: auto;
  padding: 4px 14px 16px;
}

.chart-keyword-table {
  min-width: 820px;
  width: 100%;
}

.chart-keyword-table-head,
.chart-keyword-row {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(5, minmax(100px, 1fr));
  gap: 12px;
  align-items: center;
  min-height: 38px;
  padding: 0 8px;
  border-bottom: 1px solid #eaecf0;
  color: #475467;
  font-size: 12px;
}

.chart-keyword-table-head {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #f8fafc;
  color: #667085;
  font-weight: 700;
}

.chart-keyword-row b {
  color: #1d2939;
}

.chart-keyword-empty {
  color: var(--muted);
  font-size: 12px;
}

.root-analysis-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.root-analysis-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}

.root-analysis-toolbar > div {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.root-analysis-toolbar span,
.root-analysis-toolbar label {
  color: var(--muted);
  font-size: 12px;
}

.root-analysis-toolbar label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.root-analysis-results {
  display: flex;
  gap: 10px 22px;
  flex-wrap: wrap;
  max-height: 220px;
  overflow: auto;
  padding: 8px 14px 14px;
}

.root-analysis-item {
  display: inline-flex;
  gap: 5px;
  color: #667085;
  font-size: 12px;
}

.root-analysis-item b {
  color: #344054;
}

.scale-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scale-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.scale-control select {
  min-width: 110px;
  padding: 7px 8px;
}

.coverage-filter {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.coverage-filter-head {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.coverage-filter-head b {
  color: var(--ink);
}

.coverage-filter-head span:last-child {
  margin-left: auto;
}

.dual-range {
  position: relative;
  height: 26px;
}

.range-track,
.range-fill {
  position: absolute;
  top: 11px;
  right: 0;
  left: 0;
  height: 5px;
  border-radius: 3px;
}

.range-track {
  background: #d9e0e7;
}

.range-fill {
  background: var(--accent);
}

.dual-range input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: white;
  cursor: grab;
  pointer-events: auto;
  appearance: none;
}

.keyword-filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7fbfa;
}

.keyword-filter-tags {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.keyword-filter-tag {
  border: 1px solid #a7d7d2;
  border-radius: 4px;
  background: var(--accent-soft);
  color: #0f766e;
  padding: 4px 7px;
  font-size: 11px;
}

.keyword-filter-menu {
  position: fixed;
  z-index: 40;
  width: 290px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  box-shadow: var(--shadow);
}

.keyword-filter-menu h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.keyword-filter-menu .filter-note {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.keyword-filter-menu label {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.keyword-filter-menu input,
.keyword-filter-menu select {
  width: 100%;
  padding: 7px 8px;
}

.category-filter-list {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
  padding: 6px 0;
}

.category-filter-list .checkline {
  display: flex;
  margin: 0;
}

.category-filter-list input {
  width: auto;
}

.filter-menu-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  margin-top: 12px;
}

.legend-gradient {
  width: 120px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #0ea5a4, #eab308, #dc2626);
}

.chart-tooltip {
  position: fixed;
  z-index: 30;
  max-width: 300px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}

.chart-tooltip b {
  display: block;
  margin-bottom: 3px;
}

.keyword-sortbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.sortbar-title {
  display: grid;
  gap: 2px;
  min-width: 190px;
  margin-right: auto;
}

.sortbar-title b {
  font-size: 13px;
}

.sortbar-title span,
.keyword-sortbar label span {
  color: var(--muted);
  font-size: 12px;
}

.keyword-sortbar label {
  display: grid;
  gap: 4px;
}

.keyword-sortbar select {
  width: 136px;
  padding: 7px 8px;
}

.keyword-sortbar .btn {
  padding: 8px 10px;
}

.keyword-actionbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.keyword-actionbar .selected-count {
  margin-right: auto;
}

.keyword-actionbar .btn {
  padding: 8px 12px;
}

.file-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.upload-file-summary {
  margin-top: 10px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.file-result {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: #475467;
  font-size: 12px;
  line-height: 1.4;
}

.file-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

.file-result b {
  color: var(--ink);
}

.file-result.invalid {
  border-color: #fecaca;
  background: #fff7f7;
}

.file-result .tag {
  border-radius: 999px;
  padding: 3px 8px;
  background: #dcfce7;
  color: var(--direct);
  font-weight: 800;
}

.file-result.invalid .tag {
  background: #fee4e2;
  color: var(--non);
}

.file-remove {
  border: 0;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.keyword-table-card {
  max-height: calc(100vh - 172px);
  overflow: auto;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  min-height: 48px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfd 0%, #f6f8fa 100%);
  color: var(--muted);
  font-size: 12px;
}

.table-pager .pager-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.table-pager .pager-total {
  color: #475467;
}

.table-pager .pager-total strong {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.table-pager .pager-range {
  color: #98a2b3;
}

.table-pager .pager-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.table-pager .pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #667085;
}

.table-pager .pager-size select {
  min-width: 64px;
  height: 30px;
  padding: 0 28px 0 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667085' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E") no-repeat right 8px center;
  appearance: none;
  color: #344054;
  font-size: 12px;
  cursor: pointer;
}

.table-pager .pager-size select:hover,
.table-pager .pager-size select:focus {
  border-color: var(--accent);
  outline: none;
}

.table-pager .pager-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.table-pager .pager-pages {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.table-pager .pager-btn,
.table-pager .pager-page {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475467;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.table-pager .pager-btn {
  font-size: 16px;
  line-height: 1;
  color: #667085;
}

.table-pager .pager-btn:hover:not(:disabled),
.table-pager .pager-page:hover:not(.is-active) {
  background: #f2f4f7;
  color: var(--ink);
}

.table-pager .pager-page.is-active {
  background: var(--accent);
  color: #fff;
  cursor: default;
}

.table-pager .pager-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.table-pager .pager-ellipsis {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 28px;
  color: #98a2b3;
  user-select: none;
}

.keyword-table-card table {
  min-width: 2496px;
}

.keyword-table-card th,
.keyword-table-card td {
  width: 105px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.keyword-table-card th.sortable {
  padding: 0;
}

.keyword-table-card th.sortable > button,
.keyword-table-card th.filterable > button {
  width: 100%;
  height: 100%;
  min-height: 38px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
  font-weight: 800;
}

.keyword-table-card th.sortable > button:hover,
.keyword-table-card th.filterable > button:hover {
  background: #eef6f5;
  color: var(--accent);
}

.keyword-table-card th.filter-active > button {
  background: #e6fffb;
  color: var(--accent);
}

.keyword-table-card .keyword-select-col {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  text-align: center;
}

.keyword-table-card .keyword-col-keyword {
  width: 230px;
  max-width: 230px;
}

.keyword-table-card .keyword-col-rank,
.keyword-table-card .keyword-col-related-products,
.keyword-table-card .keyword-col-search-volume,
.keyword-table-card .keyword-col-rate,
.keyword-table-card .keyword-col-percent {
  width: 96px;
  max-width: 96px;
  text-align: right;
}

.keyword-table-card .keyword-col-weekly-impressions {
  width: 118px;
  max-width: 118px;
  text-align: right;
}

.keyword-table-card .keyword-col-bid {
  width: 86px;
  max-width: 86px;
  text-align: right;
}

.keyword-table-card .keyword-col-bid-range {
  width: 132px;
  max-width: 132px;
}

.keyword-table-card .keyword-col-asin {
  width: 300px;
  max-width: 300px;
}

.keyword-table-card td.keyword-col-asin {
  color: #475467;
  font-family: "Segoe UI", Arial, sans-serif;
}

.keyword-table-card .keyword-col-default {
  width: 105px;
  max-width: 105px;
}

.side-panel {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 16px;
}

.block,
.main-panel,
.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.block {
  padding: 14px;
}

.block-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

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

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

textarea,
input:not([type="checkbox"]):not([type="radio"]),
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

textarea:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

textarea {
  min-height: 98px;
  resize: vertical;
  line-height: 1.45;
}

.target-image {
  display: grid;
  place-items: center;
  min-height: 118px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}

.target-image img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: white;
}

.input-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.input-mode-switch label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.input-mode-switch input {
  accent-color: var(--accent);
}

.target-profile {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #b8ddd9;
  border-radius: 6px;
  background: var(--accent-soft);
}

.target-profile b {
  color: var(--accent);
  font-size: 14px;
}

.target-profile span,
.target-profile small {
  color: #475467;
  line-height: 1.4;
}

.target-profile ul {
  max-height: 150px;
  margin: 4px 0 0;
  padding-left: 18px;
  overflow: auto;
  color: #475467;
  font-size: 11px;
  line-height: 1.45;
}

.target-profile li + li {
  margin-top: 4px;
}

.rule-list,
.mode-list {
  display: grid;
  gap: 8px;
}

.rule-list div {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.4;
}

.rule-list b {
  color: var(--ink);
}

.rule-list span {
  color: var(--muted);
}

.radio-card {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

.radio-card input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.radio-card b {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

.file-drop {
  display: grid;
  gap: 4px;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
  color: var(--muted);
  text-align: center;
}

.file-drop input {
  display: none;
}

.file-drop strong {
  color: var(--ink);
  font-size: 14px;
}

.file-drop span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn.ghost {
  background: var(--surface-soft);
}

.btn.danger {
  border-color: #dc2626;
  background: #dc2626;
  color: white;
}

.btn.danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn.full {
  width: 100%;
  margin-top: 10px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Shared application skeleton */
.app-frame {
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  width: calc(100vw - 24px);
  max-width: none;
  margin: 12px;
}

.app-frame:has(.app-nav:hover) {
  grid-template-columns: 232px minmax(0, 1fr);
}

.app-nav {
  top: 12px;
  min-height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  box-shadow: none;
}

.nav-divider {
  height: 1px;
  margin: 6px 2px;
  background: var(--line);
}

.nav-group-label {
  margin: 14px 10px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.nav-secondary {
  min-height: 40px;
  color: var(--muted);
}

.app-shell {
  display: grid;
  gap: 12px;
}

.global-taskbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.global-context,
.global-task-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.global-task-status {
  justify-content: flex-end;
  flex: 1;
}

.data-scope-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  white-space: nowrap;
}

.data-scope-wrap select {
  width: auto;
  min-width: 128px;
  max-width: 180px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.global-userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.global-userbar span {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.global-userbar .quota-badge {
  min-width: 172px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  font-weight: 700;
}

.global-userbar .quota-badge.is-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.quota-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}

.quota-toast[hidden] {
  display: none !important;
}

.quota-toast-body {
  flex: 1;
  min-width: 0;
}

.quota-toast-body b {
  display: block;
  margin-bottom: 4px;
  color: #9a3412;
}

.quota-toast-body p {
  margin: 0;
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.45;
}

.quota-toast-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.quota-alert {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
}

.global-task-status > div:first-child {
  display: grid;
  min-width: 180px;
  text-align: right;
}

.global-label {
  color: var(--muted);
  font-size: 11px;
}

.global-market,
.global-save-state {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
}

.global-progress-track {
  width: min(240px, 20vw);
  height: 5px;
  border-radius: 3px;
  background: #e8edf2;
  overflow: hidden;
}

.global-progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
}

.page-header {
  min-height: 76px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.page-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.layout,
.keyword-workspace {
  display: block;
}

.workspace-panel,
.traffic-analysis-panel {
  width: 100%;
}

.main-panel,
.keyword-charts,
.traffic-sourcebar {
  box-shadow: none;
}

.workbar,
.bulkbar,
.keyword-sortbar,
.keyword-actionbar {
  min-height: 52px;
}

.table-card {
  border-top: 1px solid var(--line);
}


.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  display: grid;
  align-content: start;
  gap: 12px;
  width: min(440px, calc(100vw - 24px));
  height: 100vh;
  padding: 14px;
  background: var(--surface-soft);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  transform: translateX(105%);
  visibility: hidden;
}

.settings-drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-header {
  position: sticky;
  top: -14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.drawer-header > div {
  display: grid;
  gap: 3px;
}

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

.drawer-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.24);
}

body.drawer-open {
  overflow: hidden;
}

.placeholder-workspace {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: calc(100vh - 160px);
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.placeholder-workspace b {
  color: var(--ink);
  font-size: 18px;
}

@media (max-width: 980px) {
  .app-frame,
  .app-frame:has(.app-nav:hover) {
    grid-template-columns: 58px minmax(0, 1fr);
    margin: 6px;
    width: calc(100vw - 12px);
  }

  .app-nav {
    top: 6px;
    padding: 8px;
    min-height: calc(100vh - 12px);
  }

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

  .global-task-status {
    width: 100%;
    justify-content: flex-start;
  }

  .global-task-status > div:first-child {
    text-align: left;
  }

  .global-progress-track {
    flex: 1;
    width: auto;
  }
}

.status {
  margin-top: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.progress-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #475467;
  font-size: 12px;
  line-height: 1.35;
}

.progress-head b {
  color: var(--accent);
}

.progress-track {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.progress-count {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status.error {
  background: #fff1f0;
  color: var(--non);
}

.verification-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.46);
}

.verification-dialog[hidden] {
  display: none;
}

.verification-panel {
  width: min(520px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.verification-panel h3 {
  margin-bottom: 8px;
}

.verification-panel p,
.verification-panel small {
  color: var(--muted);
  line-height: 1.55;
}

.verification-actions {
  display: flex;
  gap: 10px;
  margin: 18px 0 12px;
  flex-wrap: wrap;
}

.main-panel {
  overflow: hidden;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 1px;
  background: var(--line);
}

.stat-card {
  border: 0;
  border-radius: 0;
  background: white;
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.stat-card strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 6px;
}

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

.stat-card.direct strong { color: var(--direct); }
.stat-card.indirect strong { color: var(--indirect); }
.stat-card.review strong { color: var(--review); }
.stat-card.non strong { color: var(--non); }
.stat-card.target strong { color: var(--target); }

.workbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.checkline input,
.select-cell input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.selected-count {
  color: var(--muted);
  font-size: 12px;
  min-width: 72px;
}

.bulkbar select {
  width: 130px;
  padding: 8px 9px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tabs button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
  color: #475467;
}

.tabs button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.search {
  width: 260px;
}

.table-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-height: calc(100vh - 188px);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #667085;
  font-weight: 700;
}

th.select-col { width: 42px; }

.competitor-table-card {
  width: 100%;
  box-sizing: border-box;
}

.competitor-table-card table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed;
}

.competitor-table-card thead th {
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.25;
  height: 36px;
  padding: 6px 8px;
  overflow: visible;
  text-overflow: clip;
}

/* 展开评分明细时：整表拉满，过窄时横向滚动 */
.competitor-table-card:not(.scores-collapsed) table {
  min-width: max(100%, 1480px) !important;
}

.competitor-table-card:not(.scores-collapsed) th:nth-child(1),
.competitor-table-card:not(.scores-collapsed) td:nth-child(1) { width: 42px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(2),
.competitor-table-card:not(.scores-collapsed) td:nth-child(2) { width: 12%; min-width: 160px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(3),
.competitor-table-card:not(.scores-collapsed) td:nth-child(3) { width: 5.5%; min-width: 72px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(4),
.competitor-table-card:not(.scores-collapsed) th:nth-child(5),
.competitor-table-card:not(.scores-collapsed) td:nth-child(4),
.competitor-table-card:not(.scores-collapsed) td:nth-child(5) { width: 4.8%; min-width: 72px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(n+6):nth-child(-n+14),
.competitor-table-card:not(.scores-collapsed) td:nth-child(n+6):nth-child(-n+14) { width: 5%; min-width: 72px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(15),
.competitor-table-card:not(.scores-collapsed) td:nth-child(15) { width: 4.5%; min-width: 44px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(16),
.competitor-table-card:not(.scores-collapsed) td:nth-child(16) { width: 6.5%; min-width: 64px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(17),
.competitor-table-card:not(.scores-collapsed) td:nth-child(17) { width: 4%; min-width: 44px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(18),
.competitor-table-card:not(.scores-collapsed) td:nth-child(18) { width: 5%; min-width: 48px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(19),
.competitor-table-card:not(.scores-collapsed) td:nth-child(19) { width: 4.5%; min-width: 56px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(20),
.competitor-table-card:not(.scores-collapsed) td:nth-child(20) { width: 3.5%; min-width: 44px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(21),
.competitor-table-card:not(.scores-collapsed) td:nth-child(21) { width: 4.5%; min-width: 56px; }
.competitor-table-card:not(.scores-collapsed) th:nth-child(22),
.competitor-table-card:not(.scores-collapsed) th:nth-child(23),
.competitor-table-card:not(.scores-collapsed) td:nth-child(22),
.competitor-table-card:not(.scores-collapsed) td:nth-child(23) { width: 4.5%; min-width: 64px; }

.debug-score-head {
  background: #fff8e8;
  color: #8a5b00;
  text-align: center;
}

.debug-score-head small {
  display: inline;
  margin-left: 2px;
  color: #b7791f;
  font-weight: 600;
  white-space: nowrap;
}

.debug-score-cell {
  background: #fffcf5;
  text-align: center;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.debug-score-cell b {
  color: #7c4a03;
  font-size: 13px;
}

.debug-score-cell small {
  display: block;
  margin-top: 2px;
  color: #b7791f;
}

.debug-score-cell.status-confirmed { background: #f0fdf4; }
.debug-score-cell.status-partial { background: #fffbeb; }
.debug-score-cell.status-unknown { background: #f8fafc; }
.debug-score-cell.status-conflict { background: #fff1f0; }
.gate-cell { min-width: 96px; }
.gate-cell.status-conflict b { color: #b42318; }

.number-cell {
  text-align: right;
  color: #344054;
  font-variant-numeric: tabular-nums;
}

tbody tr.selected {
  background: #f0fdfa;
}

.select-cell {
  text-align: center;
  vertical-align: middle;
}

.product-cell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
}

.thumb-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  overflow: hidden;
  cursor: zoom-in;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb-frame.failed,
.thumb.placeholder {
  background: var(--surface-soft);
}

.thumb-frame.failed::after {
  content: "No image";
  color: var(--muted);
  font-size: 11px;
}

.image-preview {
  position: fixed;
  z-index: 1000;
  width: min(360px, calc(100vw - 24px));
  height: min(360px, calc(100vh - 24px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
  pointer-events: none;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.product-meta {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f6;
  color: #475467;
  white-space: nowrap;
}

.badge.direct { background: #dcfce7; color: var(--direct); }
.badge.indirect { background: #fef3c7; color: var(--indirect); }
.badge.review { background: #ede9fe; color: var(--review); }
.badge.non { background: #fee4e2; color: var(--non); }
.badge.target { background: #e0f2fe; color: var(--target); }

.metrics {
  display: grid;
  gap: 4px;
  color: #475467;
  line-height: 1.35;
}

.reason {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.score {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}

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

  .app-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    min-height: auto;
    overflow-x: auto;
  }

  .nav-brand {
    grid-column: 1 / -1;
  }

  .layout,
  .keyword-workspace {
    grid-template-columns: 1fr;
  }

  .side-panel,
  .keyword-upload,
  .keyword-source-panel {
    position: static;
  }

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

@media (max-width: 720px) {
  .app-frame {
    width: min(100vw - 20px, 1760px);
    margin: 10px auto;
  }

  .app-nav {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: 100%;
  }

  .topbar,
  .top-actions,
  .chart-toolbar,
  .chart-controls,
  .workbar,
  .bulkbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .project-name-input {
    width: 100%;
  }

  .project-select {
    width: 100%;
  }

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

  .search {
    width: 100%;
  }

  .table-card {
    max-height: none;
  }
}
.family-cell {
  min-width: 180px;
  max-width: 220px;
  line-height: 1.45;
}

.family-cell b {
  font-family: Consolas, monospace;
  font-size: 12px;
}

.family-cell small {
  color: #667085;
  font-size: 11px;
}

.family-cell summary {
  margin-top: 4px;
  color: #175cd3;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.family-variants {
  width: 320px;
  max-height: 240px;
  margin-top: 6px;
  padding: 6px;
  overflow: auto;
  border: 1px solid #d0d5dd;
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.14);
}

.family-variant {
  display: flex;
  gap: 7px;
  padding: 5px;
  border-bottom: 1px solid #eaecf0;
  cursor: pointer;
}

.family-variant:last-child {
  border-bottom: 0;
}

.family-variant span,
.family-variant small {
  display: block;
}

.family-variant small {
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Final shared-layout overrides */
.layout,
.keyword-workspace {
  display: block;
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
}

.settings-drawer.open {
  display: grid;
  transform: translateX(0);
  visibility: visible;
}

.keyword-source-panel.settings-drawer,
.side-panel.settings-drawer {
  position: fixed;
  top: 0;
}

.workspace-panel {
  width: 100%;
}

.module-summary {
  min-height: 48px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.module-table-card {
  max-height: calc(100vh - 196px);
}

.module-table-card table {
  min-width: 1100px;
}

.module-table-card select {
  min-width: 118px;
  padding: 6px;
}

.content-workspace {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.content-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.content-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.content-section textarea {
  width: 100%;
  min-height: 86px;
}

.keyword-chip-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.keyword-chip-list span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  font-size: 12px;
}

.project-center-grid {
  display: grid;
  gap: 10px;
}

.project-center-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(110px, 160px));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}

.project-center-item > div {
  padding: 12px;
  background: var(--surface);
}

.project-center-item small,
.project-center-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: var(--surface);
}

/* Design system refinement: phase 1 */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --surface-hover: #f2f8f7;
  --ink: #182230;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #087f6d;
  --accent-hover: #066a5b;
  --accent-soft: #eaf8f5;
  --data-blue: #2563eb;
  --direct: #15803d;
  --indirect: #2563eb;
  --review: #d97706;
  --non: #667085;
  --target: #7c3aed;
  --danger: #dc2626;
  --radius: 6px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
}

button,
input,
textarea,
select {
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(8, 127, 109, 0.32);
  outline-offset: 2px;
}

.app-nav,
.global-taskbar,
.page-header,
.main-panel,
.content-workspace,
.project-center-item {
  border-color: var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.app-nav {
  gap: var(--space-1);
  padding: var(--space-2);
}

.nav-toggle {
  width: 42px;
  border-color: transparent;
  background: transparent;
}

.nav-toggle:hover,
.nav-item:hover {
  background: var(--surface-hover);
}

.nav-item {
  grid-template-columns: 32px 166px;
  gap: var(--space-2);
  min-height: 42px;
  padding: 8px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.nav-item.active {
  border-color: transparent;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  background: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.nav-index.icon {
  width: 18px;
  height: 18px;
  margin-left: 6px;
}

.icon-menu { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E"); }
.icon-filter { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M4 5h16M7 12h10M10 19h4'/%3E%3C/svg%3E"); }
.icon-search { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E"); }
.icon-chart { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19V9M10 19V5M16 19v-7M22 19H2'/%3E%3C/svg%3E"); }
.icon-user { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); }
.icon-database { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6'/%3E%3C/svg%3E"); }
.icon-library { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19V5M9 19V5M14 19V5M19 19V5'/%3E%3C/svg%3E"); }
.icon-document { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M6 3h9l3 3v15H6zM9 11h6M9 15h6'/%3E%3C/svg%3E"); }
.icon-megaphone { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='m3 11 15-6v14L3 13zM8 15l2 6'/%3E%3C/svg%3E"); }
.icon-folder { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M3 6h7l2 2h9v11H3z'/%3E%3C/svg%3E"); }
.icon-clock { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.icon-settings { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19 12a7 7 0 0 0-.1-1l2-1-2-4-2 1a7 7 0 0 0-2-1l-.3-2h-5l-.3 2a7 7 0 0 0-2 1l-2-1-2 4 2 1a7 7 0 0 0 0 2l-2 1 2 4 2-1a7 7 0 0 0 2 1l.3 2h5l.3-2a7 7 0 0 0 2-1l2 1 2-4-2-1a7 7 0 0 0 .1-1z'/%3E%3C/svg%3E"); }
.icon-save { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M5 4h12l2 2v14H5zM8 4v6h8V4M8 16h8'/%3E%3C/svg%3E"); }
.icon-refresh { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M20 7v5h-5M4 17v-5h5M18 12a6 6 0 0 0-10-4L4 12M6 12a6 6 0 0 0 10 4l4-4'/%3E%3C/svg%3E"); }
.icon-download { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3v12m0 0 4-4m-4 4-4-4M4 20h16'/%3E%3C/svg%3E"); }
.icon-arrow-right { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M5 12h14m-5-5 5 5-5 5'/%3E%3C/svg%3E"); }
.icon-sliders { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M4 7h10M18 7h2M4 17h2M10 17h10M14 4v6M6 14v6'/%3E%3C/svg%3E"); }

.global-taskbar {
  min-height: 44px;
  padding: 7px var(--space-3);
}

.global-context b,
.global-task-status b {
  font-size: 12px;
  font-weight: 600;
}

.global-market,
.global-save-state {
  border-radius: 4px;
  background: var(--surface-soft);
}

.page-header {
  min-height: 72px;
  padding: var(--space-3) var(--space-4);
}

.page-header h1 {
  font-size: 22px;
  font-weight: 650;
}

.eyebrow {
  margin-bottom: 3px;
  font-size: 11px;
  text-transform: uppercase;
}

.top-actions {
  gap: var(--space-2);
}

.top-actions .project-select {
  width: 210px;
}

.top-actions .project-name-input {
  width: 170px;
}

.btn {
  min-height: 34px;
  padding: 7px 11px;
  border-color: var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: #344054;
  font-size: 12px;
  font-weight: 600;
}

.btn:hover:not(:disabled) {
  border-color: #98a2b3;
  background: var(--surface-soft);
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
}

.btn.primary:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.btn .icon {
  width: 15px;
  height: 15px;
  margin-right: 6px;
  vertical-align: -3px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  padding: 0;
}

.icon-btn .icon {
  margin: 0;
}

.summary-grid {
  grid-template-columns: repeat(6, minmax(104px, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.stat-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  min-height: 74px;
  padding: 12px 14px 10px 17px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.stat-card:hover,
.stat-card.active {
  background: var(--surface-hover);
}

.stat-card.active {
  box-shadow: inset 0 -2px var(--accent);
}

.stat-accent {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 8px;
  width: 3px;
  border-radius: 2px;
  background: #98a2b3;
}

.stat-card.direct .stat-accent { background: var(--direct); }
.stat-card.indirect .stat-accent { background: var(--indirect); }
.stat-card.review .stat-accent { background: var(--review); }
.stat-card.non .stat-accent { background: var(--non); }
.stat-card.target .stat-accent { background: var(--target); }

.stat-card strong {
  margin: 0;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.stat-card span:not(.stat-accent),
.stat-card small {
  color: var(--muted);
  font-size: 11px;
}

.stat-card small {
  grid-row: 1;
  grid-column: 2;
}

.workbar {
  min-height: 50px;
  padding: 8px 12px;
  border-top: 0;
  background: var(--surface);
}

.workbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.tabs {
  gap: var(--space-1);
}

.tabs button {
  min-height: 32px;
  padding: 6px 10px;
  border-color: transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 12px;
}

.tabs button:hover {
  background: var(--surface-soft);
}

.tabs button.active {
  border-color: transparent;
  background: var(--accent-soft);
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.toggle-control input {
  accent-color: var(--accent);
}

.search {
  width: 240px;
  min-height: 34px;
  padding-left: 12px;
  border-color: var(--line-strong);
}

.bulkbar {
  position: sticky;
  top: 45px;
  z-index: 8;
  min-height: 46px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: #f0f9f7;
}

.competitor-table-card {
  max-height: calc(100vh - 278px);
  border-top: 0;
}

.competitor-table-card.scores-collapsed table {
  width: 100% !important;
  min-width: 100% !important;
}

.competitor-table-card.scores-collapsed th.debug-score-head,
.competitor-table-card.scores-collapsed td.debug-score-cell {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* 收起评分后可见列：收窄商品列，其余列保证表头完整显示 */
.competitor-table-card.scores-collapsed th:nth-child(1),
.competitor-table-card.scores-collapsed td:nth-child(1) { width: 3% !important; min-width: 42px; }
.competitor-table-card.scores-collapsed th:nth-child(2),
.competitor-table-card.scores-collapsed td:nth-child(2) { width: 18% !important; min-width: 160px; max-width: 220px; }
.competitor-table-card.scores-collapsed th:nth-child(3),
.competitor-table-card.scores-collapsed td:nth-child(3) { width: 9% !important; min-width: 72px; }
.competitor-table-card.scores-collapsed th:nth-child(15),
.competitor-table-card.scores-collapsed td:nth-child(15) { width: 6% !important; min-width: 44px; }
.competitor-table-card.scores-collapsed th:nth-child(16),
.competitor-table-card.scores-collapsed td:nth-child(16) { width: 10% !important; min-width: 64px; }
.competitor-table-card.scores-collapsed th:nth-child(17),
.competitor-table-card.scores-collapsed td:nth-child(17) { width: 6% !important; min-width: 44px; }
.competitor-table-card.scores-collapsed th:nth-child(18),
.competitor-table-card.scores-collapsed td:nth-child(18) { width: 9% !important; min-width: 48px; }
.competitor-table-card.scores-collapsed th:nth-child(19),
.competitor-table-card.scores-collapsed td:nth-child(19) { width: 8% !important; min-width: 56px; }
.competitor-table-card.scores-collapsed th:nth-child(20),
.competitor-table-card.scores-collapsed td:nth-child(20) { width: 6% !important; min-width: 44px; }
.competitor-table-card.scores-collapsed th:nth-child(21),
.competitor-table-card.scores-collapsed td:nth-child(21) { width: 8% !important; min-width: 56px; }
.competitor-table-card.scores-collapsed th:nth-child(22),
.competitor-table-card.scores-collapsed td:nth-child(22) { width: 8.5% !important; min-width: 64px; }
.competitor-table-card.scores-collapsed th:nth-child(23),
.competitor-table-card.scores-collapsed td:nth-child(23) { width: 8.5% !important; min-width: 64px; }

.competitor-table-card th:nth-child(1),
.competitor-table-card td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  background: inherit;
}

.competitor-table-card th:nth-child(2),
.competitor-table-card td:nth-child(2) {
  position: sticky;
  left: 42px;
  z-index: 2;
  background: inherit;
}

.competitor-table-card th:nth-child(2) {
  z-index: 4;
  background: var(--surface-soft);
}

th,
td {
  padding: 9px 10px;
  border-bottom-color: var(--line);
  font-size: 12px;
}

th {
  height: 38px;
  background: var(--surface-soft);
  color: #475467;
  font-weight: 650;
}

tbody tr {
  background: var(--surface);
}

tbody tr:hover,
tbody tr:hover td {
  background: var(--surface-hover);
}

tbody tr.selected,
tbody tr.selected td {
  background: #eaf5ff;
}

.product-cell {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: var(--space-2);
}

.thumb-frame {
  width: 58px;
  height: 58px;
  border-color: var(--line);
  border-radius: var(--radius);
}

.product-title {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.45;
}

.product-meta,
.family-cell b,
.number-cell {
  font-family: Consolas, "Roboto Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.product-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.badge {
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 11px;
}

.badge.direct { background: #eaf8ef; color: var(--direct); }
.badge.indirect { background: #edf4ff; color: var(--indirect); }
.badge.review { background: #fff7e8; color: var(--review); }
.badge.non { background: #f2f4f7; color: var(--non); }
.badge.target { background: #f4f0ff; color: var(--target); }


.settings-drawer {
  width: min(420px, calc(100vw - 16px));
}

.settings-drawer .block {
  border-radius: var(--radius);
  box-shadow: none;
}

@media (max-width: 1280px) {
  .page-header {
    align-items: flex-start;
  }

  .top-actions {
    justify-content: flex-start;
  }

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

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

  .workbar-actions {
    width: 100%;
  }

  .search {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 760px) {
  .global-task-status {
    display: none;
  }

  .page-header h1 {
    font-size: 19px;
  }

  .top-actions .project-select,
  .top-actions .project-name-input {
    width: 100%;
  }

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

  .workbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-drawer {
    width: 100vw;
  }
}

/* Reference-design rebuild: operational dashboard */
:root {
  --shell-line: #e7ebf0;
  --shell-muted: #718096;
  --shell-teal: #008c82;
  --shell-teal-dark: #00776f;
  --shell-teal-soft: #eaf7f6;
  --shell-blue: #1677ff;
}

body {
  background: #f7f9fb;
  color: #1f2937;
}

.app-frame,
.app-frame:has(.app-nav:hover) {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 0;
  width: 100%;
  margin: 0;
}

.app-shell {
  grid-column: 2;
  gap: 0;
  min-height: 100vh;
  padding-top: 58px;
  border-left: 1px solid var(--shell-line);
}

.global-taskbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 45;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 16px;
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  padding: 0 16px 0 56px;
  border: 0;
  border-bottom: 1px solid var(--shell-line);
  border-radius: 0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  overflow: hidden;
}

.global-brand {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  margin-right: 4px;
  padding-right: 16px;
  border-right: 1px solid var(--shell-line);
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  background: #fff;
}

.global-brand-wrap {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  margin-right: 4px;
  padding-right: 16px;
  border-right: 1px solid var(--shell-line);
  background: #fff;
}

.global-brand-wrap .global-brand {
  margin-right: 0;
  padding-right: 0;
  border-right: 0;
}

.version-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--shell-muted, #64748b);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.version-badge:hover {
  border-color: var(--shell-teal, #0f766e);
  background: #ecfdf5;
  color: var(--shell-teal, #0f766e);
}

.version-panel {
  width: min(520px, 100%);
  max-height: min(84vh, 720px);
  display: flex;
  flex-direction: column;
}

.version-dialog-body {
  gap: 14px;
  max-height: min(60vh, 480px);
  overflow: auto;
}

.version-meta {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.version-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.version-meta-row b {
  color: var(--ink);
  font-size: 14px;
}

.version-section-title {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.version-highlights {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.version-highlights li::marker {
  color: var(--shell-teal, #0f766e);
}

.version-history {
  display: grid;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.version-history-item {
  display: grid;
  gap: 4px;
}

.version-history-item b {
  color: var(--ink);
  font-size: 12px;
}

.version-history-item span,
.version-history-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.global-context {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.global-taskbar .global-task-status {
  flex: 0 1 220px;
  max-width: 260px;
  min-width: 0;
}

.global-taskbar .global-userbar {
  flex: 0 0 auto;
  margin-left: auto;
}

.global-label {
  flex: 0 0 auto;
  color: var(--shell-muted);
  white-space: nowrap;
}

.global-context > b {
  flex: 0 1 140px;
  min-width: 72px;
  max-width: 180px;
  padding: 6px 10px;
  border: 1px solid var(--shell-line);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-market,
.global-save-state,
.data-scope-wrap {
  flex: 0 0 auto;
}

.global-market,
.global-save-state {
  min-height: 30px;
  padding: 6px 10px;
  border-color: var(--shell-line);
  background: #fff;
}

.global-task-status {
  max-width: 460px;
}

.global-progress-fill {
  background: var(--shell-teal);
}

.app-nav {
  position: fixed;
  top: 58px;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 104px;
  min-height: 0;
  max-height: none;
  padding: 16px 8px;
  border: 0;
  border-right: 1px solid var(--shell-line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  overflow-y: auto;
}

.nav-toggle {
  position: fixed;
  top: 15px;
  left: 18px;
  z-index: 50;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 4px;
  background: var(--shell-teal);
  color: #fff;
}

.nav-brand {
  display: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-height: 66px;
  padding: 8px 4px;
  border: 0;
  border-radius: 5px;
  color: #475467;
  text-align: center;
  font-size: 11px;
}

.nav-item span:last-child,
.app-nav:hover .nav-item span:last-child {
  opacity: 1;
  white-space: normal;
}

.nav-item .nav-index {
  width: 19px;
  height: 19px;
  background-color: #667085;
}

.nav-item.active {
  border: 0;
  background: var(--shell-teal-soft);
  color: var(--shell-teal);
}

.nav-item.active .nav-index {
  background-color: var(--shell-teal);
}

.nav-secondary {
  min-height: 56px;
}

.nav-divider {
  margin: 4px 8px;
}

.app-view {
  min-height: calc(100vh - 58px);
  padding: 0 12px 12px;
  background: #fff;
}

.page-header,
.app-view:not(#competitorView) .page-header {
  min-height: 70px;
  margin: 0;
  padding: 12px 8px;
  border: 0;
  border-bottom: 1px solid var(--shell-line);
  border-radius: 0;
  background: #fff;
}

.app-view:not(#competitorView) .page-header::before {
  display: none;
}

.page-header > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 340px;
}

.page-header .eyebrow {
  display: none;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.page-header p {
  margin: 0;
  font-size: 11px;
}

.top-actions {
  flex-wrap: nowrap;
}

.top-actions .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.top-actions .btn.danger {
  min-width: 82px;
}

.top-actions .btn.primary,
.traffic-sourcebar .btn.primary {
  min-width: 112px;
  border-color: var(--shell-teal);
  background: var(--shell-teal);
}

.top-actions .btn.primary:hover,
.traffic-sourcebar .btn.primary:hover {
  border-color: var(--shell-teal-dark);
  background: var(--shell-teal-dark);
}

.design-target-strip {
  display: grid;
  grid-template-columns: 76px minmax(260px, 1.5fr) 120px minmax(180px, .7fr) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 0;
  min-height: 90px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--shell-line);
  background: #fff;
}

.design-target-strip > * {
  min-width: 0;
}

.design-target-image {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 1px solid var(--shell-line);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
  color: var(--shell-muted);
  font-size: 11px;
}

.design-target-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.design-target-main,
.design-target-meta,
.design-target-attributes {
  display: grid;
  gap: 5px;
  min-height: 54px;
  padding: 4px 18px;
  border-right: 1px solid var(--shell-line);
}

.design-target-main small,
.design-target-meta small,
.design-target-attributes small {
  color: var(--shell-muted);
  font-size: 10px;
}

.design-target-main b,
.design-target-meta b {
  overflow: hidden;
  color: #27364b;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-target-main span {
  color: var(--shell-muted);
  font-size: 10px;
}

.design-target-attributes > div {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.design-target-attributes span {
  padding: 3px 7px;
  border: 1px solid #a9d8d3;
  border-radius: 3px;
  background: var(--shell-teal-soft);
  color: var(--shell-teal-dark);
  font-size: 10px;
}

.layout,
.keyword-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  gap: 0;
  align-items: stretch;
}

.layout > .workspace-panel,
.keyword-workspace > .workspace-panel {
  grid-column: 1;
}

.module-rail {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
  padding: 14px 12px;
  border-left: 1px solid var(--shell-line);
  background: #fff;
  color: #475467;
  font-size: 11px;
}

.module-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-rail-head b {
  color: #27364b;
  font-size: 13px;
}

.module-rail-head span {
  color: var(--shell-muted);
  font-size: 10px;
}

.progress-ring {
  --progress: 0deg;
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin: 10px auto 0;
  border-radius: 50%;
  background: conic-gradient(var(--shell-teal) var(--progress), #edf0f3 0);
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #fff;
}

.progress-ring strong {
  position: relative;
  font-size: 17px;
}

.competitor-task-rail > b,
.competitor-task-rail > span {
  text-align: center;
}

.rail-divider {
  height: 1px;
  background: var(--shell-line);
}

.rail-steps {
  display: grid;
  gap: 12px;
}

.rail-steps span {
  position: relative;
  padding-left: 18px;
}

.rail-steps span::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 8px;
  height: 8px;
  border: 1px solid #aab2bd;
  border-radius: 50%;
  background: #fff;
}

.rail-steps span.done::before {
  border-color: var(--shell-teal);
  background: var(--shell-teal);
}

.rail-action-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--shell-line);
  border-radius: 5px;
}

.rail-action-card span {
  color: var(--shell-muted);
  line-height: 1.6;
}

.rail-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--shell-line);
}

.rail-metric strong {
  color: var(--shell-teal);
  font-size: 15px;
}

.main-panel,
.keyword-panel,
.workspace-panel {
  border: 0;
  border-radius: 0;
}

.summary-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin: 14px 8px;
  border: 1px solid var(--shell-line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.stat-card {
  min-height: 68px;
  border-right: 1px solid var(--shell-line);
}

.stat-card:last-child,
.stat-card.target {
  display: none;
}

.stat-card.active {
  box-shadow: none;
  background: #fbfefe;
}

.stat-card strong {
  color: #1f2937;
  font-size: 20px;
}

.stat-card.direct strong { color: #139350; }
.stat-card.indirect strong { color: #1677ff; }
.stat-card.review strong { color: #f79009; }
.stat-card.non strong { color: #ef4444; }

.workbar,
.keyword-sortbar,
.keyword-actionbar {
  margin: 0 8px;
  border: 1px solid var(--shell-line);
  background: #fff;
}

.workbar {
  min-height: 48px;
  padding: 7px 8px;
}

.tabs button {
  min-height: 30px;
  border-color: var(--shell-line);
  border-radius: 4px;
  font-size: 11px;
}

.tabs button.active {
  border-color: #a9d8d3;
  background: var(--shell-teal-soft);
  color: var(--shell-teal);
}

.competitor-table-card,
.keyword-table-card,
.module-table-card {
  max-height: calc(100vh - 342px);
  margin: 0;
  border: 1px solid var(--shell-line);
  border-radius: 0;
}

#competitorView .workspace-panel {
  min-width: 0;
  width: 100%;
}

#competitorView .competitor-table-card {
  margin: 0;
  width: 100%;
}

th,
td {
  padding: 7px 8px;
  border-right: 1px solid #edf0f3;
  font-size: 10px;
}

th {
  height: 34px;
  background: #fbfcfd;
  color: #475467;
}

.table-pager {
  margin: 0;
  border: 1px solid var(--shell-line);
  border-top: 0;
  background: linear-gradient(180deg, #fbfcfd 0%, #f4f7f8 100%);
}

.table-pager .pager-page.is-active {
  background: var(--shell-teal);
}

.table-pager .pager-size select:hover,
.table-pager .pager-size select:focus {
  border-color: var(--shell-teal);
}

.keyword-sortbar {
  margin-top: 14px;
  border-radius: 5px 5px 0 0;
}

.reference-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin: 14px 8px 0;
  border: 1px solid var(--shell-line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.reference-kpi-strip > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  min-height: 66px;
  align-content: center;
  padding: 9px 14px;
  border-right: 1px solid var(--shell-line);
}

.reference-kpi-strip > div:last-child {
  border-right: 0;
}

.reference-kpi-strip span,
.reference-kpi-strip small {
  color: var(--shell-muted);
  font-size: 10px;
}

.reference-kpi-strip b {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--shell-teal);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.keyword-actionbar {
  margin-top: 0;
}

.keyword-filterbar {
  margin: 0 8px;
}

.traffic-analysis-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0;
  margin: 0;
}

.traffic-sourcebar {
  grid-column: 1;
  min-height: 0;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--shell-line);
  border-radius: 0;
  background: #fff;
}

.keyword-charts {
  grid-column: 1;
  margin: 8px;
  border-color: var(--shell-line);
}

.traffic-kpi-strip {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--shell-line);
  border-radius: 0;
}

.traffic-root-rail {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.design-root-summary {
  display: grid;
  gap: 0;
  overflow: auto;
}

.design-root-summary > span {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--shell-line);
}

.design-root-summary b {
  color: #344054;
  font-size: 11px;
}

.design-root-summary small {
  color: var(--shell-muted);
  font-size: 9px;
  text-align: right;
}

.bubble-chart {
  min-height: 350px;
}

.axis-range-controls {
  padding: 8px;
}

.chart-keyword-results-head {
  min-height: 48px;
}

/* Functional-detail polish */
.chart-keyword-results {
  grid-column: 1 / -1;
  margin: 12px 8px 24px;
  border-top: 1px solid var(--shell-line);
  border-bottom: 1px solid var(--shell-line);
  background: #fff;
}

.chart-keyword-list {
  max-height: none;
  padding: 0 0 24px;
  overflow: visible;
  content-visibility: visible;
}

.chart-keyword-table {
  min-width: 0;
}

.chart-keyword-table-head,
.chart-keyword-row {
  grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(90px, 1fr));
  min-height: 42px;
  padding: 0 12px;
}

.chart-keyword-table-head {
  position: static;
}

.chart-keyword-row:nth-child(even) {
  background: #fbfcfd;
}

.keyword-charts {
  overflow: visible;
}

#competitorView .page-header {
  padding-inline: 12px;
}

#competitorView .top-actions {
  gap: 6px;
}

#competitorView .design-target-strip {
  padding-inline: 12px;
}

#competitorView .summary-grid {
  margin-top: 12px;
}

#competitorView .workbar {
  gap: 8px;
}

#competitorView .competitor-table-card {
  max-height: calc(100vh - 326px);
  width: 100%;
  margin: 0;
}

#competitorView th,
#competitorView td {
  padding: 8px 9px;
  font-size: 11px;
  line-height: 1.35;
}

#competitorView .competitor-table-card thead th {
  white-space: nowrap;
  line-height: 1.2;
}

#competitorView .product-title {
  font-size: 11px;
}

#competitorView .product-meta {
  font-size: 9px;
}

#competitorView .module-rail {
  padding-inline: 14px;
}

.settings-drawer {
  z-index: 80;
}

.drawer-backdrop {
  z-index: 70;
}

.settings-workspace .btn,
.settings-workspace select {
  flex: 0 0 auto;
}

.task-message {
  min-width: 280px;
}

/* Remaining modules use the same visual system with function-specific workspaces. */
#keywordStrategyView .workspace-panel,
#adsView .workspace-panel,
#tasksView .workspace-panel,
#projectsView .project-center-grid,
#settingsView .placeholder-workspace {
  margin: 12px 8px;
  border: 1px solid var(--shell-line);
  border-radius: 6px;
  background: #fff;
}

.module-split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  min-height: calc(100vh - 128px);
}

.module-split-layout > .workspace-panel,
.module-split-layout > .content-workspace {
  grid-column: 1;
  margin: 12px 8px;
}

.persistent-rail {
  grid-column: 2;
  display: flex;
  min-height: 100%;
}

.persistent-rail p {
  margin: 0;
  color: var(--shell-muted);
  line-height: 1.7;
}

.module-summary {
  min-height: 74px;
  border: 0;
  border-bottom: 1px solid var(--shell-line);
}

.module-summary-item {
  border-right-color: var(--shell-line);
}

.module-table-card {
  max-height: calc(100vh - 230px);
  margin: 0;
  border: 0;
}

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

.content-workspace > .empty-state {
  grid-column: 1 / -1;
}

.content-section {
  min-height: 180px;
  border-right: 1px solid var(--shell-line);
  border-bottom: 1px solid var(--shell-line);
}

.project-center-grid {
  padding: 8px;
}

.project-center-item {
  border-color: var(--shell-line);
}

.project-center-item > div {
  border-color: var(--shell-line);
}

.placeholder-workspace {
  min-height: calc(100vh - 160px);
}

.settings-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
  padding: 12px 8px;
}

#settingsView.placeholder-view:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  align-self: stretch;
}

#settingsView .settings-workspace {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px 16px 28px;
  box-sizing: border-box;
  flex: 1;
  align-content: start;
}

body:not(.is-admin) #settingsView .settings-workspace {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#settingsView .settings-span-full,
#settingsView .settings-warning,
#settingsView .data-source-settings-section,
#settingsView .account-settings-section {
  grid-column: 1 / -1;
}

#settingsView .settings-section {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-content: start;
  align-items: stretch;
  justify-content: stretch;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--shell-line, var(--line));
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(31, 41, 55, 0.03);
  box-sizing: border-box;
}

#settingsView .settings-section-head {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef2f6;
}

#settingsView .settings-section-head b {
  color: #1f2a37;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

#settingsView .settings-section-head span {
  color: var(--shell-muted, var(--muted));
  font-size: 12px;
  line-height: 1.55;
  max-width: none;
}

#settingsView .settings-section-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

#settingsView .settings-field {
  display: grid;
  gap: 6px;
  min-width: min(100%, 180px);
  flex: 1 1 180px;
}

#settingsView .settings-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

#settingsView .settings-field select,
#settingsView .settings-field input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

#settingsView .settings-inline-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

#settingsView .settings-section-body > .btn,
#settingsView .settings-inline-controls > .btn {
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  flex: 0 0 auto;
  box-sizing: border-box;
}

#settingsView .settings-inline-controls .settings-status {
  flex-basis: auto;
  align-self: center;
  margin: 0;
  text-align: left;
}

#settingsView .settings-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #f5d08a;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf0 0%, #fff6e5 100%);
  color: #93370d;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

#settingsView .task-rule-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 10px;
  width: 100%;
}

#settingsView .task-rule-chip {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #e8eef3;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfd 0%, #f5f8fa 100%);
}

#settingsView .task-rule-chip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

#settingsView .task-rule-chip b {
  color: #0f766e;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

#settingsView .data-source-settings-section {
  gap: 16px;
}

#settingsView .data-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 14px;
  width: 100%;
}

#settingsView .platform-settings-form {
  display: grid;
  gap: 12px;
  min-width: 0;
}

#settingsView .platform-settings-form fieldset {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid #e8eef3;
  border-radius: 8px;
  background: #f8fafb;
}

#settingsView .platform-settings-form legend {
  padding: 0 8px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

#settingsView .platform-settings-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

#settingsView .platform-settings-form input,
#settingsView .platform-settings-form select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

#settingsView .platform-settings-form input:focus,
#settingsView .platform-settings-form select:focus,
#settingsView .settings-field input:focus,
#settingsView .settings-field select:focus {
  outline: none;
  border-color: #99f6e4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

#settingsView .settings-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}

#settingsView .usage-log-panel {
  min-width: 0;
  border: 1px solid #e8eef3;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

#settingsView .usage-log-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f6;
  background: #fbfcfd;
}

#settingsView .usage-log-panel header b {
  font-size: 13px;
  color: #1f2a37;
}

#settingsView .account-settings-section .settings-password-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
  justify-content: stretch;
  min-width: 0;
  width: 100%;
}

#settingsView .settings-password-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

#settingsView .settings-password-actions .settings-status {
  flex-basis: auto;
  text-align: left;
  min-height: 0;
}

#settingsView .settings-status {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  #settingsView .settings-workspace,
  body:not(.is-admin) #settingsView .settings-workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  #settingsView .settings-workspace,
  body:not(.is-admin) #settingsView .settings-workspace {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 10px 20px;
    gap: 12px;
  }
}

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

.admin-page-mount .settings-section {
  min-height: auto;
}

.settings-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 108px;
  padding: 18px;
  border: 1px solid var(--shell-line);
  border-radius: 6px;
  background: #fff;
}

.settings-section > div {
  display: grid;
  gap: 7px;
}

.settings-section b {
  color: #27364b;
  font-size: 13px;
}

.settings-section span {
  color: var(--shell-muted);
  font-size: 11px;
  line-height: 1.6;
}

.settings-section select {
  width: 130px;
}

.settings-warning {
  padding: 12px 14px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffaeb;
  color: #93370d;
  font-size: 13px;
  font-weight: 700;
}

.settings-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(720px, 100%);
}

.settings-form input,
.settings-form select {
  width: 180px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.settings-status {
  flex-basis: 100%;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

#userAdminView.placeholder-view:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#userAdminView .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#userAdminView .page-header-summary {
  margin-left: 0;
  flex: 0 1 auto;
  justify-content: flex-end;
}

.user-admin-workspace {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 12px 8px 16px;
  box-sizing: border-box;
}

.user-admin-card {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--shell-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(31, 41, 55, 0.03);
  box-sizing: border-box;
}

.user-admin-card-head {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f6;
}

.user-admin-card-head.compact {
  padding-bottom: 0;
  border-bottom: 0;
}

.user-admin-card-head b {
  color: #1f2a37;
  font-size: 14px;
  font-weight: 700;
}

.user-admin-card-head span {
  color: var(--shell-muted);
  font-size: 12px;
  line-height: 1.55;
}

.user-admin-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.user-admin-perm-card {
  align-content: start;
  gap: 14px;
  min-height: 0;
}

.user-admin-divider {
  height: 1px;
  background: #eef2f6;
}

.user-role-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: end;
  align-content: end;
}

.user-role-create-form .field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.user-role-create-form .field > span,
.user-admin-editor-toolbar .field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.user-role-create-form input,
.user-admin-editor-toolbar select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.user-admin-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}

.user-admin-editor-toolbar .field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.user-admin-grow {
  flex: 1 1 160px;
}

.user-admin-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  align-self: flex-end;
}

.user-admin-editor-actions .btn {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.user-admin-editor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  color: var(--muted);
  font-size: 12px;
}

.user-admin-editor-meta .settings-status {
  margin: 0;
  text-align: left;
}

.scope-overview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.scope-overview-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.scope-overview-chip:hover {
  border-color: #bfd0ea;
  background: #f0f6ff;
}

.scope-overview-chip.active {
  border-color: #98b7e8;
  background: #eff6ff;
  color: #175cd3;
}

.scope-overview-chip em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

.scope-overview-chip.active em {
  color: #2e6fbf;
}

.scope-overview-empty {
  color: var(--muted);
  font-size: 12px;
}

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

.scope-type-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.scope-type-option {
  display: grid;
  min-width: 0;
  cursor: pointer;
}

.scope-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scope-type-option > span {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.scope-type-option > span b {
  color: #1f2a37;
  font-size: 13px;
  font-weight: 700;
}

.scope-type-option > span small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.scope-type-option:hover > span {
  border-color: #bfd0ea;
  background: #f8fbff;
}

.scope-type-option input:checked + span {
  border-color: #98b7e8;
  background: linear-gradient(180deg, #f5f9ff 0%, #eef5ff 100%);
  box-shadow: inset 0 0 0 1px rgba(23, 92, 211, 0.08);
}

.scope-type-option input:focus-visible + span {
  outline: 2px solid #84adff;
  outline-offset: 1px;
}

.scope-users-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e7edf5;
  border-radius: 8px;
  background: #f8fafc;
}

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

.user-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px 12px;
  align-items: end;
  align-content: end;
  width: 100%;
  min-width: 0;
}

.perm-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
  align-items: start;
}

#userAdminView .perm-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 36px;
  max-height: none;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #314257;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
  box-sizing: border-box;
  writing-mode: horizontal-tb;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

#userAdminView .perm-check:hover {
  border-color: #bfd0ea;
  background: #f8fbff;
}

#userAdminView .perm-check:has(input:checked) {
  border-color: #98b7e8;
  background: linear-gradient(180deg, #f5f9ff 0%, #eef5ff 100%);
  box-shadow: inset 0 0 0 1px rgba(23, 92, 211, 0.08);
  color: #175cd3;
  font-weight: 600;
}

#userAdminView .perm-check input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  flex: 0 0 16px;
  align-self: center;
  accent-color: #175cd3;
}

#userAdminView .perm-check > span {
  flex: 1 1 auto;
  width: auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  word-break: keep-all;
  overflow-wrap: normal;
}

.user-create-form .field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.user-create-form .field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.user-create-form input,
.user-create-form select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.user-create-actions {
  display: grid;
  gap: 6px;
  align-content: end;
  align-self: end;
  min-width: 0;
}

/* Match .field label row so the button lines up with inputs, not labels */
.user-create-actions::before {
  content: "\00a0";
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  visibility: hidden;
  pointer-events: none;
}

.user-create-actions .btn {
  min-width: 104px;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.user-admin-status {
  text-align: left;
}

.user-admin-list-card {
  min-height: 360px;
  grid-template-rows: auto auto 1fr;
}

.user-admin-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
}

.user-admin-toolbar input[type="search"],
.user-admin-toolbar select {
  width: auto;
  flex: 0 0 auto;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.user-admin-toolbar input[type="search"] {
  width: 220px;
  min-width: 180px;
}

.user-admin-toolbar select {
  width: 140px;
  min-width: 120px;
}

.user-admin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.user-admin-summary span {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: #475467;
  font-weight: 700;
  white-space: nowrap;
}

.user-table-wrap {
  max-height: none;
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 1100px) {
  .user-create-form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .user-create-actions {
    grid-column: 1 / -1;
  }

  .user-admin-permission-grid {
    grid-template-columns: 1fr;
  }

  .user-admin-perm-card {
    min-height: 0;
  }

  .scope-type-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #userAdminView .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-create-form,
  .user-role-create-form {
    grid-template-columns: 1fr;
  }

  .user-admin-toolbar {
    flex-wrap: wrap;
  }

  .user-admin-toolbar input[type="search"] {
    width: 100%;
    min-width: 0;
  }

  .user-admin-editor-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .user-admin-editor-meta .btn {
    width: 100%;
  }
}

.user-flag {
  display: inline-block;
  margin-top: 4px;
  margin-right: 4px;
  font-weight: 700;
}

.user-flag.warn {
  color: #b54708;
}

.user-flag.danger {
  color: #b42318;
}

.user-status.admin {
  color: #175cd3;
  background: #eff8ff;
}

.user-status.member {
  color: #475467;
  background: #f2f4f7;
}

.force-password-backdrop {
  z-index: 1200;
}

.force-password-backdrop .modal-panel {
  max-width: 460px;
}

.force-password-form {
  display: grid;
  gap: 12px;
}

.force-password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

body.force-password-open {
  overflow: hidden;
}

body.force-password-open .app-shell,
body.force-password-open .side-nav {
  pointer-events: none;
  filter: grayscale(0.15);
}

.user-table {
  min-width: 1080px;
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.user-table th,
.user-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

.user-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
}

.user-table td small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quota-cell {
  display: grid;
  gap: 3px;
  min-width: 112px;
}

.quota-cell b {
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.quota-cell em {
  color: #b42318;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.lock-status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.lock-status.normal {
  color: #475467;
  background: #f2f4f7;
}

.lock-status.locked {
  color: #b54708;
  background: #fffaeb;
}

.user-status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.user-status.active {
  color: #047857;
  background: #ecfdf3;
}

.user-status.disabled {
  color: #b42318;
  background: #fff1f3;
}

.btn.mini {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

body:not(.is-admin) .admin-only {
  display: none;
}

body:not(.is-admin) .admin-debug-field {
  display: none;
}

.muted-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.strategy-analysis-panel {
  display: grid;
  gap: 0;
}

.strategy-sourcebar {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(160px, 1fr)) auto auto auto minmax(180px, 1.4fr);
  gap: 10px;
  align-items: end;
  margin: 12px 8px 0;
  padding: 12px;
  border: 1px solid var(--shell-line, var(--line));
  border-radius: 6px;
  background: #fff;
}

.strategy-sourcebar .sortbar-title {
  grid-column: 1 / -1;
}

.strategy-sourcebar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.strategy-sourcebar select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.strategy-sourcebar .status {
  align-self: center;
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.strategy-workspace {
  align-items: start;
}

.strategy-workspace > .workspace-panel {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.strategy-toolbar {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-top: 0;
  background: #fff;
}

.strategy-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.strategy-filter-row {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.strategy-bulk-row {
  background: #fff;
}

.strategy-toolbar-row > input[type="search"],
.strategy-toolbar-row > select {
  width: auto;
  flex: 0 0 auto;
  height: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
  font-size: 12px;
}

.strategy-toolbar-row > input[type="search"] {
  width: 200px;
  min-width: 160px;
  max-width: 240px;
}

.strategy-filter-row > select {
  width: 124px;
}

.strategy-bulk-row > select {
  width: 132px;
}

.strategy-quick-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  width: auto;
  min-width: 0;
  margin-left: 4px;
}

.strategy-chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.strategy-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.strategy-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.strategy-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.strategy-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

.strategy-bulk-row .selected-count {
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.strategy-bulk-row .btn {
  height: 34px;
  flex: 0 0 auto;
}

.strategy-table-card {
  border-radius: 0;
  max-height: calc(100vh - 360px);
}

#keywordStrategyView .module-summary {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  border-radius: var(--radius, 8px) var(--radius, 8px) 0 0;
}

#strategyPager.table-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius, 8px) var(--radius, 8px);
  background: #fff;
}

.strategy-rail {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px 12px;
}

.strategy-rail-breakdown {
  display: grid;
  gap: 8px;
}

.strategy-category-list {
  display: grid;
  gap: 6px;
}

.strategy-category-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  font-size: 12px;
}

.strategy-category-item span {
  color: var(--muted);
}

.strategy-category-item b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.strategy-category-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.strategy-rail .btn.full + .btn.full {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .strategy-sourcebar {
    grid-template-columns: 1fr 1fr;
  }

  .strategy-sourcebar .status,
  .strategy-sourcebar .sortbar-title {
    grid-column: 1 / -1;
  }

  #keywordStrategyView .module-summary {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .strategy-toolbar-row > input[type="search"] {
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }
}

.keyword-chip-list.compact {
  gap: 4px;
}

.keyword-chip-list.compact span {
  padding: 3px 7px;
  font-size: 11px;
}

.listing-summary {
  margin-bottom: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
}

#listingView .listing-main-column {
  margin: 12px 8px;
  min-width: 0;
}

.listing-main-column {
  display: grid;
  gap: 12px;
  min-width: 0;
  align-content: start;
}

.listing-top-actions {
  align-items: end;
  gap: 10px;
}

.listing-toolbar-field {
  display: grid;
  gap: 6px;
  min-width: 240px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.listing-toolbar-field select {
  min-width: 260px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
}

.listing-toolbar-field select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.listing-setup-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

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

.listing-setup-head > div {
  display: grid;
  gap: 4px;
}

.listing-setup-head b {
  font-size: 14px;
  color: var(--ink);
}

.listing-setup-head span,
.listing-field > span,
.listing-candidates-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.listing-setup-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(260px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.listing-setup-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.listing-setup-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.85fr) minmax(200px, 1.15fr);
  gap: 12px;
  align-items: stretch;
}

.listing-core-field {
  align-self: stretch;
}

.listing-ai-field {
  min-width: 0;
}

.listing-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.listing-switch:hover {
  border-color: #b8c2cc;
  background: #fff;
}

.listing-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.listing-switch-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #d0d5dd;
  transition: background 0.18s ease;
}

.listing-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
  transition: transform 0.18s ease;
}

.listing-switch:has(input:checked) {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
}

.listing-switch:has(input:checked) .listing-switch-track {
  background: var(--accent);
}

.listing-switch:has(input:checked) .listing-switch-thumb {
  transform: translateX(16px);
}

.listing-switch:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.listing-switch-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.listing-switch-copy b {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.listing-switch-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.listing-priority-block {
  display: grid;
  gap: 10px;
  min-width: 0;
  height: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
}

.listing-priority-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.listing-priority-head > div {
  display: grid;
  gap: 3px;
}

.listing-priority-head b {
  font-size: 12px;
  color: var(--ink);
}

.listing-priority-head span,
.listing-priority-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.listing-priority-count {
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.listing-priority-list {
  display: grid;
  gap: 6px;
  min-height: 44px;
  max-height: 220px;
  overflow: auto;
}

.listing-priority-empty {
  padding: 14px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  background: #fff;
}

.listing-priority-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.listing-priority-item:hover {
  border-color: #b8c2cc;
}

.listing-priority-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.listing-priority-text {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-priority-actions {
  display: inline-flex;
  gap: 4px;
}

.listing-priority-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.listing-priority-actions button:hover:not(:disabled) {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.listing-priority-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.listing-priority-actions .is-danger:hover:not(:disabled) {
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff1f0;
  color: #b42318;
}

.listing-priority-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.listing-priority-add input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.listing-priority-add input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.listing-priority-add .btn {
  height: 36px;
  min-width: 72px;
}

.listing-priority-suggestions-block {
  display: grid;
  gap: 8px;
}

.listing-priority-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.listing-priority-suggestions:empty::before,
.listing-priority-suggestions .empty {
  color: var(--muted);
  font-size: 12px;
}

.listing-priority-suggestions [data-add-priority] {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.listing-priority-suggestions [data-add-priority]::before {
  content: "+";
  color: var(--accent);
  font-weight: 800;
}

.listing-priority-suggestions [data-add-priority]:hover {
  border-style: solid;
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.listing-priority-suggestions [data-add-priority].is-used {
  opacity: 0.45;
  pointer-events: none;
}

.listing-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.listing-field input,
.listing-field select,
.listing-field textarea,
.listing-card textarea,
.listing-title-segments textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fbfcfd;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.listing-field input,
.listing-field select {
  height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}

.listing-field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #667085 50%), linear-gradient(135deg, #667085 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.listing-field textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.5;
}

.listing-field input:hover,
.listing-field select:hover,
.listing-field textarea:hover,
.listing-card textarea:hover {
  border-color: #b8c2cc;
  background: #fff;
}

.listing-field input:focus,
.listing-field select:focus,
.listing-field textarea:focus,
.listing-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.listing-candidates-block {
  display: grid;
  gap: 8px;
}

.listing-candidates-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.listing-candidates-head b {
  font-size: 12px;
  color: var(--ink);
}

.listing-candidate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.listing-candidate-list:empty::before {
  content: "生成后将显示核心词候选";
  color: var(--muted);
  font-size: 12px;
}

.listing-candidate-list [data-core-keyword] {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfd;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.listing-candidate-list [data-core-keyword]:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.listing-workspace {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: #fff;
  min-height: 320px;
}

.listing-workspace > .empty-state {
  place-self: center;
  color: var(--muted);
  font-size: 13px;
}

.listing-card {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.listing-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.listing-card-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.listing-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.listing-title-segments {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 12px;
}

.listing-title-segments .listing-field span,
.listing-card .listing-field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.listing-char-count {
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.listing-char-count.is-over {
  color: #b42318;
}

.listing-confirm-banner {
  padding: 12px 14px;
  border: 1px solid #fdba74;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
}

.listing-issue-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.listing-issue-list .is-error { color: #b91c1c; }
.listing-issue-list .is-warning { color: #b45309; }
.listing-issue-list .is-info { color: #0369a1; }

.listing-issue-ok {
  margin: 0;
  color: #047857;
  font-size: 12px;
  font-weight: 600;
}

.listing-bullet-list {
  display: grid;
  gap: 10px;
}

.listing-aplus-grid {
  display: grid;
  gap: 10px;
}

.listing-aplus-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.listing-aplus-card b {
  font-size: 13px;
  color: var(--ink);
}

.listing-aplus-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.listing-rail .listing-rail-status,
.listing-rail-status {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.listing-rail-status > span {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.listing-rail-status b {
  font-size: 12px;
  color: var(--ink);
}

.listing-rail-status small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.listing-confirm-banner.is-success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

.listing-confirm-banner.is-warning {
  background: #fffaeb;
  border-color: #fedf89;
  color: #b54708;
}

.listing-check-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 13px;
}

.listing-check-summary span.is-通过 { color: #047857; font-weight: 700; }
.listing-check-summary span.is-提醒 { color: #b45309; font-weight: 700; }
.listing-check-summary span.is-风险 { color: #b91c1c; font-weight: 700; }

.listing-rail-report {
  margin-top: 10px;
}

.listing-rail-report-list {
  display: grid;
  gap: 6px;
}

.listing-check-item {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 2px;
}

.listing-check-item b {
  font-size: 12px;
}

.listing-check-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.listing-check-item.is-通过 { border-color: #abefc6; }
.listing-check-item.is-提醒 { border-color: #fedf89; }
.listing-check-item.is-风险 { border-color: #fecdca; }

.listing-excluded-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.listing-excluded-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.listing-excluded-list small {
  color: var(--muted);
}

.listing-layout-table {
  overflow: auto;
  max-height: 360px;
}

.listing-layout-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.listing-layout-table th,
.listing-layout-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.listing-banned-field textarea {
  width: 100%;
  min-height: 64px;
}

.listing-skipped-block {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.listing-skipped-block ul {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.listing-skipped-block small {
  color: var(--muted);
}

.listing-workspace .keyword-chip-list {
  margin-top: 2px;
}

.listing-chip-empty {
  color: var(--muted);
  font-size: 12px;
}

.listing-field em {
  font-style: normal;
}

@media (max-width: 960px) {
  .listing-setup-grid,
  .listing-setup-row,
  .listing-title-segments {
    grid-template-columns: 1fr;
  }

  .listing-top-actions {
    width: 100%;
    align-items: stretch;
  }

  .listing-toolbar-field,
  .listing-toolbar-field select {
    min-width: 0;
    width: 100%;
  }

  .listing-priority-add {
    grid-template-columns: 1fr;
  }
}

.strategy-bulkbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  background: #fff;
}

.strategy-bulkbar label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.strategy-bulkbar select {
  width: auto;
  min-width: 126px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 8px;
}

.ad-edit-bar {
  align-items: center;
}

.ad-bid-input {
  width: 100%;
  border: 1px solid var(--line, #d9e2ec);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.ad-bid-input.is-missing,
tr.is-missing-bid td {
  background: #fff7ed;
}

.chart-keyword-row.is-missing-bid {
  background: #fff7ed;
}

.reuse-center-card {
  margin-top: 14px;
}

.reuse-center-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

.reuse-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.reuse-panel h3 {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
}

.reuse-panel > .btn {
  justify-self: start;
  margin-top: 2px;
}

.reuse-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.reuse-field > span {
  line-height: 1.2;
}

.reuse-field select,
.reuse-field input[type="text"],
.reuse-field input:not([type]),
.reuse-panel .reuse-field > input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.reuse-field select:hover,
.reuse-field input:hover {
  border-color: #b8c2cc;
  background: #fff;
}

.reuse-field select:focus,
.reuse-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.reuse-source-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.reuse-source-list .empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 2px;
}

.reuse-source-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.reuse-source-item:hover {
  background: #fff;
  border-color: var(--line);
}

.reuse-source-item:has(input:checked) {
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, 0.28);
}

.reuse-source-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  padding: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.reuse-source-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reuse-source-text b {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reuse-source-text small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

@media (max-width: 1180px) {
  .reuse-center-grid {
    grid-template-columns: 1fr;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
}

.modal-backdrop.is-open {
  display: grid;
}

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

.modal-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(31, 41, 55, 0.22);
}

.quota-panel {
  width: min(560px, 100%);
}

.modal-panel header,
.modal-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-panel footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-panel header > div {
  display: grid;
  gap: 4px;
}

.modal-panel header span,
.modal-body p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

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

.quota-toggle {
  display: flex;
  justify-content: space-between;
}

.quota-toggle input {
  width: 18px;
  height: 18px;
}

.quota-current-usage {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.quota-current-usage b {
  display: inline-block;
  min-width: 76px;
  color: var(--ink);
}

.quota-event-block {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.quota-event-block > b {
  color: var(--ink);
  font-size: 13px;
}

.quota-event-rows {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.quota-event-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quota-event-row span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.quota-event-row b {
  color: var(--ink);
}

.quota-event-row small {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1380px) {
  .design-target-strip {
    grid-template-columns: 70px minmax(240px, 1fr) 90px minmax(150px, .7fr) minmax(220px, 1fr);
  }

  .design-target-strip > .btn {
    display: none;
  }

  .layout,
  .keyword-workspace {
    grid-template-columns: minmax(0, 1fr) 176px;
  }
}

@media (max-width: 1120px) {
  .app-frame,
  .app-frame:has(.app-nav:hover) {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .app-nav {
    width: 64px;
    padding-inline: 4px;
  }

  .nav-item {
    min-height: 52px;
  }

  .nav-item span:last-child {
    display: none;
  }

  .app-shell {
    border-left: 0;
  }

  .design-target-strip {
    grid-template-columns: 70px minmax(220px, 1fr) 100px minmax(180px, 1fr);
  }

  .design-target-attributes {
    display: none;
  }

  .layout,
  .keyword-workspace,
  .traffic-analysis-panel,
  .module-split-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .module-rail,
  .traffic-root-rail,
  .persistent-rail {
    display: none;
  }

  .traffic-sourcebar,
  .keyword-charts {
    grid-column: 1;
  }

  .settings-workspace,
  .content-workspace {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Data-dense operations workspace: shared modules */
.app-view:not(#competitorView) {
  padding-bottom: var(--space-6);
}

.app-view:not(#competitorView) .page-header {
  border-bottom-color: var(--line-strong);
}

.app-view:not(#competitorView) .page-header::before {
  content: "";
  align-self: stretch;
  width: 3px;
  margin-right: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.app-view:not(#competitorView) .page-header > div:first-child {
  flex: 1;
}

.app-view:not(#competitorView) .page-header .eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .04em;
}

.app-view:not(#competitorView) .page-header p {
  max-width: 720px;
}

.keyword-panel,
.traffic-analysis-panel,
.workspace-panel,
.content-workspace,
.project-center-grid,
.placeholder-workspace {
  margin-top: var(--space-3);
}

.keyword-sortbar,
.keyword-actionbar,
.traffic-sourcebar {
  border: 1px solid var(--line);
  background: var(--surface);
}

.keyword-sortbar {
  align-items: end;
  min-height: 70px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-soft);
}

.keyword-sortbar label,
.traffic-sourcebar label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.keyword-sortbar select,
.traffic-sourcebar select {
  min-height: 34px;
  border-color: var(--line-strong);
  background: var(--surface);
  font-size: 12px;
}

.sortbar-title b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.sortbar-title span {
  font-size: 11px;
}

.keyword-actionbar {
  position: sticky;
  top: 44px;
  z-index: 9;
  min-height: 48px;
  border-top: 0;
  background: rgba(255, 255, 255, .97);
}

.checkline,
.selected-count {
  color: var(--muted);
  font-size: 12px;
}

.keyword-filterbar {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  background: #f0f9f7;
}

.keyword-filter-tag {
  border: 1px solid #b7e3da;
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent-hover);
  font-size: 11px;
}

.keyword-table-card {
  border-radius: 0;
  border-top: 0;
  box-shadow: none;
}

.keyword-table-card th:first-child,
.keyword-table-card td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: inherit;
}

.keyword-table-card th.keyword-col-keyword,
.keyword-table-card td.keyword-col-keyword {
  position: sticky;
  left: 46px;
  z-index: 2;
  background: inherit;
  box-shadow: 1px 0 var(--line);
}

.keyword-table-card th.keyword-col-keyword {
  z-index: 4;
  background: var(--surface-soft);
}

.keyword-table-card td.keyword-col-keyword {
  color: var(--ink);
  font-weight: 650;
}

.keyword-table-card td:not(.keyword-col-keyword):not(.keyword-col-asin) {
  font-variant-numeric: tabular-nums;
}

.keyword-filter-menu {
  border-color: var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(16, 24, 40, .16);
}

.traffic-analysis-panel {
  gap: var(--space-3);
  padding: 0;
}

.traffic-sourcebar {
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.traffic-sourcebar .sortbar-title {
  min-width: 0;
}

.traffic-sourcebar .status,
.traffic-source-status {
  min-height: 34px;
  margin: 0;
}

.keyword-charts {
  max-width: none !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  overflow: hidden;
}

.chart-toolbar {
  min-height: 64px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.chart-title-line {
  align-items: center;
}

.chart-info {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.chart-tabs {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart-tabs button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chart-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.bubble-chart {
  min-height: 440px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background-color: #fff;
  background-image: linear-gradient(#f2f4f7 1px, transparent 1px), linear-gradient(90deg, #f2f4f7 1px, transparent 1px);
  background-size: 40px 40px;
}

.chart-legend {
  min-height: 34px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.chart-controls,
.axis-range-controls {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.axis-range-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.axis-range-filter {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.coverage-range-last {
  grid-column: 1 / -1;
}

.chart-keyword-results {
  border: 0;
  border-radius: 0;
  background: var(--surface);
}

.chart-keyword-results-head,
.root-analysis-toolbar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.chart-keyword-list {
  max-height: 420px;
  overflow: auto;
  content-visibility: auto;
}

.chart-keyword-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-soft);
}

.chart-keyword-row:hover {
  background: var(--surface-hover);
}

.root-analysis-panel {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.root-analysis-results {
  padding: 10px 12px;
}

.root-analysis-item {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
}

.module-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  min-height: 78px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  overflow: hidden;
}

.module-summary-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-content: center;
  padding: 12px 14px 10px 17px;
  border-right: 1px solid var(--line);
}

.module-summary-item::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 8px;
  width: 3px;
  border-radius: 2px;
  background: #98a2b3;
}

.module-summary-item.is-success::before { background: var(--direct); }
.module-summary-item.is-blue::before { background: var(--data-blue); }
.module-summary-item.is-warning::before { background: var(--review); }

.module-summary-item span,
.module-summary-item small {
  color: var(--muted);
  font-size: 11px;
}

.module-summary-item b {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--ink);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.module-summary-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.module-table-card {
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: none;
}

.module-table-card th:first-child,
.module-table-card td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
}

.module-table-card th:first-child {
  z-index: 3;
  background: var(--surface-soft);
}

.module-keyword-cell {
  color: var(--ink);
  font-weight: 650;
}

.module-table-card select {
  border-color: var(--line);
  background: var(--surface);
  font-size: 11px;
}

.table-tag,
.table-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 4px;
  background: #f2f4f7;
  color: #475467;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.table-status.success { background: #eaf8ef; color: var(--direct); }
.table-status.warning { background: #fff7e8; color: var(--review); }
.table-status.danger { background: #fff1f0; color: var(--danger); }
.table-status.running { background: #edf4ff; color: var(--data-blue); }

.task-message {
  max-width: 480px;
  color: var(--muted);
  white-space: normal;
}

.content-workspace {
  gap: 0;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden;
}

.content-section {
  padding: 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.content-section:last-child {
  border-bottom: 0;
}

.content-section h3 {
  display: flex;
  align-items: center;
  min-height: 28px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.content-section textarea {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: #344054;
  font-family: inherit;
}

.keyword-chip-list span {
  border-color: #b7e3da;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.project-center-grid {
  gap: var(--space-2);
  content-visibility: auto;
}

.project-filterbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(130px, 160px));
  gap: 12px 14px;
  align-items: end;
  margin: 12px 8px;
  padding: 14px 16px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.project-filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.project-filter-field span {
  line-height: 1.2;
}

.project-filter-field input,
.project-filter-field select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.project-filter-field input::placeholder {
  color: #98a2b3;
}

.project-filter-field input:hover,
.project-filter-field select:hover {
  border-color: #b8c2cc;
  background: #fff;
}

.project-filter-field input:focus,
.project-filter-field select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.project-filter-search {
  min-width: 200px;
}

@media (max-width: 1100px) {
  .project-filterbar {
    grid-template-columns: minmax(200px, 1fr) repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 720px) {
  .project-filterbar {
    grid-template-columns: 1fr;
  }
}

.project-center-item {
  grid-template-columns: minmax(240px, 1.25fr) repeat(4, minmax(130px, .8fr));
  gap: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

.project-center-item > div {
  min-height: 92px;
  border-right: 1px solid var(--line);
}

.project-center-item > div:last-child {
  border-right: 0;
}

.project-center-item > div:first-child {
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
}

.project-stage {
  position: relative;
}

.project-stage::before {
  content: "";
  position: absolute;
  top: 15px;
  right: 12px;
  width: 7px;
  height: 7px;
  border: 1px solid #98a2b3;
  border-radius: 50%;
  background: var(--surface);
}

.project-stage.is-complete::before {
  border-color: var(--direct);
  background: var(--direct);
}

.project-stage .btn {
  margin-top: 8px;
  min-height: 26px;
  padding: 4px 7px;
}

.project-stage-bar {
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.project-stage-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.result-center-card {
  margin: 12px 8px;
}

.task-detail-panel {
  width: min(760px, 100%);
}

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

.task-detail-grid div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.task-detail-grid span,
.task-detail-logs span {
  color: var(--muted);
  font-size: 12px;
}

.task-detail-message,
.task-detail-logs {
  display: grid;
  gap: 8px;
}

.task-detail-logs div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-usage {
  display: inline-block;
  min-width: 92px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.task-usage em {
  color: #b42318;
  font-style: normal;
}

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

.task-overview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 8px;
}

.task-filterbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, 180px)) auto;
  gap: 12px 14px;
  align-items: end;
  margin: 12px 8px;
  padding: 14px 16px;
  border: 1px solid var(--shell-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.task-filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.task-filter-field span {
  line-height: 1.2;
}

.task-filter-field input,
.task-filter-field select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.task-filter-field input::placeholder {
  color: #98a2b3;
}

.task-filter-field input:hover,
.task-filter-field select:hover {
  border-color: #b8c2cc;
  background: #fff;
}

.task-filter-field input:focus,
.task-filter-field select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.task-filter-search {
  min-width: 200px;
}

.task-filter-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-bottom: 1px;
}

.task-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.task-switch input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.task-switch:hover {
  border-color: #b8c2cc;
  background: #fff;
  color: var(--ink);
}

.task-switch:has(input:checked) {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.task-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .task-filterbar {
    grid-template-columns: minmax(200px, 1fr) repeat(2, minmax(140px, 1fr));
  }

  .task-filter-switches {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .task-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-filterbar {
    grid-template-columns: 1fr;
  }

  .task-filter-switches {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .task-switch {
    justify-content: flex-start;
  }
}

.module-keyword-cell small,
td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.task-progress-cell {
  display: grid;
  gap: 6px;
  min-width: 92px;
}

.task-progress-cell i {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.task-progress-cell b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.task-detail-context {
  display: grid;
  grid-template-columns: 1.4fr .7fr 1fr .8fr;
  gap: 10px;
}

.task-detail-context div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-detail-context span {
  color: var(--muted);
  font-size: 12px;
}

.task-detail-message pre {
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 12px;
  white-space: pre-wrap;
}

.empty-state,
.placeholder-workspace {
  border-color: var(--line-strong);
  border-radius: var(--radius);
  background: repeating-linear-gradient(-45deg, #fff, #fff 10px, #fafbfc 10px, #fafbfc 20px);
}

.data-source-settings-section {
  align-items: stretch;
  flex-direction: column;
  gap: 16px;
}

.data-source-grid {
  display: grid;
  grid-template-columns: minmax(420px, .95fr) minmax(420px, 1.05fr);
  gap: 16px;
  width: 100%;
}

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

.platform-settings-form fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.platform-settings-form legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 700;
}

.platform-settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.platform-settings-form input,
.platform-settings-form select {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.settings-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.usage-log-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.usage-log-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.usage-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
}

.usage-summary span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.usage-log-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.usage-log-table {
  min-width: 780px;
}

.usage-workspace {
  display: grid;
  gap: 12px;
  padding: 12px 8px;
}

.usage-filterbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--shell-line);
  border-radius: 6px;
  background: #fff;
}

.usage-filterbar label {
  display: grid;
  gap: 5px;
  min-width: 130px;
  color: var(--muted);
  font-size: 12px;
}

.usage-filterbar input,
.usage-filterbar select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
}

.usage-overview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.usage-card {
  display: grid;
  gap: 7px;
  min-height: 106px;
  padding: 14px;
  border: 1px solid var(--shell-line);
  border-radius: 6px;
  background: #fff;
}

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

.usage-card b {
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.usage-card small {
  color: var(--muted);
  line-height: 1.5;
}

.usage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 12px;
}

.usage-table-card {
  margin: 0;
  overflow: hidden;
}

.usage-table-card > header {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 1280px) {
  .traffic-source-head {
    grid-template-columns: 1fr minmax(180px, 240px);
  }

  .traffic-source-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .project-center-item {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 1fr));
  }

  .data-source-grid {
    grid-template-columns: 1fr;
  }

  .usage-overview-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .usage-grid {
    grid-template-columns: 1fr;
  }

  .project-center-item > div {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-view:not(#competitorView) .page-header::before {
    display: none;
  }

  .keyword-sortbar,
  .keyword-actionbar,
  .chart-toolbar,
  .chart-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .traffic-source-grid {
    grid-template-columns: 1fr;
  }

  .keyword-sortbar label,
  .keyword-sortbar select,
  .traffic-sourcebar label {
    width: 100%;
  }

  .axis-range-controls,
  .module-summary,
  .project-center-item,
  .usage-overview-grid {
    grid-template-columns: 1fr;
  }

  .coverage-range-last {
    grid-column: auto;
  }

  .module-summary-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .project-center-item > div {
    border-right: 0;
  }

  .bubble-chart {
    min-height: 360px;
  }
}

/* Archive / restore / project-first / traffic relevance */
.global-project-select {
  min-width: 180px;
  max-width: 260px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.project-center-item.is-archived,
tr.is-archived {
  opacity: 0.72;
}

.project-center-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.traffic-relevance-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.traffic-relevance-summary > div,
.traffic-relevance-summary > label {
  display: grid;
  gap: 4px;
}

.traffic-relevance-summary span {
  color: var(--muted);
  font-size: 12px;
}

.traffic-relevance-summary b {
  font-size: 18px;
}

.settings-inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.task-rule-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  color: var(--muted);
  font-size: 13px;
}

.task-rule-summary b {
  color: var(--ink);
}

.rel-level {
  font-weight: 700;
}

.rel-level.rel-高 { color: #1f7a4d; }
.rel-level.rel-中 { color: #9a6700; }
.rel-level.rel-低 { color: #b42318; }

.chart-keyword-table-head,
.chart-keyword-row {
  grid-template-columns: minmax(160px, 1.6fr) 72px 110px 90px 90px 110px minmax(140px, 1.4fr);
}

.rel-reason {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 960px) {
  .traffic-relevance-summary {
    grid-template-columns: 1fr 1fr;
  }

  .global-project-select {
    max-width: 160px;
  }
}
