/* =========================
   Base
========================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* V2 Topvisor density and toolbar polish */
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar {
  display: grid !important;
  grid-template-columns: minmax(280px, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 14px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 14px !important;
  background: color-mix(in srgb, var(--surface-secondary) 84%, transparent) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-primary,
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-primary {
  flex-wrap: nowrap;
}

html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

html[data-theme] body.theme-light-premium.project-page .matrix-search-wrap {
  height: 38px !important;
  min-width: 220px !important;
  max-width: 560px !important;
  flex: 1 1 360px !important;
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-search {
  height: 36px !important;
  color: var(--text-primary) !important;
  font-size: 14px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-search::placeholder {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  min-height: 38px !important;
  padding: 3px !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 10px !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button,
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme] body.theme-light-premium.project-page .matrix-filter-select {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 10px !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme] body.theme-light-premium.project-page .matrix-filter-select {
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button.active,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button.active {
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button:disabled {
  color: var(--text-muted) !important;
  cursor: not-allowed;
  opacity: .72;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment i,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle i,
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn i,
html[data-theme] body.theme-light-premium.project-page .matrix-filter-select i {
  display: inline-flex !important;
  width: 14px !important;
  height: 14px !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 14px !important;
  line-height: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-filter-select select {
  width: auto !important;
  min-width: 76px !important;
  height: 30px !important;
  padding: 0 18px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 720 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-filter-count {
  min-height: 28px !important;
  padding: 6px 10px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 8px !important;
  background: var(--surface-primary) !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-check-note {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 8px 2px 10px !important;
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-check-note span,
html[data-theme] body.theme-light-premium.project-page .matrix-check-note small {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-shell.is-topvisor-mode {
  border-color: var(--border-default) !important;
  border-radius: 12px !important;
  background: var(--surface-primary) !important;
  contain: none !important;
  isolation: isolate !important;
  overflow: auto !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor {
  width: max(100%, var(--pa-topvisor-min-width, 960px)) !important;
  min-width: var(--pa-topvisor-min-width, 960px) !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-col-frequency,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor th:nth-child(2),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor td:nth-child(2) {
  width: 84px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-col-date,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor th:nth-child(n+3),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor td:nth-child(n+3) {
  width: 104px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead th,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody td {
  border-right: 1px solid var(--border-soft) !important;
  border-bottom: 1px solid var(--border-soft) !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead th {
  height: 44px !important;
  padding: 5px 7px !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
  vertical-align: middle !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody td {
  height: 40px !important;
  padding: 0 !important;
  color: var(--text-primary) !important;
  vertical-align: middle !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-sort-button {
  min-height: 32px !important;
  padding: 0 2px !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  line-height: 1.12 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head span {
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 780 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head small {
  margin-top: 2px !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  font-weight: 650 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell {
  position: sticky !important;
  left: 0 !important;
  z-index: 18 !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  position: sticky !important;
  left: var(--pa-matrix-keyword-width) !important;
  z-index: 19 !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  border-right-color: color-mix(in srgb, var(--border-default) 78%, var(--text-primary)) !important;
  box-shadow: 8px 0 12px -12px rgba(0, 0, 0, .7) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
  z-index: 28 !important;
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: color-mix(in srgb, var(--surface-secondary) 78%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:hover .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:hover .topvisor-frequency-cell {
  background: var(--surface-hover) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-keyword {
  display: block !important;
  padding: 8px 10px !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  line-height: 1.18 !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  padding: 0 8px !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  text-align: center !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-cell-button {
  min-height: 40px !important;
  height: 40px !important;
  padding: 6px 8px !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-value {
  color: var(--text-primary) !important;
  font-size: 15px !important;
  font-weight: 780 !important;
  line-height: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-delta {
  min-width: 24px !important;
  padding: 2px 4px !important;
  border-radius: 5px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-up,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-new {
  background: color-mix(in srgb, var(--success) 13%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-down,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-lost {
  background: color-mix(in srgb, var(--danger) 13%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-same,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-neutral,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-missing {
  background: color-mix(in srgb, var(--surface-secondary) 82%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-up,
html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-new {
  background: color-mix(in srgb, var(--success) 18%, transparent) !important;
  color: var(--success) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-down,
html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-lost {
  background: color-mix(in srgb, var(--danger) 18%, transparent) !important;
  color: var(--danger) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head.is-active-date {
  background: color-mix(in srgb, var(--accent-primary) 12%, var(--surface-secondary)) !important;
  box-shadow: inset 0 2px 0 var(--accent-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-active-date-cell {
  box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--accent-primary) 6%, transparent) !important;
}

html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-up,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-new {
  background: #eaf4ec !important;
}

html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-down,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-lost {
  background: #f5e5e9 !important;
}

html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-same,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-neutral,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-missing {
  background: #f6f7f9 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search-wrap,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-mode-segment,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-select,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-count,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-shell.is-topvisor-mode {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-select select,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-count,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-check-note,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-check-note span,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-check-note small {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search::placeholder {
  color: var(--retro-sheet-muted) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-mode-segment button:not(.active),
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle button:not(.active) {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead th,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
  background: var(--retro-sheet-head-light) !important;
  color: #101508 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody td {
  border-color: var(--retro-sheet-grid) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-up,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-new {
  background: #e5ebcf !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-down,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-lost {
  background: #eeddd1 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-same,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-neutral,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-missing {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-value,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-cell-button {
  color: #101508 !important;
}

@media (max-width: 980px) {
  html[data-theme] body.theme-light-premium.project-page .matrix-toolbar {
    grid-template-columns: 1fr !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor {
    width: max(100%, var(--pa-topvisor-mobile-min-width, 760px)) !important;
    min-width: var(--pa-topvisor-mobile-min-width, 760px) !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-col-date,
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor th:nth-child(n+3),
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor td:nth-child(n+3) {
    width: 82px !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-head,
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
    left: 150px !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-actions {
    gap: 6px;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button,
  html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button,
  html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn,
  html[data-theme] body.theme-light-premium.project-page .matrix-filter-select {
    padding: 0 8px !important;
    font-size: 12px !important;
  }
}

/* V2 safe client summary table */
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary .matrix-col-keyword,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary th:nth-child(1),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary td:nth-child(1) {
  width: var(--pa-matrix-keyword-width) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary .matrix-col-frequency,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary th:nth-child(2),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary td:nth-child(2) {
  width: 92px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary .matrix-col-current,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary th:nth-child(3),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary td:nth-child(3) {
  width: 128px !important;
  text-align: center !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary .matrix-col-delta,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary th:nth-child(4),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary td:nth-child(4) {
  width: 112px !important;
  text-align: center !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary .matrix-col-range,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary th:nth-child(5),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary td:nth-child(5) {
  width: 116px !important;
  text-align: center !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary .matrix-col-history,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary th:nth-child(6),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary td:nth-child(6) {
  width: 190px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary .matrix-col-cluster,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary th:nth-child(7),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-summary td:nth-child(7) {
  width: 150px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-range-badge,
html[data-theme] body.theme-light-premium.project-page .matrix-cluster-pill,
html[data-theme] body.theme-light-premium.project-page .matrix-cluster-empty {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  max-width: 100% !important;
  min-height: 26px !important;
  padding: 5px 9px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-range-badge {
  color: var(--text-primary) !important;
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-range-badge.range-top3 {
  background: color-mix(in srgb, var(--success) 18%, var(--surface-primary)) !important;
  color: var(--success) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-range-badge.range-top10 {
  background: color-mix(in srgb, var(--success) 12%, var(--surface-primary)) !important;
  color: var(--success) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-range-badge.range-top30 {
  background: color-mix(in srgb, var(--accent-primary) 12%, var(--surface-primary)) !important;
  color: var(--accent-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-range-badge.range-top100 {
  background: color-mix(in srgb, var(--warning) 14%, var(--surface-primary)) !important;
  color: var(--warning) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-range-badge.range-out,
html[data-theme] body.theme-light-premium.project-page .matrix-range-badge.range-noData {
  background: var(--surface-secondary) !important;
  color: var(--text-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-cluster-pill {
  justify-content: flex-start !important;
  max-width: 132px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  background: color-mix(in srgb, var(--accent-primary) 10%, var(--surface-primary)) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-cluster-empty {
  background: var(--surface-secondary) !important;
  color: var(--text-muted) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-range-badge,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-cluster-pill,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-cluster-empty {
  border-color: var(--retro-sheet-grid) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-range-badge.range-top3,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-range-badge.range-top10 {
  background: #e5ebcf !important;
  color: #101508 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-range-badge.range-top30,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-cluster-pill {
  background: #ece4bd !important;
  color: #101508 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-range-badge.range-top100 {
  background: #eeddd1 !important;
  color: #101508 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-range-badge.range-out,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-range-badge.range-noData,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-cluster-empty {
  background: var(--retro-sheet-bg-alt) !important;
  color: var(--retro-sheet-muted) !important;
}

:root{
  --bg: #0f0f0f;
  --panel: #212121;
  --panel2: #1e1e1e;
  --border: #272727;
  --border2: #363636;
  --text: #ffffff;
  --muted: #b0b0b0;
  --muted2: #999999;
  --accent: #e74c3c;
  --accent2: #c0392b;

  --matrix-bg: #0b0b10;
  --matrix-bg-2: #101019;
  --matrix-bg-3: #141420;
  --matrix-line: rgba(255,255,255,0.05);
  --matrix-line-soft: rgba(255,255,255,0.03);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================
   Header
========================= */

header {
  background: var(--panel);
  padding: 20px 0;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo i {
  color: var(--accent);
}

.logo a {
  color: var(--text);
  text-decoration: none;
  transition: color .2s;
}

.logo a:hover {
  color: var(--accent);
}

.home-page {
  background:
    radial-gradient(circle at 10% -10%, rgba(96,76,176,0.2), transparent 32%),
    radial-gradient(circle at 90% 0%, rgba(29,82,147,0.18), transparent 28%),
    #05070d;
}

.home-page header {
  background: rgba(5,7,13,0.86);
  border-bottom: 1px solid rgba(135,151,186,0.16);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.app-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(119,89,210,0.2);
  color: #c8b8ff;
  font-size: 12px;
  font-weight: 800;
}

.header-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(135,151,186,0.22);
  border-radius: 10px;
  background: rgba(21,25,38,0.72);
  color: var(--text);
  cursor: pointer;
}

.notification-btn {
  position: relative;
}

.notification-btn span {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.account-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(135,151,186,0.32);
  border-radius: 999px;
  background: rgba(21,25,38,0.78);
  color: #f5f7ff;
  font-weight: 800;
  cursor: pointer;
}

.account-menu-wrap {
  position: relative;
  display: inline-flex;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  display: none;
  overflow: hidden;
  border: 1px solid rgba(135,151,186,0.24);
  border-radius: 12px;
  background: rgba(10,14,24,0.98);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  z-index: 250;
}

.account-menu.show {
  display: block;
}

.account-menu-head {
  display: grid;
  gap: 3px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(135,151,186,0.16);
}

.account-menu-head b {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-head span,
.account-billing span {
  color: var(--muted);
  font-size: 12px;
}

.account-billing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
}

.account-billing > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(135,151,186,0.14);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
}

.account-billing b {
  font-size: 14px;
}

.is-expired {
  color: #ff8f8f !important;
}

.account-menu a,
.account-menu button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 0;
  border-top: 1px solid rgba(135,151,186,0.12);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.account-menu a:hover,
.account-menu button:hover {
  background: rgba(255,255,255,0.05);
}

/* =========================
   Prime header
========================= */

.home-page,
.project-page {
  min-height: 100vh;
}

.home-page header,
.project-page header {
  position: relative;
  top: auto;
  margin: 8px 8px 28px;
  padding: 0;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 12px;
  background:
    radial-gradient(circle at 4% 25%, rgba(231,76,60,0.07), transparent 24%),
    linear-gradient(120deg, rgba(9,14,25,0.96), rgba(7,11,20,0.94));
  box-shadow: 0 18px 60px rgba(0,0,0,0.26);
  backdrop-filter: blur(18px);
}

.home-page header .container,
.project-page header .container {
  width: 100%;
  max-width: none;
  padding: 0 22px;
}

.home-page .header-content,
.project-page .header-content {
  min-height: 164px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, 690px);
  gap: 24px;
  align-items: center;
}

.home-page .logo,
.project-page .logo {
  font-size: 28px;
  gap: 14px;
}

.home-page .logo i,
.project-page .logo i {
  font-size: 34px;
}

.home-page .app-badge,
.project-page .app-badge {
  height: 31px;
  padding: 0 11px;
  border-radius: 8px;
  background: rgba(119,89,210,0.34);
  color: #d2c5ff;
  font-size: 16px;
}

.header-tools {
  justify-content: flex-end;
}

.account-console {
  width: min(100%, 690px);
  display: grid;
  gap: 14px;
}

.account-console-top {
  min-height: 74px;
  display: grid;
  grid-template-columns: 98px minmax(112px, 1fr) minmax(230px, 1.3fr) 64px;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 12px;
  background: rgba(8,12,22,0.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.account-console-pill {
  width: 86px;
  min-height: 52px;
  justify-content: space-between;
  padding: 0 14px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.08), transparent 36%),
    rgba(19,25,39,0.92);
}

.account-console-pill span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  font-size: 17px;
}

.account-identity {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding-right: 18px;
  border-right: 1px solid rgba(135,151,186,0.16);
}

.account-identity b {
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  text-decoration: underline;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity span {
  color: rgba(225,230,242,0.68);
  font-size: 14px;
}

.account-console-billing {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding-right: 18px;
  border-right: 1px solid rgba(135,151,186,0.16);
}

.account-console-billing > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(225,230,242,0.72);
  font-size: 14px;
}

.account-console-billing i {
  color: #8b5cf6;
  font-size: 10px;
}

.account-console-billing > div:nth-child(2) i {
  color: #00d98b;
}

.account-console-billing b {
  overflow: hidden;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-console-settings {
  display: flex;
  justify-content: flex-end;
}

.account-settings-btn {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 12px;
  background: rgba(19,25,39,0.86);
}

.account-console-actions {
  display: grid;
  grid-template-columns: minmax(136px, 1fr) minmax(150px, 1.15fr) minmax(210px, 1.55fr) minmax(112px, 0.85fr);
  gap: 12px;
}

.account-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid rgba(135,151,186,0.22);
  border-radius: 8px;
  background: rgba(17,22,34,0.72);
  color: rgba(245,247,255,0.9);
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.account-action:hover {
  transform: translateY(-1px);
}

.account-action-telegram {
  border-color: rgba(139,92,246,0.75);
  background: linear-gradient(180deg, rgba(92,45,154,0.5), rgba(41,24,72,0.64));
  color: #d6c7ff;
  box-shadow: 0 0 22px rgba(139,92,246,0.12);
}

.account-action-phone {
  border-color: rgba(46,104,255,0.58);
  background: linear-gradient(180deg, rgba(21,57,143,0.42), rgba(12,28,70,0.62));
  color: #8fb2ff;
}

.account-action-theme {
  color: rgba(225,230,242,0.86);
}

.account-action-theme i:first-child {
  color: #f7d774;
}

.account-action-theme i:nth-child(2) {
  color: #c5c8d4;
}

.account-action-logout {
  border-color: rgba(255,75,62,0.68);
  color: #ff6e63;
}

/* =========================
   Buttons
========================= */

.btn {
  padding: 10px 16px;
  border: 1px solid #404040;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  border-color: #606060;
  background: #272727;
}

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

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

.btn-danger {
  background: #b03a2e;
  color: #fff;
  border-color: #b03a2e;
}

.btn-danger:hover {
  background: #922b21;
  border-color: #922b21;
}

.btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* =========================
   Titles
========================= */

.section-title {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 900px;
  margin: 34px auto 18px auto;
}

.section-title i {
  color: var(--accent);
}

/* =========================
   Alerts
========================= */

.alert {
  padding: 12px 16px;
  margin: 0 auto 20px auto;
  border-radius: 8px;
  display: none;
  font-size: 13px;
  border-left: 3px solid;
  max-width: 900px;
}

.alert.show {
  display: block;
}

.alert-success {
  background: #1a3a1a;
  color: #4cff4c;
  border-left-color: #4cff4c;
}

.alert-error {
  background: #3a1a1a;
  color: #ff4c4c;
  border-left-color: #ff4c4c;
}

/* =========================
   Cards / Forms
========================= */

.card,
.form-container {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  max-width: 900px;
  margin: 0 auto 30px auto;
  width: 100%;
}

.manual-tools {
  max-width: 1200px;
  margin: 0 auto 30px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.manual-tools .card {
  max-width: none;
  margin: 0;
}

.manual-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.manual-card-head h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
}

.manual-card-head i {
  color: var(--accent);
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 13px;
  color: #ddd;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--panel2);
  color: var(--text);
}

input:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.12);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.form-actions .btn {
  min-width: 180px;
}

/* =========================
   Results / Index blocks
========================= */

.result-box {
  margin-top: 16px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: #ddd;
  font-size: 13px;
  display: none;
}

.manual-result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.manual-result:last-child {
  border-bottom: 0;
}

.manual-summary,
.analytics-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}

.manual-summary span,
.summary-item {
  min-height: 122px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background:
    linear-gradient(135deg, rgba(128,98,222,0.08), transparent 52%),
    rgba(16,19,31,0.88);
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 12px;
  padding: 20px 22px;
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 18px 38px rgba(0,0,0,0.22);
}

.manual-summary b,
.summary-item b {
  display: block;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  margin: 10px 0 8px;
  letter-spacing: 0;
}

.summary-item span {
  color: rgba(225,230,242,0.7);
  font-size: 13px;
  font-weight: 700;
}

.summary-item em {
  font-style: normal;
  color: rgba(225,230,242,0.58);
  font-size: 12px;
  font-weight: 800;
}

.summary-item .metric-up {
  color: #6be68c;
}

.summary-item .metric-down {
  color: #ff6666;
}

.summary-item > i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(103,116,224,0.2);
  color: #9fb0ff;
}

.summary-item svg {
  width: 92px;
  height: 46px;
  overflow: visible;
}

.summary-item path {
  fill: none;
  stroke: #8c76ff;
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(140,118,255,0.35));
}

.manual-results-list {
  display: flex;
  flex-direction: column;
}

.frequency-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.frequency-table-wrap {
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}

.frequency-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.frequency-table th,
.frequency-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  vertical-align: middle;
}

.frequency-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.03);
}

.frequency-table tr:last-child td {
  border-bottom: 0;
}

.frequency-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.manual-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.manual-keyword {
  font-weight: 800;
  font-size: 14px;
}

.manual-url {
  font-size: 12px;
  color: #9aa0a6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-url a {
  color: #9aa0a6;
  text-decoration: none;
  border-bottom: 1px dashed rgba(154,160,166,0.35);
}

.manual-url a:hover {
  color: #fff;
  border-bottom-color: rgba(255,255,255,0.35);
}

/* =========================
   Home dashboard
========================= */

.home-page .container {
  max-width: 1440px;
}

.home-panel {
  padding: 28px;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 16px;
  background:
    radial-gradient(circle at top left, rgba(231,76,60,0.11), transparent 32%),
    linear-gradient(135deg, rgba(124,87,195,0.08), transparent 46%),
    rgba(12,16,27,0.86);
  box-shadow: 0 24px 80px rgba(0,0,0,0.32);
}

.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.home-section-head .section-title,
.home-projects-head .section-title {
  margin: 0 0 6px;
}

.home-section-head p {
  color: rgba(225,230,242,0.62);
}

.home-page .manual-tools {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.home-page .manual-tools .card {
  max-width: none;
  min-width: 0;
  min-height: 420px;
  border-color: rgba(135,151,186,0.22);
  background:
    linear-gradient(135deg, rgba(231,76,60,0.08), transparent 40%),
    rgba(10,14,24,0.74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.home-page .manual-tools .card:nth-child(2) {
  background:
    linear-gradient(135deg, rgba(124,87,195,0.14), transparent 42%),
    rgba(10,14,24,0.74);
}

.home-page .manual-card-head {
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.home-page .manual-card-head span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(231,76,60,0.16);
  color: var(--accent);
}

.home-page .manual-card:nth-child(2) .manual-card-head span {
  background: rgba(124,87,195,0.22);
  color: #a78bff;
}

.home-page .manual-card-head h3 {
  margin: 0 0 4px;
}

.home-page .manual-card-head p {
  color: rgba(225,230,242,0.62);
  font-size: 13px;
}

.home-page .manual-card .btn {
  max-width: 100%;
  white-space: normal;
}

.home-page .result-box {
  overflow: hidden;
}

.home-page .manual-summary {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}

.home-page .manual-summary span,
.home-page .summary-item {
  min-width: 0;
  padding: 16px;
}

.home-page .manual-summary b,
.home-page .summary-item b {
  font-size: clamp(22px, 3vw, 30px);
  overflow-wrap: anywhere;
}

.home-page .manual-result {
  grid-template-columns: minmax(0, 1fr) auto;
}

.home-page .badge {
  min-width: 92px;
  max-width: 132px;
  flex-wrap: wrap;
  padding: 8px 10px;
}

.home-page .frequency-actions {
  align-items: stretch;
}

.home-page .frequency-actions .btn {
  flex: 1 1 180px;
}

.input-icon {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--panel2);
}

.input-icon input {
  border: 0;
  background: transparent;
  padding: 0;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.home-projects-head {
  align-items: center;
  margin-bottom: 14px;
  max-width: none;
}

.home-project-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.home-project-toolbar .matrix-search-wrap {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 9px;
  background: rgba(8,11,20,0.58);
  color: rgba(225,230,242,0.58);
  flex: 1;
}

.home-project-toolbar .matrix-search-wrap input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.home-project-toolbar select {
  height: 42px;
  min-width: 170px;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 9px;
  background: rgba(12,15,26,0.72);
  color: rgba(245,247,255,0.88);
  padding: 0 12px;
}

.home-page .projects-grid {
  display: block;
  margin-bottom: 28px;
}

.home-page .project-folder {
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 14px;
  padding: 18px;
  background: rgba(12,16,27,0.72);
}

.home-page .projects-grid-inner {
  gap: 12px;
}

.home-page .project-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(135,151,186,0.18);
  background:
    linear-gradient(135deg, rgba(34,77,119,0.12), transparent 42%),
    rgba(10,14,24,0.86);
}

.home-page .project-card h3,
.home-page .project-card p {
  max-width: min(100%, 28ch);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-page .project-card:hover {
  border-color: rgba(231,76,60,0.42);
}

.project-spark {
  position: absolute;
  right: 22px;
  top: 58px;
  width: 100px;
  height: 38px;
  pointer-events: none;
}

.project-spark path {
  fill: none;
  stroke: #8c76ff;
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(140,118,255,0.35));
}

.home-footer {
  margin-top: 26px;
  padding: 26px 0;
  color: rgba(225,230,242,0.66);
}

.home-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =========================
   Prime dashboard
========================= */

.home-page {
  background:
    radial-gradient(circle at 9% 26%, rgba(231,76,60,0.12), transparent 22%),
    radial-gradient(circle at 82% 14%, rgba(43,91,173,0.1), transparent 28%),
    #050914;
}

.home-page .container {
  padding: 0 12px;
}

.home-page .manual-section {
  margin: 0 0 20px;
}

.home-panel {
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 8%, rgba(231,76,60,0.13), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(52,88,164,0.08), transparent 32%),
    linear-gradient(135deg, rgba(12,18,32,0.96), rgba(7,12,23,0.94));
}

.home-section-head {
  padding: 16px 18px 0;
}

.home-section-head .section-title {
  font-size: 28px;
}

.home-section-head .section-title i {
  font-size: 34px;
}

.home-section-head p {
  color: rgba(225,230,242,0.66);
  font-size: 16px;
}

.home-page .manual-tools {
  width: min(1220px, calc(100% - 120px));
  margin: 22px auto 4px;
  gap: 28px;
}

.home-page .manual-tools .card {
  min-height: 470px;
  padding: 24px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 0% 8%, rgba(231,76,60,0.07), transparent 30%),
    rgba(5,10,21,0.66);
  border-color: rgba(135,151,186,0.22);
}

.home-page .manual-tools .card:nth-child(2) {
  background:
    radial-gradient(circle at 0% 8%, rgba(139,92,246,0.1), transparent 30%),
    rgba(5,10,21,0.66);
}

.home-page .manual-card-head span {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.home-page .manual-card-head i {
  font-size: 20px;
}

.home-page .manual-card-head h3 {
  font-size: 20px;
}

.home-page .manual-card-head p {
  font-size: 14px;
}

.home-page label {
  color: rgba(245,247,255,0.88);
  font-size: 14px;
  font-weight: 650;
}

.home-page input[type="text"],
.home-page textarea,
.home-page select,
.home-page .input-icon {
  border-color: rgba(135,151,186,0.24);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025)),
    rgba(22,25,31,0.78);
  color: rgba(245,247,255,0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.home-page .input-icon,
.home-page select {
  height: 48px;
}

.home-page textarea {
  min-height: 124px;
}

.home-page input::placeholder,
.home-page textarea::placeholder {
  color: rgba(225,230,242,0.56);
}

.home-page .form-actions {
  margin-top: 18px;
}

.home-page .btn-primary {
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, #ff563f, #ff3d31);
  box-shadow: 0 10px 24px rgba(255,72,55,0.2);
}

.home-page .summary-item {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 10px;
  background:
    radial-gradient(circle at 88% 24%, rgba(117,104,255,0.12), transparent 26%),
    rgba(9,15,28,0.82);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.home-page .summary-item div {
  display: grid;
  gap: 10px;
}

.home-page .summary-item span,
.home-page .summary-item em {
  color: rgba(225,230,242,0.66);
  font-size: 15px;
  font-style: normal;
}

.home-page .summary-item b {
  color: #fff;
  font-size: 36px;
  line-height: 1;
}

.home-page .summary-item > i {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(119,104,255,0.2);
  color: #8d8cff;
  font-size: 18px;
}

.home-page .summary-item svg {
  width: 118px;
  height: 46px;
}

.footer-status {
  display: inline-flex;
  gap: 9px;
  align-items: center;
}

.footer-status span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #58d66d;
  box-shadow: 0 0 12px rgba(88,214,109,0.55);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 0%, rgba(96,76,176,0.22), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(231,76,60,0.16), transparent 30%),
    #05070d;
}

.login-shell {
  width: min(440px, calc(100vw - 32px));
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(135,151,186,0.2);
  border-radius: 16px;
  background: rgba(12,16,27,0.9);
  box-shadow: 0 24px 80px rgba(0,0,0,0.36);
}

.login-card h1 {
  margin-top: 12px;
  font-size: 28px;
}

.login-card p {
  color: rgba(225,230,242,0.66);
}

.login-card input {
  height: 44px;
}

.login-back-link {
  width: 100%;
  justify-content: center;
}

.login-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(231,76,60,0.14);
  color: #ff9b91;
  border: 1px solid rgba(231,76,60,0.24);
}

.admin-modal-content {
  width: min(1180px, calc(100vw - 40px));
  max-width: 1180px;
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 22px;
}

.admin-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, 0.92fr) minmax(520px, 1.35fr);
  gap: 18px;
}

.admin-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 12px;
  padding: 16px;
  background: rgba(10,14,24,0.58);
}

.admin-panel:nth-child(2) {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.admin-panel h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.admin-list,
.admin-access-projects {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
}

.admin-user-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}

.admin-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 154px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}

.admin-user-row .admin-user-main,
.admin-access-row span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.admin-user-row b,
.admin-access-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-row span,
.admin-access-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.admin-access-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.admin-access-main {
  min-width: 0;
}

.admin-access-main input,
.admin-edit-label input {
  flex: 0 0 auto;
}

.admin-access-main span {
  min-width: 0;
}

.admin-edit-label {
  justify-content: flex-start;
  white-space: nowrap;
  color: var(--muted);
}

.admin-edit-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-create-user {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(135,151,186,0.12);
}

.admin-create-user #admin-new-username,
.admin-create-user #admin-new-password,
.admin-create-user #admin-new-role,
.admin-create-user .btn {
  grid-column: 1 / -1;
}

.admin-create-user input,
.admin-create-user select {
  min-width: 0;
  height: 38px;
}

.admin-user-main {
  min-width: 0;
}

.admin-user-billing {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-user-billing > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid rgba(135,151,186,0.12);
  border-radius: 9px;
  background: rgba(255,255,255,0.025);
}

.admin-user-billing b,
.admin-user-billing em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-billing em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.admin-user-credentials {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(132px, auto);
  gap: 8px;
}

.admin-user-credentials input {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  padding: 0 10px;
}

.admin-user-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-billing-input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  padding: 0 10px;
}

.admin-billing-input {
  grid-column: span 1;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-panel-head h3 {
  margin: 0;
}

.admin-xml-panel {
  grid-column: 1 / -1;
}

.admin-xml-status {
  min-height: 108px;
}

.admin-xml-card {
  padding: 14px;
  border: 1px solid rgba(135,151,186,0.16);
  border-radius: 10px;
  background: rgba(8,12,22,0.46);
}

.admin-xml-card.ok {
  border-color: rgba(0,217,139,0.22);
}

.admin-xml-card.warn {
  border-color: rgba(255,193,7,0.30);
}

.admin-xml-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.admin-xml-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: #ffc107;
  box-shadow: 0 0 0 4px rgba(255,193,7,0.10);
}

.admin-xml-card.ok .admin-xml-dot {
  background: #00d98b;
  box-shadow: 0 0 0 4px rgba(0,217,139,0.10);
}

.admin-xml-top b,
.admin-xml-top em {
  display: block;
}

.admin-xml-top em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.admin-xml-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-xml-grid > div {
  padding: 10px;
  border: 1px solid rgba(135,151,186,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
}

.admin-xml-grid span,
.admin-xml-grid b {
  display: block;
}

.admin-xml-grid span {
  color: var(--muted);
  font-size: 11px;
}

.admin-xml-grid b {
  margin-top: 4px;
  font-size: 14px;
}

/* =========================
   Projects grid
========================= */

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto 20px auto;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 40px;
}

.project-folder {
  min-width: 0;
}

.folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.folder-header h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
}

.folder-header i {
  color: var(--accent);
}

.folder-header span,
.folder-pill {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.projects-grid-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.project-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.project-card-top > div {
  min-width: 0;
  padding-right: 110px;
}

.project-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.project-stats span {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
}

.project-stats b {
  color: var(--text);
  font-size: 16px;
}

.move-btn span {
  font-size: 12px;
}

.project-card:hover {
  border-color: var(--accent);
  background: #252525;
  box-shadow: 0 0 20px rgba(231, 76, 60, 0.10);
}

.project-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.project-card p {
  color: var(--muted2);
  font-size: 13px;
  margin-bottom: 12px;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #666;
}

.project-meta > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.project-meta .btn {
  min-height: 34px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  color: #404040;
}

/* =========================
   Modal
========================= */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--panel);
  padding: 30px;
  border-radius: 12px;
  max-width: 520px;
  width: 92%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.55);
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.close {
  font-size: 26px;
  font-weight: 300;
  cursor: pointer;
  background: none;
  border: none;
  color: #999;
  padding: 0;
  line-height: 1;
}

.close:hover {
  color: #fff;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
}

.frequency-refresh-modal.show {
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7, 10, 18, 0.56);
  z-index: 7000;
}

.frequency-refresh-content {
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.frequency-refresh-content .modal-header {
  align-items: flex-start;
  gap: 16px;
}

.frequency-refresh-content .modal-header h2 {
  margin-bottom: 6px;
}

.frequency-refresh-content .modal-header p {
  margin: 0;
  color: var(--text-secondary, var(--text-muted));
  line-height: 1.45;
}

.frequency-refresh-content .modal-close {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-default, rgba(135,151,186,0.2));
  border-radius: 10px;
  background: var(--surface-secondary, rgba(255,255,255,0.04));
  color: var(--text-secondary, var(--text-muted));
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.frequency-refresh-body {
  padding: 18px 0 4px;
}

.frequency-refresh-note {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border-default, rgba(135,151,186,0.2));
  border-radius: 12px;
  background: var(--surface-secondary, rgba(255,255,255,0.04));
}

.frequency-refresh-note i {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-primary, var(--accent)) 16%, transparent);
  color: var(--accent-primary, var(--accent));
}

.frequency-refresh-note b,
.frequency-refresh-note small {
  display: block;
}

.frequency-refresh-note small {
  margin-top: 4px;
  color: var(--text-secondary, var(--text-muted));
  line-height: 1.4;
}

/* =========================
   Results block
========================= */

.results {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  max-width: 900px;
  margin: 20px auto 40px auto;
  display: none;
}

.results.show {
  display: block;
}

.results-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
}

.result-item {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.result-keyword {
  font-weight: 700;
}

.result-position {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.position-top3 { background: rgba(76, 255, 76, 0.1); color: #4cff4c; }
.position-top10 { background: rgba(100, 200, 255, 0.1); color: #64c8ff; }
.position-top30 { background: rgba(255, 200, 0, 0.1); color: #ffc800; }
.position-top100 { background: rgba(255, 150, 0, 0.1); color: #ff9600; }
.position-not-found { background: rgba(255, 76, 76, 0.1); color: #ff4c4c; }

/* =========================
   Keywords table
========================= */

.keywords-table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
}

.keywords-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 600px;
}

.keywords-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  text-align: left;
}

.keywords-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.keywords-table tbody tr:hover {
  background: #1d1d1d;
}

/* =========================
   Project page only
========================= */

.project-page {
  background:
    radial-gradient(circle at 10% -10%, rgba(96,76,176,0.22), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(29,82,147,0.16), transparent 28%),
    #05070d;
}

.project-page .container {
  width: calc(100vw - 40px);
  max-width: none;
  margin-left: calc(50% - 50vw + 20px);
  margin-right: calc(50% - 50vw + 20px);
  padding: 0;
}

.project-page header {
  background: rgba(5,7,13,0.86);
  border-bottom: 1px solid rgba(135,151,186,0.16);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.project-page .header-content {
  min-height: 68px;
}

.project-page .logo {
  display: flex;
  gap: 10px;
  align-items: center;
}

.project-page .app-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(119,89,210,0.2);
  color: #c8b8ff;
  font-size: 12px;
  font-weight: 800;
}

.project-page .header-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

.project-page .account-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(135,151,186,0.32);
  border-radius: 999px;
  background: rgba(21,25,38,0.78);
  color: #f5f7ff;
  font-weight: 800;
  cursor: pointer;
}

.project-page .project-info {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 260px;
  gap: 28px;
  align-items: start;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(124,87,195,0.12), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.014)),
    rgba(14,17,28,0.92);
  border: 1px solid rgba(130,104,205,0.45);
  border-radius: 16px;
  padding: 26px;
  width: 100%;
  max-width: none;
  margin: 0 auto 14px auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.36);
}

.project-page .project-info h2{
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
}

.project-page .project-info p{
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0;
}

.project-page .project-info strong{
  color: var(--text);
  font-weight: 700;
}

.project-page .project-avatar {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(150,119,230,0.75);
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 20%, rgba(158,134,255,0.2), transparent 40%),
    rgba(35,31,54,0.74);
  color: rgba(255,255,255,0.72);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0;
}

.project-page .project-main {
  min-width: 0;
}

.project-page .project-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 6px;
}

.project-page .project-title-row h2 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-page .icon-btn,
.project-page .inline-edit {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
}

.project-page .inline-edit {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.58);
}

.project-page .icon-btn:hover,
.project-page .inline-edit:hover,
.project-page .schedule-days button.active {
  border-color: rgba(231,76,60,0.55);
  background: rgba(231,76,60,0.14);
}

.project-page .project-domain-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: rgba(220,226,240,0.78);
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 18px;
}

.project-page .project-domain-link:hover {
  color: #fff;
}

.project-page .project-meta-row,
.project-page .project-access-row,
.project-page .project-update-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  color: rgba(221,226,239,0.78);
  font-size: 13px;
  margin-top: 10px;
}

.project-page .project-meta-row b {
  color: #f7f8ff;
}

.project-page .project-meta-row i,
.project-page .project-update-row i {
  color: rgba(150,127,235,0.95);
}

.project-page .project-access-row {
  gap: 8px;
}

.project-page .access-pill {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
  color: rgba(231,236,248,0.78);
  font-size: 12px;
  font-weight: 700;
}

.project-page .access-off i {
  color: #ff7373;
}

.project-page .access-on {
  border-color: rgba(76,211,117,0.24);
  background: rgba(76,211,117,0.09);
}

.project-page .access-on i {
  color: #6be68c;
}

.project-page .access-muted i {
  color: #c1a0ff;
}

.project-page .project-update-row {
  color: rgba(221,226,239,0.62);
  margin-top: 16px;
}

.project-page .project-status-side {
  position: relative;
  min-height: 150px;
}

.project-page .tracking-status {
  position: relative;
  z-index: 2;
  float: right;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(61,139,82,0.22);
  color: #74e292;
  font-size: 13px;
  font-weight: 800;
}

.project-page .tracking-status.tracking-muted {
  background: rgba(255,255,255,0.06);
  color: rgba(231,236,248,0.64);
}

.project-page .hero-wave {
  position: absolute;
  right: -28px;
  bottom: 8px;
  width: 260px;
  height: 86px;
  opacity: 0.8;
  background:
    linear-gradient(180deg, rgba(145,85,223,0.2), transparent),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 260 86' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 51 C18 19 39 18 58 50 S98 82 124 45 166 15 190 45 222 75 260 20' fill='none' stroke='%23815ad8' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.project-page .btn-compact {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
}

.project-page .project-info-actions,
.project-page .schedule-save-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.project-page .project-info .project-info-actions {
  margin-top: 24px;
}

.project-page .schedule-panel {
  grid-column: 2 / 4;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.project-page .schedule-panel h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.project-page .access-settings {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  background: rgba(255,255,255,0.025);
}

.project-page .access-settings .form-group {
  margin: 0;
}

.project-page .access-settings input[type="text"] {
  width: min(360px, 100%);
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  padding: 0 10px;
}

.project-page .switch-row {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.project-page .schedule-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-page .schedule-days button {
  min-width: 38px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
  color: var(--text);
  cursor: pointer;
}

.project-page .schedule-save-row input[type="time"] {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  padding: 0 10px;
}

.project-page .schedule-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.project-page .schedule-panel.hidden,
.project-page .range-panel.hidden {
  display: none;
}

.project-page .project-actions {
  width: 100%;
  max-width: 50vw;
  margin: 0 auto 30px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.project-page .project-actions .btn {
  min-height: 44px;
  padding: 10px 16px;
}

.project-page .semantics-panel {
  width: 100%;
  max-width: 50vw;
  margin: 0 auto 30px auto;
}

.project-page .hidden {
  display: none;
}

.project-page .loading {
  display: none;
  text-align: center;
  padding: 18px;
  width: 100%;
  max-width: 50vw;
  margin: 0 auto 20px auto;
}

.project-page .loading.show {
  display: block;
}

.project-page .spinner {
  border: 3px solid rgba(255,255,255,0.08);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}

.project-page .progress-wrap {
  width: min(420px, 100%);
  height: 10px;
  margin: 14px auto 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}

.project-page .progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff8a65);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.project-page .progress-meta {
  color: var(--muted);
  font-size: 13px;
}

/* =========================
   Matrix section
========================= */

.project-page .matrix-section {
  width: 100%;
  margin-top: 40px;
  padding: 0 20px 40px;
}

.project-page .matrix-section .section-title {
  max-width: none;
  margin: 0 0 18px 0;
}

.project-page .matrix-card {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.06);
  background:
    radial-gradient(circle at top left, rgba(231,76,60,0.05), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.01)),
    var(--matrix-bg);
  box-shadow:
    0 18px 50px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.03);
}

.project-page .matrix-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
}

.project-page .matrix-search-wrap {
  flex: 1 1 260px;
  min-width: 220px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 9px;
  background: rgba(8,11,20,0.58);
  color: rgba(225,230,242,0.58);
}

.project-page .matrix-search-wrap i {
  font-size: 13px;
}

.project-page .matrix-search-wrap .matrix-search {
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.project-page .matrix-toolbar .form-group {
  margin: 0;
}

.project-page .matrix-toolbar label {
  display: none;
}

.project-page .matrix-toolbar select,
.project-page .matrix-toolbar input[type="number"],
.project-page .matrix-toolbar .btn,
.project-page .matrix-filter-count {
  height: 42px;
  min-height: 42px;
  border-radius: 9px;
  border: 1px solid rgba(135,151,186,0.18);
  background: rgba(12,15,26,0.72);
  color: rgba(245,247,255,0.88);
  font-size: 13px;
}

.project-page .matrix-toolbar select,
.project-page .matrix-toolbar input[type="number"] {
  max-width: 150px;
  padding: 0 12px;
}

.project-page .matrix-toolbar .btn {
  padding: 0 14px;
}

.project-page .compare-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.project-page .compare-panel .form-group {
  margin-bottom: 0;
}

.project-page .range-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  background: rgba(22,32,50,0.82);
}

.project-page .range-panel .form-group {
  margin-bottom: 0;
  min-width: 160px;
}

.project-page .range-panel input[type="date"] {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  padding: 0 10px;
}

.project-page .range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-page .range-presets button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 8px;
  background: rgba(9,15,25,0.7);
  color: rgba(245,247,255,0.86);
  cursor: pointer;
}

.project-page .range-presets button:hover,
.project-page .range-presets button.active {
  border-color: rgba(231,76,60,0.45);
  background: rgba(231,76,60,0.12);
}

.project-page .range-calendar-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
}

.project-page .range-calendar {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.project-page .calendar-month-title {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
}

.project-page .calendar-month-title span {
  color: rgba(225,230,242,0.62);
  margin-left: 8px;
}

.project-page .calendar-weekdays,
.project-page .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.project-page .calendar-weekdays {
  color: rgba(225,230,242,0.62);
  font-size: 12px;
  margin-bottom: 6px;
}

.project-page .calendar-day {
  position: relative;
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.project-page .calendar-day.muted {
  cursor: default;
}

.project-page .calendar-day.has-check i,
.project-page .dot-check {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3c9cff;
}

.project-page .calendar-day.has-check i {
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
}

.project-page .calendar-day.selected {
  background: rgba(60,156,255,0.22);
  color: #fff;
}

.project-page .range-side {
  display: grid;
  gap: 14px;
  align-content: start;
  border-left: 1px solid rgba(255,255,255,0.08);
  padding-left: 16px;
}

.project-page .range-legend {
  display: flex;
  gap: 16px;
  color: rgba(255,255,255,0.82);
  font-size: 13px;
}

.project-page .range-legend span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.project-page .compare-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 40px;
}

.project-page .compare-summary span {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}

.project-page .matrix-search {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: #fff;
  margin-bottom: 10px;
  font-size: 14px;
}

.project-page .matrix-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.project-page .matrix-filters .form-group {
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.project-page .matrix-filters label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  margin: 0;
  white-space: nowrap;
}

.project-page .matrix-filters select,
.project-page .matrix-filters input {
  height: 34px;
  max-width: 150px;
  border-radius: 8px;
  font-size: 12px;
  padding: 0 9px;
}

.project-page .matrix-filters .btn {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.project-page .matrix-filter-count {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.035);
  border-radius: 8px;
  padding: 0 12px;
  white-space: nowrap;
}

.project-page .matrix-search::placeholder {
  color: rgba(255,255,255,0.45);
}

.project-page .matrix-search:focus {
  outline: none;
  border-color: rgba(231,76,60,0.45);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.08);
}

.project-page .matrix-shell {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--matrix-line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0)),
    var(--matrix-bg-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.project-page .matrix-table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  font-size: 13px;
}

.project-page .matrix-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

.project-page .matrix-table thead th.sortable::after {
  content: '⇅';
  font-size: 11px;
  margin-left: 8px;
  opacity: 0.35;
}

.project-page .matrix-table thead th.sort-asc::after {
  content: '↑';
  opacity: 0.95;
  color: #72ffb2;
}

.project-page .matrix-table thead th.sort-desc::after {
  content: '↓';
  opacity: 0.95;
  color: #ff8c8c;
}

.project-page .matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 9;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015)),
    #0f1018;
  padding: 14px 12px;
  border-right: 1px solid var(--matrix-line);
  border-bottom: 1px solid var(--matrix-line);
  text-align: center;
  font-weight: 700;
  color: rgba(226,232,246,0.72);
  white-space: nowrap;
}

.project-page .matrix-table thead th span {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.055);
  color: rgba(226,232,246,0.58);
  font-size: 11px;
}

.project-page .matrix-table thead th.keyword-col {
  left: 0;
  z-index: 11;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    #11131d;
}

.project-page .matrix-table tbody td {
  padding: 13px 12px;
  border-right: 1px solid var(--matrix-line-soft);
  border-bottom: 1px solid var(--matrix-line-soft);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.008), rgba(255,255,255,0)),
    #0c0d15;
  transition: background .18s ease, box-shadow .18s ease;
}

.project-page .matrix-table tbody tr:nth-child(odd) td {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0)),
    #0d0f18;
}

.project-page .matrix-table tbody tr:hover td {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005)),
    #121522;
}

.project-page .keyword-col {
  position: sticky;
  left: 48px;
  z-index: 8;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    #10121b !important;
  box-shadow:
    14px 0 24px rgba(0,0,0,0.24),
    1px 0 0 rgba(255,255,255,0.03);
}

.project-page .select-col {
  width: 48px;
  min-width: 48px;
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 10;
  background: #10121b !important;
}

.project-page .matrix-keyword {
  display: inline;
  line-height: 1.3;
  font-weight: 750;
  color: #f3f3f3;
}

.project-page .matrix-pos {
  position: relative;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  min-width: 132px;
  letter-spacing: -0.02em;
  color: #d7d7d7;
  text-shadow: 0 0 10px rgba(255,255,255,0.05);
}

.project-page .matrix-pos.pos-good {
  color: #72ffb2;
  text-shadow:
    0 0 6px rgba(114,255,178,0.95),
    0 0 18px rgba(114,255,178,0.25);
}

.project-page .matrix-pos.pos-mid {
  color: #ffd86a;
  text-shadow:
    0 0 6px rgba(255,216,106,0.95),
    0 0 18px rgba(255,216,106,0.22);
}

.project-page .matrix-pos.pos-bad {
  color: #ff7878;
  text-shadow:
    0 0 6px rgba(255,120,120,0.95),
    0 0 18px rgba(255,120,120,0.24);
}

.project-page .matrix-pos.pos-neutral {
  color: #d0d0d0;
  text-shadow: none;
}

.project-page .delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  vertical-align: middle;
}

.project-page .delta-up {
  color: #79ffb7;
  background: rgba(40,255,140,0.09);
  border: 1px solid rgba(40,255,140,0.12);
}

.project-page .delta-down {
  color: #ff9a9a;
  background: rgba(255,70,70,0.09);
  border: 1px solid rgba(255,70,70,0.12);
}

.project-page .delta-same {
  color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
}

.project-page .matrix-empty {
  padding: 18px 6px;
  font-size: 14px;
  color: rgba(255,255,255,0.64);
}

.project-page .matrix-shell::-webkit-scrollbar,
.project-page .keywords-table-wrapper::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}

.project-page .matrix-shell::-webkit-scrollbar-track,
.project-page .keywords-table-wrapper::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.02);
  border-radius: 20px;
}

.project-page .matrix-shell::-webkit-scrollbar-thumb,
.project-page .keywords-table-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(231,76,60,0.45), rgba(192,57,43,0.28));
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.project-page .matrix-shell::-webkit-scrollbar-thumb:hover,
.project-page .keywords-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(231,76,60,0.56), rgba(192,57,43,0.36));
  background-clip: padding-box;
}

@media (max-width: 768px) {
  .project-page .matrix-section {
    padding: 0 10px 30px;
  }

  .project-page .matrix-table thead th.sticky-col,
  .project-page .matrix-table tbody td.sticky-col,
  .project-page .matrix-keyword {
    width: 20ch;
    min-width: 20ch;
    max-width: 20ch;
  }

  .project-page .matrix-pos {
    font-size: 22px;
    min-width: 102px;
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.project-page .sticky-col {
  position: sticky;
  left: 0;
  z-index: 8;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    #10121b !important;
  box-shadow:
    14px 0 24px rgba(0,0,0,0.24),
    1px 0 0 rgba(255,255,255,0.03);
}

.project-page .matrix-table tbody td.sticky-col {
  z-index: 7;
}

.project-page .matrix-keyword {
  width: 25ch;
  max-width: 25ch;
  min-width: 25ch;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.38;
  font-weight: 650;
  color: #f3f3f3;
}

.project-page .matrix-frequency-head,
.project-page .matrix-frequency {
  min-width: 128px;
  width: 128px;
  text-align: center;
}

.project-page .matrix-frequency-head {
  line-height: 1.25;
}

.project-page .matrix-frequency-head span {
  display: block;
}

.project-page .mini-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin-top: 5px;
  padding: 3px 8px;
  border: 1px solid rgba(231,76,60,0.45);
  border-radius: 7px;
  background: rgba(231,76,60,0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.project-page .mini-action:hover {
  background: rgba(231,76,60,0.22);
}

.project-page .matrix-frequency {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 750;
  color: #f2f2f2;
}

.project-page .star-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  border: 0;
  background: transparent;
  color: rgba(225,230,242,0.48);
  cursor: pointer;
}

.project-page .star-btn:hover {
  color: #ffd86a;
}

.project-page .group-label {
  color: rgba(225,230,242,0.82);
  font-weight: 650;
}

.project-page .intent-badge,
.project-page .rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  color: #fff;
  font-weight: 850;
}

.project-page .intent-nav {
  background: rgba(127,93,207,0.48);
}

.project-page .intent-info {
  background: rgba(38,151,170,0.48);
}

.project-page .intent-commercial {
  background: rgba(199,125,38,0.52);
}

.project-page .rank-badge.pos-good {
  background: rgba(56,145,50,0.46);
  color: #9af58b;
}

.project-page .rank-badge.pos-top10 {
  background: rgba(122,164,45,0.48);
  color: #d9ff91;
}

.project-page .rank-badge.pos-mid {
  background: rgba(165,117,24,0.5);
  color: #ffd86a;
}

.project-page .rank-badge.pos-bad {
  background: rgba(154,48,54,0.52);
  color: #ff8f8f;
}

.project-page .rank-badge.pos-neutral {
  background: rgba(255,255,255,0.06);
  color: rgba(225,230,242,0.64);
}

.project-page .rank-change {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-weight: 850;
  font-size: 12px;
}

.project-page .change-up {
  color: #68de81;
}

.project-page .change-down {
  color: #ff6868;
}

.project-page .change-muted {
  color: rgba(225,230,242,0.48);
}

.project-page .url-action {
  color: rgba(225,230,242,0.82);
}

.project-page .url-action:hover {
  color: #fff;
}

.project-page .matrix-pos-cell {
  min-width: 112px;
  text-align: center;
  white-space: nowrap;
}

.project-page .matrix-pos {
  position: relative;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  min-width: 132px;
  letter-spacing: -0.02em;
  color: #d7d7d7;
  text-shadow: 0 0 10px rgba(255,255,255,0.05);
}

.project-page .matrix-pos.pos-good {
  color: #72ffb2;
  text-shadow:
    0 0 6px rgba(114,255,178,0.95),
    0 0 18px rgba(114,255,178,0.25);
}

.project-page .matrix-pos.pos-mid {
  color: #ffd86a;
  text-shadow:
    0 0 6px rgba(255,216,106,0.95),
    0 0 18px rgba(255,216,106,0.22);
}

.project-page .matrix-pos.pos-bad {
  color: #ff7878;
  text-shadow:
    0 0 6px rgba(255,120,120,0.95),
    0 0 18px rgba(255,120,120,0.24);
}

.project-page .matrix-pos.pos-neutral {
  color: #d0d0d0;
  text-shadow: none;
}

.project-page .delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  vertical-align: middle;
}

.project-page .delta-up {
  color: #79ffb7;
  background: rgba(40,255,140,0.09);
  border: 1px solid rgba(40,255,140,0.12);
}

.project-page .delta-down {
  color: #ff9a9a;
  background: rgba(255,70,70,0.09);
  border: 1px solid rgba(255,70,70,0.12);
}

.project-page .delta-same {
  color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
}

.project-page .matrix-empty {
  padding: 18px 6px;
  font-size: 14px;
  color: rgba(255,255,255,0.64);
}

.project-page .matrix-shell::-webkit-scrollbar,
.project-page .keywords-table-wrapper::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}

.project-page .matrix-shell::-webkit-scrollbar-track,
.project-page .keywords-table-wrapper::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.02);
  border-radius: 20px;
}

.project-page .matrix-shell::-webkit-scrollbar-thumb,
.project-page .keywords-table-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(231,76,60,0.45), rgba(192,57,43,0.28));
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.project-page .matrix-shell::-webkit-scrollbar-thumb:hover,
.project-page .keywords-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(231,76,60,0.56), rgba(192,57,43,0.36));
  background-clip: padding-box;
}

/* =========================
   Prime final overrides
========================= */

.home-page header,
.project-page header {
  position: relative;
  top: auto;
  margin: 8px 8px 28px;
  padding: 0;
  border: 1px solid rgba(135,151,186,0.18);
  border-radius: 12px;
  background:
    radial-gradient(circle at 4% 25%, rgba(231,76,60,0.07), transparent 24%),
    linear-gradient(120deg, rgba(9,14,25,0.96), rgba(7,11,20,0.94));
  box-shadow: 0 18px 60px rgba(0,0,0,0.26);
  backdrop-filter: blur(18px);
}

.home-page header .container,
.project-page header .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 22px;
}

.home-page .header-content,
.project-page .header-content {
  min-height: 164px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, 690px);
  gap: 24px;
  align-items: center;
}

.home-page .logo,
.project-page .logo {
  font-size: 28px;
  gap: 14px;
}

.home-page .logo i,
.project-page .logo i {
  font-size: 34px;
}

.home-page .app-badge,
.project-page .app-badge {
  height: 31px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 16px;
}

.home-page .header-tools,
.project-page .header-tools {
  width: 100%;
  justify-content: flex-end;
}

.home-page .account-console,
.project-page .account-console {
  width: min(100%, 690px);
}

.home-page .account-console-pill,
.project-page .account-console-pill {
  width: 86px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 12px;
}

.account-console.no-settings .account-console-top {
  grid-template-columns: 98px minmax(112px, 1fr) minmax(230px, 1.3fr);
}

.account-console.no-settings .account-console-billing {
  border-right: 0;
  padding-right: 0;
}

.home-page .account-settings-btn,
.project-page .account-settings-btn {
  width: 50px;
  height: 50px;
  min-width: 50px;
}

.project-page .container {
  width: calc(100vw - 40px);
}

/* =========================
   Light theme
========================= */

body.theme-light {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel2: #f6f8fb;
  --border: #d9e2ec;
  --border2: #c6d3df;
  --text: #152033;
  --muted: #617086;
  --muted2: #76849a;
  --accent: #d94b3b;
  --accent2: #b93c2f;
  --matrix-bg: #f8fbff;
  --matrix-bg-2: #eef5fb;
  --matrix-bg-3: #e7f0f8;
  --matrix-line: rgba(31,49,72,0.09);
  --matrix-line-soft: rgba(31,49,72,0.055);
  background: var(--bg);
}

body.theme-light.home-page,
body.theme-light.project-page {
  background:
    radial-gradient(circle at 12% -8%, rgba(74,116,168,0.11), transparent 30%),
    radial-gradient(circle at 92% 4%, rgba(217,75,59,0.08), transparent 28%),
    #f8fafc;
}

body.theme-light header,
body.theme-light.home-page header,
body.theme-light.project-page header {
  background:
    radial-gradient(circle at 4% 25%, rgba(217,75,59,0.035), transparent 24%),
    rgba(255,255,255,0.96);
  border-color: rgba(86,112,143,0.16);
  box-shadow: 0 12px 34px rgba(35,55,82,0.1);
}

body.theme-light .app-badge {
  background: rgba(43,107,163,0.12);
  color: #2d638f;
}

body.theme-light .icon-btn,
body.theme-light .account-pill,
body.theme-light.project-page .icon-btn,
body.theme-light.project-page .account-pill,
body.theme-light.project-page .inline-edit {
  background: rgba(255,255,255,0.82);
  border-color: rgba(85,111,142,0.24);
  color: var(--text);
}

body.theme-light .account-console-top {
  background: rgba(255,255,255,0.78);
  border-color: rgba(86,112,143,0.15);
  box-shadow: 0 10px 28px rgba(35,55,82,0.06);
}

body.theme-light .account-console-pill {
  background: rgba(255,255,255,0.92);
  border-color: rgba(86,112,143,0.15);
}

body.theme-light .account-console-pill span {
  background: #f1f5f9;
}

body.theme-light .account-identity,
body.theme-light .account-console-billing {
  border-right-color: rgba(86,112,143,0.14);
}

body.theme-light .account-identity b,
body.theme-light .account-console-billing b {
  color: #101828;
}

body.theme-light .account-identity span,
body.theme-light .account-console-billing > div {
  color: #667085;
}

body.theme-light .account-action {
  background: rgba(255,255,255,0.84);
  border-color: rgba(86,112,143,0.18);
  color: #344054;
  box-shadow: 0 8px 22px rgba(35,55,82,0.05);
}

body.theme-light .account-action-telegram {
  border-color: rgba(124,87,195,0.48);
  background: rgba(255,255,255,0.9);
  color: #7142c7;
}

body.theme-light .account-action-phone {
  border-color: rgba(37,99,235,0.42);
  background: rgba(255,255,255,0.9);
  color: #2563eb;
}

body.theme-light .account-action-logout {
  border-color: rgba(255,75,62,0.48);
  color: #ef3f31;
}

body.theme-light .account-action-theme i:first-child {
  color: #344054;
}

body.theme-light .account-action-theme i:nth-child(2) {
  color: #667085;
}

body.theme-light .account-menu {
  background: rgba(255,255,255,0.98);
  border-color: rgba(85,111,142,0.22);
  box-shadow: 0 24px 70px rgba(35,55,82,0.16);
}

body.theme-light .account-billing > div,
body.theme-light .admin-panel,
body.theme-light .admin-user-row,
body.theme-light .admin-access-row,
body.theme-light .admin-user-billing > div,
body.theme-light .home-panel,
body.theme-light .home-page .project-folder,
body.theme-light .home-page .project-card,
body.theme-light .card {
  background: rgba(255,255,255,0.86);
  border-color: rgba(85,111,142,0.18);
  box-shadow: 0 18px 44px rgba(35,55,82,0.08);
}

body.theme-light .home-panel {
  background: rgba(255,255,255,0.92);
  border-color: rgba(86,112,143,0.16);
  box-shadow: 0 18px 48px rgba(35,55,82,0.08);
}

body.theme-light .home-page .manual-tools .card,
body.theme-light .home-page .manual-tools .card:nth-child(2) {
  background: rgba(255,255,255,0.72);
  border-color: rgba(86,112,143,0.16);
  box-shadow: 0 12px 32px rgba(35,55,82,0.06);
}

body.theme-light .home-page .manual-card-head span {
  background: rgba(255,75,62,0.08);
}

body.theme-light .home-page .manual-card:nth-child(2) .manual-card-head span {
  background: rgba(139,92,246,0.1);
}

body.theme-light .home-section-head p,
body.theme-light .home-page .manual-card-head p,
body.theme-light .home-page .summary-item span,
body.theme-light .home-page .summary-item em {
  color: #667085;
}

body.theme-light .home-page label {
  color: #101828;
}

body.theme-light .btn {
  background: #ffffff;
  border-color: rgba(85,111,142,0.24);
  color: var(--text);
}

body.theme-light .btn:hover,
body.theme-light .account-menu a:hover,
body.theme-light .account-menu button:hover {
  background: #eef5fb;
}

body.theme-light .btn-primary,
body.theme-light .btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

body.theme-light input[type="text"],
body.theme-light input[type="number"],
body.theme-light input[type="date"],
body.theme-light select,
body.theme-light textarea,
body.theme-light .admin-billing-input,
body.theme-light .input-icon,
body.theme-light .home-project-toolbar .matrix-search-wrap,
body.theme-light.project-page .matrix-search-wrap,
body.theme-light.project-page .matrix-toolbar select,
body.theme-light.project-page .matrix-toolbar input[type="number"],
body.theme-light.project-page .matrix-filter-count {
  background: rgba(255,255,255,0.96);
  border-color: rgba(85,111,142,0.16);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(16,24,40,0.03);
}

body.theme-light .home-page input::placeholder,
body.theme-light .home-page textarea::placeholder {
  color: #7d8899;
}

body.theme-light .home-page .summary-item {
  background: rgba(255,255,255,0.88);
  border-color: rgba(86,112,143,0.16);
}

body.theme-light .home-page .summary-item b {
  color: #0f172a;
}

body.theme-light .home-page .summary-item > i {
  background: rgba(139,92,246,0.1);
  color: #6d5dfc;
}

body.theme-light.home-page .home-panel {
  background: rgba(255,255,255,0.92);
  border-color: rgba(86,112,143,0.16);
  box-shadow: 0 18px 48px rgba(35,55,82,0.08);
}

body.theme-light.home-page .manual-tools .card,
body.theme-light.home-page .manual-tools .card:nth-child(2),
body.theme-light.home-page .project-folder,
body.theme-light.home-page .project-card {
  background: rgba(255,255,255,0.82);
  border-color: rgba(86,112,143,0.16);
  box-shadow: 0 12px 32px rgba(35,55,82,0.06);
}

body.theme-light.home-page .manual-card-head span {
  background: rgba(255,75,62,0.08);
}

body.theme-light.home-page .manual-card:nth-child(2) .manual-card-head span {
  background: rgba(139,92,246,0.1);
}

body.theme-light.home-page .home-section-head p,
body.theme-light.home-page .manual-card-head p,
body.theme-light.home-page .summary-item span,
body.theme-light.home-page .summary-item em,
body.theme-light.home-page .project-card p,
body.theme-light.home-page .folder-header span {
  color: #667085;
}

body.theme-light.home-page label,
body.theme-light.home-page .manual-card-head h3,
body.theme-light.home-page .project-card h3,
body.theme-light.home-page .folder-header h3 {
  color: #101828;
}

body.theme-light.home-page input[type="text"],
body.theme-light.home-page textarea,
body.theme-light.home-page select,
body.theme-light.home-page .input-icon,
body.theme-light.home-page .home-project-toolbar .matrix-search-wrap {
  background: rgba(255,255,255,0.96);
  border-color: rgba(86,112,143,0.16);
  color: #101828;
}

body.theme-light.home-page input::placeholder,
body.theme-light.home-page textarea::placeholder {
  color: #7d8899;
}

body.theme-light.home-page .summary-item {
  background: rgba(255,255,255,0.88);
  border-color: rgba(86,112,143,0.16);
}

body.theme-light.home-page .summary-item b,
body.theme-light.home-page .project-stats b {
  color: #0f172a;
}

body.theme-light.home-page .summary-item > i {
  background: rgba(139,92,246,0.1);
  color: #6d5dfc;
}

body.theme-light.home-page .project-stats span,
body.theme-light.home-page .folder-pill {
  background: rgba(241,245,249,0.84);
  border-color: rgba(86,112,143,0.12);
  color: #667085;
}

.modal .admin-modal-content {
  width: min(1180px, calc(100vw - 40px));
  max-width: 1180px;
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

body.theme-light .admin-modal-content {
  background: rgba(255,255,255,0.96);
  border-color: rgba(86,112,143,0.16);
}

body.theme-light .admin-access-row,
body.theme-light .admin-user-row {
  background: rgba(248,250,252,0.82);
  border-color: rgba(86,112,143,0.14);
}

body.theme-light .admin-user-billing > div {
  background: rgba(255,255,255,0.86);
  border-color: rgba(86,112,143,0.14);
}

body.theme-light .admin-user-credentials input {
  background: rgba(255,255,255,0.96);
  border-color: rgba(86,112,143,0.16);
  color: #101828;
}

body.theme-light .admin-create-user {
  border-top-color: rgba(86,112,143,0.14);
}

body.theme-light .home-footer,
body.theme-light .login-card p {
  color: rgba(49,67,92,0.72);
}

body.theme-light.project-page .project-info {
  background:
    linear-gradient(135deg, rgba(56,117,170,0.12), transparent 36%),
    rgba(255,255,255,0.76);
  border-color: rgba(74,116,168,0.24);
  box-shadow: 0 24px 70px rgba(35,55,82,0.12);
}

body.theme-light.project-page .project-avatar {
  background:
    radial-gradient(circle at 30% 20%, rgba(56,117,170,0.18), transparent 42%),
    rgba(255,255,255,0.7);
  border-color: rgba(56,117,170,0.34);
  color: rgba(21,32,51,0.72);
}

body.theme-light.project-page .matrix-card {
  background:
    radial-gradient(circle at top left, rgba(217,75,59,0.05), transparent 24%),
    var(--matrix-bg);
  border-color: rgba(85,111,142,0.16);
  box-shadow: 0 20px 54px rgba(35,55,82,0.1);
}

body.theme-light.project-page .matrix-table th,
body.theme-light.project-page .matrix-table td,
body.theme-light .keywords-table thead th,
body.theme-light .keywords-table tbody td {
  border-color: rgba(85,111,142,0.13);
}

body.theme-light.project-page .sticky-col {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(247,251,255,0.92)),
    #f7fbff !important;
  box-shadow:
    14px 0 24px rgba(35,55,82,0.1),
    1px 0 0 rgba(85,111,142,0.14);
}

body.theme-light.project-page .matrix-keyword,
body.theme-light.project-page .matrix-frequency,
body.theme-light.project-page .matrix-pos.pos-neutral,
body.theme-light .result-keyword {
  color: var(--text);
}

body.theme-light.project-page .matrix-empty {
  color: rgba(49,67,92,0.72);
}

/* =========================
   Retro olive theme
========================= */

.project-table-shell {
  overflow: auto;
  border: 1px solid rgba(150,158,63,0.26);
  border-radius: 8px;
  background: #f2eed7;
}

.project-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  color: #11140c;
}

.project-table th {
  height: 44px;
  padding: 0 16px;
  border-right: 1px solid rgba(68,76,25,0.24);
  background: linear-gradient(180deg, #d9dfa4, #c6cc80);
  color: #1a210b;
  font-size: 12px;
  text-transform: uppercase;
  text-align: left;
}

.project-table td {
  height: 52px;
  padding: 8px 16px;
  border-right: 1px solid rgba(68,76,25,0.16);
  border-bottom: 1px solid rgba(68,76,25,0.13);
  background: rgba(252,248,224,0.92);
  font-size: 14px;
}

.project-table tbody tr {
  cursor: pointer;
}

.project-table tbody tr:nth-child(even) td {
  background: rgba(246,241,211,0.94);
}

.project-table tbody tr:hover td {
  background: #fff6cc;
}

.project-table a,
.matrix-site-cell a {
  color: #1356b8;
  text-decoration: none;
}

.project-row-index {
  width: 52px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.project-table-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-table-name > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d9d6ba;
  color: #2b3118;
  font-weight: 800;
}

.project-table-name b,
.project-table-name em {
  display: block;
}

.project-table-name em {
  color: #4d5337;
  font-size: 12px;
  font-style: normal;
}

.project-position-badge {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 7px;
  background: #efe29b;
  color: #19200b;
  font-weight: 800;
}

.project-table-actions {
  display: flex;
  gap: 8px;
}

.project-table-actions .icon-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 7px;
  background: rgba(255,255,255,0.52);
  border-color: rgba(68,76,25,0.18);
  color: #202513;
}

.project-page .matrix-positions-cell {
  min-width: 230px;
}

.project-page .matrix-history {
  display: inline-flex;
  gap: 6px;
  margin-left: 10px;
  vertical-align: middle;
}

.project-page .history-chip {
  min-width: 26px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: rgba(225,230,242,0.74);
  font-size: 12px;
  font-weight: 750;
}

.matrix-sort-head {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.matrix-sort-head > span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 850;
}

.matrix-sort-head em {
  min-width: 24px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: inherit;
  font-size: 11px;
  font-style: normal;
}

.matrix-sort-head select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(179,186,84,0.24);
  border-radius: 7px;
  background: rgba(9,13,8,0.78);
  color: #f5f1cf;
  font-size: 12px;
  outline: none;
}

.project-index {
  width: 48px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #3f4528;
}

.project-name-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.project-name-cell b {
  display: block;
  max-width: 24ch;
  color: #15170f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-name-cell small {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 3px;
  color: #596039;
  font-size: 12px;
}

.project-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #e3dfbd, #cfc99d);
  color: #2b3118;
  font-weight: 850;
}

.avg-position {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 7px;
  background: #efe29b;
  color: #19200b;
  font-weight: 850;
}

.project-table-footer {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid rgba(68,76,25,0.18);
  color: #4a5031;
  background: #f7f0c9;
  font-size: 13px;
}

.project-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-pagination strong {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(180deg, #9bab28, #637019);
  color: #fffbd3;
}

.project-pagination .icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body.theme-light {
  --bg: #0b0f09;
  --panel: #151a10;
  --panel2: #10150d;
  --border: rgba(179,186,84,0.22);
  --border2: rgba(179,186,84,0.28);
  --text: #f5f1cf;
  --muted: #c0ba8a;
  --muted2: #9c966e;
  --accent: #b6c632;
  --accent2: #88951f;
  --matrix-bg: #11170e;
  --matrix-bg-2: #0d120b;
  --matrix-bg-3: #1d2412;
  --matrix-line: rgba(95,101,44,0.34);
  --matrix-line-soft: rgba(95,101,44,0.18);
}

body.theme-light.home-page,
body.theme-light.project-page {
  background:
    radial-gradient(circle at 12% 12%, rgba(183,198,50,0.12), transparent 22%),
    radial-gradient(circle at 80% 4%, rgba(218,196,76,0.08), transparent 26%),
    linear-gradient(180deg, #10150c, #050805);
  color: var(--text);
}

body.theme-light header,
body.theme-light.home-page header,
body.theme-light.project-page header,
body.theme-light .home-panel,
body.theme-light.project-page .project-info,
body.theme-light.project-page .matrix-card,
body.theme-light .account-console-top,
body.theme-light .summary-item,
body.theme-light.home-page .summary-item,
body.theme-light.home-page .home-panel {
  border-color: rgba(179,186,84,0.24);
  background:
    radial-gradient(circle at 0% 0%, rgba(204,218,62,0.08), transparent 30%),
    linear-gradient(180deg, rgba(31,38,20,0.92), rgba(12,17,11,0.94));
  box-shadow:
    inset 0 1px 0 rgba(255,255,208,0.08),
    0 18px 50px rgba(0,0,0,0.32);
}

body.theme-light .logo a,
body.theme-light .account-identity b,
body.theme-light .account-console-billing b,
body.theme-light .home-page .summary-item b,
body.theme-light.home-page .summary-item b,
body.theme-light.project-page .project-info strong,
body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light label,
body.theme-light .section-title,
body.theme-light.home-page label,
body.theme-light.home-page .manual-card-head h3,
body.theme-light.home-page .project-card h3,
body.theme-light.home-page .folder-header h3 {
  color: #fff9d7;
}

body.theme-light .app-badge,
body.theme-light .account-console-pill span,
body.theme-light .home-page .manual-card-head span,
body.theme-light.home-page .manual-card-head span,
body.theme-light.project-page .project-avatar {
  border: 1px solid rgba(183,198,50,0.42);
  background: linear-gradient(180deg, rgba(180,197,48,0.18), rgba(82,92,21,0.22));
  color: #f4f0a8;
  box-shadow: 0 0 18px rgba(177,197,48,0.16);
}

body.theme-light .account-action,
body.theme-light .btn,
body.theme-light .icon-btn,
body.theme-light .account-pill,
body.theme-light.project-page .icon-btn,
body.theme-light.project-page .inline-edit {
  border-color: rgba(179,186,84,0.26);
  background: linear-gradient(180deg, rgba(37,44,22,0.84), rgba(13,18,10,0.9));
  color: #f5f1cf;
}

body.theme-light .btn-primary,
body.theme-light .btn.active,
body.theme-light.home-page .btn-primary {
  border-color: rgba(204,218,62,0.48);
  background: linear-gradient(180deg, #7d8b20, #48540f);
  color: #fffbd3;
  box-shadow: 0 0 22px rgba(181,198,48,0.18);
}

body.theme-light .account-action-telegram,
body.theme-light .account-action-phone {
  color: #f5f1cf;
}

body.theme-light input[type="text"],
body.theme-light input[type="number"],
body.theme-light input[type="date"],
body.theme-light select,
body.theme-light textarea,
body.theme-light .input-icon,
body.theme-light.home-page input[type="text"],
body.theme-light.home-page textarea,
body.theme-light.home-page select,
body.theme-light.home-page .input-icon,
body.theme-light.project-page .matrix-search-wrap,
body.theme-light.project-page .matrix-toolbar select,
body.theme-light.project-page .matrix-toolbar input[type="number"] {
  background: rgba(9,13,8,0.84);
  border-color: rgba(179,186,84,0.26);
  color: #f5f1cf;
}

body.theme-light input::placeholder,
body.theme-light textarea::placeholder,
body.theme-light.home-page input::placeholder,
body.theme-light.home-page textarea::placeholder {
  color: rgba(222,216,156,0.56);
}

body.theme-light.home-page .manual-tools .card,
body.theme-light.home-page .manual-tools .card:nth-child(2),
body.theme-light.home-page .project-folder,
body.theme-light.home-page .project-card,
body.theme-light .card {
  border-color: rgba(179,186,84,0.22);
  background:
    radial-gradient(circle at 0% 0%, rgba(204,218,62,0.06), transparent 28%),
    linear-gradient(180deg, rgba(18,24,14,0.94), rgba(8,12,7,0.94));
  box-shadow: inset 0 1px 0 rgba(255,255,208,0.05);
}

body.theme-light.home-page .home-section-head p,
body.theme-light.home-page .manual-card-head p,
body.theme-light .account-identity span,
body.theme-light .account-console-billing > div,
body.theme-light.project-page .project-info p {
  color: #c0ba8a;
}

body.theme-light .home-stats {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

body.theme-light .summary-item,
body.theme-light.home-page .summary-item {
  min-height: 76px;
  padding: 16px 18px;
}

body.theme-light .summary-item > i,
body.theme-light.home-page .summary-item > i {
  color: #b8ca33;
  background: rgba(177,197,48,0.14);
}

body.theme-light .summary-item span,
body.theme-light.home-page .summary-item span,
body.theme-light .summary-item em,
body.theme-light.home-page .summary-item em {
  color: #c0ba8a;
}

body.theme-light .summary-item b,
body.theme-light.home-page .summary-item b {
  font-size: 24px;
}

body.theme-light .projects-grid {
  display: block;
}

body.theme-light .home-project-toolbar {
  border-top: 1px solid rgba(179,186,84,0.14);
  padding-top: 16px;
}

body.theme-light .project-table-shell,
body.theme-light.project-page .matrix-shell {
  border-color: rgba(112,119,47,0.34);
  background: #f3efd7;
  box-shadow: 0 18px 50px rgba(0,0,0,0.26);
}

body.theme-light.project-page .matrix-shell {
  max-height: 72vh;
  overflow: auto;
}

body.theme-light.project-page .matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Retro project-page repair layer */
body.theme-light.project-page .btn:hover,
body.theme-light.project-page .account-action:hover,
body.theme-light.project-page .icon-btn:hover,
body.theme-light.project-page .inline-edit:hover,
body.theme-light.project-page .range-presets button:hover,
body.theme-light.project-page .range-presets button.active {
  border-color: rgba(226,215,92,0.62);
  background: linear-gradient(180deg, rgba(95,106,24,0.98), rgba(38,47,14,0.98));
  color: #fffbd3;
  box-shadow:
    inset 0 1px 0 rgba(255,255,210,0.16),
    0 0 0 1px rgba(226,215,92,0.08),
    0 10px 26px rgba(0,0,0,0.26);
  transform: translateY(-1px);
}

body.theme-light.project-page .btn:focus-visible,
body.theme-light.project-page .account-action:focus-visible,
body.theme-light.project-page .range-presets button:focus-visible {
  outline: 2px solid rgba(226,215,92,0.7);
  outline-offset: 2px;
}

body.theme-light.project-page .project-actions .btn,
body.theme-light.project-page .matrix-toolbar .btn {
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}

body.theme-light.project-page .analytics-summary {
  align-items: stretch;
}

body.theme-light.project-page .summary-item {
  min-width: 0;
  overflow: hidden;
  gap: 14px;
}

body.theme-light.project-page .summary-item > div {
  min-width: 0;
  position: relative;
  z-index: 1;
}

body.theme-light.project-page .summary-item span {
  max-width: 11ch;
  line-height: 1.2;
}

body.theme-light.project-page .summary-item b {
  white-space: nowrap;
}

body.theme-light.project-page .summary-item svg {
  width: clamp(72px, 7vw, 112px);
  min-width: 72px;
  max-width: 42%;
  opacity: .95;
}

body.theme-light.project-page .summary-item > i {
  flex: 0 0 auto;
}

body.theme-light.project-page .range-panel {
  padding: 18px;
  border-color: rgba(179,186,84,0.28);
  background:
    radial-gradient(circle at 0% 0%, rgba(204,218,62,0.08), transparent 28%),
    linear-gradient(180deg, rgba(28,37,20,0.96), rgba(13,19,11,0.96));
  box-shadow:
    inset 0 1px 0 rgba(255,255,208,0.07),
    0 20px 44px rgba(0,0,0,0.28);
}

body.theme-light.project-page .range-presets {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 10px;
}

body.theme-light.project-page .range-presets button {
  min-height: 42px;
  border-color: rgba(179,186,84,0.22);
  background: linear-gradient(180deg, rgba(23,31,18,0.94), rgba(9,14,8,0.96));
  color: #f5f1cf;
  font-size: 14px;
}

body.theme-light.project-page .range-calendar-shell {
  grid-template-columns: 1fr;
  gap: 14px;
}

body.theme-light.project-page .range-side {
  order: -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px)) minmax(160px, 220px);
  gap: 12px;
  align-items: end;
  padding: 12px;
  border-left: 0;
  border: 1px solid rgba(179,186,84,0.18);
  border-radius: 10px;
  background: rgba(8,13,7,0.55);
}

body.theme-light.project-page .range-side .form-group {
  min-width: 0;
}

body.theme-light.project-page .range-side label {
  display: block;
  margin-bottom: 6px;
  color: #d6d09a;
  font-size: 12px;
  line-height: 1.15;
}

body.theme-light.project-page .range-panel input[type="date"] {
  width: 100%;
  height: 42px;
  border-color: rgba(179,186,84,0.26);
  background: rgba(8,13,7,0.92);
  color: #fffbd3;
}

body.theme-light.project-page .range-side .btn {
  width: 100%;
  height: 42px;
}

body.theme-light.project-page .range-calendar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

body.theme-light.project-page .calendar-month {
  min-width: 0;
}

body.theme-light.project-page .calendar-month-title {
  color: #fff9d7;
  font-size: 19px;
}

body.theme-light.project-page .calendar-month-title span,
body.theme-light.project-page .calendar-weekdays {
  color: #b9b481;
}

body.theme-light.project-page .calendar-day {
  min-height: 34px;
  color: #f7f1cd;
  background: rgba(8,13,7,0.22);
}

body.theme-light.project-page .calendar-day:not(.muted):hover {
  background: rgba(177,197,48,0.16);
  color: #fffbd3;
}

body.theme-light.project-page .calendar-day.selected {
  background: linear-gradient(180deg, rgba(95,112,27,0.98), rgba(40,59,18,0.98));
  color: #fffbd3;
  box-shadow: inset 0 0 0 1px rgba(226,215,92,0.18);
}

body.theme-light.project-page .calendar-day.has-check i,
body.theme-light.project-page .dot-check {
  background: #d6e84c;
}

body.theme-light.project-page .range-legend {
  color: #d6d09a;
}

body.theme-light.project-page .compare-summary span {
  border-color: rgba(179,186,84,0.18);
  background: rgba(8,13,7,0.44);
  color: #d6d09a;
}

body.theme-light.project-page .matrix-card {
  overflow: hidden;
}

body.theme-light.project-page .matrix-shell {
  border-radius: 10px;
}

/* Premium olive console refinement */
body.theme-light {
  --bg: #172012;
  --panel: #27311c;
  --panel2: #1c2516;
  --border: rgba(178,171,111,0.24);
  --border2: rgba(196,187,126,0.28);
  --text: #f5efd2;
  --muted: #d0c89a;
  --muted2: #aaa37b;
  --accent: #a7a45b;
  --accent2: #7f8545;
  --matrix-bg: #f6f0d8;
  --matrix-bg-2: #efe6c8;
  --matrix-bg-3: #fff9df;
  --matrix-line: rgba(93,89,54,0.24);
  --matrix-line-soft: rgba(93,89,54,0.16);
}

body.theme-light.home-page,
body.theme-light.project-page {
  background:
    linear-gradient(180deg, rgba(45,58,32,0.72), rgba(24,33,19,0.84) 38%, #11180f),
    #172012;
}

body.theme-light header,
body.theme-light.home-page header,
body.theme-light.project-page header,
body.theme-light .account-console-top,
body.theme-light.project-page .project-info,
body.theme-light.project-page .summary-item,
body.theme-light.home-page .summary-item,
body.theme-light.home-page .home-panel {
  border-color: rgba(196,187,126,0.22);
  background:
    linear-gradient(180deg, rgba(47,58,34,0.94), rgba(24,32,20,0.96));
  box-shadow:
    inset 0 1px 0 rgba(255,248,210,0.08),
    0 18px 44px rgba(0,0,0,0.22);
}

body.theme-light .logo i,
body.theme-light .section-title i,
body.theme-light .project-actions i,
body.theme-light .summary-item > i {
  color: #bbb66b;
}

body.theme-light .app-badge,
body.theme-light .account-console-pill span,
body.theme-light.project-page .project-avatar {
  border-color: rgba(196,187,126,0.34);
  background: linear-gradient(180deg, rgba(170,171,95,0.20), rgba(86,95,47,0.28));
  color: #efe9b9;
  box-shadow: none;
}

body.theme-light .account-action,
body.theme-light .btn,
body.theme-light .icon-btn,
body.theme-light .account-pill,
body.theme-light.project-page .icon-btn,
body.theme-light.project-page .inline-edit,
body.theme-light.project-page .matrix-toolbar .btn,
body.theme-light.project-page .matrix-filter-count {
  border-color: rgba(196,187,126,0.25);
  background: linear-gradient(180deg, rgba(40,49,30,0.94), rgba(22,30,18,0.96));
  color: #f4edcf;
  box-shadow: none;
}

body.theme-light .btn-primary,
body.theme-light .btn.active,
body.theme-light.home-page .btn-primary {
  border-color: rgba(190,181,105,0.42);
  background: linear-gradient(180deg, #858949, #5c642f);
  color: #fff8d7;
  box-shadow: 0 12px 24px rgba(0,0,0,0.18);
}

body.theme-light.project-page .btn:hover,
body.theme-light.project-page .account-action:hover,
body.theme-light.project-page .icon-btn:hover,
body.theme-light.project-page .inline-edit:hover,
body.theme-light.project-page .range-presets button:hover,
body.theme-light.project-page .range-presets button.active {
  border-color: rgba(218,205,135,0.48);
  background: linear-gradient(180deg, #6f7440, #404b27);
  color: #fff8d7;
  box-shadow: 0 10px 22px rgba(0,0,0,0.20);
}

body.theme-light .summary-item path,
body.theme-light.home-page .summary-item path {
  stroke: #b9b06a;
  filter: none;
}

body.theme-light.project-page .matrix-card {
  border-color: rgba(196,187,126,0.24);
  background:
    linear-gradient(180deg, rgba(47,58,34,0.92), rgba(23,31,19,0.95));
  box-shadow:
    inset 0 1px 0 rgba(255,248,210,0.08),
    0 20px 44px rgba(0,0,0,0.24);
}

body.theme-light .project-table-shell,
body.theme-light.project-page .matrix-shell {
  border: 1px solid rgba(160,151,97,0.42);
  background: #f6f0d8;
  box-shadow: 0 18px 34px rgba(0,0,0,0.22);
}

body.theme-light.project-page .matrix-table {
  min-width: 1040px;
  table-layout: fixed;
  color: #18170f;
}

body.theme-light.project-page .matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: linear-gradient(180deg, #2a351f, #1d2818);
  color: #f5edca;
  border-color: rgba(236,226,167,0.14);
  height: 68px;
}

body.theme-light.project-page .keyword-col,
body.theme-light.project-page .select-col {
  position: static !important;
  left: auto !important;
  z-index: auto !important;
  box-shadow: none !important;
}

body.theme-light.project-page .matrix-table tbody td,
body.theme-light.project-page .keyword-col,
body.theme-light.project-page .select-col {
  background: #fbf5dc !important;
  color: #18170f;
}

body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) td,
body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) .keyword-col,
body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) .select-col {
  background: #f4edcf !important;
}

body.theme-light.project-page .matrix-table tbody tr:hover td,
body.theme-light.project-page .matrix-table tbody tr:hover .keyword-col,
body.theme-light.project-page .matrix-table tbody tr:hover .select-col {
  background: #fff8df !important;
}

body.theme-light.project-page .matrix-keyword {
  width: auto;
  min-width: 0;
  max-width: none;
  word-break: normal;
  overflow-wrap: break-word;
  color: #11130d;
}

body.theme-light.project-page .rank-badge,
body.theme-light.project-page .history-chip {
  border: 0;
  box-shadow: none;
}

body.theme-light.project-page .rank-badge.pos-good,
body.theme-light.project-page .history-chip.pos-good {
  background: linear-gradient(180deg, #b7d66f, #8fb657);
}

body.theme-light.project-page .rank-badge.pos-top10,
body.theme-light.project-page .history-chip.pos-top10 {
  background: linear-gradient(180deg, #d4df7c, #b5c85d);
}

body.theme-light.project-page .rank-badge.pos-mid,
body.theme-light.project-page .history-chip.pos-mid {
  background: linear-gradient(180deg, #e5d978, #ccb856);
}

body.theme-light.project-page .rank-badge.pos-bad,
body.theme-light.project-page .history-chip.pos-bad {
  background: linear-gradient(180deg, #e8be5e, #ce963f);
}

body.theme-light.project-page .project-meta i,
body.theme-light.project-page .project-meta svg,
body.theme-light.project-page .project-info i,
body.theme-light.project-page .project-info svg,
body.theme-light.project-page .access-pill i,
body.theme-light.project-page .access-pill svg,
body.theme-light.project-page .inline-edit i,
body.theme-light.project-page .refresh-link,
body.theme-light.project-page .account-action-theme i,
body.theme-light.project-page .account-console-billing i {
  color: #b9ad66 !important;
  fill: #b9ad66 !important;
  stroke: #b9ad66 !important;
}

body.theme-light.project-page .tracking-status,
body.theme-light.project-page .mode-pill,
body.theme-light.project-page .access-pill {
  border-color: rgba(196,187,126,0.20);
  background: rgba(246,240,216,0.08);
  color: #d8cf9d;
}

body.theme-light.project-page .hero-wave path,
body.theme-light.project-page .summary-item svg path,
body.theme-light.home-page .summary-item svg path,
body.theme-light .project-spark path {
  stroke: #b9ad66 !important;
  filter: none !important;
}

body.theme-light.project-page .hero-wave {
  opacity: .78;
  background: linear-gradient(90deg, transparent, rgba(246,240,216,0.06));
}

body.theme-light .account-console-billing span {
  background: transparent;
}

@media (max-width: 1180px) {
  body.theme-light.project-page .analytics-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body.theme-light.project-page .analytics-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.keyword-history-content {
  width: min(860px, calc(100vw - 28px));
}

.keyword-history-content .modal-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.keyword-history-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.keyword-history-meta span {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255,255,255,0.04);
  font-weight: 850;
}

.keyword-history-meta b {
  color: var(--muted);
  font-size: 12px;
}

.keyword-history-chart-wrap {
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.16);
}

.history-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}

.history-chart line {
  stroke: rgba(200,193,134,0.24);
  stroke-width: 2;
}

.history-chart path {
  fill: none;
  stroke: #beb46b;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-chart circle {
  fill: #f5efd2;
  stroke: #8c8952;
  stroke-width: 3;
}

.history-chart text {
  fill: #f5efd2;
  font-size: 13px;
  font-weight: 800;
  text-anchor: middle;
}

.history-chart .history-date-label {
  fill: rgba(245,239,210,0.62);
  font-size: 11px;
  font-weight: 650;
}

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

body.theme-light.project-page .keyword-history-content {
  border-color: rgba(196,187,126,0.26);
  background: linear-gradient(180deg, #2a351f, #172113);
}

body.theme-light.project-page .keyword-history-meta span,
body.theme-light.project-page .keyword-history-chart-wrap {
  border-color: rgba(196,187,126,0.22);
  background: rgba(10,15,8,0.42);
}

body.theme-light.project-page .history-chart path {
  stroke: #b9ad66;
  filter: none;
}

body.theme-light.project-page .history-chart circle {
  fill: #f6f0d8;
  stroke: #8a8750;
}

body.theme-light.project-page .history-chart text {
  fill: #f6f0d8;
}

@media (max-width: 900px) {
  body.theme-light.project-page .matrix-shell,
  body.theme-light.project-page .matrix-table,
  body.theme-light.project-page .matrix-table tbody,
  body.theme-light.project-page .matrix-table tr,
  body.theme-light.project-page .matrix-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.theme-light.project-page .matrix-shell {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.theme-light.project-page .matrix-table {
    min-width: 0;
  }

  body.theme-light.project-page .matrix-table thead {
    display: none;
  }

  body.theme-light.project-page .matrix-table tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid rgba(160,151,97,0.36);
    border-radius: 14px;
    background:
      linear-gradient(180deg, rgba(255,252,234,0.96), rgba(244,238,211,0.98));
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.58),
      0 12px 24px rgba(0,0,0,0.16);
  }

  body.theme-light.project-page .matrix-table td {
    min-height: 0;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent !important;
  }

  body.theme-light.project-page .matrix-table td:nth-child(1),
  body.theme-light.project-page .matrix-table td:nth-child(2),
  body.theme-light.project-page .matrix-table td:nth-child(3),
  body.theme-light.project-page .matrix-table td:nth-child(7) {
    display: none;
  }

  body.theme-light.project-page .keyword-col {
    order: 1;
    padding-right: 74px;
  }

  body.theme-light.project-page .matrix-frequency {
    order: 2;
    display: inline-flex;
    width: fit-content;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 10px;
    border: 1px solid rgba(160,151,97,0.24);
    border-radius: 999px;
    background: rgba(90,92,49,0.08) !important;
    color: #4f4c31;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
  }

  body.theme-light.project-page .matrix-frequency::before {
    content: "Частота: ";
    margin-right: 4px;
    color: #7c7650;
    font-weight: 700;
  }

  body.theme-light.project-page .matrix-positions-cell {
    order: 3;
    display: block;
    min-width: 0;
    padding-top: 6px;
    border-top: 1px solid rgba(160,151,97,0.18);
  }

  body.theme-light.project-page .matrix-keyword {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    color: #11130d;
    font-size: 18px;
    line-height: 1.28;
    font-weight: 850;
  }

  body.theme-light.project-page .matrix-positions-cell::before {
    content: "История позиций";
    display: block;
    margin-bottom: 8px;
    color: #77704d;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  body.theme-light.project-page .matrix-positions-cell > .rank-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    min-width: 52px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    font-size: 20px;
    font-weight: 900;
  }

  body.theme-light.project-page .matrix-history {
    margin-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  body.theme-light.project-page .history-chip {
    min-width: 34px;
    min-height: 30px;
    border-radius: 9px;
    font-size: 14px;
  }

  body.theme-light.project-page .matrix-toolbar {
    grid-template-columns: 1fr;
  }
}

body.theme-light.project-page .matrix-table {
  min-width: 1120px;
  color: #15170f;
  table-layout: fixed;
}

body.theme-light.project-page .matrix-table th:nth-child(1),
body.theme-light.project-page .matrix-table td:nth-child(1) { width: 116px; }
body.theme-light.project-page .matrix-table th:nth-child(2),
body.theme-light.project-page .matrix-table td:nth-child(2) { width: 150px; }
body.theme-light.project-page .matrix-table th:nth-child(3),
body.theme-light.project-page .matrix-table td:nth-child(3) { width: 96px; }
body.theme-light.project-page .matrix-table th:nth-child(4),
body.theme-light.project-page .matrix-table td:nth-child(4) { width: 110px; text-align: center; }
body.theme-light.project-page .matrix-table th:nth-child(5),
body.theme-light.project-page .matrix-table td:nth-child(5) { width: 330px; }
body.theme-light.project-page .matrix-table th:nth-child(6),
body.theme-light.project-page .matrix-table td:nth-child(6) { width: 210px; }
body.theme-light.project-page .matrix-table th:nth-child(7),
body.theme-light.project-page .matrix-table td:nth-child(7) { width: 110px; text-align: center; }

body.theme-light.project-page .matrix-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 180px 140px 100px;
  align-items: end;
  gap: 10px;
}

body.theme-light.project-page .matrix-toolbar .btn,
body.theme-light.project-page .matrix-filter-count {
  height: 42px;
  min-height: 42px;
  border: 1px solid rgba(179,186,84,0.26);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(37,44,22,0.84), rgba(13,18,10,0.9));
  color: #f5f1cf;
}

body.theme-light.project-page .matrix-filter-count {
  display: grid;
  place-items: center;
  padding: 0 10px;
  font-weight: 850;
  white-space: nowrap;
}

body.theme-light.project-page .matrix-toolbar .form-group {
  margin: 0;
}

body.theme-light.project-page .matrix-table thead th {
  background: linear-gradient(180deg, #24301a, #17210f);
  color: #f8f1ce;
  border-color: rgba(224,215,154,0.12);
  text-shadow: none;
  height: 66px;
  padding: 9px 10px;
  vertical-align: middle;
}

body.theme-light.project-page .matrix-table tbody td {
  background: rgba(253,249,225,0.94);
  color: #15170f;
  border-color: rgba(83,90,37,0.16);
}

body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) td {
  background: rgba(248,243,216,0.96);
}

body.theme-light.project-page .matrix-table tbody tr:hover td {
  background: #fff4c6;
}

body.theme-light.project-page .keyword-col,
body.theme-light.project-page .select-col {
  background: rgba(253,249,225,0.98) !important;
  color: #15170f;
  box-shadow:
    10px 0 18px rgba(83,90,37,0.08),
    1px 0 0 rgba(83,90,37,0.16);
}

body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) .keyword-col,
body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) .select-col {
  background: rgba(248,243,216,0.98) !important;
}

body.theme-light.project-page .matrix-table tbody tr:hover .keyword-col,
body.theme-light.project-page .matrix-table tbody tr:hover .select-col {
  background: #fff4c6 !important;
}

body.theme-light.project-page .matrix-keyword,
body.theme-light.project-page .matrix-frequency,
body.theme-light.project-page .matrix-pos.pos-neutral {
  color: #15170f;
}

body.theme-light.project-page .rank-badge,
body.theme-light.project-page .history-chip {
  color: #1b1e10;
}

body.theme-light.project-page .rank-badge.pos-good,
body.theme-light.project-page .history-chip.pos-good {
  background: linear-gradient(180deg, #a7d56b, #7eb342);
}

body.theme-light.project-page .rank-badge.pos-top10,
body.theme-light.project-page .history-chip.pos-top10 {
  background: linear-gradient(180deg, #cbe77b, #9fca45);
}

body.theme-light.project-page .rank-badge.pos-mid,
body.theme-light.project-page .history-chip.pos-mid {
  background: linear-gradient(180deg, #dce98a, #b7cf4b);
}

body.theme-light.project-page .rank-badge.pos-bad,
body.theme-light.project-page .history-chip.pos-bad {
  background: linear-gradient(180deg, #f2c950, #e2a72d);
}

body.theme-light.project-page .rank-badge.pos-neutral,
body.theme-light.project-page .history-chip.pos-neutral {
  background: #dfdbc3;
  color: #5b5a4d;
}

/* Retro usability polish */
body.theme-light.home-page .container {
  width: min(100% - 32px, 1440px);
  max-width: 1440px;
  padding: 0;
}

body.theme-light.home-page header,
body.theme-light.project-page header {
  margin: 8px 8px 24px;
}

body.theme-light.home-page .header-content,
body.theme-light.project-page .header-content {
  min-height: 128px;
}

body.theme-light.home-page .home-panel {
  padding: 24px;
}

body.theme-light.home-page .manual-tools .card {
  min-height: 330px;
}

body.theme-light.home-page .manual-card-head span {
  width: 56px;
  height: 56px;
}

body.theme-light.home-page .manual-card-head h3 {
  font-size: 24px;
}

body.theme-light.home-page .manual-card-head p {
  font-size: 15px;
}

body.theme-light.home-page .home-stats {
  gap: 10px;
}

body.theme-light.home-page .summary-item {
  min-height: 70px;
  padding: 14px;
}

body.theme-light.home-page .summary-item b {
  font-size: 22px;
  line-height: 1.1;
}

body.theme-light.home-page .summary-item > i {
  width: 38px;
  height: 38px;
  min-width: 38px;
}

body.theme-light .home-project-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 190px 190px;
}

body.theme-light .project-table {
  min-width: 1120px;
  table-layout: fixed;
}

body.theme-light .project-table th:nth-child(1),
body.theme-light .project-table td:nth-child(1) { width: 56px; }
body.theme-light .project-table th:nth-child(2),
body.theme-light .project-table td:nth-child(2) { width: 270px; }
body.theme-light .project-table th:nth-child(3),
body.theme-light .project-table td:nth-child(3) { width: 220px; }
body.theme-light .project-table th:nth-child(4),
body.theme-light .project-table td:nth-child(4) { width: 95px; text-align: center; }
body.theme-light .project-table th:nth-child(5),
body.theme-light .project-table td:nth-child(5) { width: 140px; text-align: center; }
body.theme-light .project-table th:nth-child(6),
body.theme-light .project-table td:nth-child(6) { width: 135px; text-align: center; }
body.theme-light .project-table th:nth-child(7),
body.theme-light .project-table td:nth-child(7) { width: 155px; text-align: center; }
body.theme-light .project-table th:nth-child(8),
body.theme-light .project-table td:nth-child(8) { width: 150px; }

body.theme-light .project-table td {
  vertical-align: middle;
}

body.theme-light .project-table td:nth-child(3) a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

body.theme-light .project-table-actions {
  justify-content: flex-start;
}

@media (max-width: 1100px) {
  body.theme-light.home-page .header-content,
  body.theme-light.project-page .header-content {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 0;
  }

  body.theme-light.home-page .account-console,
  body.theme-light.project-page .account-console {
    width: 100%;
    max-width: none;
  }

  body.theme-light .home-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  html,
  body,
  body.theme-light.home-page,
  body.theme-light.project-page {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body.theme-light.home-page header,
  body.theme-light.project-page header {
    margin: 6px 6px 16px;
    border-radius: 10px;
  }

  body.theme-light.home-page .container,
  body.theme-light.project-page .container {
    width: calc(100% - 14px);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
  }

  body.theme-light.home-page header .container,
  body.theme-light.project-page header .container {
    width: 100%;
    padding: 0 10px;
  }

  body.theme-light.home-page .header-content,
  body.theme-light.project-page .header-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 0;
  }

  body.theme-light.home-page .logo,
  body.theme-light.project-page .logo {
    font-size: 20px;
    gap: 8px;
  }

  body.theme-light.home-page .logo i,
  body.theme-light.project-page .logo i {
    font-size: 24px;
  }

  body.theme-light.home-page .app-badge,
  body.theme-light.project-page .app-badge {
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
  }

  body.theme-light .account-console {
    gap: 8px;
  }

  body.theme-light .account-console-top,
  body.theme-light .account-console.no-settings .account-console-top {
    min-height: 0;
    grid-template-columns: 68px minmax(0, 1fr) 44px;
    gap: 10px;
    padding: 10px;
  }

  body.theme-light .account-console-pill {
    width: 62px;
    min-height: 44px;
    padding: 0 8px;
  }

  body.theme-light .account-console-pill span {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  body.theme-light .account-identity {
    padding-right: 0;
    border-right: 0;
  }

  body.theme-light .account-console-billing {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px 0 0;
    border-top: 1px solid rgba(179,186,84,0.16);
    border-right: 0;
    font-size: 12px;
  }

  body.theme-light .account-console-settings {
    position: static;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  body.theme-light .account-console-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.theme-light .account-action {
    min-height: 40px;
    font-size: 12px;
  }

  body.theme-light.home-page .home-panel {
    padding: 14px;
    border-radius: 10px;
  }

  body.theme-light.home-page .home-section-head {
    display: block;
    margin-bottom: 14px;
  }

  body.theme-light.home-page .section-title {
    font-size: 20px;
    line-height: 1.2;
  }

  body.theme-light.home-page .home-section-head p {
    margin-top: 6px;
    font-size: 13px;
  }

  body.theme-light.home-page .manual-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.theme-light.home-page .manual-tools .card {
    min-height: 0;
    padding: 14px;
  }

  body.theme-light.home-page .manual-card-head {
    gap: 10px;
    margin-bottom: 14px;
  }

  body.theme-light.home-page .manual-card-head span {
    width: 42px;
    height: 42px;
    border-radius: 8px;
  }

  body.theme-light.home-page .manual-card-head h3 {
    font-size: 18px;
  }

  body.theme-light.home-page .manual-card-head p {
    font-size: 12px;
  }

  body.theme-light.home-page textarea {
    min-height: 92px;
  }

  body.theme-light.home-page .home-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
  }

  body.theme-light.home-page .summary-item {
    min-height: 72px;
    padding: 10px;
    gap: 8px;
  }

  body.theme-light.home-page .summary-item span {
    font-size: 11px;
  }

  body.theme-light.home-page .summary-item b {
    font-size: 18px;
  }

  body.theme-light.home-page .summary-item > i {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 13px;
  }

  body.theme-light .home-projects-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }

  body.theme-light .home-projects-head .btn {
    width: 100%;
    justify-content: center;
  }

  body.theme-light .home-project-toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 10px;
  }

  body.theme-light .home-project-toolbar .matrix-search-wrap,
  body.theme-light .home-project-toolbar select {
    width: 100%;
    min-width: 0;
    height: 40px;
  }

  body.theme-light .project-table-shell {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.theme-light .project-table,
  body.theme-light .project-table thead,
  body.theme-light .project-table tbody,
  body.theme-light .project-table tr,
  body.theme-light .project-table td {
    display: block;
    width: 100% !important;
    min-width: 0;
  }

  body.theme-light .project-table thead {
    display: none;
  }

  body.theme-light .project-table tr {
    margin-bottom: 10px;
    border: 1px solid rgba(112,119,47,0.34);
    border-radius: 10px;
    overflow: hidden;
    background: #f5efd0;
    box-shadow: 0 12px 24px rgba(0,0,0,0.18);
  }

  body.theme-light .project-table td {
    min-height: 0;
    height: auto;
    padding: 9px 12px;
    border-right: 0;
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    font-size: 13px;
  }

  body.theme-light .project-table td::before {
    color: #6d6b48;
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
  }

  body.theme-light .project-table td:nth-child(1)::before { content: "#"; }
  body.theme-light .project-table td:nth-child(2)::before { content: "Проект"; }
  body.theme-light .project-table td:nth-child(3)::before { content: "Домен"; }
  body.theme-light .project-table td:nth-child(4)::before { content: "Ключей"; }
  body.theme-light .project-table td:nth-child(5)::before { content: "Средняя"; }
  body.theme-light .project-table td:nth-child(6)::before { content: "Проверки"; }
  body.theme-light .project-table td:nth-child(7)::before { content: "Дата"; }
  body.theme-light .project-table td:nth-child(8)::before { content: "Действия"; }

  body.theme-light .project-name-cell {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  body.theme-light .project-avatar {
    width: 36px;
    height: 36px;
  }

  body.theme-light .project-name-cell b {
    max-width: 100%;
    white-space: normal;
    line-height: 1.2;
  }

  body.theme-light .project-table-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  body.theme-light .project-table-footer {
    flex-direction: column;
    align-items: stretch;
    margin-top: 8px;
    border: 1px solid rgba(112,119,47,0.34);
    border-radius: 10px;
  }

  body.theme-light .project-pagination {
    justify-content: space-between;
  }

  body.theme-light .home-footer .container {
    width: calc(100% - 14px);
    padding: 0;
  }

  body.theme-light.project-page .project-info {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
  }

  body.theme-light.project-page .project-avatar {
    width: 54px;
    height: 54px;
    font-size: 18px;
  }

  body.theme-light.project-page .project-info h2 {
    font-size: 20px;
    line-height: 1.15;
  }

  body.theme-light.project-page .project-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.theme-light.project-page .access-tags {
    flex-wrap: wrap;
  }

  body.theme-light.project-page .project-status-side {
    grid-column: 1 / -1;
    min-height: 52px;
  }

  body.theme-light.project-page .project-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.theme-light.project-page .project-actions .btn {
    width: 100%;
    justify-content: center;
  }

  body.theme-light.project-page .analytics-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.theme-light.project-page .summary-item {
    min-height: 74px;
    padding: 10px;
  }

  body.theme-light.project-page .summary-item b {
    font-size: 19px;
  }

  body.theme-light.project-page .matrix-card {
    padding: 10px;
    border-radius: 10px;
  }

  body.theme-light.project-page .matrix-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.theme-light.project-page .matrix-toolbar .btn,
  body.theme-light.project-page .matrix-search-wrap,
  body.theme-light.project-page .matrix-toolbar select,
  body.theme-light.project-page .matrix-toolbar input[type="number"],
  body.theme-light.project-page .matrix-filter-count {
    width: 100%;
    max-width: none;
  }

  body.theme-light.project-page .matrix-shell {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 8px;
  }

  body.theme-light.project-page .matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  body.theme-light.project-page .matrix-table {
    min-width: 900px;
    font-size: 12px;
  }

  body.theme-light.project-page .matrix-table th,
  body.theme-light.project-page .matrix-table td {
    padding: 9px 8px;
  }

  body.theme-light.project-page .keyword-col {
    position: static;
    box-shadow: none;
  }

  body.theme-light.project-page .matrix-keyword {
    width: 28ch;
    min-width: 28ch;
    max-width: 28ch;
  }

  body.theme-light.project-page .matrix-sort-head select {
    height: 28px;
    font-size: 11px;
  }

  body.theme-light.project-page .matrix-history {
    margin-left: 5px;
    gap: 4px;
  }

  body.theme-light.project-page .history-chip {
    min-width: 22px;
    min-height: 22px;
    padding: 2px 5px;
  }
}

/* =========================
   Responsive
========================= */

@media (max-width: 768px) {
  .project-page .header-content {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px 0;
  }

  .project-page .header-tools {
    margin-left: 0;
  }

  .project-page .project-info {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 18px;
    padding: 22px;
  }

  .project-page .project-avatar {
    width: 76px;
    height: 76px;
    font-size: 22px;
  }

  .project-page .project-info h2 {
    font-size: 23px;
  }

  .project-page .project-status-side {
    grid-column: 1 / -1;
    min-height: 70px;
  }

  .project-page .tracking-status {
    float: none;
  }

  .project-page .hero-wave {
    width: 230px;
    height: 70px;
    right: -20px;
    bottom: 0;
  }

  .project-page .schedule-panel {
    grid-column: 1 / -1;
  }

  .project-page .range-calendar-shell {
    grid-template-columns: 1fr;
  }

  .project-page .range-calendar {
    grid-template-columns: 1fr;
  }

  .project-page .range-side {
    border-left: 0;
    padding-left: 0;
  }

  .analytics-summary {
    grid-template-columns: 1fr;
  }

  .summary-item {
    min-height: 98px;
  }

  .project-page .matrix-toolbar {
    align-items: stretch;
  }

  .project-page .matrix-search-wrap,
  .project-page .matrix-toolbar .form-group,
  .project-page .matrix-toolbar select,
  .project-page .matrix-toolbar input[type="number"],
  .project-page .matrix-toolbar .btn,
  .project-page .matrix-filter-count {
    width: 100%;
    max-width: none;
  }

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

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .manual-tools {
    grid-template-columns: 1fr;
  }

  .home-page .header-tools {
    margin-left: auto;
  }

  .header-content {
    align-items: flex-start;
  }

  .home-page header,
  .project-page header {
    margin: 8px;
  }

  .home-page header .container,
  .project-page header .container {
    padding: 0 14px;
  }

  .home-page .header-content,
  .project-page .header-content {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px 0;
  }

  .logo {
    min-width: 0;
  }

  .home-page .logo,
  .project-page .logo {
    font-size: 22px;
  }

  .home-page .logo i,
  .project-page .logo i {
    font-size: 28px;
  }

  .logo a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-tools {
    gap: 8px;
  }

  .account-console,
  .home-page .account-console,
  .project-page .account-console {
    width: 100%;
  }

  .account-console-top,
  .account-console.no-settings .account-console-top {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
  }

  .account-console-billing {
    grid-column: 1 / -1;
    padding: 12px 0 0;
    border-top: 1px solid rgba(135,151,186,0.14);
    border-right: 0;
  }

  .account-console-settings {
    position: absolute;
    right: 16px;
    top: 12px;
  }

  .account-console-top {
    position: relative;
  }

  .account-console-actions {
    grid-template-columns: 1fr 1fr;
  }

  .account-action {
    min-height: 44px;
    padding: 0 10px;
    font-size: 13px;
  }

  .account-pill {
    min-width: 38px;
    padding: 0 10px;
  }

  .home-page .account-console-pill,
  .project-page .account-console-pill,
  .account-console-pill {
    width: 70px;
    min-height: 48px;
  }

  .home-panel {
    padding: 18px;
  }

  .home-section-head {
    padding: 0;
  }

  .home-page .manual-tools {
    width: 100%;
    margin: 18px 0 0;
  }

  .home-stats,
  .home-page .projects-grid,
  .home-page .manual-tools {
    grid-template-columns: 1fr;
  }

  .home-project-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .home-project-toolbar select,
  .home-project-toolbar .matrix-search-wrap {
    width: 100%;
  }

  .home-footer .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

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

  .admin-modal-content {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
    padding: 16px;
  }

  .admin-panel {
    min-height: 360px;
  }

  .admin-access-row,
  .admin-user-row {
    align-items: flex-start;
  }

  .admin-access-row {
    grid-template-columns: 1fr;
  }

  .admin-user-billing {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .admin-user-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

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

  .admin-user-actions .btn,
  .admin-billing-input {
    width: 100%;
  }

  .admin-billing-input {
    grid-column: 1 / -1;
  }

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

  .admin-create-user #admin-new-paid-months,
  .admin-create-user #admin-new-balance {
    grid-column: 1 / -1;
  }

  .project-card-top > div {
    padding-right: 0;
  }

  .project-spark {
    position: static;
    width: 100%;
    max-width: 140px;
    margin: 8px 0 0 auto;
    display: block;
  }

  .project-meta > div {
    justify-content: flex-start;
    width: 100%;
  }

  .project-page .compare-panel {
    grid-template-columns: 1fr;
  }

  .project-page .matrix-filters {
    grid-template-columns: 1fr;
  }

  .form-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .manual-result {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .project-page .container {
    width: calc(100vw - 20px);
    margin-left: calc(50% - 50vw + 10px);
    margin-right: calc(50% - 50vw + 10px);
  }

  .project-page .project-info,
  .project-page .project-actions,
  .project-page .semantics-panel,
  .project-page .loading {
    max-width: 100%;
    width: 100%;
  }

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

  .project-page .project-actions .btn,
  .project-page .project-actions a.btn {
    width: 100%;
  }

  .project-page .matrix-section {
    padding: 0 10px 30px;
  }

  .project-page .matrix-table thead th.sticky-col,
  .project-page .matrix-table tbody td.sticky-col,
  .project-page .matrix-keyword {
    width: 30ch;
    min-width: 30ch;
    max-width: 30ch;
  }

  .project-page .matrix-pos {
    font-size: 30px;
    min-width: 102px;
  }
}

/* Home dashboard final polish */
.project-avatar.project-favicon {
  position: relative;
  overflow: hidden;
}

.project-avatar.project-favicon img {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255,255,255,0.92);
  z-index: 2;
}

.project-avatar.project-favicon img + .project-avatar-fallback,
.project-avatar.project-favicon:has(img) .project-avatar-fallback {
  opacity: 0;
}

body.theme-light.home-page .header-content {
  min-height: 156px;
  grid-template-columns: minmax(360px, 1fr) minmax(620px, 780px);
  align-items: center;
}

body.theme-light.home-page .logo {
  align-self: center;
}

body.theme-light.home-page .account-console {
  width: min(100%, 780px);
  justify-self: end;
}

body.theme-light.home-page .account-console-top {
  grid-template-columns: 98px minmax(160px, 1fr) minmax(260px, 1.2fr) 64px;
}

body.theme-light.home-page .project-table-shell {
  border: 1px solid rgba(196,187,126,0.16);
  background: linear-gradient(180deg, rgba(13,18,14,0.96), rgba(9,13,10,0.98));
  box-shadow: 0 18px 36px rgba(0,0,0,0.28);
}

body.theme-light.home-page .project-table {
  color: #f5edca;
}

body.theme-light.home-page .project-table th {
  border-color: rgba(196,187,126,0.14);
  background: linear-gradient(180deg, rgba(42,53,31,0.96), rgba(24,34,20,0.98));
  color: rgba(245,237,202,0.84);
}

body.theme-light.home-page .project-table td {
  border-color: rgba(196,187,126,0.10);
  background: rgba(10,14,11,0.82);
  color: rgba(250,246,222,0.90);
}

body.theme-light.home-page .project-table tbody tr:nth-child(even) td {
  background: rgba(15,21,15,0.90);
}

body.theme-light.home-page .project-table tbody tr:hover td {
  background: rgba(38,50,27,0.92);
}

body.theme-light.home-page .project-table a,
body.theme-light.home-page .project-name-cell b {
  color: #fff8d7;
}

body.theme-light.home-page .project-name-cell small,
body.theme-light.home-page .project-index,
body.theme-light.home-page .project-table-footer {
  color: rgba(245,237,202,0.62);
}

body.theme-light.home-page .project-table-footer {
  border-color: rgba(196,187,126,0.14);
  background: rgba(8,12,9,0.92);
}

body.theme-light.home-page .project-table .icon-btn {
  border-color: rgba(196,187,126,0.20);
  background: rgba(22,30,18,0.92);
  color: #f4edcf;
}

@media (max-width: 1100px) {
  body.theme-light.home-page .header-content {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  body.theme-light.home-page .account-console {
    justify-self: stretch;
  }
}

@media (max-width: 760px) {
  .project-avatar.project-favicon img {
    inset: 6px;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
  }

  body.theme-light.home-page .project-table-shell {
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  body.theme-light.home-page .project-table tr {
    border-color: rgba(196,187,126,0.18);
    background: linear-gradient(180deg, rgba(18,25,15,0.96), rgba(10,14,10,0.98));
    box-shadow: 0 14px 26px rgba(0,0,0,0.24);
  }

  body.theme-light.home-page .project-table td,
  body.theme-light.home-page .project-table tbody tr:nth-child(even) td,
  body.theme-light.home-page .project-table tbody tr:hover td {
    background: transparent;
  }

body.theme-light.home-page .project-table td::before {
    color: rgba(245,237,202,0.58);
  }
}

/* Theme table correction and motion polish */
body.home-page:not(.theme-light) .project-table-shell {
  border: 1px solid rgba(135,151,186,0.18);
  background: rgba(8,12,22,0.78);
  box-shadow: 0 18px 42px rgba(0,0,0,0.28);
}

body.home-page:not(.theme-light) .project-table {
  color: #eef3ff;
}

body.home-page:not(.theme-light) .project-table th {
  border-color: rgba(135,151,186,0.14);
  background: linear-gradient(180deg, rgba(16,23,38,0.98), rgba(10,15,26,0.98));
  color: rgba(225,230,242,0.72);
}

body.home-page:not(.theme-light) .project-table td {
  border-color: rgba(135,151,186,0.10);
  background: rgba(10,15,26,0.86);
  color: rgba(245,247,255,0.88);
}

body.home-page:not(.theme-light) .project-table tbody tr:nth-child(even) td {
  background: rgba(14,19,32,0.90);
}

body.home-page:not(.theme-light) .project-table tbody tr:hover td {
  background: rgba(21,29,48,0.98);
}

body.home-page:not(.theme-light) .project-table a,
body.home-page:not(.theme-light) .project-name-cell b {
  color: #dbe7ff;
}

body.home-page:not(.theme-light) .project-name-cell small,
body.home-page:not(.theme-light) .project-index,
body.home-page:not(.theme-light) .project-table-footer {
  color: rgba(225,230,242,0.58);
}

body.home-page:not(.theme-light) .project-table-footer {
  border-color: rgba(135,151,186,0.14);
  background: rgba(7,10,18,0.92);
}

body.home-page:not(.theme-light) .project-position-badge,
body.home-page:not(.theme-light) .avg-position {
  background: rgba(119,89,210,0.22);
  color: #e9ddff;
}

body.theme-light.home-page .project-table-shell {
  border: 1px solid rgba(160,151,97,0.42);
  background: #f6f0d8;
  box-shadow: 0 18px 34px rgba(0,0,0,0.22);
}

body.theme-light.home-page .project-table {
  color: #18170f;
}

body.theme-light.home-page .project-table th {
  border-color: rgba(93,89,54,0.24);
  background: linear-gradient(180deg, #d9dfa4, #c6cc80);
  color: #1a210b;
}

body.theme-light.home-page .project-table td {
  border-color: rgba(93,89,54,0.16);
  background: rgba(252,248,224,0.92);
  color: #15170d;
}

body.theme-light.home-page .project-table tbody tr:nth-child(even) td {
  background: rgba(246,241,211,0.94);
}

body.theme-light.home-page .project-table tbody tr:hover td {
  background: #fff6cc;
}

body.theme-light.home-page .project-table a {
  color: #1356b8;
}

body.theme-light.home-page .project-name-cell b {
  color: #15170d;
}

body.theme-light.home-page .project-name-cell small,
body.theme-light.home-page .project-index,
body.theme-light.home-page .project-table-footer {
  color: #545638;
}

body.theme-light.home-page .project-table-footer {
  border-color: rgba(93,89,54,0.16);
  background: rgba(243,238,210,0.96);
}

.home-page .header-content,
.project-page .header-content {
  align-items: center;
}

.home-page .logo,
.project-page .logo {
  min-width: 0;
  line-height: 1;
  align-items: center;
  transform: translateY(-1px);
}

.home-page .logo a,
.project-page .logo a {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  line-height: 1;
}

.home-page .logo i,
.project-page .logo i {
  width: 1.12em;
  display: inline-flex;
  justify-content: center;
  line-height: 1;
}

body.theme-light.home-page .header-content {
  min-height: 136px;
  grid-template-columns: minmax(380px, 1fr) minmax(620px, 780px);
}

@media (prefers-reduced-motion: no-preference) {
  .card,
  .manual-tools .card,
  .summary-item,
  .project-table-shell,
  .matrix-card,
  .project-info,
  .account-console,
  .modal-content,
  .keyword-history-content {
    animation: softRise .28s ease both;
  }

  .modal.show .modal-content,
  .modal.show .keyword-history-content {
    animation: modalIn .22s ease both;
  }

  .project-table tbody tr,
  .matrix-table tbody tr,
  .btn,
  .icon-btn,
  .account-action,
  .project-avatar,
  .summary-item,
  .access-pill,
  .rank-badge,
  .history-chip {
    transition:
      transform .18s ease,
      border-color .18s ease,
      background .18s ease,
      color .18s ease,
      box-shadow .18s ease,
      opacity .18s ease;
  }

  .project-table tbody tr:hover,
  .matrix-table tbody tr:hover {
    transform: translateY(-1px);
  }

  .btn:active,
  .icon-btn:active,
  .account-action:active {
    transform: translateY(0) scale(.985);
  }
}

@keyframes softRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes themeVeil {
  0% { opacity: 0; }
  28% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 760px) {
  body.home-page:not(.theme-light) .project-table-shell,
  body.theme-light.home-page .project-table-shell {
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  body.home-page:not(.theme-light) .project-table tr {
    border-color: rgba(135,151,186,0.18);
    background: linear-gradient(180deg, rgba(12,17,29,0.96), rgba(7,10,18,0.98));
  }

  body.theme-light.home-page .project-table tr {
    border-color: rgba(160,151,97,0.30);
    background: #f6f0d8;
  }

  body.home-page:not(.theme-light) .project-table td,
  body.home-page:not(.theme-light) .project-table tbody tr:nth-child(even) td,
  body.home-page:not(.theme-light) .project-table tbody tr:hover td,
  body.theme-light.home-page .project-table td,
  body.theme-light.home-page .project-table tbody tr:nth-child(even) td,
  body.theme-light.home-page .project-table tbody tr:hover td {
    background: transparent;
  }

  body.home-page:not(.theme-light) .project-table td::before {
    color: rgba(225,230,242,0.58);
  }

  body.theme-light.home-page .project-table td::before {
    color: #6d6b48;
  }
}

/* Project matrix behavior: desktop is page scroll, mobile is cards */
.project-page .matrix-shell,
body.theme-light.project-page .matrix-shell {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.project-page .matrix-card {
  overflow: visible;
}

@media (max-width: 900px) {
  .project-page .matrix-shell,
  .project-page .matrix-table,
  .project-page .matrix-table tbody,
  .project-page .matrix-table tr,
  .project-page .matrix-table td,
  body.theme-light.project-page .matrix-shell,
  body.theme-light.project-page .matrix-table,
  body.theme-light.project-page .matrix-table tbody,
  body.theme-light.project-page .matrix-table tr,
  body.theme-light.project-page .matrix-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }

  .project-page .matrix-shell,
  body.theme-light.project-page .matrix-shell {
    max-height: none !important;
    overflow: visible !important;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .project-page .matrix-table,
  body.theme-light.project-page .matrix-table {
    min-width: 0 !important;
    table-layout: auto;
  }

  .project-page .matrix-table thead,
  body.theme-light.project-page .matrix-table thead {
    display: none;
  }

  .project-page .matrix-table tr,
  body.theme-light.project-page .matrix-table tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
    padding: 16px;
    border-radius: 14px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.16);
  }

  .project-page .matrix-table tr {
    border: 1px solid rgba(135,151,186,0.18);
    background: linear-gradient(180deg, rgba(13,18,31,0.97), rgba(8,12,22,0.99));
  }

  body.theme-light.project-page .matrix-table tr {
    border: 1px solid rgba(160,151,97,0.36);
    background: linear-gradient(180deg, rgba(255,252,234,0.96), rgba(244,238,211,0.98));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.58), 0 12px 24px rgba(0,0,0,0.16);
  }

  .project-page .matrix-table td,
  body.theme-light.project-page .matrix-table td {
    min-height: 0;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent !important;
  }

  .project-page .matrix-table td:nth-child(1),
  .project-page .matrix-table td:nth-child(2),
  .project-page .matrix-table td:nth-child(3),
  .project-page .matrix-table td:nth-child(7),
  body.theme-light.project-page .matrix-table td:nth-child(1),
  body.theme-light.project-page .matrix-table td:nth-child(2),
  body.theme-light.project-page .matrix-table td:nth-child(3),
  body.theme-light.project-page .matrix-table td:nth-child(7) {
    display: none !important;
  }

  .project-page .keyword-col,
  body.theme-light.project-page .keyword-col {
    order: 1;
    padding-right: 74px;
    position: static !important;
    box-shadow: none !important;
  }

  .project-page .matrix-keyword,
  body.theme-light.project-page .matrix-keyword {
    display: block;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    font-size: 18px;
    line-height: 1.28;
    font-weight: 850;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .project-page .matrix-keyword {
    color: #f7f9ff;
  }

  body.theme-light.project-page .matrix-keyword {
    color: #11130d;
  }

  .project-page .matrix-frequency,
  body.theme-light.project-page .matrix-frequency {
    order: 2;
    display: inline-flex;
    width: fit-content !important;
    min-width: 0 !important;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
  }

  .project-page .matrix-frequency {
    border: 1px solid rgba(135,151,186,0.18);
    background: rgba(255,255,255,0.06) !important;
    color: rgba(225,230,242,0.82);
  }

  body.theme-light.project-page .matrix-frequency {
    border: 1px solid rgba(160,151,97,0.24);
    background: rgba(90,92,49,0.08) !important;
    color: #4f4c31;
  }

  .project-page .matrix-frequency::before,
  body.theme-light.project-page .matrix-frequency::before {
    content: "Частота: ";
    margin-right: 4px;
    font-weight: 700;
  }

  .project-page .matrix-positions-cell,
  body.theme-light.project-page .matrix-positions-cell {
    order: 3;
    display: block;
    min-width: 0;
    padding-top: 6px;
  }

  .project-page .matrix-positions-cell {
    border-top: 1px solid rgba(135,151,186,0.14);
  }

  body.theme-light.project-page .matrix-positions-cell {
    border-top: 1px solid rgba(160,151,97,0.18);
  }

  .project-page .matrix-positions-cell::before,
  body.theme-light.project-page .matrix-positions-cell::before {
    content: "История позиций";
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .project-page .matrix-positions-cell::before {
    color: rgba(225,230,242,0.52);
  }

  body.theme-light.project-page .matrix-positions-cell::before {
    color: #77704d;
  }

  .project-page .matrix-positions-cell > .rank-badge,
  body.theme-light.project-page .matrix-positions-cell > .rank-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    min-width: 52px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    font-size: 20px;
    font-weight: 900;
  }

  .project-page .matrix-history,
  body.theme-light.project-page .matrix-history {
    margin-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .project-page .history-chip,
  body.theme-light.project-page .history-chip {
    min-width: 34px;
    min-height: 30px;
    border-radius: 9px;
    font-size: 14px;
  }
}

/* Theme switch geometry lock: colors change, layout stays put */
:root {
  --theme-transition-speed: 560ms;
  --theme-transition-ease: cubic-bezier(.16, 1, .3, 1);
}

html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after,
body.theme-switching *,
body.theme-switching *::before,
body.theme-switching *::after {
  transition:
    background-color var(--theme-transition-speed) var(--theme-transition-ease),
    background var(--theme-transition-speed) var(--theme-transition-ease),
    border-color var(--theme-transition-speed) var(--theme-transition-ease),
    color var(--theme-transition-speed) var(--theme-transition-ease),
    box-shadow var(--theme-transition-speed) var(--theme-transition-ease),
    opacity var(--theme-transition-speed) var(--theme-transition-ease),
    fill var(--theme-transition-speed) var(--theme-transition-ease),
    stroke var(--theme-transition-speed) var(--theme-transition-ease) !important;
}

body.home-page,
body.theme-light.home-page,
body.project-page,
body.theme-light.project-page {
  min-width: 0;
}

body.home-page header,
body.theme-light.home-page header,
body.project-page header,
body.theme-light.project-page header {
  margin: 8px 8px 24px;
  padding: 0;
  border-radius: 12px;
}

body.home-page > .container,
body.theme-light.home-page > .container {
  width: min(100% - 32px, 1440px);
  max-width: 1440px;
  padding: 0;
}

body.project-page > .container,
body.theme-light.project-page > .container {
  width: calc(100vw - 40px);
  max-width: none;
  padding: 0;
}

body.home-page header .container,
body.theme-light.home-page header .container,
body.project-page header .container,
body.theme-light.project-page header .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 22px;
}

body.theme-switching::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  background: rgba(255,255,255,0.035);
  animation: themeVeil 620ms var(--theme-transition-ease) both;
}

body.home-page .header-content,
body.theme-light.home-page .header-content,
body.project-page .header-content,
body.theme-light.project-page .header-content {
  min-height: 136px;
  grid-template-columns: minmax(380px, 1fr) minmax(620px, 780px);
  gap: 24px;
  align-items: center;
}

body.home-page .account-console,
body.theme-light.home-page .account-console,
body.project-page .account-console,
body.theme-light.project-page .account-console {
  width: min(100%, 780px);
  justify-self: end;
}

body.home-page .account-console-top,
body.theme-light.home-page .account-console-top,
body.project-page .account-console-top,
body.theme-light.project-page .account-console-top {
  min-height: 74px;
  grid-template-columns: 98px minmax(160px, 1fr) minmax(260px, 1.2fr) 64px;
  gap: 16px;
  padding: 12px 16px;
}

body.home-page .account-console.no-settings .account-console-top,
body.theme-light.home-page .account-console.no-settings .account-console-top,
body.project-page .account-console.no-settings .account-console-top,
body.theme-light.project-page .account-console.no-settings .account-console-top {
  grid-template-columns: 98px minmax(160px, 1fr) minmax(260px, 1.2fr);
}

body.home-page .account-console-actions,
body.theme-light.home-page .account-console-actions,
body.project-page .account-console-actions,
body.theme-light.project-page .account-console-actions {
  grid-template-columns: minmax(136px, 1fr) minmax(150px, 1.15fr) minmax(210px, 1.55fr) minmax(112px, .85fr);
  gap: 12px;
}

body.home-page .logo,
body.theme-light.home-page .logo,
body.project-page .logo,
body.theme-light.project-page .logo {
  font-size: 28px;
  gap: 14px;
}

body.home-page .logo i,
body.theme-light.home-page .logo i,
body.project-page .logo i,
body.theme-light.project-page .logo i {
  font-size: 34px;
}

body.home-page .app-badge,
body.theme-light.home-page .app-badge,
body.project-page .app-badge,
body.theme-light.project-page .app-badge {
  height: 31px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 16px;
}

body.home-page .home-stats,
body.theme-light.home-page .home-stats {
  gap: 10px;
}

body.home-page .summary-item,
body.theme-light.home-page .summary-item,
body.project-page .summary-item,
body.theme-light.project-page .summary-item {
  min-height: 70px;
  padding: 14px;
}

body.home-page .summary-item b,
body.theme-light.home-page .summary-item b,
body.project-page .summary-item b,
body.theme-light.project-page .summary-item b {
  font-size: 22px;
  line-height: 1.1;
}

body.home-page .home-project-toolbar,
body.theme-light.home-page .home-project-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 190px 190px;
  gap: 12px;
}

body.home-page .project-table,
body.theme-light.home-page .project-table {
  min-width: 1120px;
  table-layout: fixed;
}

body.home-page .project-table th:nth-child(1),
body.home-page .project-table td:nth-child(1),
body.theme-light.home-page .project-table th:nth-child(1),
body.theme-light.home-page .project-table td:nth-child(1) { width: 56px; }
body.home-page .project-table th:nth-child(2),
body.home-page .project-table td:nth-child(2),
body.theme-light.home-page .project-table th:nth-child(2),
body.theme-light.home-page .project-table td:nth-child(2) { width: 270px; }
body.home-page .project-table th:nth-child(3),
body.home-page .project-table td:nth-child(3),
body.theme-light.home-page .project-table th:nth-child(3),
body.theme-light.home-page .project-table td:nth-child(3) { width: 220px; }
body.home-page .project-table th:nth-child(4),
body.home-page .project-table td:nth-child(4),
body.theme-light.home-page .project-table th:nth-child(4),
body.theme-light.home-page .project-table td:nth-child(4) { width: 95px; text-align: center; }
body.home-page .project-table th:nth-child(5),
body.home-page .project-table td:nth-child(5),
body.theme-light.home-page .project-table th:nth-child(5),
body.theme-light.home-page .project-table td:nth-child(5) { width: 140px; text-align: center; }
body.home-page .project-table th:nth-child(6),
body.home-page .project-table td:nth-child(6),
body.theme-light.home-page .project-table th:nth-child(6),
body.theme-light.home-page .project-table td:nth-child(6) { width: 135px; text-align: center; }
body.home-page .project-table th:nth-child(7),
body.home-page .project-table td:nth-child(7),
body.theme-light.home-page .project-table th:nth-child(7),
body.theme-light.home-page .project-table td:nth-child(7) { width: 155px; text-align: center; }
body.home-page .project-table th:nth-child(8),
body.home-page .project-table td:nth-child(8),
body.theme-light.home-page .project-table th:nth-child(8),
body.theme-light.home-page .project-table td:nth-child(8) { width: 150px; }

body.project-page .matrix-table,
body.theme-light.project-page .matrix-table {
  min-width: 1120px;
  table-layout: fixed;
}

body.project-page .matrix-table th:nth-child(1),
body.project-page .matrix-table td:nth-child(1),
body.theme-light.project-page .matrix-table th:nth-child(1),
body.theme-light.project-page .matrix-table td:nth-child(1) { width: 116px; }
body.project-page .matrix-table th:nth-child(2),
body.project-page .matrix-table td:nth-child(2),
body.theme-light.project-page .matrix-table th:nth-child(2),
body.theme-light.project-page .matrix-table td:nth-child(2) { width: 150px; }
body.project-page .matrix-table th:nth-child(3),
body.project-page .matrix-table td:nth-child(3),
body.theme-light.project-page .matrix-table th:nth-child(3),
body.theme-light.project-page .matrix-table td:nth-child(3) { width: 96px; }
body.project-page .matrix-table th:nth-child(4),
body.project-page .matrix-table td:nth-child(4),
body.theme-light.project-page .matrix-table th:nth-child(4),
body.theme-light.project-page .matrix-table td:nth-child(4) { width: 110px; text-align: center; }
body.project-page .matrix-table th:nth-child(5),
body.project-page .matrix-table td:nth-child(5),
body.theme-light.project-page .matrix-table th:nth-child(5),
body.theme-light.project-page .matrix-table td:nth-child(5) { width: 330px; }
body.project-page .matrix-table th:nth-child(6),
body.project-page .matrix-table td:nth-child(6),
body.theme-light.project-page .matrix-table th:nth-child(6),
body.theme-light.project-page .matrix-table td:nth-child(6) { width: 210px; }
body.project-page .matrix-table th:nth-child(7),
body.project-page .matrix-table td:nth-child(7),
body.theme-light.project-page .matrix-table th:nth-child(7),
body.theme-light.project-page .matrix-table td:nth-child(7) { width: 110px; text-align: center; }

@media (max-width: 1100px) {
  body.home-page .header-content,
  body.theme-light.home-page .header-content,
  body.project-page .header-content,
  body.theme-light.project-page .header-content {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  body.home-page .account-console,
  body.theme-light.home-page .account-console,
  body.project-page .account-console,
  body.theme-light.project-page .account-console {
    justify-self: stretch;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 900px) {
  body.project-page .matrix-table,
  body.theme-light.project-page .matrix-table {
    min-width: 0 !important;
    table-layout: auto;
  }
}

@media (max-width: 760px) {
  body.home-page .header-content,
  body.theme-light.home-page .header-content,
  body.project-page .header-content,
  body.theme-light.project-page .header-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 0;
  }

  body.home-page .logo,
  body.theme-light.home-page .logo,
  body.project-page .logo,
  body.theme-light.project-page .logo {
    font-size: 20px;
    gap: 8px;
  }

  body.home-page .logo i,
  body.theme-light.home-page .logo i,
  body.project-page .logo i,
  body.theme-light.project-page .logo i {
    font-size: 24px;
  }

  body.home-page .account-console-top,
  body.theme-light.home-page .account-console-top,
  body.project-page .account-console-top,
  body.theme-light.project-page .account-console-top {
    grid-template-columns: 68px minmax(0, 1fr) 44px;
    gap: 10px;
    padding: 10px;
  }

  body.home-page .account-console.no-settings .account-console-top,
  body.theme-light.home-page .account-console.no-settings .account-console-top,
  body.project-page .account-console.no-settings .account-console-top,
  body.theme-light.project-page .account-console.no-settings .account-console-top {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  body.home-page .account-console-actions,
  body.theme-light.home-page .account-console-actions,
  body.project-page .account-console-actions,
  body.theme-light.project-page .account-console-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.home-page .home-project-toolbar,
  body.theme-light.home-page .home-project-toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.home-page .project-table,
  body.theme-light.home-page .project-table {
    min-width: 0;
  }
}

/* =========================
   Stage 1 design system
========================= */

:root {
  color-scheme: light;

  --pa-bg: #f3f5f8;
  --pa-surface: #ffffff;
  --pa-surface-muted: #f8fafc;
  --pa-surface-inset: #eef2f7;
  --pa-text: #141b2d;
  --pa-text-muted: #667085;
  --pa-text-subtle: #8a94a6;
  --pa-border: #d9e1ec;
  --pa-border-subtle: #e8edf4;
  --pa-accent: #2563eb;
  --pa-accent-hover: #1d4ed8;
  --pa-accent-soft: #e8f0ff;
  --pa-success: #16a34a;
  --pa-success-soft: #e8f7ee;
  --pa-danger: #dc2626;
  --pa-danger-soft: #fdecec;
  --pa-warning: #d97706;
  --pa-warning-soft: #fff4df;
  --pa-neutral: #64748b;
  --pa-neutral-soft: #eef2f7;

  --status-green: var(--pa-success);
  --status-red: var(--pa-danger);
  --status-yellow: var(--pa-warning);
  --status-neutral: var(--pa-neutral);

  --pa-radius-sm: 8px;
  --pa-radius-md: 10px;
  --pa-radius-card: 12px;
  --pa-control-height: 42px;
  --pa-space-card: 22px;
  --pa-shadow-sm: 0 1px 2px rgba(20, 27, 45, 0.05);
  --pa-shadow-md: 0 10px 28px rgba(20, 27, 45, 0.08);

  --bg: var(--pa-bg);
  --panel: var(--pa-surface);
  --panel2: var(--pa-surface-muted);
  --border: var(--pa-border);
  --border2: var(--pa-border-subtle);
  --text: var(--pa-text);
  --muted: var(--pa-text-muted);
  --muted2: var(--pa-text-subtle);
  --accent: var(--pa-accent);
  --accent2: var(--pa-accent-hover);
  --matrix-bg: var(--pa-surface);
  --matrix-bg-2: var(--pa-surface-muted);
  --matrix-bg-3: var(--pa-surface-inset);
  --matrix-line: rgba(20, 27, 45, 0.10);
  --matrix-line-soft: rgba(20, 27, 45, 0.07);
}

body.theme-light,
body.login-page,
body.lead-page,
body.monitoring-page {
  color-scheme: light;
  --pa-bg: #f3f5f8;
  --pa-surface: #ffffff;
  --pa-surface-muted: #f8fafc;
  --pa-surface-inset: #eef2f7;
  --pa-text: #141b2d;
  --pa-text-muted: #667085;
  --pa-text-subtle: #8a94a6;
  --pa-border: #d9e1ec;
  --pa-border-subtle: #e8edf4;
  --pa-accent: #2563eb;
  --pa-accent-hover: #1d4ed8;
  --pa-accent-soft: #e8f0ff;
  --pa-success: #16a34a;
  --pa-success-soft: #e8f7ee;
  --pa-danger: #dc2626;
  --pa-danger-soft: #fdecec;
  --pa-warning: #d97706;
  --pa-warning-soft: #fff4df;
  --pa-neutral: #64748b;
  --pa-neutral-soft: #eef2f7;
  --bg: var(--pa-bg);
  --panel: var(--pa-surface);
  --panel2: var(--pa-surface-muted);
  --border: var(--pa-border);
  --border2: var(--pa-border-subtle);
  --text: var(--pa-text);
  --muted: var(--pa-text-muted);
  --muted2: var(--pa-text-subtle);
  --accent: var(--pa-accent);
  --accent2: var(--pa-accent-hover);
  --matrix-bg: var(--pa-surface);
  --matrix-bg-2: var(--pa-surface-muted);
  --matrix-bg-3: var(--pa-surface-inset);
  --matrix-line: rgba(20, 27, 45, 0.10);
  --matrix-line-soft: rgba(20, 27, 45, 0.07);
}

body.home-page:not(.theme-light),
body.project-page:not(.theme-light) {
  color-scheme: dark;
  --pa-bg: #111827;
  --pa-surface: #182231;
  --pa-surface-muted: #202c3d;
  --pa-surface-inset: #101722;
  --pa-text: #f6f8fb;
  --pa-text-muted: #a7b1c2;
  --pa-text-subtle: #7f8a9b;
  --pa-border: #324056;
  --pa-border-subtle: #263448;
  --pa-accent: #60a5fa;
  --pa-accent-hover: #93c5fd;
  --pa-accent-soft: rgba(96, 165, 250, 0.16);
  --pa-success: #4ade80;
  --pa-success-soft: rgba(74, 222, 128, 0.14);
  --pa-danger: #f87171;
  --pa-danger-soft: rgba(248, 113, 113, 0.14);
  --pa-warning: #fbbf24;
  --pa-warning-soft: rgba(251, 191, 36, 0.15);
  --pa-neutral: #a7b1c2;
  --pa-neutral-soft: rgba(167, 177, 194, 0.13);
  --pa-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.16);
  --pa-shadow-md: 0 12px 30px rgba(0, 0, 0, 0.24);
  --bg: var(--pa-bg);
  --panel: var(--pa-surface);
  --panel2: var(--pa-surface-muted);
  --border: var(--pa-border);
  --border2: var(--pa-border-subtle);
  --text: var(--pa-text);
  --muted: var(--pa-text-muted);
  --muted2: var(--pa-text-subtle);
  --accent: var(--pa-accent);
  --accent2: var(--pa-accent-hover);
  --matrix-bg: var(--pa-surface);
  --matrix-bg-2: var(--pa-surface-muted);
  --matrix-bg-3: var(--pa-surface-inset);
  --matrix-line: rgba(246, 248, 251, 0.12);
  --matrix-line-soft: rgba(246, 248, 251, 0.07);
}

body,
body.home-page,
body.project-page,
body.theme-light.home-page,
body.theme-light.project-page,
body.login-page,
body.lead-page,
body.monitoring-page {
  background: var(--pa-bg) !important;
  color: var(--pa-text) !important;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

.container {
  width: min(100% - 32px, 1440px);
}

body.project-page > .container,
body.theme-light.project-page > .container {
  width: min(100% - 32px, 1520px);
}

body.home-page header,
body.theme-light.home-page header,
body.project-page header,
body.theme-light.project-page header,
header,
.lead-header {
  background: var(--pa-surface) !important;
  border: 1px solid var(--pa-border) !important;
  border-radius: var(--pa-radius-card) !important;
  box-shadow: var(--pa-shadow-sm) !important;
}

body.home-page header,
body.project-page header,
body.theme-light.home-page header,
body.theme-light.project-page header {
  margin: 12px auto 28px;
  width: min(100% - 24px, 1520px);
}

body.home-page header .container,
body.theme-light.home-page header .container,
body.project-page header .container,
body.theme-light.project-page header .container {
  padding: 0 20px;
}

body.home-page .header-content,
body.theme-light.home-page .header-content,
body.project-page .header-content,
body.theme-light.project-page .header-content {
  min-height: 96px;
  grid-template-columns: minmax(280px, 1fr) minmax(520px, 720px);
}

.logo a,
.lead-logo {
  color: var(--pa-text) !important;
  letter-spacing: 0;
}

.logo i,
.lead-logo,
.project-domain-link,
.project-table a,
.matrix-site-cell a,
.lead-table a {
  color: var(--pa-accent) !important;
}

.app-badge,
body.theme-light .app-badge,
body.theme-light.home-page .app-badge,
body.theme-light.project-page .app-badge {
  background: var(--pa-accent-soft) !important;
  color: var(--pa-accent) !important;
  border: 1px solid color-mix(in srgb, var(--pa-accent), transparent 78%);
  border-radius: var(--pa-radius-sm);
  font-weight: 800;
}

h1,
h2,
h3,
.section-title,
.results-title,
.lead-panel h1,
.modal-header h2 {
  color: var(--pa-text) !important;
  letter-spacing: 0;
}

.section-title {
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.2;
}

.home-section-head p,
.manual-card-head p,
.project-card p,
.folder-header span,
.project-meta-row,
.project-update-row,
.modal-header p,
.lead-panel p,
.lead-header span,
.summary-item span,
.summary-item em,
.account-identity span,
.account-console-billing span,
.admin-user-meta,
.admin-xml-card p {
  color: var(--pa-text-muted) !important;
}

.summary-item b,
.project-stats b,
.mon-value,
.rank-badge,
.history-chip,
.matrix-pos,
.badge .num,
.project-position-badge,
.avg-position {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  color: var(--pa-text);
}

.card,
.home-panel,
.home-page .manual-tools .card,
.home-page .manual-tools .card:nth-child(2),
.project-card,
.project-folder,
.summary-item,
.project-info,
.matrix-card,
.keyword-actions,
.results,
.lead-panel,
.lead-table-section,
.admin-panel,
.admin-user-row,
.admin-access-row,
.admin-xml-card,
.account-menu,
.account-console-top,
.account-console-actions,
.login-card,
.modal-content,
.keyword-history-content,
.project-table-shell,
.matrix-shell,
.keywords-table-wrapper,
.frequency-table-wrap {
  background: var(--pa-surface) !important;
  border: 1px solid var(--pa-border) !important;
  border-radius: var(--pa-radius-card) !important;
  box-shadow: var(--pa-shadow-sm) !important;
  color: var(--pa-text) !important;
}

.home-panel,
.project-info,
.matrix-card,
.lead-panel,
.lead-table-section,
.modal-content,
.keyword-history-content,
.login-card {
  padding: var(--pa-space-card) !important;
}

.manual-card,
.project-card,
.summary-item,
.admin-user-row,
.admin-access-row,
.admin-xml-card {
  padding: 18px !important;
}

.home-page .manual-card-head span,
.home-page .manual-card:nth-child(2) .manual-card-head span,
.manual-card-head span,
.summary-item > i,
.project-avatar,
body.theme-light.project-page .project-avatar {
  background: var(--pa-accent-soft) !important;
  color: var(--pa-accent) !important;
  border: 1px solid color-mix(in srgb, var(--pa-accent), transparent 76%) !important;
  box-shadow: none !important;
}

.hero-wave,
.home-page::before,
.home-page::after,
.project-page::before,
.project-page::after {
  display: none !important;
}

.btn,
.icon-btn,
.account-pill,
.account-action,
.inline-edit,
.close,
.range-presets button,
.schedule-days button,
.project-pagination .icon-btn,
.lead-link {
  min-height: var(--pa-control-height);
  border: 1px solid var(--pa-border) !important;
  border-radius: var(--pa-radius-md) !important;
  background: var(--pa-surface) !important;
  color: var(--pa-text) !important;
  box-shadow: none !important;
  font-weight: 750;
  letter-spacing: 0;
}

.btn:hover,
.icon-btn:hover,
.account-pill:hover,
.account-action:hover,
.inline-edit:hover,
.range-presets button:hover,
.schedule-days button:hover,
.lead-link:hover {
  background: var(--pa-surface-muted) !important;
  border-color: color-mix(in srgb, var(--pa-accent), var(--pa-border) 55%) !important;
  color: var(--pa-accent) !important;
}

.btn-primary,
.btn.active,
.range-presets button.active,
.schedule-days button.active,
body.theme-light .btn-primary,
body.theme-light .btn.active,
body.theme-light.home-page .btn-primary {
  background: var(--pa-accent) !important;
  border-color: var(--pa-accent) !important;
  color: #ffffff !important;
}

.btn-primary:hover,
.btn.active:hover {
  background: var(--pa-accent-hover) !important;
  border-color: var(--pa-accent-hover) !important;
  color: #ffffff !important;
}

.btn-danger {
  background: var(--pa-danger) !important;
  border-color: var(--pa-danger) !important;
  color: #ffffff !important;
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--pa-danger), #000000 12%) !important;
  border-color: color-mix(in srgb, var(--pa-danger), #000000 12%) !important;
  color: #ffffff !important;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
textarea,
select,
.input-icon,
.matrix-search-wrap,
.home-project-toolbar .matrix-search-wrap,
.project-page .matrix-search-wrap,
.matrix-filter-count,
.admin-billing-input,
.admin-user-credentials input,
.admin-create-user input,
.admin-create-user select,
.lead-form input,
.lead-form textarea,
.lead-table select,
.lead-table textarea {
  min-height: var(--pa-control-height);
  border: 1px solid var(--pa-border) !important;
  border-radius: var(--pa-radius-md) !important;
  background: var(--pa-surface) !important;
  color: var(--pa-text) !important;
  box-shadow: none !important;
}

textarea {
  min-height: 120px;
}

input::placeholder,
textarea::placeholder {
  color: var(--pa-text-subtle) !important;
}

input:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus,
.matrix-search:focus {
  border-color: var(--pa-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pa-accent), transparent 84%) !important;
  outline: none !important;
}

label,
.project-page .matrix-toolbar label,
.project-page .matrix-filters label {
  color: var(--pa-text) !important;
  font-size: 13px;
  font-weight: 750;
}

.home-project-toolbar,
.matrix-toolbar,
.compare-panel,
.range-panel,
.schedule-panel,
.access-settings,
.admin-create-user,
.admin-access-main,
.lead-form {
  background: var(--pa-surface-muted) !important;
  border: 1px solid var(--pa-border-subtle) !important;
  border-radius: var(--pa-radius-card) !important;
  box-shadow: none !important;
}

.home-project-toolbar,
.matrix-toolbar,
.compare-panel,
.range-panel,
.schedule-panel,
.lead-form {
  padding: 14px !important;
}

.account-console-top,
.account-console-actions {
  background: var(--pa-surface-muted) !important;
}

.account-console-billing > div,
.account-action {
  background: var(--pa-surface) !important;
  border-color: var(--pa-border) !important;
}

.account-action-telegram,
.account-action-phone {
  color: var(--pa-accent) !important;
}

.account-action-logout {
  color: var(--pa-danger) !important;
}

.account-action-theme i:first-child {
  color: var(--pa-warning) !important;
}

.account-action-theme i:nth-child(2) {
  color: var(--pa-neutral) !important;
}

.alert {
  background: var(--pa-surface) !important;
  border: 1px solid var(--pa-border) !important;
  border-left: 4px solid var(--pa-neutral) !important;
  color: var(--pa-text) !important;
  border-radius: var(--pa-radius-md) !important;
  box-shadow: var(--pa-shadow-md) !important;
}

.alert-success,
.lead-status.ok {
  background: var(--pa-success-soft) !important;
  border-color: color-mix(in srgb, var(--pa-success), transparent 68%) !important;
  border-left-color: var(--pa-success) !important;
  color: color-mix(in srgb, var(--pa-success), #111827 22%) !important;
}

.alert-error,
.login-error,
.lead-status.error {
  background: var(--pa-danger-soft) !important;
  border-color: color-mix(in srgb, var(--pa-danger), transparent 68%) !important;
  border-left-color: var(--pa-danger) !important;
  color: color-mix(in srgb, var(--pa-danger), #111827 18%) !important;
}

.lead-status.work,
.admin-xml-card.warn {
  background: var(--pa-warning-soft) !important;
  border-color: color-mix(in srgb, var(--pa-warning), transparent 68%) !important;
  color: color-mix(in srgb, var(--pa-warning), #111827 28%) !important;
}

.admin-xml-card.ok {
  background: var(--pa-success-soft) !important;
  border-color: color-mix(in srgb, var(--pa-success), transparent 70%) !important;
}

.access-pill,
.tracking-status,
.footer-status,
.project-position-badge,
.avg-position,
.pill,
.position-top3,
.position-top10,
.position-top30,
.position-top100,
.position-not-found,
.badge,
.intent-badge,
.rank-badge,
.history-chip,
.delta,
.rank-change {
  border-radius: 999px !important;
  border: 1px solid transparent;
  box-shadow: none !important;
  text-shadow: none !important;
}

.access-on,
.tracking-status,
.position-top3,
.badge-top3,
.rank-badge.pos-good,
.history-chip.pos-good,
.matrix-pos.pos-good,
.delta-up,
.change-up {
  background: var(--pa-success-soft) !important;
  border-color: color-mix(in srgb, var(--pa-success), transparent 74%) !important;
  color: var(--pa-success) !important;
}

.position-top10,
.badge-top10,
.rank-badge.pos-top10,
.history-chip.pos-top10 {
  background: var(--pa-accent-soft) !important;
  border-color: color-mix(in srgb, var(--pa-accent), transparent 74%) !important;
  color: var(--pa-accent) !important;
}

.position-top30,
.badge-top30,
.rank-badge.pos-mid,
.history-chip.pos-mid,
.matrix-pos.pos-mid {
  background: var(--pa-warning-soft) !important;
  border-color: color-mix(in srgb, var(--pa-warning), transparent 72%) !important;
  color: var(--pa-warning) !important;
}

.position-top100,
.badge-top100,
.rank-badge.pos-bad,
.history-chip.pos-bad,
.matrix-pos.pos-bad,
.delta-down,
.change-down,
.access-off,
.position-not-found,
.badge-notfound {
  background: var(--pa-danger-soft) !important;
  border-color: color-mix(in srgb, var(--pa-danger), transparent 74%) !important;
  color: var(--pa-danger) !important;
}

.access-muted,
.tracking-status.tracking-muted,
.rank-badge.pos-neutral,
.history-chip.pos-neutral,
.matrix-pos.pos-neutral,
.delta-same {
  background: var(--pa-neutral-soft) !important;
  border-color: color-mix(in srgb, var(--pa-neutral), transparent 78%) !important;
  color: var(--pa-neutral) !important;
}

.project-table,
.matrix-table,
.keywords-table,
.frequency-table,
.lead-table,
.mon-table {
  background: var(--pa-surface) !important;
  color: var(--pa-text) !important;
  border-collapse: separate;
  border-spacing: 0;
}

.project-table th,
.project-table td,
.matrix-table th,
.matrix-table td,
.keywords-table th,
.keywords-table td,
.frequency-table th,
.frequency-table td,
.lead-table th,
.lead-table td {
  border-color: var(--pa-border-subtle) !important;
  color: var(--pa-text) !important;
}

.project-table th,
.matrix-table thead th,
.keywords-table thead th,
.frequency-table th,
.lead-table th,
.mon-table th {
  background: var(--pa-surface-muted) !important;
  color: var(--pa-text-muted) !important;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.project-table td,
.matrix-table tbody td,
.keywords-table tbody td,
.frequency-table td,
.lead-table td {
  background: var(--pa-surface) !important;
}

.project-table tbody tr:nth-child(even) td,
.matrix-table tbody tr:nth-child(odd) td,
.keywords-table tbody tr:nth-child(even) td,
.frequency-table tr:nth-child(even) td {
  background: var(--pa-surface-muted) !important;
}

.project-table tbody tr:hover td,
.matrix-table tbody tr:hover td,
.keywords-table tbody tr:hover td,
.frequency-table tr:hover td,
.lead-table tbody tr:hover td {
  background: color-mix(in srgb, var(--pa-accent-soft), var(--pa-surface) 45%) !important;
}

.project-page .sticky-col,
.project-page .matrix-table tbody td.sticky-col,
.project-page .matrix-keyword,
body.theme-light.project-page .sticky-col,
body.theme-light.project-page .matrix-keyword {
  background: var(--pa-surface) !important;
  color: var(--pa-text) !important;
  box-shadow: 10px 0 18px rgba(20, 27, 45, 0.06) !important;
}

.matrix-keyword,
.project-table-name b,
.project-name-cell b,
.manual-keyword,
.result-keyword {
  color: var(--pa-text) !important;
  font-weight: 800;
}

.matrix-frequency,
.matrix-frequency-head,
.manual-url,
.project-table-name em,
.project-name-cell small,
.project-index,
.project-table-footer,
.matrix-empty,
.empty {
  color: var(--pa-text-muted) !important;
}

.project-page .matrix-pos,
.project-page .matrix-pos.pos-good,
.project-page .matrix-pos.pos-mid,
.project-page .matrix-pos.pos-bad,
.project-page .matrix-pos.pos-neutral {
  font-size: 18px;
  font-weight: 850;
}

.modal {
  background: rgba(15, 23, 42, 0.48) !important;
  backdrop-filter: blur(3px);
}

.modal-header {
  border-bottom: 1px solid var(--pa-border-subtle) !important;
}

.modal-actions {
  border-top: 1px solid var(--pa-border-subtle);
  padding-top: 16px;
}

.close {
  width: 38px;
  height: 38px;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  color: var(--pa-text-muted) !important;
}

.loading {
  background: var(--pa-surface) !important;
  border: 1px solid var(--pa-border) !important;
  border-radius: var(--pa-radius-card) !important;
  box-shadow: var(--pa-shadow-md) !important;
}

.spinner {
  border-color: var(--pa-border) !important;
  border-top-color: var(--pa-accent) !important;
}

.progress-wrap {
  background: var(--pa-surface-inset) !important;
}

.progress-bar {
  background: var(--pa-accent) !important;
}

.home-footer {
  color: var(--pa-text-muted) !important;
  background: transparent !important;
}

.lead-shell {
  width: min(100% - 32px, 1440px);
  margin: 0 auto;
}

.lead-header {
  width: min(100% - 24px, 1440px);
  margin: 12px auto 24px;
  padding: 18px 22px;
}

.lead-table-wrap {
  border: 1px solid var(--pa-border) !important;
  border-radius: var(--pa-radius-card) !important;
  overflow: auto;
}

.lead-status {
  min-height: 42px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--pa-radius-md);
  color: var(--pa-text-muted);
}

.project-status-side,
body.theme-light.project-page .project-status-side {
  background: var(--pa-surface-muted) !important;
  border: 1px solid var(--pa-border-subtle) !important;
  border-radius: var(--pa-radius-card) !important;
}

.tooltip,
[role="tooltip"] {
  background: var(--pa-text) !important;
  color: var(--pa-surface) !important;
  border-radius: var(--pa-radius-sm) !important;
  box-shadow: var(--pa-shadow-md) !important;
}

.tabs,
.tab-list {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--pa-border);
}

.tab {
  min-height: var(--pa-control-height);
  border: 1px solid transparent;
  border-radius: var(--pa-radius-md) var(--pa-radius-md) 0 0;
  background: transparent;
  color: var(--pa-text-muted);
}

.tab.active,
.tab:hover {
  background: var(--pa-surface);
  border-color: var(--pa-border);
  color: var(--pa-accent);
}

@media (max-width: 1100px) {
  body.home-page .header-content,
  body.theme-light.home-page .header-content,
  body.project-page .header-content,
  body.theme-light.project-page .header-content {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .container,
  body.home-page > .container,
  body.theme-light.home-page > .container,
  body.project-page > .container,
  body.theme-light.project-page > .container,
  .lead-shell {
    width: min(100% - 20px, 100%);
  }

  body.home-page header,
  body.theme-light.home-page header,
  body.project-page header,
  body.theme-light.project-page header,
  .lead-header {
    width: min(100% - 16px, 100%);
    margin-top: 8px;
    margin-bottom: 18px;
    border-radius: var(--pa-radius-card) !important;
  }

  .home-panel,
  .project-info,
  .matrix-card,
  .lead-panel,
  .lead-table-section,
  .modal-content,
  .keyword-history-content,
  .login-card {
    padding: 16px !important;
  }

  .btn,
  .icon-btn,
  .account-action,
  .lead-link {
    min-height: 40px;
  }

  body.home-page .account-console-actions,
  body.theme-light.home-page .account-console-actions,
  body.project-page .account-console-actions,
  body.theme-light.project-page .account-console-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* Stage 1 contrast repairs for legacy high-specificity theme rules */
body.theme-light .account-identity b,
body.theme-light .account-console-billing b,
body.theme-light .home-page .summary-item b,
body.theme-light.home-page .summary-item b,
body.theme-light.project-page .summary-item b,
body.theme-light .summary-item b,
body.theme-light .project-stats b,
body.theme-light.project-page .project-meta-row b,
body.theme-light.project-page .project-info strong,
body.theme-light.home-page .project-name-cell b,
body.theme-light.home-page .project-table a,
body.theme-light.project-page .matrix-keyword,
body.theme-light.project-page .matrix-frequency,
body.theme-light.project-page .rank-badge,
body.theme-light.project-page .history-chip,
body.theme-light.project-page .project-info h2 {
  color: var(--pa-text) !important;
  text-shadow: none !important;
}

body.theme-light .account-identity span,
body.theme-light .account-console-billing > div,
body.theme-light .account-console-billing span,
body.theme-light.home-page .summary-item span,
body.theme-light.home-page .summary-item em,
body.theme-light.project-page .summary-item span,
body.theme-light.project-page .summary-item em,
body.theme-light.project-page .project-meta-row,
body.theme-light.project-page .project-update-row,
body.theme-light.home-page .project-name-cell small,
body.theme-light.home-page .project-index,
body.theme-light.home-page .project-table-footer,
body.theme-light.project-page .matrix-empty {
  color: var(--pa-text-muted) !important;
}

body.theme-light .account-console-billing > div,
body.theme-light .account-console-top,
body.theme-light .account-console-actions {
  background: var(--pa-surface-muted) !important;
  border-color: var(--pa-border-subtle) !important;
}

body.theme-light.home-page .project-table th,
body.theme-light.project-page .matrix-table thead th,
body.theme-light.project-page .matrix-table thead th span,
body.theme-light .keywords-table thead th,
body.theme-light .frequency-table th {
  background: var(--pa-surface-muted) !important;
  color: var(--pa-text-muted) !important;
}

body.theme-light.home-page .project-table td,
body.theme-light.project-page .matrix-table tbody td,
body.theme-light .keywords-table tbody td,
body.theme-light .frequency-table td {
  background: var(--pa-surface) !important;
  color: var(--pa-text) !important;
}

body.theme-light.home-page .project-table tbody tr:nth-child(even) td,
body.theme-light.home-page .project-table tbody tr:nth-child(odd) td,
body.theme-light.project-page .matrix-table tbody tr:nth-child(even) td,
body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) td,
body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) .keyword-col,
body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) .select-col,
body.theme-light .keywords-table tbody tr:nth-child(even) td,
body.theme-light .keywords-table tbody tr:nth-child(odd) td,
body.theme-light .frequency-table tr:nth-child(even) td {
  background: var(--pa-surface-muted) !important;
}

body.theme-light.home-page .project-table tbody tr:hover td,
body.theme-light.project-page .matrix-table tbody tr:hover td,
body.theme-light .keywords-table tbody tr:hover td,
body.theme-light .frequency-table tr:hover td {
  background: color-mix(in srgb, var(--pa-accent-soft), var(--pa-surface) 42%) !important;
}

body.theme-light.project-page .sticky-col,
body.theme-light.project-page .matrix-table tbody td.sticky-col,
body.theme-light.project-page .matrix-table tbody tr:nth-child(even) td.sticky-col,
body.theme-light.project-page .matrix-table tbody tr:nth-child(odd) td.sticky-col {
  background: var(--pa-surface) !important;
}

body.theme-light.project-page .compare-summary span,
body.theme-light.project-page .range-legend span,
body.theme-light.project-page .matrix-filter-count {
  background: var(--pa-neutral-soft) !important;
  border: 1px solid color-mix(in srgb, var(--pa-neutral), transparent 78%) !important;
  color: var(--pa-text-muted) !important;
  border-radius: var(--pa-radius-md) !important;
  box-shadow: none !important;
}

body.theme-light.project-page .compare-summary span:first-child,
body.theme-light.project-page .range-presets button.active {
  background: var(--pa-accent-soft) !important;
  border-color: color-mix(in srgb, var(--pa-accent), transparent 72%) !important;
  color: var(--pa-accent) !important;
}

/* Stage 1 point refinements */
body.theme-light,
body.login-page,
body.lead-page,
body.monitoring-page {
  --pa-bg: #e9eef5;
  --pa-surface-muted: #f4f7fb;
  --pa-surface-inset: #edf2f8;
  --pa-border: #d2dbe8;
  --pa-border-subtle: #e4eaf2;
  --pa-accent: #2563eb;
  --pa-accent-hover: #1d4ed8;
  --pa-accent-soft: #e7efff;
  --bg: var(--pa-bg);
  --panel: var(--pa-surface);
  --panel2: var(--pa-surface-muted);
  --border: var(--pa-border);
  --border2: var(--pa-border-subtle);
  --accent: var(--pa-accent);
  --accent2: var(--pa-accent-hover);
}

body.theme-retro {
  color-scheme: light;
  --pa-bg: #e6dfcb;
  --pa-surface: #fffaf0;
  --pa-surface-muted: #f3ecd8;
  --pa-surface-inset: #ebe1c5;
  --pa-text: #1f241c;
  --pa-text-muted: #6d735f;
  --pa-text-subtle: #8a8f7c;
  --pa-border: #d6cdb3;
  --pa-border-subtle: #e4dcc6;
  --pa-accent: #2563eb;
  --pa-accent-hover: #1d4ed8;
  --pa-accent-soft: #e7efff;
  --pa-success: #15803d;
  --pa-success-soft: #e5f4e9;
  --pa-danger: #b91c1c;
  --pa-danger-soft: #f8e7e7;
  --pa-warning: #9a6a10;
  --pa-warning-soft: #f6edd5;
  --pa-neutral: #68715e;
  --pa-neutral-soft: #ece7d8;
  --bg: var(--pa-bg);
  --panel: var(--pa-surface);
  --panel2: var(--pa-surface-muted);
  --border: var(--pa-border);
  --border2: var(--pa-border-subtle);
  --text: var(--pa-text);
  --muted: var(--pa-text-muted);
  --muted2: var(--pa-text-subtle);
  --accent: var(--pa-accent);
  --accent2: var(--pa-accent-hover);
  --matrix-bg: var(--pa-surface);
  --matrix-bg-2: var(--pa-surface-muted);
  --matrix-bg-3: var(--pa-surface-inset);
  --matrix-line: rgba(31, 36, 28, 0.12);
  --matrix-line-soft: rgba(31, 36, 28, 0.08);
}

body.theme-retro,
body.theme-retro.home-page,
body.theme-retro.project-page {
  background: var(--pa-bg) !important;
  color: var(--pa-text) !important;
}

body.home-page header,
body.theme-light.home-page header,
body.theme-retro.home-page header,
body.project-page header,
body.theme-light.project-page header,
body.theme-retro.project-page header {
  margin: 10px auto 20px !important;
}

body.home-page .header-content,
body.theme-light.home-page .header-content,
body.theme-retro.home-page .header-content,
body.project-page .header-content,
body.theme-light.project-page .header-content,
body.theme-retro.project-page .header-content {
  min-height: 68px !important;
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) auto !important;
  gap: 18px !important;
  align-items: center !important;
}

body.home-page .logo,
body.theme-light.home-page .logo,
body.theme-retro.home-page .logo,
body.project-page .logo,
body.theme-light.project-page .logo,
body.theme-retro.project-page .logo {
  font-size: 24px !important;
  gap: 10px !important;
}

body.home-page .logo i,
body.theme-light.home-page .logo i,
body.theme-retro.home-page .logo i,
body.project-page .logo i,
body.theme-light.project-page .logo i,
body.theme-retro.project-page .logo i {
  font-size: 27px !important;
}

body.home-page .app-badge,
body.theme-light.home-page .app-badge,
body.theme-retro.home-page .app-badge,
body.project-page .app-badge,
body.theme-light.project-page .app-badge,
body.theme-retro.project-page .app-badge {
  height: 28px !important;
  font-size: 14px !important;
}

.app-header-tools {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.theme-menu-wrap,
.account-menu-wrap {
  position: relative;
  display: inline-flex;
}

.header-control {
  min-height: 40px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--pa-border) !important;
  border-radius: var(--pa-radius-md) !important;
  background: var(--pa-surface) !important;
  color: var(--pa-text) !important;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  box-shadow: none !important;
}

.header-control:hover {
  border-color: color-mix(in srgb, var(--pa-accent), var(--pa-border) 55%) !important;
  color: var(--pa-accent) !important;
}

.theme-menu-btn b {
  color: var(--pa-text-muted);
  font-weight: 750;
}

.header-icon {
  width: 40px;
  padding: 0;
}

.notification-btn {
  position: relative;
}

.notification-btn span {
  position: absolute;
  top: -6px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--pa-danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
  pointer-events: none;
}

.account-console-pill span,
.account-pill span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--pa-accent-soft);
  color: var(--pa-accent);
  font-size: 12px;
  font-weight: 850;
}

.header-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 500;
  display: none;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-card);
  background: var(--pa-surface);
  box-shadow: var(--pa-shadow-md);
}

.header-dropdown.show {
  display: grid;
  gap: 4px;
}

.theme-menu button,
.account-dropdown-item,
.account-dropdown button.account-dropdown-item {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: var(--pa-radius-sm);
  background: transparent;
  color: var(--pa-text);
  font: inherit;
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
}

.theme-menu button:hover,
.theme-menu button.active,
.account-dropdown-item:hover {
  background: var(--pa-accent-soft);
  color: var(--pa-accent);
}

.theme-menu button.active::after {
  content: "✓";
  margin-left: auto;
  font-weight: 900;
}

.account-dropdown {
  min-width: 280px;
}

.account-dropdown-head {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--pa-border-subtle);
}

.account-dropdown-head span {
  color: var(--pa-text);
  font-weight: 850;
}

.account-dropdown-head em {
  color: var(--pa-text-muted);
  font-style: normal;
  font-size: 12px;
}

.account-dropdown-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
}

.account-dropdown-metrics > div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: var(--pa-radius-sm);
  background: var(--pa-surface-muted);
}

.account-dropdown-metrics span {
  color: var(--pa-text-muted);
  font-size: 12px;
}

.account-dropdown-metrics b {
  color: var(--pa-text);
  font-size: 13px;
}

.account-action-logout,
.account-action-logout:hover {
  color: var(--pa-danger) !important;
}

.home-panel,
.project-info,
.matrix-card,
.lead-panel,
.lead-table-section,
.project-table-shell,
.matrix-shell,
.keywords-table-wrapper,
.frequency-table-wrap {
  border-color: var(--pa-border) !important;
  box-shadow: 0 1px 2px rgba(20, 27, 45, 0.035) !important;
}

.home-page .manual-tools .card,
.home-page .manual-tools .card:nth-child(2),
.home-project-toolbar,
.matrix-toolbar,
.compare-panel,
.range-panel,
.schedule-panel,
.access-settings,
.lead-form,
.admin-create-user,
.admin-access-main {
  border-color: transparent !important;
  background: var(--pa-surface-muted) !important;
  box-shadow: none !important;
}

.project-table th,
.project-table td,
.matrix-table th,
.matrix-table td,
.keywords-table th,
.keywords-table td,
.frequency-table th,
.frequency-table td {
  border-right-color: transparent !important;
}

body.theme-light .position-top30,
body.theme-light .badge-top30,
body.theme-light .rank-badge.pos-mid,
body.theme-light .history-chip.pos-mid,
body.theme-light .matrix-pos.pos-mid,
body.theme-light .avg-position,
body.theme-retro .position-top30,
body.theme-retro .badge-top30,
body.theme-retro .rank-badge.pos-mid,
body.theme-retro .history-chip.pos-mid,
body.theme-retro .matrix-pos.pos-mid,
body.theme-retro .avg-position {
  background: var(--pa-neutral-soft) !important;
  border-color: color-mix(in srgb, var(--pa-neutral), transparent 78%) !important;
  color: var(--pa-neutral) !important;
}

.project-row-menu {
  position: relative;
  display: inline-flex;
  justify-content: center;
}

.project-action-trigger {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
}

.project-action-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 420;
  display: none;
  min-width: 180px;
  padding: 7px;
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius-card);
  background: var(--pa-surface);
  box-shadow: var(--pa-shadow-md);
}

.project-action-menu.show {
  display: grid;
  gap: 3px;
}

.project-action-menu.is-fixed-menu {
  position: fixed !important;
  right: auto !important;
  z-index: 2147483647 !important;
}

.project-action-menu button {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: var(--pa-radius-sm);
  background: transparent;
  color: var(--pa-text);
  font: inherit;
  font-size: 13px;
  font-weight: 720;
  text-align: left;
  cursor: pointer;
}

.project-action-menu button:hover {
  background: var(--pa-accent-soft);
  color: var(--pa-accent);
}

.project-action-menu button.danger,
.project-action-menu button.danger:hover {
  color: var(--pa-danger);
}

.home-footer {
  margin-top: 28px !important;
  padding: 10px 0 14px !important;
}

.home-footer .container {
  min-height: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.home-footer .logo {
  font-size: 16px !important;
  gap: 8px !important;
}

.home-footer .app-badge {
  height: 22px !important;
  font-size: 12px !important;
}

.footer-status {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--pa-surface);
  border: 1px solid var(--pa-border-subtle);
  font-size: 12px;
}

@media (max-width: 900px) {
  body.home-page .header-content,
  body.theme-light.home-page .header-content,
  body.theme-retro.home-page .header-content,
  body.project-page .header-content,
  body.theme-light.project-page .header-content,
  body.theme-retro.project-page .header-content {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 12px 0 !important;
  }

  .app-header-tools {
    justify-content: stretch;
    width: 100%;
  }

  .theme-menu-wrap {
    flex: 1 1 auto;
  }

  .theme-menu-btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-header-tools {
    display: grid;
    grid-template-columns: 1fr 40px 54px;
    gap: 8px;
  }

  .theme-menu-btn {
    justify-content: flex-start;
  }

  .theme-menu-btn b {
    margin-left: auto;
  }

  .header-dropdown {
    right: 0;
    width: min(320px, calc(100vw - 24px));
  }

  .home-footer .container {
    align-items: flex-start !important;
    flex-direction: column;
  }
}

body.home-page.theme-retro,
body.project-page.theme-retro {
  color-scheme: light;
  --pa-bg: #e6dfcb;
  --pa-surface: #fffaf0;
  --pa-surface-muted: #f3ecd8;
  --pa-surface-inset: #ebe1c5;
  --pa-text: #1f241c;
  --pa-text-muted: #6d735f;
  --pa-text-subtle: #8a8f7c;
  --pa-border: #d6cdb3;
  --pa-border-subtle: #e4dcc6;
  --pa-accent: #2563eb;
  --pa-accent-hover: #1d4ed8;
  --pa-accent-soft: #e7efff;
  --pa-success: #15803d;
  --pa-success-soft: #e5f4e9;
  --pa-danger: #b91c1c;
  --pa-danger-soft: #f8e7e7;
  --pa-warning: #9a6a10;
  --pa-warning-soft: #f6edd5;
  --pa-neutral: #68715e;
  --pa-neutral-soft: #ece7d8;
  --pa-shadow-sm: 0 1px 2px rgba(63, 51, 28, 0.06);
  --pa-shadow-md: 0 14px 32px rgba(63, 51, 28, 0.12);
  --bg: var(--pa-bg);
  --panel: var(--pa-surface);
  --panel2: var(--pa-surface-muted);
  --border: var(--pa-border);
  --border2: var(--pa-border-subtle);
  --text: var(--pa-text);
  --muted: var(--pa-text-muted);
  --muted2: var(--pa-text-subtle);
  --accent: var(--pa-accent);
  --accent2: var(--pa-accent-hover);
  --matrix-bg: var(--pa-surface);
  --matrix-bg-2: var(--pa-surface-muted);
  --matrix-bg-3: var(--pa-surface-inset);
  --matrix-line: rgba(31, 36, 28, 0.12);
  --matrix-line-soft: rgba(31, 36, 28, 0.08);
  background: var(--pa-bg) !important;
  color: var(--pa-text) !important;
}

/* Premium white theme inspired by compact SaaS dashboards */
.premium-sidebar,
.premium-context,
.premium-dashboard,
.premium-project-dashboard {
  display: none;
}

body.home-page.theme-light-premium,
body.project-page.theme-light-premium {
  color-scheme: light !important;
  --page-bg: #ececea;
  --surface: #f7f7f5;
  --surface-white: #ffffff;
  --surface-muted: #f1f1ef;
  --surface-inset: #e8e8e3;
  --surface-dark: #20201f;
  --text-main: #1d1d1b;
  --text-secondary: #73736f;
  --text-muted: #9b9b96;
  --text-inverse: #ffffff;
  --border: #d8d8d3;
  --border-soft: #e7e7e2;
  --accent: #111111;
  --accent-secondary: #2f6fed;
  --success: #2f8f57;
  --danger: #c84d4d;
  --warning: #b38923;
  --pa-bg: var(--page-bg);
  --pa-surface: var(--surface-white);
  --pa-surface-muted: var(--surface-muted);
  --pa-surface-inset: var(--surface-inset);
  --pa-text: var(--text-main);
  --pa-text-muted: var(--text-secondary);
  --pa-text-subtle: var(--text-muted);
  --pa-border: var(--border);
  --pa-border-subtle: var(--border-soft);
  --pa-accent: var(--accent);
  --pa-accent-hover: #000000;
  --pa-accent-soft: #efefeb;
  --pa-success: var(--success);
  --pa-success-soft: #e8f3ec;
  --pa-danger: var(--danger);
  --pa-danger-soft: #f5e9e9;
  --pa-warning: var(--warning);
  --pa-warning-soft: #f3ead5;
  --pa-neutral: #73736f;
  --pa-neutral-soft: #efefeb;
  --bg: var(--page-bg);
  --panel: var(--surface-white);
  --panel2: var(--surface-muted);
  --border2: var(--border-soft);
  --text: var(--text-main);
  --muted: var(--text-secondary);
  --muted2: var(--text-muted);
  --matrix-bg: var(--surface-white);
  --matrix-bg-2: var(--surface-muted);
  --matrix-bg-3: var(--surface-inset);
  --matrix-line: rgba(29, 29, 27, 0.10);
  --matrix-line-soft: rgba(29, 29, 27, 0.06);
  --pa-shadow-sm: 0 1px 2px rgba(29, 29, 27, 0.04);
  --pa-shadow-md: 0 18px 42px rgba(29, 29, 27, 0.10);
  min-height: 100vh;
  padding: 18px 22px 24px 202px;
  background: var(--page-bg) !important;
  color: var(--text-main) !important;
  font-size: 14px;
}

body.theme-light-premium::before,
body.theme-light-premium::after {
  display: none !important;
}

body.theme-light-premium .premium-sidebar {
  position: fixed;
  inset: 18px auto 18px 22px;
  z-index: 450;
  display: flex;
  flex-direction: column;
  width: 160px;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 50px rgba(29, 29, 27, 0.08);
  backdrop-filter: blur(10px);
}

body.theme-light-premium .premium-sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 8px;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0;
}

body.theme-light-premium .premium-sidebar-brand i {
  color: var(--text-main);
}

body.theme-light-premium .premium-sidebar-nav {
  display: grid;
  gap: 4px;
  margin-top: 26px;
}

body.theme-light-premium .premium-sidebar-nav a,
body.theme-light-premium .premium-sidebar-bottom a,
body.theme-light-premium .premium-sidebar-bottom button {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

body.theme-light-premium .premium-sidebar-nav a i,
body.theme-light-premium .premium-sidebar-bottom a i,
body.theme-light-premium .premium-sidebar-bottom button i {
  width: 15px;
  color: inherit;
  text-align: center;
}

body.theme-light-premium .premium-sidebar-nav a:hover,
body.theme-light-premium .premium-sidebar-nav a.active,
body.theme-light-premium .premium-sidebar-bottom a:hover,
body.theme-light-premium .premium-sidebar-bottom button:hover {
  background: var(--surface-dark);
  color: var(--text-inverse);
}

body.theme-light-premium .premium-sidebar-bottom {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 18px;
}

body.theme-light-premium header {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto 16px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.theme-light-premium header .container,
body.theme-light-premium > .container,
body.theme-light-premium .home-footer .container {
  width: min(1500px, 100%);
  max-width: 1500px !important;
  padding: 0 !important;
}

body.theme-light-premium .header-content {
  min-height: 58px !important;
  display: grid !important;
  grid-template-columns: minmax(280px, 1fr) auto !important;
  gap: 18px !important;
  padding: 8px 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.theme-light-premium header .logo {
  display: none !important;
}

body.theme-light-premium .premium-context {
  display: grid;
  gap: 2px;
}

body.theme-light-premium .premium-context span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.theme-light-premium .premium-context h1 {
  margin: 0;
  color: var(--text-main);
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: 0;
}

body.theme-light-premium .premium-context p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

body.theme-light-premium .app-header-tools {
  gap: 8px;
}

body.theme-light-premium .header-control {
  height: 36px !important;
  min-height: 36px !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: var(--surface-white) !important;
  color: var(--text-main) !important;
  box-shadow: 0 8px 22px rgba(29, 29, 27, 0.08) !important;
}

body.theme-light-premium .premium-top-action,
body.theme-light-premium .btn-primary,
body.theme-light-premium .btn.active,
body.theme-light-premium.home-page .btn-primary {
  border-color: var(--surface-dark) !important;
  background: var(--surface-dark) !important;
  color: var(--text-inverse) !important;
  box-shadow: none !important;
}

body.theme-light-premium .theme-menu-btn {
  min-width: 142px;
}

body.theme-light-premium .theme-menu-btn b {
  color: var(--text-main);
}

body.theme-light-premium .header-icon {
  width: 36px !important;
  min-width: 36px !important;
}

body.theme-light-premium .header-dropdown {
  border: 1px solid var(--border-soft) !important;
  border-radius: 18px !important;
  background: var(--surface-white) !important;
  box-shadow: 0 18px 42px rgba(29, 29, 27, 0.14) !important;
}

body.theme-light-premium .theme-menu button:hover,
body.theme-light-premium .theme-menu button.active,
body.theme-light-premium .account-dropdown-item:hover {
  background: var(--surface-dark) !important;
  color: var(--text-inverse) !important;
}

body.theme-light-premium .premium-dashboard {
  display: block;
  margin-bottom: 22px;
}

body.theme-light-premium .premium-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(320px, 1fr) minmax(280px, 0.78fr);
  gap: 16px;
}

body.theme-light-premium .premium-dashboard-secondary {
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(420px, 1.42fr);
  gap: 16px;
  margin-top: 16px;
}

body.theme-light-premium .premium-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--surface-white);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(29, 29, 27, 0.035);
}

body.theme-light-premium .premium-card-dark {
  border-color: var(--surface-dark);
  background: var(--surface-dark);
  color: var(--text-inverse);
}

body.theme-light-premium .premium-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

body.theme-light-premium .premium-card-head span {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 760;
}

body.theme-light-premium .premium-card-dark .premium-card-head span {
  color: rgba(255, 255, 255, 0.66);
}

body.theme-light-premium .premium-card-head h2 {
  margin: 2px 0 0;
  color: inherit;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0;
}

body.theme-light-premium .premium-card-head a,
body.theme-light-premium .premium-card-head small {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 760;
  text-decoration: none;
}

body.theme-light-premium .premium-icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  cursor: pointer;
}

body.theme-light-premium .premium-overview-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 8px 0 22px;
}

body.theme-light-premium .premium-overview-main b {
  color: var(--text-inverse);
  font-size: clamp(44px, 4vw, 62px);
  line-height: 0.95;
  font-weight: 920;
}

body.theme-light-premium .premium-overview-main span {
  max-width: 98px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  line-height: 1.25;
}

body.theme-light-premium .premium-overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

body.theme-light-premium .premium-overview-metrics div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-main);
}

body.theme-light-premium .premium-overview-metrics b {
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

body.theme-light-premium .premium-overview-metrics span {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.2;
}

body.theme-light-premium .premium-periods {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-muted);
}

body.theme-light-premium .premium-periods button {
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
}

body.theme-light-premium .premium-periods button.active {
  background: var(--surface-dark);
  color: var(--text-inverse);
}

body.theme-light-premium .premium-chart-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text-secondary);
  text-align: center;
}

body.theme-light-premium .premium-chart-empty span {
  color: var(--text-main);
  font-weight: 850;
}

body.theme-light-premium .premium-chart-empty small {
  max-width: 260px;
  color: var(--text-muted);
  font-size: 12px;
}

body.theme-light-premium .premium-progress-content {
  display: grid;
  grid-template-columns: 132px 1fr;
  align-items: center;
  gap: 18px;
}

body.theme-light-premium .premium-donut,
body.theme-light-premium .premium-ranges-donut {
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--surface-dark) 0 var(--progress), var(--surface-muted) var(--progress) 100%);
  position: relative;
}

body.theme-light-premium .premium-donut::after,
body.theme-light-premium .premium-ranges-donut::after {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: var(--surface-white);
}

body.theme-light-premium .premium-donut span,
body.theme-light-premium .premium-ranges-donut span {
  position: relative;
  z-index: 1;
  color: var(--text-main);
  font-size: 22px;
  font-weight: 900;
}

body.theme-light-premium .premium-progress-legend,
body.theme-light-premium .premium-range-legend {
  display: grid;
  gap: 8px;
}

body.theme-light-premium .premium-progress-legend span,
body.theme-light-premium .premium-range-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 760;
}

body.theme-light-premium .premium-progress-legend i,
body.theme-light-premium .premium-range-legend i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--surface-dark);
}

body.theme-light-premium .premium-progress-legend span:nth-child(2) i {
  background: #b7b7b0;
}

body.theme-light-premium .premium-progress-legend span:nth-child(3) i {
  background: var(--border);
}

body.theme-light-premium .premium-issues-list {
  display: grid;
  gap: 8px;
}

body.theme-light-premium .premium-issue {
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px 1fr 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

body.theme-light-premium .premium-issue b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-white);
  font-size: 15px;
  font-weight: 900;
}

body.theme-light-premium .premium-issue span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 760;
}

body.theme-light-premium .premium-issue.active,
body.theme-light-premium .premium-issue:hover {
  border-color: var(--surface-dark);
  background: var(--surface-white);
}

body.theme-light-premium .premium-empty-line {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
}

body.theme-light-premium .premium-project-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

body.theme-light-premium .premium-project-card {
  min-height: 138px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

body.theme-light-premium .premium-project-card:hover {
  border-color: var(--surface-dark);
  background: var(--surface-white);
}

body.theme-light-premium .premium-project-card-dark {
  border-color: var(--surface-dark);
  background: var(--surface-dark);
  color: var(--text-inverse);
}

body.theme-light-premium .premium-project-card span {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

body.theme-light-premium .premium-project-card small {
  color: inherit;
  opacity: 0.62;
  font-size: 11px;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-light-premium .premium-project-card div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

body.theme-light-premium .premium-project-card b {
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
}

body.theme-light-premium .premium-project-card em {
  color: inherit;
  opacity: 0.64;
  font-style: normal;
  font-size: 11px;
  font-weight: 760;
}

body.theme-light-premium .premium-project-card p {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  color: inherit;
  opacity: 0.72;
  font-size: 11px;
}

body.theme-light-premium .home-stats {
  display: none !important;
}

body.theme-light-premium .home-panel,
body.theme-light-premium .project-info,
body.theme-light-premium .matrix-card,
body.theme-light-premium .lead-panel,
body.theme-light-premium .lead-table-section,
body.theme-light-premium .project-table-shell,
body.theme-light-premium .matrix-shell,
body.theme-light-premium .keywords-table-wrapper,
body.theme-light-premium .frequency-table-wrap,
body.theme-light-premium .modal-content {
  border: 1px solid var(--border-soft) !important;
  border-radius: 20px !important;
  background: var(--surface-white) !important;
  color: var(--text-main) !important;
  box-shadow: 0 1px 2px rgba(29, 29, 27, 0.035) !important;
}

body.theme-light-premium .manual-section {
  margin-top: 22px;
}

body.theme-light-premium .home-section-head,
body.theme-light-premium .projects-header {
  margin-bottom: 12px !important;
}

body.theme-light-premium .section-title,
body.theme-light-premium .project-info h2,
body.theme-light-premium .modal-header h2,
body.theme-light-premium .results-title {
  color: var(--text-main) !important;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

body.theme-light-premium .home-section-head p,
body.theme-light-premium .manual-card-head p,
body.theme-light-premium .project-meta-row,
body.theme-light-premium .project-update-row,
body.theme-light-premium .project-domain-link,
body.theme-light-premium .matrix-filter-count,
body.theme-light-premium .compare-summary,
body.theme-light-premium label {
  color: var(--text-secondary) !important;
}

body.theme-light-premium.home-page .manual-tools .card,
body.theme-light-premium.home-page .manual-tools .card:nth-child(2),
body.theme-light-premium .manual-card,
body.theme-light-premium .keyword-actions,
body.theme-light-premium .compare-panel,
body.theme-light-premium .range-panel,
body.theme-light-premium .schedule-panel,
body.theme-light-premium .access-settings {
  border: 1px solid var(--border-soft) !important;
  border-radius: 18px !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

body.theme-light-premium input,
body.theme-light-premium textarea,
body.theme-light-premium select,
body.theme-light-premium .matrix-search-wrap {
  border: 1px solid var(--border-soft) !important;
  border-radius: 14px !important;
  background: var(--surface-white) !important;
  color: var(--text-main) !important;
  box-shadow: none !important;
}

body.theme-light-premium input:focus,
body.theme-light-premium textarea:focus,
body.theme-light-premium select:focus {
  border-color: var(--surface-dark) !important;
  box-shadow: 0 0 0 3px rgba(29, 29, 27, 0.08) !important;
}

body.theme-light-premium .btn,
body.theme-light-premium .icon-btn {
  min-height: 38px;
  border: 1px solid var(--border-soft) !important;
  border-radius: 14px !important;
  background: var(--surface-white) !important;
  color: var(--text-main) !important;
  box-shadow: none !important;
}

body.theme-light-premium .btn-danger,
body.theme-light-premium .project-action-menu button.danger,
body.theme-light-premium .account-action-logout {
  color: var(--danger) !important;
}

body.theme-light-premium .project-table,
body.theme-light-premium .matrix-table,
body.theme-light-premium .keywords-table,
body.theme-light-premium .frequency-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: var(--surface-white) !important;
  color: var(--text-main) !important;
}

body.theme-light-premium .project-table th,
body.theme-light-premium .matrix-table thead th,
body.theme-light-premium .keywords-table th,
body.theme-light-premium .frequency-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  border: 0 !important;
  border-bottom: 1px solid var(--border-soft) !important;
  background: var(--surface-white) !important;
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.theme-light-premium .project-table td,
body.theme-light-premium .matrix-table tbody td,
body.theme-light-premium .keywords-table td,
body.theme-light-premium .frequency-table td {
  border: 0 !important;
  border-bottom: 1px solid var(--border-soft) !important;
  background: var(--surface-white) !important;
  color: var(--text-main) !important;
}

body.theme-light-premium .project-table tbody tr:hover td,
body.theme-light-premium .matrix-table tbody tr:hover td,
body.theme-light-premium .keywords-table tbody tr:hover td,
body.theme-light-premium .frequency-table tr:hover td {
  background: var(--surface) !important;
}

body.theme-light-premium .project-name-cell b,
body.theme-light-premium .project-table a,
body.theme-light-premium .matrix-keyword,
body.theme-light-premium .matrix-frequency,
body.theme-light-premium .rank-badge,
body.theme-light-premium .history-chip {
  color: var(--text-main) !important;
}

body.theme-light-premium .project-name-cell small,
body.theme-light-premium .project-index,
body.theme-light-premium .project-table-footer {
  color: var(--text-secondary) !important;
}

body.theme-light-premium .project-position-badge,
body.theme-light-premium .avg-position,
body.theme-light-premium .position-top3,
body.theme-light-premium .position-top10,
body.theme-light-premium .position-top30,
body.theme-light-premium .position-top100,
body.theme-light-premium .position-not-found,
body.theme-light-premium .rank-badge,
body.theme-light-premium .history-chip,
body.theme-light-premium .matrix-pos {
  border: 1px solid var(--border-soft) !important;
  background: var(--surface-muted) !important;
  color: var(--text-main) !important;
  box-shadow: none !important;
}

body.theme-light-premium .metric-up,
body.theme-light-premium .change-up {
  color: var(--success) !important;
}

body.theme-light-premium .metric-down,
body.theme-light-premium .change-down {
  color: var(--danger) !important;
}

body.theme-light-premium .project-page-row-menu,
body.theme-light-premium .project-row-menu {
  position: relative;
  display: inline-flex;
}

body.theme-light-premium .project-page-action-menu {
  min-width: 190px;
}

body.theme-light-premium .project-action-menu {
  border: 1px solid var(--border-soft) !important;
  border-radius: 16px !important;
  background: var(--surface-white) !important;
  box-shadow: 0 18px 42px rgba(29, 29, 27, 0.14) !important;
}

body.theme-light-premium .project-action-menu button:hover {
  background: var(--surface-dark) !important;
  color: var(--text-inverse) !important;
}

body.theme-light-premium .project-info {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

body.theme-light-premium .project-avatar {
  width: 58px !important;
  height: 58px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 18px !important;
  background: var(--surface-muted) !important;
  color: var(--text-main) !important;
}

body.theme-light-premium .project-status-side {
  min-width: 150px;
  border: 1px solid var(--border-soft) !important;
  border-radius: 18px !important;
  background: var(--surface) !important;
}

body.theme-light-premium .hero-wave {
  opacity: 0.32;
  filter: grayscale(1);
}

body.theme-light-premium .analytics-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

body.theme-light-premium .analytics-summary .summary-item {
  border: 1px solid var(--border-soft) !important;
  border-radius: 18px !important;
  background: var(--surface-white) !important;
  box-shadow: none !important;
}

body.theme-light-premium .analytics-summary .summary-item:nth-child(2) {
  border-color: var(--surface-dark) !important;
  background: var(--surface-dark) !important;
  color: var(--text-inverse) !important;
}

body.theme-light-premium .analytics-summary .summary-item:nth-child(2) span,
body.theme-light-premium .analytics-summary .summary-item:nth-child(2) em,
body.theme-light-premium .analytics-summary .summary-item:nth-child(2) b {
  color: inherit !important;
}

body.theme-light-premium .premium-project-dashboard {
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(280px, 0.78fr);
  gap: 16px;
  margin: 16px 0;
}

body.theme-light-premium .premium-project-chart-card {
  min-height: 310px;
}

body.theme-light-premium .premium-line-chart {
  width: 100%;
  min-height: 220px;
}

body.theme-light-premium .premium-line-chart .premium-chart-grid line {
  stroke: rgba(29, 29, 27, 0.08);
  stroke-width: 1;
}

body.theme-light-premium .premium-line-chart path {
  fill: none;
  stroke: var(--surface-dark);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.theme-light-premium .premium-line-chart circle {
  fill: var(--surface-white);
  stroke: var(--surface-dark);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.16s ease;
}

body.theme-light-premium .premium-line-chart:hover circle {
  opacity: 1;
}

body.theme-light-premium .premium-single-value {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: var(--surface);
}

body.theme-light-premium .premium-single-value b {
  font-size: 44px;
  line-height: 1;
  font-weight: 900;
}

body.theme-light-premium .premium-donut-wrap {
  display: grid;
  grid-template-columns: 132px 1fr;
  align-items: center;
  gap: 18px;
}

body.theme-light-premium .premium-range-legend span:nth-child(1) i { background: #111111; }
body.theme-light-premium .premium-range-legend span:nth-child(2) i { background: #4a4a47; }
body.theme-light-premium .premium-range-legend span:nth-child(3) i { background: #7a7a75; }
body.theme-light-premium .premium-range-legend span:nth-child(4) i { background: #b7b7b0; }
body.theme-light-premium .premium-range-legend span:nth-child(5) i { background: #d7d7d0; }
body.theme-light-premium .premium-range-legend span:nth-child(6) i { background: #efefeb; border: 1px solid var(--border); }

body.theme-light-premium .premium-change-card {
  grid-column: 1 / -1;
}

body.theme-light-premium .premium-change-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

body.theme-light-premium .premium-change-grid button {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

body.theme-light-premium .premium-change-grid button:hover,
body.theme-light-premium .premium-change-grid button.active {
  border-color: var(--surface-dark);
  background: var(--surface-dark);
  color: var(--text-inverse);
}

body.theme-light-premium .premium-change-grid b {
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
}

body.theme-light-premium .premium-change-grid span {
  color: inherit;
  opacity: 0.7;
  font-size: 12px;
  font-weight: 760;
}

body.theme-light-premium .home-footer {
  max-width: 1500px;
  margin: 18px auto 0 !important;
  padding: 0 !important;
  color: var(--text-secondary);
}

body.theme-light-premium .home-footer .logo {
  display: none !important;
}

body.theme-light-premium .footer-status {
  min-height: 28px;
  margin-left: auto;
  border: 0;
  background: transparent;
}

@media (max-width: 1180px) {
  body.home-page.theme-light-premium,
  body.project-page.theme-light-premium {
    padding-left: 104px;
  }

  body.theme-light-premium .premium-sidebar {
    width: 74px;
  }

  body.theme-light-premium .premium-sidebar span {
    display: none;
  }

  body.theme-light-premium .premium-sidebar-brand a,
  body.theme-light-premium .premium-sidebar-nav a,
  body.theme-light-premium .premium-sidebar-bottom a,
  body.theme-light-premium .premium-sidebar-bottom button {
    justify-content: center;
    padding: 0;
  }

  body.theme-light-premium .premium-dashboard-grid,
  body.theme-light-premium .premium-dashboard-secondary,
  body.theme-light-premium .premium-project-dashboard {
    grid-template-columns: 1fr 1fr;
  }

  body.theme-light-premium .premium-overview-card,
  body.theme-light-premium .premium-latest-card,
  body.theme-light-premium .premium-project-chart-card {
    grid-column: 1 / -1;
  }

  body.theme-light-premium .premium-project-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.theme-light-premium .premium-change-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body.home-page.theme-light-premium,
  body.project-page.theme-light-premium {
    padding: 12px;
  }

  body.theme-light-premium .premium-sidebar {
    display: none;
  }

  body.theme-light-premium .header-content {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 4px 0 10px !important;
  }

  body.theme-light-premium .app-header-tools {
    display: grid;
    grid-template-columns: 1fr 38px 52px;
    width: 100%;
  }

  body.theme-light-premium .premium-top-action {
    grid-column: 1 / -1;
    justify-content: center;
  }

  body.theme-light-premium .premium-dashboard-grid,
  body.theme-light-premium .premium-dashboard-secondary,
  body.theme-light-premium .premium-project-dashboard,
  body.theme-light-premium .project-info,
  body.theme-light-premium .premium-progress-content,
  body.theme-light-premium .premium-donut-wrap {
    grid-template-columns: 1fr;
  }

  body.theme-light-premium .premium-project-cards,
  body.theme-light-premium .premium-change-grid,
  body.theme-light-premium .analytics-summary {
    grid-template-columns: 1fr;
  }

  body.theme-light-premium .premium-donut,
  body.theme-light-premium .premium-ranges-donut {
    margin: 0 auto;
  }

  body.theme-light-premium .premium-overview-metrics {
    grid-template-columns: 1fr;
  }
}

/* Premium white stabilization pass */
body.home-page.theme-light-premium,
body.project-page.theme-light-premium {
  display: grid !important;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  width: 100%;
  padding: 18px 22px 24px !important;
}

body.theme-light-premium > header,
body.theme-light-premium > .container,
body.theme-light-premium > .home-footer {
  grid-column: 2;
  width: 100%;
  max-width: 1500px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body.theme-light-premium .premium-sidebar {
  position: sticky !important;
  inset: auto !important;
  top: 18px !important;
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 176px !important;
  min-height: calc(100vh - 36px);
  padding: 18px 14px !important;
  border-radius: 20px !important;
}

body.theme-light-premium .premium-sidebar-nav a,
body.theme-light-premium .premium-sidebar-bottom a,
body.theme-light-premium .premium-sidebar-bottom button {
  min-height: 34px;
  gap: 10px;
  font-weight: 620;
}

body.theme-light-premium .premium-sidebar-nav a i,
body.theme-light-premium .premium-sidebar-bottom a i,
body.theme-light-premium .premium-sidebar-bottom button i {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
}

body.theme-light-premium .header-content {
  min-height: 48px !important;
  padding: 0 0 6px !important;
  align-items: center !important;
}

body.theme-light-premium .premium-context {
  gap: 0;
}

body.theme-light-premium .premium-context > span {
  display: none;
}

body.theme-light-premium .premium-context h1 {
  font-size: clamp(20px, 1.55vw, 24px);
  font-weight: 750;
}

body.theme-light-premium .premium-context p {
  font-size: 12px;
  line-height: 1.25;
}

body.theme-light-premium .premium-context span,
body.theme-light-premium .premium-card-head span,
body.theme-light-premium label {
  font-weight: 500 !important;
}

body.theme-light-premium .premium-card-head h2,
body.theme-light-premium .section-title {
  font-weight: 700 !important;
}

body.theme-light-premium .header-control {
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 17px !important;
  font-weight: 620 !important;
}

body.theme-light-premium .theme-menu-btn {
  min-width: 112px;
}

body.theme-light-premium .theme-menu-btn > span {
  display: none;
}

body.theme-light-premium .header-icon {
  width: 34px !important;
  min-width: 34px !important;
}

body.theme-light-premium.home-page .home-projects-head #create-project-btn {
  display: none !important;
}

body.theme-light-premium .premium-card-dark > .premium-card-head span,
body.theme-light-premium .premium-card-dark > .premium-overview-main span {
  color: rgba(255, 255, 255, 0.65) !important;
}

body.theme-light-premium .premium-card-dark > .premium-card-head h2,
body.theme-light-premium .premium-card-dark > .premium-overview-main b {
  color: #fff !important;
}

body.theme-light-premium .premium-chart-empty i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-white);
  color: var(--surface-dark);
}

body.theme-light-premium .premium-chart-empty a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-dark);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

body.theme-light-premium .premium-issue span {
  display: grid;
  gap: 2px;
}

body.theme-light-premium .premium-issue span em {
  color: var(--text-muted);
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.theme-light-premium .premium-issue b {
  position: relative;
}

body.theme-light-premium .premium-issue b::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

body.theme-light-premium .premium-issue-critical b::after {
  background: var(--danger);
}

body.theme-light-premium .premium-issue-attention b::after {
  background: var(--warning);
}

body.theme-light-premium .premium-project-card {
  min-height: 142px;
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
}

body.theme-light-premium .premium-project-card > span {
  display: -webkit-box;
  min-height: 32px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

body.theme-light-premium .premium-project-card p {
  margin-top: auto;
}

body.theme-light-premium .manual-section {
  padding: 16px !important;
}

body.theme-light-premium .manual-tools {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px !important;
}

body.theme-light-premium .manual-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px !important;
}

body.theme-light-premium .manual-card textarea {
  min-height: 100px !important;
}

body.theme-light-premium .manual-card .form-group {
  margin-bottom: 10px !important;
}

body.theme-light-premium .manual-card .btn {
  min-height: 38px;
  border-radius: 14px !important;
  font-weight: 650 !important;
}

body.theme-light-premium .project-table th,
body.theme-light-premium .matrix-table thead th {
  background: var(--surface) !important;
  font-weight: 650 !important;
  padding-top: 9px !important;
  padding-bottom: 9px !important;
}

body.theme-light-premium .project-table td {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

body.theme-light-premium .project-name-cell {
  min-width: 0;
}

body.theme-light-premium .project-name-cell > div {
  min-width: 0;
}

body.theme-light-premium .project-name-cell b {
  display: block;
  max-width: 240px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 650 !important;
}

body.theme-light-premium .project-table td a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body.theme-light-premium .project-table-footer {
  border-top: 1px solid var(--border-soft) !important;
  background: var(--surface-white) !important;
  color: var(--text-secondary) !important;
}

body.theme-light-premium .project-pagination strong {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-dark);
  color: var(--text-inverse);
}

body.theme-light-premium .project-info {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px !important;
  align-items: center;
}

body.theme-light-premium .project-main {
  display: grid !important;
  gap: 7px !important;
}

body.theme-light-premium .project-title-row h2 {
  font-size: 22px !important;
  font-weight: 750 !important;
}

body.theme-light-premium .project-title-row,
body.theme-light-premium .project-domain-link,
body.theme-light-premium .project-meta-row,
body.theme-light-premium .project-access-row,
body.theme-light-premium .project-update-row,
body.theme-light-premium .project-info-actions {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body.theme-light-premium .project-title-row {
  min-height: 0 !important;
  height: auto !important;
}

body.theme-light-premium .project-domain-link {
  max-width: 320px;
}

body.theme-light-premium .project-meta-row,
body.theme-light-premium .project-access-row {
  gap: 7px !important;
}

body.theme-light-premium .project-status-side {
  min-width: 210px;
  min-height: 0;
  display: grid !important;
  justify-items: end;
  gap: 8px;
  padding: 8px 10px !important;
  background: transparent !important;
  border: 0 !important;
}

body.theme-light-premium .project-status-side .hero-wave {
  display: none !important;
}

body.theme-light-premium .tracking-status {
  min-height: 28px !important;
  padding: 0 10px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 999px !important;
  background: var(--surface) !important;
  color: var(--text-main) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

body.theme-light-premium .tracking-status.tracking-muted {
  color: var(--text-secondary) !important;
}

body.theme-light-premium .project-status-side .project-update-row {
  justify-content: flex-end;
  color: var(--text-secondary) !important;
  font-size: 12px;
}

body.theme-light-premium .project-status-side .project-info-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}

body.theme-light-premium .project-status-side .project-info-actions .btn-primary {
  white-space: nowrap;
}

body.theme-light-premium .access-pill {
  min-height: 28px !important;
  padding: 0 9px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 999px !important;
  background: var(--surface-muted) !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

body.theme-light-premium .access-pill i {
  font-size: 9px !important;
}

body.theme-light-premium .access-pill.access-off i {
  color: var(--danger) !important;
}

body.theme-light-premium .access-pill.access-on i {
  color: var(--success) !important;
}

body.theme-light-premium .analytics-summary .summary-item {
  min-height: 118px;
}

body.theme-light-premium .analytics-summary .summary-item:not(:nth-child(2)) {
  background: var(--surface-white) !important;
}

body.theme-light-premium .analytics-summary .summary-item b {
  font-weight: 760 !important;
}

body.theme-light-premium .premium-project-chart-card {
  min-height: 0;
}

body.theme-light-premium .premium-single-value {
  min-height: 160px;
  padding: 22px;
}

body.theme-light-premium .premium-single-value span,
body.theme-light-premium .premium-single-value small {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

body.theme-light-premium .premium-single-value b {
  font-weight: 760;
}

body.theme-light-premium .premium-range-legend {
  gap: 6px;
}

body.theme-light-premium .premium-range-legend button {
  min-height: 30px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

body.theme-light-premium .premium-range-legend button:hover,
body.theme-light-premium .premium-range-legend button.active {
  background: var(--surface-muted);
  color: var(--text-main);
}

body.theme-light-premium .premium-range-legend button i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

body.theme-light-premium .premium-range-legend button b {
  justify-self: end;
  color: var(--text-main);
  font-weight: 650;
}

body.theme-light-premium .premium-no-changes {
  min-height: 48px;
  display: grid;
  place-items: center;
  grid-column: 1 / -1;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

body.theme-light-premium .compare-panel {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center !important;
  gap: 10px !important;
}

body.theme-light-premium .matrix-toolbar {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) 180px auto auto;
  align-items: end !important;
  gap: 10px !important;
}

body.theme-light-premium .matrix-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

body.theme-light-premium .matrix-sort-button em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 500;
}

body.theme-light-premium .matrix-table tbody td {
  padding-top: 9px !important;
  padding-bottom: 9px !important;
}

body.theme-light-premium .matrix-keyword {
  max-width: 360px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 560 !important;
}

body.theme-light-premium .matrix-url-cell a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-secondary) !important;
}

body.theme-light-premium .matrix-positions-cell .rank-badge {
  cursor: pointer;
}

@media (max-width: 1100px) {
  body.home-page.theme-light-premium,
  body.project-page.theme-light-premium {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 18px;
    padding-left: 18px !important;
  }

  body.theme-light-premium .premium-sidebar {
    width: 74px !important;
    padding: 16px 10px !important;
  }

  body.theme-light-premium .premium-sidebar span {
    display: none;
  }

  body.theme-light-premium .premium-sidebar-brand a,
  body.theme-light-premium .premium-sidebar-nav a,
  body.theme-light-premium .premium-sidebar-bottom a,
  body.theme-light-premium .premium-sidebar-bottom button {
    justify-content: center;
    padding: 0;
  }

  body.theme-light-premium .premium-dashboard-grid,
  body.theme-light-premium .premium-dashboard-secondary,
  body.theme-light-premium .premium-project-dashboard {
    grid-template-columns: 1fr 1fr;
  }

  body.theme-light-premium .premium-overview-card,
  body.theme-light-premium .premium-latest-card,
  body.theme-light-premium .premium-project-chart-card {
    grid-column: 1 / -1;
  }

  body.theme-light-premium .manual-tools,
  body.theme-light-premium .matrix-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body.home-page.theme-light-premium,
  body.project-page.theme-light-premium {
    display: block !important;
    padding: 12px !important;
  }

  body.theme-light-premium > header,
  body.theme-light-premium > .container,
  body.theme-light-premium > .home-footer {
    width: 100%;
    max-width: none !important;
  }

  body.theme-light-premium .premium-sidebar {
    display: none !important;
  }

  body.theme-light-premium .manual-tools,
  body.theme-light-premium .premium-dashboard-grid,
  body.theme-light-premium .premium-dashboard-secondary,
  body.theme-light-premium .premium-project-dashboard,
  body.theme-light-premium .project-info,
  body.theme-light-premium .compare-panel,
  body.theme-light-premium .matrix-toolbar {
    grid-template-columns: 1fr !important;
  }

  body.theme-light-premium .project-status-side {
    justify-self: start;
    padding: 0 !important;
  }
}

/* Project detail targeted polish */
body.theme-light-premium .project-table .project-name-cell {
  grid-template-columns: 34px minmax(0, 1fr) !important;
  gap: 10px !important;
}

body.theme-light-premium .project-table .project-avatar {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
}

body.theme-light-premium .project-table .project-avatar.project-favicon img {
  inset: 6px !important;
  width: calc(100% - 12px) !important;
  height: calc(100% - 12px) !important;
}

body.theme-light-premium .project-info {
  overflow: visible !important;
  position: relative;
  z-index: 4;
}

body.theme-light-premium .project-status-side,
body.theme-light-premium .project-status-side .project-info-actions,
body.theme-light-premium .project-page-row-menu {
  position: relative;
  z-index: 20;
}

body.theme-light-premium .project-page-action-menu {
  z-index: 9999 !important;
}

body.theme-light-premium .matrix-shell {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

body.theme-light-premium .matrix-table {
  table-layout: fixed !important;
  min-width: calc(var(--matrix-keyword-width, 380px) + 848px) !important;
  width: max(100%, calc(var(--matrix-keyword-width, 380px) + 848px)) !important;
}

body.theme-light-premium .matrix-table th:nth-child(1),
body.theme-light-premium .matrix-table td:nth-child(1) {
  width: 116px !important;
}

body.theme-light-premium .matrix-table th:nth-child(2),
body.theme-light-premium .matrix-table td:nth-child(2) {
  width: var(--matrix-keyword-width, 380px) !important;
  min-width: var(--matrix-keyword-width, 380px) !important;
}

body.theme-light-premium .matrix-table th:nth-child(3),
body.theme-light-premium .matrix-table td:nth-child(3) {
  width: 100px !important;
}

body.theme-light-premium .matrix-table th:nth-child(4),
body.theme-light-premium .matrix-table td:nth-child(4) {
  width: 124px !important;
  text-align: center !important;
}

body.theme-light-premium .matrix-table th:nth-child(5),
body.theme-light-premium .matrix-table td:nth-child(5) {
  width: 94px !important;
  text-align: center !important;
}

body.theme-light-premium .matrix-table th:nth-child(6),
body.theme-light-premium .matrix-table td:nth-child(6) {
  width: 126px !important;
  text-align: center !important;
}

body.theme-light-premium .matrix-table th:nth-child(7),
body.theme-light-premium .matrix-table td:nth-child(7) {
  width: 108px !important;
  text-align: center !important;
}

body.theme-light-premium .matrix-table th:nth-child(8),
body.theme-light-premium .matrix-table td:nth-child(8) {
  width: 180px !important;
}

body.theme-light-premium .matrix-table thead th.sortable::after {
  content: none !important;
}

body.theme-light-premium .matrix-keyword-head {
  position: sticky !important;
  top: 0;
  padding-right: 20px !important;
}

body.theme-light-premium .keyword-col {
  position: static !important;
  left: auto !important;
  box-shadow: none !important;
}

body.theme-light-premium .matrix-keyword {
  display: block !important;
  max-width: none !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
  line-height: 1.34;
}

body.theme-light-premium .matrix-keyword-head .matrix-sort-button {
  display: inline-grid !important;
  grid-template-columns: minmax(0, auto) auto;
  justify-content: start;
  align-items: center;
  gap: 7px;
  max-width: 100%;
}

body.theme-light-premium .matrix-table thead th .matrix-head-title,
body.theme-light-premium .matrix-table thead th .matrix-head-stack span,
body.theme-light-premium .matrix-table thead th.matrix-head-stack > span {
  display: block !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-size: inherit !important;
}

body.theme-light-premium .matrix-keyword-head em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
}

body.theme-light-premium .matrix-head-stack,
body.theme-light-premium .matrix-sort-button.matrix-head-stack {
  display: grid !important;
  justify-items: center;
  gap: 2px;
  line-height: 1.1;
  text-align: center;
}

body.theme-light-premium .matrix-head-stack small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 520;
  text-transform: none;
  letter-spacing: 0;
}

body.theme-light-premium .matrix-col-resizer {
  position: absolute;
  top: 8px;
  right: 2px;
  bottom: 8px;
  width: 10px;
  border-radius: 999px;
  cursor: col-resize;
}

body.theme-light-premium .matrix-col-resizer::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: 2px;
  border-radius: 999px;
  background: var(--border);
}

body.theme-light-premium .matrix-col-resizer:hover::after,
body.matrix-resizing .matrix-col-resizer::after {
  background: var(--accent);
}

body.matrix-resizing {
  cursor: col-resize;
  user-select: none;
}

body.theme-light-premium .matrix-dynamics-cell,
body.theme-light-premium .matrix-first-cell,
body.theme-light-premium .matrix-positions-cell {
  text-align: center !important;
}

body.theme-light-premium .matrix-dynamics-cell .rank-change,
body.theme-light-premium .matrix-dynamics-cell .change-muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  text-align: center;
}

body.theme-light-premium .premium-line-chart .premium-chart-date {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 620;
}

/* Unified data-theme color system. Layout stays on the current Pro structure. */
:root {
  --radius-control: 14px;
  --radius-card: 20px;
  --radius-large: 22px;
  --control-height: 38px;
  --page-bg: #ececea;
  --sidebar-bg: #ffffff;
  --topbar-bg: transparent;
  --surface-primary: #ffffff;
  --surface-secondary: #f5f5f2;
  --surface-tertiary: #eeeeeb;
  --surface-elevated: #ffffff;
  --surface-dark: #1f1f1d;
  --surface-hover: #e7e7e3;
  --surface-active: #1f1f1d;
  --surface-disabled: #eeeeeb;
  --overlay-bg: rgba(255, 255, 255, 0.88);
  --backdrop-bg: rgba(20, 20, 18, 0.46);
  --text-primary: #1d1d1b;
  --text-secondary: #696965;
  --text-muted: #999994;
  --text-disabled: #b9b9b2;
  --text-inverse: #ffffff;
  --text-link: #1d1d1b;
  --text-link-hover: #333330;
  --border-default: #d9d9d4;
  --border-soft: #e7e7e2;
  --border-strong: #bdbdb7;
  --border-focus: #1d1d1b;
  --border-danger: #e2b7b7;
  --border-success: #b8d9c4;
  --accent-primary: #1d1d1b;
  --accent-primary-hover: #333330;
  --accent-primary-active: #000000;
  --accent-primary-text: #ffffff;
  --accent-secondary: #2f6fed;
  --success: #2f8f57;
  --success-bg: #e8f3ec;
  --success-border: #b8d9c4;
  --danger: #c84d4d;
  --danger-bg: #f5e9e9;
  --danger-border: #e2b7b7;
  --warning: #b38923;
  --warning-bg: #f3ead5;
  --warning-border: #e0c981;
  --info: #2f6fed;
  --info-bg: #e7eefc;
  --info-border: #bfd0f8;
  --neutral: #73736f;
  --neutral-bg: #efefeb;
  --neutral-border: #d9d9d4;
  --table-header-bg: #ffffff;
  --table-row-bg: #ffffff;
  --table-row-alt-bg: #efefec;
  --table-row-hover-bg: #e7e7e3;
  --table-row-selected-bg: #deded8;
  --table-border: #e7e7e2;
  --table-footer-bg: #ffffff;
  --input-bg: #ffffff;
  --input-text: #1d1d1b;
  --input-placeholder: #999994;
  --input-border: #ddddda;
  --input-hover-border: #c9c9c2;
  --input-focus-border: #1d1d1b;
  --input-disabled-bg: #eeeeeb;
  --shadow-card: 0 1px 2px rgba(29, 29, 27, 0.04);
  --shadow-dropdown: 0 18px 42px rgba(29, 29, 27, 0.14);
  --shadow-modal: 0 24px 80px rgba(29, 29, 27, 0.18);
  --shadow-focus: 0 0 0 3px rgba(29, 29, 27, 0.08);
  --chart-line-primary: #1d1d1b;
  --chart-line-secondary: #696965;
  --chart-grid: #e3e3df;
  --chart-axis: #bdbdb7;
  --chart-label: #696965;
  --chart-tooltip-bg: #1d1d1b;
  --chart-tooltip-text: #ffffff;
  --chart-success: #2f8f57;
  --chart-danger: #c84d4d;
  --chart-warning: #b38923;
  --chart-neutral: #73736f;
  --chart-segment-1: #111111;
  --chart-segment-2: #4a4a47;
  --chart-segment-3: #7a7a75;
  --chart-segment-4: #b7b7b0;
  --chart-segment-5: #d7d7d0;
  --chart-segment-6: #efefeb;
}

html[data-theme="light"],
html[data-theme="light"] body {
  color-scheme: light;
  --page-bg: #f3eee5;
  --sidebar-bg: #fbf7ee;
  --topbar-bg: transparent;
  --surface-primary: #fffaf0;
  --surface-secondary: #f7f1e6;
  --surface-tertiary: #efe7da;
  --surface-elevated: #fffdf7;
  --surface-dark: #221e1b;
  --surface-hover: #efe5d7;
  --surface-active: #681827;
  --surface-disabled: #ece3d5;
  --overlay-bg: rgba(255, 250, 240, 0.9);
  --backdrop-bg: rgba(34, 30, 27, 0.46);
  --text-primary: #211915;
  --text-secondary: #6f6257;
  --text-muted: #9a8c7d;
  --text-disabled: #b9aa98;
  --text-inverse: #ffffff;
  --text-link: #681827;
  --text-link-hover: #4d111c;
  --border-default: #d8ccbc;
  --border-soft: #e6dccd;
  --border-strong: #bcae9d;
  --border-focus: #681827;
  --border-danger: #e2b7b7;
  --border-success: #b8d9c4;
  --accent-primary: #681827;
  --accent-primary-hover: #53111d;
  --accent-primary-active: #3e0c15;
  --accent-primary-text: #ffffff;
  --accent-secondary: #8b6a36;
  --success: #2f8f57;
  --success-bg: #e8f3ec;
  --success-border: #b8d9c4;
  --danger: #c84d4d;
  --danger-bg: #f5e9e9;
  --danger-border: #e2b7b7;
  --warning: #b38923;
  --warning-bg: #f3ead5;
  --warning-border: #e0c981;
  --info: #2f6fed;
  --info-bg: #e7eefc;
  --info-border: #bfd0f8;
  --neutral: #76695d;
  --neutral-bg: #efe6d8;
  --neutral-border: #d8ccbc;
  --table-header-bg: #f1e8d9;
  --table-row-bg: #fffaf0;
  --table-row-alt-bg: #f7f0e4;
  --table-row-hover-bg: #eee2d1;
  --table-row-selected-bg: #e6d5c1;
  --table-border: #ded2c2;
  --table-footer-bg: #fbf4e8;
  --input-bg: #fffdf7;
  --input-text: #211915;
  --input-placeholder: #948575;
  --input-border: #d7c9b7;
  --input-hover-border: #bba993;
  --input-focus-border: #681827;
  --input-disabled-bg: #eee4d6;
  --shadow-card: 0 1px 2px rgba(57, 45, 34, 0.05);
  --shadow-dropdown: 0 18px 42px rgba(57, 45, 34, 0.14);
  --shadow-modal: 0 24px 80px rgba(57, 45, 34, 0.18);
  --shadow-focus: 0 0 0 3px rgba(104, 24, 39, 0.12);
  --chart-line-primary: #681827;
  --chart-line-secondary: #8b6a36;
  --chart-grid: #ded2c2;
  --chart-axis: #bcae9d;
  --chart-label: #6f6257;
  --chart-tooltip-bg: #211915;
  --chart-tooltip-text: #ffffff;
  --chart-success: #2f8f57;
  --chart-danger: #c84d4d;
  --chart-warning: #b38923;
  --chart-neutral: #76695d;
  --chart-segment-1: #681827;
  --chart-segment-2: #8b2f3d;
  --chart-segment-3: #8b6a36;
  --chart-segment-4: #bcae9d;
  --chart-segment-5: #d8ccbc;
  --chart-segment-6: #efe6d8;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  color-scheme: dark;
  --page-bg: #080d1a;
  --sidebar-bg: #0d1424;
  --topbar-bg: transparent;
  --surface-primary: #0d1524;
  --surface-secondary: #121c2d;
  --surface-tertiary: #182438;
  --surface-elevated: #111a2a;
  --surface-dark: #ff4d4d;
  --surface-hover: #18253a;
  --surface-active: #202f47;
  --surface-disabled: #151d2c;
  --overlay-bg: rgba(13, 21, 36, 0.92);
  --backdrop-bg: rgba(0, 0, 0, 0.62);
  --text-primary: #f4f6fb;
  --text-secondary: #9da7b8;
  --text-muted: #707c90;
  --text-disabled: #5e697a;
  --text-inverse: #ffffff;
  --text-link: #c7d1ff;
  --text-link-hover: #ffffff;
  --border-default: #263248;
  --border-soft: #1c273b;
  --border-strong: #38455d;
  --border-focus: #6954d9;
  --border-danger: #803c47;
  --border-success: #2e6d56;
  --accent-primary: #ff4d4d;
  --accent-primary-hover: #ff6666;
  --accent-primary-active: #dc3d3d;
  --accent-primary-text: #ffffff;
  --accent-secondary: #6954d9;
  --success: #5dd39e;
  --success-bg: #122d2a;
  --success-border: #2e6d56;
  --danger: #ff6b7a;
  --danger-bg: #351720;
  --danger-border: #803c47;
  --warning: #e0b85f;
  --warning-bg: #332816;
  --warning-border: #796236;
  --info: #8aa4ff;
  --info-bg: #182345;
  --info-border: #384d91;
  --neutral: #9da7b8;
  --neutral-bg: #182438;
  --neutral-border: #263248;
  --table-header-bg: #111b2c;
  --table-row-bg: #0d1524;
  --table-row-alt-bg: #121d2e;
  --table-row-hover-bg: #18253a;
  --table-row-selected-bg: #202f47;
  --table-border: #1c273b;
  --table-footer-bg: #0a101d;
  --input-bg: #1d2229;
  --input-text: #f4f6fb;
  --input-placeholder: #858e9e;
  --input-border: #313a49;
  --input-hover-border: #455166;
  --input-focus-border: #6954d9;
  --input-disabled-bg: #151d2c;
  --shadow-card: none;
  --shadow-dropdown: 0 14px 40px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.55);
  --shadow-focus: 0 0 0 3px rgba(105, 84, 217, 0.22);
  --chart-line-primary: #7a61ff;
  --chart-line-secondary: #ff4d4d;
  --chart-grid: #263248;
  --chart-axis: #38455d;
  --chart-label: #9da7b8;
  --chart-tooltip-bg: #111a2a;
  --chart-tooltip-text: #f4f6fb;
  --chart-success: #5dd39e;
  --chart-danger: #ff6b7a;
  --chart-warning: #e0b85f;
  --chart-neutral: #9da7b8;
  --chart-segment-1: #7a61ff;
  --chart-segment-2: #6f7fdc;
  --chart-segment-3: #52627f;
  --chart-segment-4: #38455d;
  --chart-segment-5: #263248;
  --chart-segment-6: #151d2c;
}

html[data-theme="retro"],
html[data-theme="retro"] body {
  color-scheme: dark;
  --page-bg: #13200f;
  --sidebar-bg: #182711;
  --topbar-bg: transparent;
  --surface-primary: #1f2f18;
  --surface-secondary: #26381d;
  --surface-tertiary: #304425;
  --surface-elevated: #22351a;
  --surface-dark: #989a43;
  --surface-hover: #2b4020;
  --surface-active: #344b25;
  --surface-disabled: #182713;
  --overlay-bg: rgba(31, 47, 24, 0.92);
  --backdrop-bg: rgba(7, 12, 5, 0.66);
  --text-primary: #f1efc6;
  --text-secondary: #c8c58d;
  --text-muted: #99975f;
  --text-disabled: #77764d;
  --text-inverse: #13170b;
  --text-link: #e6e28b;
  --text-link-hover: #ffffff;
  --border-default: #4d5c31;
  --border-soft: #344523;
  --border-strong: #6c7540;
  --border-focus: #989a43;
  --border-danger: #856348;
  --border-success: #627746;
  --accent-primary: #989a43;
  --accent-primary-hover: #acad54;
  --accent-primary-active: #7d8034;
  --accent-primary-text: #13170b;
  --accent-secondary: #c6c36c;
  --success: #a8c66c;
  --success-bg: #26381d;
  --success-border: #627746;
  --danger: #e09365;
  --danger-bg: #3d2619;
  --danger-border: #856348;
  --warning: #d4c96a;
  --warning-bg: #393718;
  --warning-border: #837d38;
  --info: #c6c36c;
  --info-bg: #30351c;
  --info-border: #6f7140;
  --neutral: #c8c58d;
  --neutral-bg: #26381d;
  --neutral-border: #4d5c31;
  --table-header-bg: #24351b;
  --table-row-bg: #182713;
  --table-row-alt-bg: #1e3017;
  --table-row-hover-bg: #2b4020;
  --table-row-selected-bg: #344b25;
  --table-border: #344523;
  --table-footer-bg: #10190d;
  --input-bg: #080d07;
  --input-text: #f1efc6;
  --input-placeholder: #8e8c59;
  --input-border: #4c5b30;
  --input-hover-border: #6c7540;
  --input-focus-border: #989a43;
  --input-disabled-bg: #182713;
  --shadow-card: none;
  --shadow-dropdown: 0 14px 40px rgba(7, 12, 5, 0.55);
  --shadow-modal: 0 24px 80px rgba(7, 12, 5, 0.65);
  --shadow-focus: 0 0 0 3px rgba(152, 154, 67, 0.22);
  --chart-line-primary: #c1c35a;
  --chart-line-secondary: #818b39;
  --chart-grid: #42512c;
  --chart-axis: #6c7540;
  --chart-label: #b0ad76;
  --chart-tooltip-bg: #10190d;
  --chart-tooltip-text: #f1efc6;
  --chart-success: #a8c66c;
  --chart-danger: #e09365;
  --chart-warning: #d4c96a;
  --chart-neutral: #c8c58d;
  --chart-segment-1: #c1c35a;
  --chart-segment-2: #a4a848;
  --chart-segment-3: #818b39;
  --chart-segment-4: #657331;
  --chart-segment-5: #42512c;
  --chart-segment-6: #26381d;
}

html[data-theme] body {
  --surface: var(--surface-secondary);
  --surface-white: var(--surface-primary);
  --surface-muted: var(--surface-secondary);
  --surface-inset: var(--surface-tertiary);
  --text-main: var(--text-primary);
  --border: var(--border-default);
  --pa-bg: var(--page-bg);
  --pa-surface: var(--surface-primary);
  --pa-surface-muted: var(--surface-secondary);
  --pa-surface-inset: var(--surface-tertiary);
  --pa-text: var(--text-primary);
  --pa-text-muted: var(--text-secondary);
  --pa-text-subtle: var(--text-muted);
  --pa-border: var(--border-default);
  --pa-border-subtle: var(--border-soft);
  --pa-accent: var(--accent-primary);
  --pa-accent-hover: var(--accent-primary-hover);
  --pa-accent-soft: var(--neutral-bg);
  --pa-success: var(--success);
  --pa-success-soft: var(--success-bg);
  --pa-danger: var(--danger);
  --pa-danger-soft: var(--danger-bg);
  --pa-warning: var(--warning);
  --pa-warning-soft: var(--warning-bg);
  --pa-neutral: var(--neutral);
  --pa-neutral-soft: var(--neutral-bg);
  --bg: var(--page-bg);
  --panel: var(--surface-primary);
  --panel2: var(--surface-secondary);
  --border2: var(--border-soft);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --muted2: var(--text-muted);
  --accent: var(--accent-primary);
  --accent2: var(--accent-primary-hover);
  --matrix-bg: var(--table-row-bg);
  --matrix-bg-2: var(--table-row-alt-bg);
  --matrix-bg-3: var(--surface-tertiary);
  --matrix-line: var(--table-border);
  --matrix-line-soft: var(--border-soft);
  --pa-shadow-sm: var(--shadow-card);
  --pa-shadow-md: var(--shadow-dropdown);
  scrollbar-color: var(--border-strong) var(--surface-secondary);
  background: var(--page-bg) !important;
  color: var(--text-primary) !important;
}

html[data-theme] {
  overflow-x: clip;
}

@supports not (overflow: clip) {
  html[data-theme] {
    overflow-x: hidden;
  }
}

html[data-theme] * {
  scrollbar-color: var(--border-strong) var(--surface-secondary);
}

html[data-theme] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html[data-theme] ::-webkit-scrollbar-track {
  background: var(--surface-secondary);
}

html[data-theme] ::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-secondary);
  border-radius: 999px;
  background: var(--border-strong);
}

html[data-theme] i,
html[data-theme] svg {
  color: currentColor;
}

html[data-theme] body.theme-light-premium {
  background: var(--page-bg) !important;
  color: var(--text-primary) !important;
  overflow-x: clip !important;
}

@supports not (overflow: clip) {
  html[data-theme] body.theme-light-premium {
    overflow-x: hidden !important;
  }
}

@media (max-width: 1100px) {
  html[data-theme] body.home-page.theme-light-premium,
  html[data-theme] body.project-page.theme-light-premium {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }
}

html[data-theme] body.theme-light-premium .matrix-shell {
  max-width: 100% !important;
  overflow: auto !important;
  contain: paint;
}

html[data-theme] body.theme-light-premium .premium-sidebar {
  border-color: var(--border-soft) !important;
  background: color-mix(in srgb, var(--sidebar-bg) 92%, transparent) !important;
  box-shadow: var(--shadow-card) !important;
}

html[data-theme] body.theme-light-premium header,
html[data-theme] body.theme-light-premium .header-content {
  background: var(--topbar-bg) !important;
}

html[data-theme] body.theme-light-premium .premium-sidebar-brand a,
html[data-theme] body.theme-light-premium .premium-context h1,
html[data-theme] body.theme-light-premium .section-title,
html[data-theme] body.theme-light-premium .project-info h2,
html[data-theme] body.theme-light-premium .modal-header h2,
html[data-theme] body.theme-light-premium .results-title {
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .premium-sidebar-nav a,
html[data-theme] body.theme-light-premium .premium-sidebar-bottom a,
html[data-theme] body.theme-light-premium .premium-sidebar-bottom button,
html[data-theme] body.theme-light-premium .premium-context p,
html[data-theme] body.theme-light-premium .premium-context span,
html[data-theme] body.theme-light-premium .premium-card-head span,
html[data-theme] body.theme-light-premium .home-section-head p,
html[data-theme] body.theme-light-premium .manual-card-head p,
html[data-theme] body.theme-light-premium .project-meta-row,
html[data-theme] body.theme-light-premium .project-update-row,
html[data-theme] body.theme-light-premium .project-domain-link,
html[data-theme] body.theme-light-premium .matrix-filter-count,
html[data-theme] body.theme-light-premium .compare-summary,
html[data-theme] body.theme-light-premium label {
  color: var(--text-secondary) !important;
}

html[data-theme] body.theme-light-premium .premium-sidebar-nav a:hover,
html[data-theme] body.theme-light-premium .premium-sidebar-nav a.active,
html[data-theme] body.theme-light-premium .premium-sidebar-bottom a:hover,
html[data-theme] body.theme-light-premium .premium-sidebar-bottom button:hover,
html[data-theme] body.theme-light-premium .btn-primary,
html[data-theme] body.theme-light-premium .btn.active,
html[data-theme] body.theme-light-premium .premium-project-card-dark,
html[data-theme] body.theme-light-premium .analytics-summary .summary-item:nth-child(2),
html[data-theme] body.theme-light-premium .project-pagination strong,
html[data-theme] body.theme-light-premium .premium-chart-empty a,
html[data-theme] body.theme-light-premium .premium-change-grid button:hover,
html[data-theme] body.theme-light-premium .premium-change-grid button.active {
  border-color: var(--accent-primary) !important;
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
}

html[data-theme] body.theme-light-premium .home-panel,
html[data-theme] body.theme-light-premium .premium-card,
html[data-theme] body.theme-light-premium .project-info,
html[data-theme] body.theme-light-premium .matrix-card,
html[data-theme] body.theme-light-premium .lead-panel,
html[data-theme] body.theme-light-premium .lead-table-section,
html[data-theme] body.theme-light-premium .project-table-shell,
html[data-theme] body.theme-light-premium .matrix-shell,
html[data-theme] body.theme-light-premium .keywords-table-wrapper,
html[data-theme] body.theme-light-premium .frequency-table-wrap,
html[data-theme] body.theme-light-premium .modal-content,
html[data-theme] body.theme-light .login-card,
html[data-theme] body.theme-light .lead-panel,
html[data-theme] body.theme-light .lead-table-section {
  border-color: var(--border-soft) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card) !important;
}

html[data-theme] body.theme-light-premium .manual-card,
html[data-theme] body.theme-light-premium .keyword-actions,
html[data-theme] body.theme-light-premium .compare-panel,
html[data-theme] body.theme-light-premium .range-panel,
html[data-theme] body.theme-light-premium .schedule-panel,
html[data-theme] body.theme-light-premium .access-settings,
html[data-theme] body.theme-light-premium .premium-empty-line,
html[data-theme] body.theme-light-premium .premium-no-changes,
html[data-theme] body.theme-light .login-shell {
  border-color: var(--border-soft) !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .header-control,
html[data-theme] body.theme-light-premium .btn,
html[data-theme] body.theme-light-premium .icon-btn,
html[data-theme] body.theme-light-premium .inline-edit {
  border-color: var(--border-soft) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium .header-control:hover,
html[data-theme] body.theme-light-premium .btn:hover,
html[data-theme] body.theme-light-premium .icon-btn:hover,
html[data-theme] body.theme-light-premium .inline-edit:hover {
  border-color: var(--border-strong) !important;
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium input,
html[data-theme] body.theme-light-premium textarea,
html[data-theme] body.theme-light-premium select,
html[data-theme] body.theme-light-premium .matrix-search-wrap,
html[data-theme] body.theme-light input,
html[data-theme] body.theme-light textarea,
html[data-theme] body.theme-light select {
  border-color: var(--input-border) !important;
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium input::placeholder,
html[data-theme] body.theme-light-premium textarea::placeholder,
html[data-theme] body.theme-light input::placeholder,
html[data-theme] body.theme-light textarea::placeholder {
  color: var(--input-placeholder) !important;
}

html[data-theme] body.theme-light-premium input:focus,
html[data-theme] body.theme-light-premium textarea:focus,
html[data-theme] body.theme-light-premium select:focus,
html[data-theme] body.theme-light input:focus,
html[data-theme] body.theme-light textarea:focus,
html[data-theme] body.theme-light select:focus {
  border-color: var(--input-focus-border) !important;
  box-shadow: var(--shadow-focus) !important;
}

html[data-theme] body.theme-light-premium .header-dropdown,
html[data-theme] body.theme-light-premium .project-action-menu,
html[data-theme] body.theme-light-premium .account-dropdown,
html[data-theme] body.theme-light-premium .theme-menu {
  border-color: var(--border-soft) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-dropdown) !important;
}

html[data-theme] body.theme-light-premium .header-dropdown button,
html[data-theme] body.theme-light-premium .header-dropdown a,
html[data-theme] body.theme-light-premium .project-action-menu button {
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .header-dropdown button:hover,
html[data-theme] body.theme-light-premium .header-dropdown a:hover,
html[data-theme] body.theme-light-premium .project-action-menu button:hover {
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .project-table,
html[data-theme] body.theme-light-premium .matrix-table,
html[data-theme] body.theme-light-premium .keywords-table,
html[data-theme] body.theme-light-premium .frequency-table {
  background: var(--table-row-bg) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .project-table th,
html[data-theme] body.theme-light-premium .matrix-table thead th,
html[data-theme] body.theme-light-premium .keywords-table th,
html[data-theme] body.theme-light-premium .frequency-table th {
  border-color: var(--table-border) !important;
  background: var(--table-header-bg) !important;
  color: var(--text-secondary) !important;
}

html[data-theme] body.theme-light-premium .project-table td,
html[data-theme] body.theme-light-premium .matrix-table tbody td,
html[data-theme] body.theme-light-premium .keywords-table td,
html[data-theme] body.theme-light-premium .frequency-table td {
  border-color: var(--table-border) !important;
  background: var(--table-row-bg) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .project-table tbody tr:nth-child(odd) td,
html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(odd) td {
  background: var(--table-row-alt-bg) !important;
}

html[data-theme] body.theme-light-premium .project-table tbody tr:hover td,
html[data-theme] body.theme-light-premium .matrix-table tbody tr:hover td,
html[data-theme] body.theme-light-premium .keywords-table tbody tr:hover td,
html[data-theme] body.theme-light-premium .frequency-table tr:hover td {
  background: var(--table-row-hover-bg) !important;
}

html[data-theme] body.theme-light-premium .project-name-cell b,
html[data-theme] body.theme-light-premium .project-table a,
html[data-theme] body.theme-light-premium .matrix-keyword,
html[data-theme] body.theme-light-premium .matrix-frequency,
html[data-theme] body.theme-light-premium .rank-badge,
html[data-theme] body.theme-light-premium .history-chip {
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .project-name-cell small,
html[data-theme] body.theme-light-premium .project-index,
html[data-theme] body.theme-light-premium .project-table-footer,
html[data-theme] body.theme-light-premium .matrix-head-stack small {
  color: var(--text-secondary) !important;
}

html[data-theme] body.theme-light-premium .project-position-badge,
html[data-theme] body.theme-light-premium .avg-position,
html[data-theme] body.theme-light-premium .position-top3,
html[data-theme] body.theme-light-premium .position-top10,
html[data-theme] body.theme-light-premium .position-top30,
html[data-theme] body.theme-light-premium .position-top100,
html[data-theme] body.theme-light-premium .position-not-found,
html[data-theme] body.theme-light-premium .rank-badge,
html[data-theme] body.theme-light-premium .history-chip,
html[data-theme] body.theme-light-premium .matrix-pos {
  border-color: var(--neutral-border) !important;
  background: var(--neutral-bg) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .metric-up,
html[data-theme] body.theme-light-premium .change-up,
html[data-theme] body.theme-light-premium .access-pill.access-on i {
  color: var(--success) !important;
}

html[data-theme] body.theme-light-premium .metric-down,
html[data-theme] body.theme-light-premium .change-down,
html[data-theme] body.theme-light-premium .btn-danger,
html[data-theme] body.theme-light-premium .project-action-menu button.danger,
html[data-theme] body.theme-light-premium .account-action-logout {
  color: var(--danger) !important;
}

html[data-theme] body.theme-light-premium .access-pill {
  border-color: var(--neutral-border) !important;
  background: var(--neutral-bg) !important;
  color: var(--neutral) !important;
}

html[data-theme] body.theme-light-premium .access-pill.access-on {
  border-color: var(--success-border) !important;
  background: var(--success-bg) !important;
  color: var(--success) !important;
}

html[data-theme] body.theme-light-premium .access-pill.access-off {
  border-color: var(--danger-border) !important;
  background: var(--danger-bg) !important;
  color: var(--danger) !important;
}

html[data-theme] body.theme-light-premium .premium-issue {
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .premium-issue b {
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .premium-issue-critical b::after {
  background: var(--danger) !important;
}

html[data-theme] body.theme-light-premium .premium-issue-attention b::after {
  background: var(--warning) !important;
}

html[data-theme] body.theme-light-premium .premium-issue-info b::after {
  background: var(--info) !important;
}

html[data-theme] body.theme-light-premium .premium-donut,
html[data-theme] body.theme-light-premium .premium-ranges-donut {
  background: conic-gradient(var(--chart-line-primary) 0 var(--progress), var(--surface-tertiary) var(--progress) 100%);
}

html[data-theme] body.theme-light-premium .premium-donut::after,
html[data-theme] body.theme-light-premium .premium-ranges-donut::after {
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium .premium-donut span,
html[data-theme] body.theme-light-premium .premium-ranges-donut span {
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium .premium-progress-legend span:nth-child(1) i,
html[data-theme] body.theme-light-premium .premium-range-legend button:nth-child(1) i {
  background: var(--chart-segment-1) !important;
}

html[data-theme] body.theme-light-premium .premium-progress-legend span:nth-child(2) i,
html[data-theme] body.theme-light-premium .premium-range-legend button:nth-child(2) i {
  background: var(--chart-segment-2) !important;
}

html[data-theme] body.theme-light-premium .premium-progress-legend span:nth-child(3) i,
html[data-theme] body.theme-light-premium .premium-range-legend button:nth-child(3) i {
  background: var(--chart-segment-3) !important;
}

html[data-theme] body.theme-light-premium .premium-range-legend button:nth-child(4) i {
  background: var(--chart-segment-4) !important;
}

html[data-theme] body.theme-light-premium .premium-range-legend button:nth-child(5) i {
  background: var(--chart-segment-5) !important;
}

html[data-theme] body.theme-light-premium .premium-range-legend button:nth-child(6) i {
  border: 1px solid var(--border-default) !important;
  background: var(--chart-segment-6) !important;
}

html[data-theme] body.theme-light-premium .premium-line-chart .premium-chart-grid line,
html[data-theme] body.theme-light-premium .history-chart line {
  stroke: var(--chart-grid) !important;
}

html[data-theme] body.theme-light-premium .premium-line-chart path,
html[data-theme] body.theme-light-premium .history-chart path {
  stroke: var(--chart-line-primary) !important;
}

html[data-theme] body.theme-light-premium .premium-line-chart circle,
html[data-theme] body.theme-light-premium .history-chart circle {
  fill: var(--surface-primary) !important;
  stroke: var(--chart-line-primary) !important;
}

html[data-theme] body.theme-light-premium .premium-line-chart text,
html[data-theme] body.theme-light-premium .history-chart text,
html[data-theme] body.theme-light-premium .premium-line-chart .premium-chart-date {
  fill: var(--chart-label) !important;
}

html[data-theme] body.theme-light-premium .theme-preview {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: inherit;
  background: var(--surface-primary);
  box-shadow: inset 0 0 0 5px var(--accent-primary);
}

html[data-theme] body.theme-light-premium .theme-preview-light {
  background: #ffffff;
  box-shadow: inset 0 0 0 5px #1d1d1b;
}

html[data-theme] body.theme-light-premium .theme-preview-dark {
  background: #0d1524;
  box-shadow: inset 0 0 0 5px #ff4d4d;
}

html[data-theme] body.theme-light-premium .theme-preview-retro {
  background: #1f2f18;
  box-shadow: inset 0 0 0 5px #989a43;
}

html[data-theme] body.theme-light-premium [data-theme-option].active::after {
  content: '✓';
  margin-left: auto;
  color: var(--accent-primary);
  font-weight: 900;
}

html[data-theme] body.theme-light-premium .modal {
  background: var(--backdrop-bg) !important;
}

html[data-theme] body.theme-light-premium .alert.success,
html[data-theme] body.theme-light-premium .status-success {
  border-color: var(--success-border) !important;
  background: var(--success-bg) !important;
  color: var(--success) !important;
}

html[data-theme] body.theme-light-premium .alert.error,
html[data-theme] body.theme-light-premium .login-error,
html[data-theme] body.theme-light-premium .status-danger {
  border-color: var(--danger-border) !important;
  background: var(--danger-bg) !important;
  color: var(--danger) !important;
}

html[data-theme] body.theme-light .login-shell,
html[data-theme] body.theme-light.lead-page,
html[data-theme] body.theme-light.monitoring-page {
  background: var(--page-bg) !important;
  color: var(--text-primary) !important;
}

html[data-theme="dark"] body.theme-light-premium {
  --page-bg: #080d1a;
  --sidebar-bg: #0d1424;
  --surface: #121c2d;
  --surface-white: #0d1524;
  --surface-muted: #121c2d;
  --surface-inset: #182438;
  --surface-dark: #ff4d4d;
  --text-main: #f4f6fb;
  --text-secondary: #9da7b8;
  --text-muted: #707c90;
  --text-inverse: #ffffff;
  --border: #263248;
  --border-soft: #1c273b;
  --accent: #ff4d4d;
  --accent-secondary: #6954d9;
  --success: #5dd39e;
  --danger: #ff6b7a;
  --warning: #e0b85f;
  --pa-bg: #080d1a;
  --pa-surface: #0d1524;
  --pa-surface-muted: #121c2d;
  --pa-surface-inset: #182438;
  --pa-text: #f4f6fb;
  --pa-text-muted: #9da7b8;
  --pa-text-subtle: #707c90;
  --pa-border: #263248;
  --pa-border-subtle: #1c273b;
  --pa-accent: #ff4d4d;
  --pa-accent-hover: #ff6666;
  --pa-accent-soft: #182345;
  --pa-success: #5dd39e;
  --pa-success-soft: #122d2a;
  --pa-danger: #ff6b7a;
  --pa-danger-soft: #351720;
  --pa-warning: #e0b85f;
  --pa-warning-soft: #332816;
  --pa-neutral: #9da7b8;
  --pa-neutral-soft: #182438;
  --bg: #080d1a;
  --panel: #0d1524;
  --panel2: #121c2d;
  --border2: #1c273b;
  --text: #f4f6fb;
  --muted: #9da7b8;
  --muted2: #707c90;
  --accent2: #ff6666;
  --matrix-bg: #0d1524;
  --matrix-bg-2: #121d2e;
  --matrix-bg-3: #182438;
  --matrix-line: #1c273b;
  --matrix-line-soft: #1c273b;
  background: #080d1a !important;
}

html[data-theme="retro"] body.theme-light-premium {
  --page-bg: #13200f;
  --sidebar-bg: #182711;
  --surface: #26381d;
  --surface-white: #1f2f18;
  --surface-muted: #26381d;
  --surface-inset: #304425;
  --surface-dark: #989a43;
  --text-main: #f1efc6;
  --text-secondary: #c8c58d;
  --text-muted: #99975f;
  --text-inverse: #13170b;
  --border: #4d5c31;
  --border-soft: #344523;
  --accent: #989a43;
  --accent-secondary: #c6c36c;
  --success: #a8c66c;
  --danger: #e09365;
  --warning: #d4c96a;
  --pa-bg: #13200f;
  --pa-surface: #1f2f18;
  --pa-surface-muted: #26381d;
  --pa-surface-inset: #304425;
  --pa-text: #f1efc6;
  --pa-text-muted: #c8c58d;
  --pa-text-subtle: #99975f;
  --pa-border: #4d5c31;
  --pa-border-subtle: #344523;
  --pa-accent: #989a43;
  --pa-accent-hover: #acad54;
  --pa-accent-soft: #30351c;
  --pa-success: #a8c66c;
  --pa-success-soft: #26381d;
  --pa-danger: #e09365;
  --pa-danger-soft: #3d2619;
  --pa-warning: #d4c96a;
  --pa-warning-soft: #393718;
  --pa-neutral: #c8c58d;
  --pa-neutral-soft: #26381d;
  --bg: #13200f;
  --panel: #1f2f18;
  --panel2: #26381d;
  --border2: #344523;
  --text: #f1efc6;
  --muted: #c8c58d;
  --muted2: #99975f;
  --accent2: #acad54;
  --matrix-bg: #182713;
  --matrix-bg-2: #1e3017;
  --matrix-bg-3: #304425;
  --matrix-line: #344523;
  --matrix-line-soft: #344523;
  background: #13200f !important;
}

/* Final visual/UX stabilization */
html[data-theme="light"] body.theme-light-premium {
  --overview-card-bg: #1f1f1d;
  --overview-card-border: #1f1f1d;
  --overview-card-text: #ffffff;
  --overview-card-muted: rgba(255, 255, 255, 0.66);
  --overview-chip-bg: #f1f1ee;
  --overview-chip-border: #e1e1dc;
  --overview-chip-text: #1d1d1b;
  --overview-chip-muted: #676762;
  --selected-project-bg: #1f1f1d;
  --selected-project-border: #1f1f1d;
  --selected-project-text: #ffffff;
}

html[data-theme="dark"] body.theme-light-premium {
  --surface-dark: #705cff;
  --accent-primary: #705cff;
  --accent-primary-hover: #8574ff;
  --accent-primary-active: #5d48e6;
  --accent-primary-text: #ffffff;
  --pa-accent: #705cff;
  --pa-accent-hover: #8574ff;
  --accent: #705cff;
  --accent2: #8574ff;
  --chart-line-primary: #8574ff;
  --chart-line-secondary: #6f7fdc;
  --chart-segment-1: #8574ff;
  --chart-segment-2: #6f7fdc;
  --overview-card-bg: #101827;
  --overview-card-border: #263248;
  --overview-card-text: #f7f8fc;
  --overview-card-muted: #a9b2c4;
  --overview-chip-bg: #182438;
  --overview-chip-border: #263248;
  --overview-chip-text: #f7f8fc;
  --overview-chip-muted: #a9b2c4;
  --selected-project-bg: #121c2d;
  --selected-project-border: #705cff;
  --selected-project-text: #f7f8fc;
}

html[data-theme="retro"] body.theme-light-premium {
  --overview-card-bg: #1b2a15;
  --overview-card-border: #4d5c31;
  --overview-card-text: #f4f0bf;
  --overview-card-muted: #c8c58d;
  --overview-chip-bg: #2b4020;
  --overview-chip-border: #4d5c31;
  --overview-chip-text: #f4f0bf;
  --overview-chip-muted: #c8c58d;
  --selected-project-bg: #989a43;
  --selected-project-border: #b7b957;
  --selected-project-text: #13170b;
}

html[data-theme] body.theme-light-premium .premium-card.premium-card-dark,
html[data-theme] body.theme-light-premium #premium-overview-card {
  border-color: var(--overview-card-border) !important;
  background: var(--overview-card-bg) !important;
  color: var(--overview-card-text) !important;
}

html[data-theme] body.theme-light-premium .premium-card-dark > .premium-card-head h2,
html[data-theme] body.theme-light-premium .premium-card-dark > .premium-overview-main b {
  color: var(--overview-card-text) !important;
}

html[data-theme] body.theme-light-premium .premium-card-dark > .premium-card-head span,
html[data-theme] body.theme-light-premium .premium-card-dark > .premium-overview-main span {
  color: var(--overview-card-muted) !important;
}

html[data-theme] body.theme-light-premium .premium-overview-metrics div {
  border: 1px solid var(--overview-chip-border) !important;
  background: var(--overview-chip-bg) !important;
  color: var(--overview-chip-text) !important;
}

html[data-theme] body.theme-light-premium .premium-overview-metrics b {
  color: var(--overview-chip-text) !important;
}

html[data-theme] body.theme-light-premium .premium-overview-metrics span {
  color: var(--overview-chip-muted) !important;
}

html[data-theme] body.theme-light-premium .premium-trend-card,
html[data-theme] body.theme-light-premium .premium-progress-card {
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium .premium-project-card-dark {
  border-color: var(--selected-project-border) !important;
  background: var(--selected-project-bg) !important;
  color: var(--selected-project-text) !important;
}

html[data-theme="dark"] body.theme-light-premium .premium-project-card-dark {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-primary) 55%, transparent) !important;
}

html[data-theme="dark"] body.theme-light-premium .premium-sidebar-nav a:hover,
html[data-theme="dark"] body.theme-light-premium .premium-sidebar-nav a.active,
html[data-theme="dark"] body.theme-light-premium .premium-sidebar-bottom a:hover,
html[data-theme="dark"] body.theme-light-premium .premium-sidebar-bottom button:hover,
html[data-theme="dark"] body.theme-light-premium .btn-primary,
html[data-theme="dark"] body.theme-light-premium .btn.active,
html[data-theme="dark"] body.theme-light-premium .premium-top-action,
html[data-theme="dark"] body.theme-light-premium .premium-chart-empty a,
html[data-theme="dark"] body.theme-light-premium .premium-periods button.active {
  border-color: var(--accent-primary) !important;
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
}

html[data-theme] body.theme-light-premium .theme-menu button.active,
html[data-theme] body.theme-light-premium .theme-menu button[aria-checked="true"] {
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
}

html[data-theme] body.theme-light-premium .theme-menu button.active span,
html[data-theme] body.theme-light-premium .theme-menu button[aria-checked="true"] span {
  color: var(--accent-primary-text) !important;
}

html[data-theme] body.theme-light-premium .theme-menu button.active::after {
  content: "✓";
  color: var(--accent-primary-text) !important;
}

html[data-theme="dark"] body.theme-light-premium .theme-preview-dark {
  box-shadow: inset 0 0 0 5px #705cff !important;
}

html[data-theme] body.theme-light-premium .project-table-shell {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
}

html[data-theme] body.theme-light-premium .project-table {
  min-width: 1040px !important;
  width: 100% !important;
  table-layout: fixed !important;
}

html[data-theme] body.theme-light-premium .project-table th:nth-child(1),
html[data-theme] body.theme-light-premium .project-table td:nth-child(1) { width: 52px !important; }
html[data-theme] body.theme-light-premium .project-table th:nth-child(2),
html[data-theme] body.theme-light-premium .project-table td:nth-child(2) { width: 230px !important; }
html[data-theme] body.theme-light-premium .project-table th:nth-child(3),
html[data-theme] body.theme-light-premium .project-table td:nth-child(3) { width: 190px !important; }
html[data-theme] body.theme-light-premium .project-table th:nth-child(4),
html[data-theme] body.theme-light-premium .project-table td:nth-child(4) { width: 80px !important; text-align: center !important; }
html[data-theme] body.theme-light-premium .project-table th:nth-child(5),
html[data-theme] body.theme-light-premium .project-table td:nth-child(5) { width: 118px !important; text-align: center !important; }
html[data-theme] body.theme-light-premium .project-table th:nth-child(6),
html[data-theme] body.theme-light-premium .project-table td:nth-child(6) { width: 112px !important; text-align: center !important; }
html[data-theme] body.theme-light-premium .project-table th:nth-child(7),
html[data-theme] body.theme-light-premium .project-table td:nth-child(7) { width: 132px !important; text-align: center !important; }
html[data-theme] body.theme-light-premium .project-table th:nth-child(8),
html[data-theme] body.theme-light-premium .project-table td:nth-child(8) { width: 104px !important; text-align: center !important; }

html[data-theme] body.theme-light-premium .project-name-cell b,
html[data-theme] body.theme-light-premium .project-table td:nth-child(3) a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .project-action-menu {
  min-width: 190px !important;
  z-index: 10000 !important;
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .premium-card,
  html[data-theme] body.theme-light-premium .home-panel,
  html[data-theme] body.theme-light-premium .project-info,
  html[data-theme] body.theme-light-premium .matrix-card {
    border-radius: 16px !important;
  }

  html[data-theme] body.theme-light-premium .premium-card {
    padding: 16px !important;
  }

  html[data-theme] body.theme-light-premium .premium-overview-card {
    min-height: 0 !important;
  }

  html[data-theme] body.theme-light-premium .premium-overview-main {
    margin: 10px 0 14px !important;
  }

  html[data-theme] body.theme-light-premium .premium-overview-main b {
    font-size: 38px !important;
  }

  html[data-theme] body.theme-light-premium .premium-overview-metrics {
    gap: 8px !important;
  }

  html[data-theme] body.theme-light-premium .premium-overview-metrics div {
    min-height: 58px !important;
    padding: 10px 12px !important;
  }

  html[data-theme] body.theme-light-premium .manual-section {
    padding: 16px !important;
  }

  html[data-theme] body.theme-light-premium .manual-card {
    padding: 14px !important;
  }

  html[data-theme] body.theme-light-premium .manual-card-head {
    gap: 10px !important;
    margin-bottom: 12px !important;
  }

  html[data-theme] body.theme-light-premium .manual-card-head span {
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
  }

  html[data-theme] body.theme-light-premium .manual-card-head p {
    font-size: 12px !important;
    opacity: .72;
  }

  html[data-theme] body.theme-light-premium .manual-card textarea {
    min-height: 96px !important;
    max-height: 110px !important;
  }

  html[data-theme] body.theme-light-premium .manual-card .btn,
  html[data-theme] body.theme-light-premium .manual-card .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  html[data-theme] body.theme-light-premium .project-table-shell {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  html[data-theme] body.theme-light-premium .project-table,
  html[data-theme] body.theme-light-premium .project-table tbody,
  html[data-theme] body.theme-light-premium .project-table tr,
  html[data-theme] body.theme-light-premium .project-table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-theme] body.theme-light-premium .project-table {
    border-collapse: separate !important;
    border-spacing: 0 10px !important;
  }

  html[data-theme] body.theme-light-premium .project-table thead {
    display: none !important;
  }

  html[data-theme] body.theme-light-premium .project-table tr {
    padding: 14px !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: 16px !important;
    background: var(--surface-primary) !important;
    box-shadow: var(--shadow-card) !important;
  }

  html[data-theme] body.theme-light-premium .project-table td {
    display: grid !important;
    grid-template-columns: 86px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 30px !important;
    padding: 5px 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
  }

  html[data-theme] body.theme-light-premium .project-table td::before {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 720;
    text-transform: uppercase;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(1)::before { content: "#"; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(2)::before { content: "Проект"; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(3)::before { content: "Домен"; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(4)::before { content: "Ключей"; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(5)::before { content: "Средняя"; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(6)::before { content: "Проверки"; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(7)::before { content: "Дата"; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(8)::before { content: "Действия"; }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(2) {
    grid-template-columns: 1fr;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(2)::before {
    content: none;
  }

  html[data-theme] body.theme-light-premium .project-table .project-name-cell {
    grid-template-columns: 38px minmax(0, 1fr) !important;
  }

  html[data-theme] body.theme-light-premium .project-row-menu {
    justify-content: flex-start;
  }

  html[data-theme] body.theme-light-premium .project-action-menu {
    left: 0;
    right: auto;
  }

  html[data-theme] body.theme-light-premium .matrix-shell {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
    contain: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table,
  html[data-theme] body.theme-light-premium .matrix-table tbody,
  html[data-theme] body.theme-light-premium .matrix-table tr,
  html[data-theme] body.theme-light-premium .matrix-table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table {
    min-width: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 10px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead {
    display: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
    padding: 14px !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: 16px !important;
    background: var(--surface-primary) !important;
    box-shadow: var(--shadow-card) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td {
    display: grid !important;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 28px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    text-align: left !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td::before {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 720;
    text-transform: uppercase;
  }

  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(1)::before { content: "Дата"; }
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2)::before { content: "Запрос"; }
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(3)::before { content: "Частотность"; }
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(4)::before { content: "Позиция"; }
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(5)::before { content: "Динамика"; }
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(6)::before { content: "Первая"; }
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(7)::before { content: "Лучшая"; }
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(8)::before { content: "URL"; }

  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2) {
    grid-template-columns: 1fr;
    padding-bottom: 4px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2)::before {
    content: none;
  }

  html[data-theme] body.theme-light-premium .matrix-keyword {
    color: var(--text-primary) !important;
    font-size: 16px !important;
    line-height: 1.3 !important;
    font-weight: 780 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-frequency {
    display: grid !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    padding: 0 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-frequency::before,
  html[data-theme] body.theme-light-premium .matrix-positions-cell::before {
    content: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-positions-cell > .rank-badge,
  html[data-theme] body.theme-light-premium .matrix-table .rank-badge,
  html[data-theme] body.theme-light-premium .matrix-dynamics-cell .rank-change,
  html[data-theme] body.theme-light-premium .matrix-dynamics-cell .change-muted {
    position: static !important;
    inset: auto !important;
    min-width: 42px !important;
    width: fit-content !important;
    height: 28px !important;
    justify-self: start;
    font-size: 13px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell a {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  html[data-theme] body.theme-light-premium .matrix-keyword-head,
  html[data-theme] body.theme-light-premium .keyword-col {
    position: sticky !important;
    left: 0 !important;
    z-index: 3;
  }

  html[data-theme] body.theme-light-premium .keyword-col {
    background: var(--table-row-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(odd) .keyword-col {
    background: var(--table-row-alt-bg) !important;
  }
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .project-table tr {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }

  html[data-theme] body.theme-light-premium .project-table tr > td {
    width: 100% !important;
    max-width: none !important;
    grid-column: 1 / -1 !important;
    grid-template-columns: 78px minmax(0, 1fr) !important;
    box-sizing: border-box !important;
    min-height: 26px !important;
    padding: 3px 0 !important;
    background: transparent !important;
  }

  html[data-theme] body.theme-light-premium .project-table tbody tr > td,
  html[data-theme] body.theme-light-premium .project-table tbody tr:nth-child(odd) > td,
  html[data-theme] body.theme-light-premium .project-table tbody tr:nth-child(even) > td,
  html[data-theme] body.theme-light-premium .project-table tbody tr:hover > td {
    background: transparent !important;
  }

  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(1) {
    order: 0;
    grid-template-columns: 78px auto !important;
  }

  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(2) {
    order: 1;
    padding: 0 0 7px !important;
  }

  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(3) { order: 2; }
  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(4) { order: 3; }
  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(5) { order: 4; }
  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(6) { order: 5; }
  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(7) { order: 6; }
  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(8) { order: 7; }

  html[data-theme] body.theme-light-premium .project-table tr > td:nth-child(7) {
    white-space: nowrap;
  }

  html[data-theme] body.theme-light-premium .project-table td::before {
    background: transparent !important;
  }

  html[data-theme] body.theme-light-premium .project-table .project-table-actions,
  html[data-theme] body.theme-light-premium .project-table .project-row-menu {
    width: auto !important;
    max-width: 100% !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 5px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td {
    width: 100% !important;
    max-width: none !important;
    grid-column: 1 / -1 !important;
    grid-template-columns: 96px minmax(0, 1fr) !important;
    box-sizing: border-box !important;
    min-height: 27px !important;
    background: transparent !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr > td,
  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(odd) > td,
  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(even) > td,
  html[data-theme] body.theme-light-premium .matrix-table tbody tr:hover > td {
    background: transparent !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(2) {
    order: 0;
    grid-template-columns: 1fr !important;
    padding-bottom: 6px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3) { order: 1; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4) { order: 2; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5) { order: 3; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6) { order: 4; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7) { order: 5; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1) { order: 6; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8) { order: 7; }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3)::before { content: "Частотность" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4)::before { content: "Позиция" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5)::before { content: "Динамика" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6)::before { content: "Первая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7)::before { content: "Лучшая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before { content: "Дата" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8)::before { content: "URL" !important; }

  html[data-theme] body.theme-light-premium .matrix-frequency {
    display: grid !important;
    grid-template-columns: 96px minmax(0, 1fr) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4) .rank-badge,
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5) .rank-change,
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6) .rank-badge,
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7) .rank-badge {
    justify-self: start !important;
  }
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .project-table tr {
    position: relative !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 12px !important;
  }

  html[data-theme] body.theme-light-premium .project-table tr > td {
    grid-template-columns: 1fr !important;
    gap: 3px !important;
    min-height: 0 !important;
    padding: 8px 10px !important;
    border-radius: 12px !important;
    background: var(--surface-secondary) !important;
  }

  html[data-theme] body.theme-light-premium .project-table td::before,
  html[data-theme] body.theme-light-premium .matrix-table td::before {
    color: var(--text-tertiary) !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    letter-spacing: .02em !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(1) {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: auto !important;
    padding: 0 !important;
    color: var(--text-tertiary) !important;
    background: transparent !important;
    font-size: 11px !important;
    font-weight: 760 !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(1)::before,
  html[data-theme] body.theme-light-premium .project-table td:nth-child(2)::before {
    content: none !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(2) {
    grid-column: 1 / -1 !important;
    padding: 0 34px 4px 0 !important;
    background: transparent !important;
  }

  html[data-theme] body.theme-light-premium .project-table .project-name-cell {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: center !important;
  }

  html[data-theme] body.theme-light-premium .project-table .project-name-cell > div {
    min-width: 0 !important;
  }

  html[data-theme] body.theme-light-premium .project-table .project-name-cell b {
    display: block !important;
    max-width: 100% !important;
    color: var(--text-primary) !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html[data-theme] body.theme-light-premium .project-table .project-name-cell small {
    display: inline-flex !important;
    max-width: 100% !important;
    margin-top: 3px !important;
    color: var(--text-secondary) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(3) {
    grid-column: 1 / -1 !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(3) a {
    display: block !important;
    color: var(--text-primary) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(4),
  html[data-theme] body.theme-light-premium .project-table td:nth-child(5),
  html[data-theme] body.theme-light-premium .project-table td:nth-child(6),
  html[data-theme] body.theme-light-premium .project-table td:nth-child(7) {
    grid-column: auto !important;
    color: var(--text-primary) !important;
    font-size: 13px !important;
    font-weight: 720 !important;
    text-align: left !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(8) {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 6px 0 0 !important;
    background: transparent !important;
  }

  html[data-theme] body.theme-light-premium .project-table td:nth-child(3)::before { content: "Домен" !important; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(4)::before { content: "Ключей" !important; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(5)::before { content: "Средняя" !important; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(6)::before { content: "Проверки" !important; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(7)::before { content: "Дата" !important; }
  html[data-theme] body.theme-light-premium .project-table td:nth-child(8)::before { content: "Действия" !important; }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3)::before { content: "Частотность" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4)::before { content: "Позиция" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5)::before { content: "Динамика" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6)::before { content: "Первая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7)::before { content: "Лучшая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before { content: "Дата" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8)::before { content: "URL" !important; }
}

/* Position matrix readability pass */
html[data-theme] body.theme-light-premium {
  --pa-table-header-bg: var(--table-header-bg);
  --pa-table-row-bg: var(--table-row-bg);
  --pa-table-row-alt-bg: color-mix(in srgb, var(--table-row-bg) 92%, var(--surface-hover));
  --pa-table-row-hover-bg: color-mix(in srgb, var(--table-row-bg) 82%, var(--accent-primary) 18%);
  --pa-table-border: var(--table-border);
  --pa-table-sticky-shadow: 10px 0 18px rgba(20, 20, 18, .06);
  --pa-position-bg: var(--neutral-bg);
  --pa-position-border: var(--neutral-border);
  --pa-position-text: var(--text-primary);
  --pa-dynamic-up-bg: var(--success-bg);
  --pa-dynamic-up-border: var(--success-border);
  --pa-dynamic-up-text: var(--success);
  --pa-dynamic-down-bg: var(--danger-bg);
  --pa-dynamic-down-border: var(--danger-border);
  --pa-dynamic-down-text: var(--danger);
  --pa-dynamic-same-bg: var(--neutral-bg);
  --pa-dynamic-same-border: var(--neutral-border);
  --pa-dynamic-same-text: var(--text-secondary);
}

html[data-theme="dark"] body.theme-light-premium {
  --pa-table-sticky-shadow: 10px 0 22px rgba(0, 0, 0, .26);
}

html[data-theme="retro"] body.theme-light-premium {
  --pa-table-row-alt-bg: color-mix(in srgb, var(--table-row-bg) 90%, var(--surface-hover));
  --pa-table-row-hover-bg: color-mix(in srgb, var(--table-row-bg) 78%, var(--accent-primary) 22%);
}

html[data-theme] body.theme-light-premium .home-project-toolbar .matrix-search-wrap {
  height: 44px !important;
  border: 1px solid var(--input-border) !important;
  border-radius: 16px !important;
  background: var(--input-bg) !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium .home-project-toolbar .matrix-search-wrap i {
  display: inline-flex !important;
  flex: 0 0 18px !important;
  width: 18px !important;
  height: 18px !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--text-secondary) !important;
  font-size: 14px !important;
  position: relative !important;
}

html[data-theme] body.theme-light-premium .home-project-toolbar .matrix-search-wrap i::before {
  content: "" !important;
  width: 10px !important;
  height: 10px !important;
  border: 2px solid currentColor !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
}

html[data-theme] body.theme-light-premium .home-project-toolbar .matrix-search-wrap i::after {
  content: "" !important;
  position: absolute !important;
  width: 7px !important;
  height: 2px !important;
  right: 1px !important;
  bottom: 3px !important;
  border-radius: 999px !important;
  background: currentColor !important;
  transform: rotate(45deg) !important;
  transform-origin: center !important;
}

html[data-theme] body.theme-light-premium .home-project-toolbar .matrix-search-wrap input {
  height: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium .matrix-check-note {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 2px 0 10px;
  padding: 5px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 720;
}

html[data-theme] body.theme-light-premium .matrix-check-note[hidden] {
  display: none !important;
}

@media (min-width: 761px) {
  html[data-theme] body.theme-light-premium .matrix-shell {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: 16px !important;
    background: var(--surface-primary) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table {
    min-width: calc(var(--matrix-keyword-width, 380px) + 792px) !important;
    width: max(100%, calc(var(--matrix-keyword-width, 380px) + 792px)) !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: fixed !important;
    background: var(--pa-table-row-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(1),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(1) {
    width: var(--matrix-keyword-width, 380px) !important;
    min-width: var(--matrix-keyword-width, 380px) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(2),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2) {
    width: 112px !important;
    text-align: right !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(3),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(3) {
    width: 126px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(4),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(4) {
    width: 104px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(5),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(5) {
    width: 116px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(6),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(6) {
    width: 110px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(7),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(7) {
    width: 224px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 4 !important;
    height: 52px !important;
    padding: 10px 16px !important;
    border-width: 0 0 1px !important;
    border-color: var(--pa-table-border) !important;
    background: var(--pa-table-header-bg) !important;
    color: var(--text-secondary) !important;
    font-size: 11px !important;
    font-weight: 760 !important;
    letter-spacing: .02em !important;
    text-transform: uppercase !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th:first-child,
  html[data-theme] body.theme-light-premium .matrix-table tbody td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 5 !important;
    box-shadow: var(--pa-table-sticky-shadow) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th:first-child {
    z-index: 8 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody td {
    height: 60px !important;
    padding: 14px 16px !important;
    border-width: 0 0 1px !important;
    border-color: var(--pa-table-border) !important;
    background: var(--pa-table-row-bg) !important;
    color: var(--text-primary) !important;
    vertical-align: middle !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(odd) td {
    background: var(--pa-table-row-alt-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:hover td,
  html[data-theme] body.theme-light-premium .matrix-table tbody tr:hover td:first-child {
    background: var(--pa-table-row-hover-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-keyword-head {
    padding-right: 22px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-keyword-head .matrix-sort-button,
  html[data-theme] body.theme-light-premium .matrix-table thead .matrix-sort-button {
    width: 100% !important;
    color: inherit !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th.sort-asc .matrix-sort-button::after,
  html[data-theme] body.theme-light-premium .matrix-table thead th.sort-desc .matrix-sort-button::after {
    margin-left: 6px;
    color: var(--accent-primary);
    font-size: 10px;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th.sort-asc .matrix-sort-button::after {
    content: "↑";
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th.sort-desc .matrix-sort-button::after {
    content: "↓";
  }

  html[data-theme] body.theme-light-premium .keyword-col {
    background: inherit !important;
  }

  html[data-theme] body.theme-light-premium .matrix-keyword {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    font-weight: 760 !important;
    line-height: 1.28 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html[data-theme] body.theme-light-premium .keyword-col small {
    display: block;
    max-width: 100%;
    margin-top: 4px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 520;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-theme] body.theme-light-premium .matrix-frequency {
    font-variant-numeric: tabular-nums;
    font-weight: 620 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell a {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    gap: 6px;
    color: var(--text-link) !important;
    font-size: 13px;
    text-decoration: none;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell a span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

html[data-theme] body.theme-light-premium .rank-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 38px !important;
  height: 28px !important;
  padding: 0 10px !important;
  border: 1px solid var(--pa-position-border) !important;
  border-radius: 999px !important;
  background: var(--pa-position-bg) !important;
  color: var(--pa-position-text) !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  font-variant-numeric: tabular-nums;
  line-height: 1 !important;
}

html[data-theme] body.theme-light-premium button.rank-badge {
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .position-empty,
html[data-theme] body.theme-light-premium .change-empty,
html[data-theme] body.theme-light-premium .url-empty {
  color: var(--text-muted) !important;
  font-weight: 620;
}

html[data-theme] body.theme-light-premium .rank-change {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 44px !important;
  height: 28px !important;
  padding: 0 10px !important;
  border: 1px solid var(--pa-dynamic-same-border) !important;
  border-radius: 999px !important;
  background: var(--pa-dynamic-same-bg) !important;
  color: var(--pa-dynamic-same-text) !important;
  font-size: 13px !important;
  font-weight: 780 !important;
  font-variant-numeric: tabular-nums;
}

html[data-theme] body.theme-light-premium .rank-change.change-up {
  border-color: var(--pa-dynamic-up-border) !important;
  background: var(--pa-dynamic-up-bg) !important;
  color: var(--pa-dynamic-up-text) !important;
}

html[data-theme] body.theme-light-premium .rank-change.change-down {
  border-color: var(--pa-dynamic-down-border) !important;
  background: var(--pa-dynamic-down-bg) !important;
  color: var(--pa-dynamic-down-text) !important;
}

html[data-theme] body.theme-light-premium .rank-change.change-same {
  border-color: var(--pa-dynamic-same-border) !important;
  background: var(--pa-dynamic-same-bg) !important;
  color: var(--pa-dynamic-same-text) !important;
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before { content: "Запрос" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(2)::before { content: "Частотность" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3)::before { content: "Позиция" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4)::before { content: "Динамика" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5)::before { content: "Первая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6)::before { content: "Лучшая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7)::before { content: "URL" !important; }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1) {
    order: 0 !important;
    grid-template-columns: 1fr !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(2) { order: 1 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3) { order: 2 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4) { order: 3 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5) { order: 4 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6) { order: 5 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7) { order: 6 !important; }
}

/* Matrix table reference alignment */
html[data-theme] body.theme-light-premium {
  --pa-matrix-keyword-width: clamp(300px, var(--matrix-keyword-width, 330px), 360px);
  --pa-matrix-min-width: calc(var(--pa-matrix-keyword-width) + 890px);
  --pa-matrix-header-bg: var(--table-header-bg);
  --pa-matrix-row-bg: var(--table-row-bg);
  --pa-matrix-row-alt-bg: color-mix(in srgb, var(--table-row-bg) 96%, var(--surface-hover));
  --pa-matrix-row-hover-bg: color-mix(in srgb, var(--table-row-bg) 84%, var(--accent-primary) 16%);
}

html[data-theme="dark"] body.theme-light-premium {
  --pa-matrix-row-alt-bg: color-mix(in srgb, var(--table-row-bg) 92%, #ffffff 8%);
  --pa-matrix-row-hover-bg: color-mix(in srgb, var(--table-row-bg) 78%, var(--accent-primary) 22%);
}

html[data-theme="retro"] body.theme-light-premium {
  --pa-matrix-row-alt-bg: color-mix(in srgb, var(--table-row-bg) 90%, var(--surface-hover));
  --pa-matrix-row-hover-bg: color-mix(in srgb, var(--table-row-bg) 76%, var(--accent-primary) 24%);
}

@media (min-width: 761px) {
  html[data-theme] body.theme-light-premium .matrix-card {
    overflow: hidden !important;
  }

  html[data-theme] body.theme-light-premium .matrix-check-note {
    display: flex !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 16px !important;
    border: 1px solid var(--border-soft) !important;
    border-bottom: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    background: var(--surface-primary) !important;
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    font-weight: 650 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-check-note::before {
    content: "\f073";
    margin-right: 9px;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--text-secondary);
  }

  html[data-theme] body.theme-light-premium .matrix-shell {
    border-radius: 0 0 16px 16px !important;
    border-color: var(--border-soft) !important;
    background: var(--surface-primary) !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table {
    min-width: var(--pa-matrix-min-width) !important;
    width: max(100%, var(--pa-matrix-min-width)) !important;
    table-layout: fixed !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(1),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(1) {
    width: var(--pa-matrix-keyword-width) !important;
    min-width: var(--pa-matrix-keyword-width) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(2),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2) {
    width: 120px !important;
    text-align: right !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(3),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(3) {
    width: 120px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(4),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(4) {
    width: 120px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(5),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(5) {
    width: 122px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(6),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(6) {
    width: 108px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(7),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(7) {
    width: 190px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(8),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(8) {
    width: 110px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th {
    height: 44px !important;
    padding: 8px 14px !important;
    background: var(--pa-matrix-header-bg) !important;
    border-width: 0 0 1px !important;
    border-color: var(--pa-table-border) !important;
    box-shadow: none !important;
    vertical-align: middle !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody td {
    height: 50px !important;
    padding: 9px 14px !important;
    background: var(--pa-matrix-row-bg) !important;
    border-width: 0 0 1px !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(odd) td,
  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(odd) .keyword-col {
    background: var(--pa-matrix-row-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(even) td,
  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(even) .keyword-col {
    background: var(--pa-matrix-row-alt-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:hover td,
  html[data-theme] body.theme-light-premium .matrix-table tbody tr:hover .keyword-col {
    background: var(--pa-matrix-row-hover-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th:first-child,
  html[data-theme] body.theme-light-premium .matrix-table tbody td:first-child {
    position: sticky !important;
    left: 0 !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody td:first-child::after,
  html[data-theme] body.theme-light-premium .matrix-table thead th:first-child::after {
    content: none !important;
  }

  html[data-theme] body.theme-light-premium .keyword-col,
  html[data-theme] body.theme-light-premium .matrix-keyword,
  html[data-theme] body.theme-light-premium .keyword-col small {
    border: 0 !important;
    box-shadow: none !important;
    filter: none !important;
    text-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-keyword {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    font-weight: 760 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html[data-theme] body.theme-light-premium .matrix-frequency {
    color: var(--text-primary) !important;
    font-size: 14px !important;
    font-weight: 650 !important;
    font-variant-numeric: tabular-nums !important;
  }

  html[data-theme] body.theme-light-premium .matrix-date-cell {
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    font-variant-numeric: tabular-nums !important;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell a {
    max-width: 100% !important;
    color: var(--text-link) !important;
    text-decoration: underline !important;
    text-underline-offset: 2px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell .url-empty {
    display: inline-block;
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8)::before {
    content: "Дата" !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8) {
    order: 7 !important;
  }
}

/* Desktop matrix fit: all analytical columns visible at 1280-1366px */
html[data-theme] body.theme-light-premium {
  --pa-matrix-keyword-width: clamp(260px, var(--matrix-keyword-width, 290px), 300px);
  --pa-matrix-min-width: calc(var(--pa-matrix-keyword-width) + 718px);
}

@media (min-width: 761px) {
  html[data-theme] body.theme-light-premium .matrix-check-note::before {
    content: "" !important;
    width: 12px;
    height: 12px;
    margin-right: 9px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    box-sizing: border-box;
    background:
      linear-gradient(currentColor, currentColor) 2px 3px / 8px 1.5px no-repeat;
    font-family: inherit;
  }

  html[data-theme] body.theme-light-premium .matrix-table {
    min-width: min(100%, var(--pa-matrix-min-width)) !important;
    width: 100% !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(1),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(1) {
    width: var(--pa-matrix-keyword-width) !important;
    min-width: var(--pa-matrix-keyword-width) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(2),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2) {
    width: 100px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(3),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(3) {
    width: 92px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(4),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(4) {
    width: 98px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(5),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(5) {
    width: 96px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(6),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(6) {
    width: 82px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(7),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(7) {
    width: 150px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(8),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(8) {
    width: 100px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th:first-child,
  html[data-theme] body.theme-light-premium .matrix-table tbody td:first-child {
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    background: inherit !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(odd) td:first-child {
    background: var(--pa-matrix-row-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:nth-child(even) td:first-child {
    background: var(--pa-matrix-row-alt-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody tr:hover td:first-child {
    background: var(--pa-matrix-row-hover-bg) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th,
  html[data-theme] body.theme-light-premium .matrix-table tbody td {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* Technical audit module */
body.tech-audit-page {
  background: var(--page-bg);
  color: var(--text-primary);
}

body.tech-audit-page #premium-context {
  display: none;
}

body.tech-audit-page header .header-content {
  justify-content: flex-end;
}

.audit-page-shell {
  padding-bottom: 48px;
}

.audit-toolbar,
.audit-last-row,
.audit-summary-panel,
.audit-card,
.audit-table-card,
.audit-empty {
  border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-primary) 94%, transparent);
  box-shadow: var(--shadow-card);
}

.audit-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.audit-title-block h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-primary);
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.audit-title-block p,
.audit-muted,
.audit-empty p,
.audit-settings-content p,
.audit-progress small {
  color: var(--text-secondary);
}

.audit-title-block p {
  margin: 6px 0 0;
}

.audit-help,
.audit-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.audit-help:hover,
.audit-refresh:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

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

.audit-project-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-control);
  background: var(--input-bg);
  color: var(--text-primary);
}

.audit-target-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-secondary);
}

.audit-target-mode.hidden,
.audit-custom-url.hidden,
.audit-project-select.hidden {
  display: none;
}

.audit-target-mode button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 750;
  cursor: pointer;
}

.audit-target-mode button.active {
  color: var(--text-primary);
  background: var(--surface-primary);
  box-shadow: var(--shadow-card);
}

.audit-custom-url {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-control);
  background: var(--input-bg);
  color: var(--text-primary);
}

.audit-custom-url input {
  width: 220px;
  height: 38px;
  border: 0;
  outline: none;
  color: var(--text-primary);
  background: transparent;
  font-weight: 700;
}

.audit-project-select select {
  min-width: 150px;
  height: 38px;
  border: 0;
  outline: none;
  color: var(--text-primary);
  background: transparent;
  font-weight: 700;
}

.audit-icon-action {
  width: 42px;
  padding: 0;
}

.audit-export-menu-wrap {
  position: relative;
}

.audit-export-menu {
  z-index: 40;
}

.audit-last-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: var(--radius-control);
  color: var(--text-secondary);
  font-size: 13px;
}

.audit-summary-panel {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius-large);
}

.audit-summary-panel > *,
.audit-kpi-grid,
.audit-kpi-card,
.audit-tabs,
.audit-tabs-row {
  min-width: 0;
}

.audit-score-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  min-height: 150px;
}

.audit-score-card > span,
.audit-kpi-card span,
.audit-table-head span {
  color: var(--text-secondary);
  font-size: 13px;
}

.audit-score-ring {
  --score: 0;
  display: grid;
  place-items: center;
  width: 120px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface-primary) 56%, transparent 57%),
    conic-gradient(var(--success) calc(var(--score) * 1%), var(--neutral-bg) 0);
}

html[data-theme="dark"] .audit-score-ring {
  background:
    radial-gradient(circle at center, var(--surface-primary) 56%, transparent 57%),
    conic-gradient(var(--accent-secondary) calc(var(--score) * 1%), var(--surface-tertiary) 0);
}

html[data-theme="retro"] .audit-score-ring {
  background:
    radial-gradient(circle at center, var(--surface-primary) 56%, transparent 57%),
    conic-gradient(var(--warning) calc(var(--score) * 1%), var(--surface-tertiary) 0);
}

.audit-score-ring div {
  display: grid;
  justify-items: center;
  line-height: 1;
}

.audit-score-ring b {
  color: var(--text-primary);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.audit-score-ring small {
  margin-top: 7px;
  color: var(--text-secondary);
}

.audit-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 12px;
}

.audit-kpi-card {
  display: grid;
  align-content: center;
  min-height: 110px;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: var(--surface-secondary);
}

.audit-kpi-card b,
.audit-big-number {
  margin-top: 12px;
  color: var(--text-primary);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.audit-kpi-card small {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.audit-kpi-card.error b { color: var(--danger); }
.audit-kpi-card.warning b { color: var(--warning); }
.audit-kpi-card.success b { color: var(--success); }
.audit-kpi-card.link b { color: var(--accent-secondary); }

.audit-progress {
  grid-column: 1 / -1;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: var(--surface-secondary);
}

.audit-progress.hidden {
  display: none;
}

.audit-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 700;
}

.audit-tabs-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
}

.audit-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-secondary);
}

.audit-tabs button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.audit-tabs button:hover,
.audit-tabs button.active {
  color: var(--text-primary);
  background: var(--surface-primary);
  box-shadow: var(--shadow-card);
}

.audit-tab-content {
  margin-top: 16px;
}

.audit-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.45fr) minmax(220px, .7fr);
  gap: 16px;
}

.audit-speed-layout {
  display: grid;
  gap: 16px;
}

.audit-speed-score-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.audit-speed-score.is-good .audit-big-number {
  color: var(--status-success);
}

.audit-speed-score.is-warning .audit-big-number {
  color: var(--status-warning);
}

.audit-speed-score.is-error .audit-big-number {
  color: var(--status-danger);
}

.audit-pagespeed-card {
  padding: 0;
  overflow: hidden;
}

.audit-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.audit-metric-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: var(--surface-secondary);
}

.audit-metric-item span,
.audit-metric-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-metric-item b {
  display: block;
  margin: 8px 0 4px;
  color: var(--text-primary);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.audit-card,
.audit-table-card,
.audit-empty {
  border-radius: var(--radius-large);
}

.audit-card {
  padding: 22px;
}

.audit-card h2,
.audit-table-head h2,
.audit-empty h2 {
  margin: 0 0 16px;
  color: var(--text-primary);
  font-size: 18px;
  letter-spacing: 0;
}

.audit-category-row,
.audit-issue-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--table-border);
}

.audit-category-row:last-child,
.audit-issue-mini:last-child {
  border-bottom: 0;
}

.audit-issue-mini {
  justify-content: flex-start;
}

.audit-issue-mini div {
  min-width: 0;
}

.audit-issue-mini b,
.audit-issue-mini small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-issue-mini small {
  margin-top: 4px;
  color: var(--text-secondary);
}

.audit-priority-card {
  padding: 0;
  overflow: hidden;
}

.audit-priority-card .audit-table-head {
  border-bottom: 1px solid var(--table-border);
}

.audit-priority-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 20px;
}

.audit-priority-group {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: var(--surface-secondary);
}

.audit-priority-group h3 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 15px;
  letter-spacing: 0;
}

.audit-table-card {
  overflow: hidden;
}

.audit-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--table-border);
}

.audit-table-head h2 {
  margin: 0;
}

.audit-table-scroll {
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}

.audit-table th,
.audit-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-primary);
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-header-bg);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--table-row-alt-bg) 45%, transparent);
}

.audit-table tbody tr:hover {
  background: var(--table-row-hover-bg);
}

.audit-table td b,
.audit-table td small {
  display: block;
}

.audit-table td small {
  margin-top: 5px;
  color: var(--text-secondary);
}

.audit-table a {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.audit-pages-table td:nth-child(1),
.audit-pages-table td:nth-child(4),
.audit-pages-table td:nth-child(5) {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-severity,
.audit-status-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--neutral-border);
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.audit-severity.is-error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.audit-severity.is-warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning);
}

.audit-severity.is-important {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning);
}

.audit-severity.is-info {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--info);
}

.audit-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
}

.audit-empty i {
  color: var(--text-secondary);
  font-size: 32px;
}

.audit-empty h2,
.audit-empty p {
  margin: 0;
}

.audit-settings-content {
  max-width: 760px;
}

.audit-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.audit-settings-grid .form-group {
  margin: 0;
}

.audit-settings-grid .form-group > span {
  display: block;
  margin-bottom: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.audit-switches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .audit-toolbar,
  .audit-tabs-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .audit-summary-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .audit-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .audit-summary-grid {
    grid-template-columns: 1fr;
  }

  .audit-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .audit-priority-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1320px) {
  .audit-tabs-row {
    align-items: stretch;
    flex-direction: column;
  }

  .audit-tabs-row > .btn {
    align-self: flex-start;
  }
}

@media (max-width: 720px) {
  .audit-toolbar,
  .audit-summary-panel,
  .audit-card {
    padding: 16px;
    border-radius: 16px;
  }

  .audit-title-block h1 {
    font-size: 22px;
  }

  .audit-score-card {
    min-height: auto;
    padding: 6px 0 12px;
  }

  .audit-score-ring {
    width: 104px;
  }

  .audit-kpi-card {
    min-height: 96px;
  }

  .audit-actions,
  .audit-actions .btn,
  .audit-target-mode,
  .audit-custom-url,
  .audit-custom-url input,
  .audit-project-select,
  .audit-project-select select {
    width: 100%;
  }

  .audit-kpi-grid,
  .audit-metric-grid,
  .audit-settings-grid,
  .audit-switches {
    grid-template-columns: minmax(0, 1fr);
  }

  .audit-tabs-row .btn {
    width: 100%;
  }

  .audit-toolbar .audit-icon-action {
    display: none;
  }

  .audit-last-row {
    justify-content: space-between;
  }
}

/* Retro Excel table skin */
html[data-theme="retro"] body.theme-light-premium {
  --retro-sheet-bg: #fbf6dd;
  --retro-sheet-bg-alt: #f3eccb;
  --retro-sheet-bg-hover: #ede4bd;
  --retro-sheet-head-light: #d8dc99;
  --retro-sheet-head-dark: #17230f;
  --retro-sheet-head-dark-2: #202f17;
  --retro-sheet-grid: rgba(93, 89, 54, 0.22);
  --retro-sheet-grid-strong: rgba(93, 89, 54, 0.34);
  --retro-sheet-text: #16170d;
  --retro-sheet-muted: #5d5b38;
  --retro-sheet-link: #005fbd;
  --retro-sheet-note: #efe091;
  --retro-sheet-note-strong: #e7bd38;
  --retro-sheet-good: #a8d35d;
  --retro-sheet-control: #1d2818;
}

html[data-theme="retro"] body.theme-light-premium .project-table-shell,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-shell,
html[data-theme="retro"] body.theme-light-premium .keywords-table-wrapper,
html[data-theme="retro"] body.theme-light-premium .frequency-table-wrap,
html[data-theme="retro"] body.theme-light-premium .audit-table-scroll {
  border-color: var(--retro-sheet-grid-strong) !important;
  background: var(--retro-sheet-bg) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 251, 227, 0.88),
    0 14px 34px rgba(9, 16, 7, 0.22) !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table,
html[data-theme="retro"] body.theme-light-premium .keywords-table,
html[data-theme="retro"] body.theme-light-premium .frequency-table,
html[data-theme="retro"] body.theme-light-premium .audit-table {
  background:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(93, 89, 54, 0.08) 100%),
    var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
  font-variant-numeric: tabular-nums !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table th,
html[data-theme="retro"] body.theme-light-premium .keywords-table thead th,
html[data-theme="retro"] body.theme-light-premium .frequency-table th {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.28), rgba(139,139,80,0.10)),
    var(--retro-sheet-head-light) !important;
  color: #101508 !important;
  border-right: 1px solid var(--retro-sheet-grid-strong) !important;
  border-bottom: 1px solid var(--retro-sheet-grid-strong) !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.45) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table thead th,
html[data-theme="retro"] body.theme-light-premium .audit-table th {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(0,0,0,0.18)),
    var(--retro-sheet-head-dark) !important;
  color: #f9f1ce !important;
  border-right: 1px solid rgba(217, 218, 154, 0.20) !important;
  border-bottom: 1px solid rgba(217, 218, 154, 0.30) !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.38) !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody td,
html[data-theme="retro"] body.theme-light-premium .keywords-table tbody td,
html[data-theme="retro"] body.theme-light-premium .frequency-table td,
html[data-theme="retro"] body.theme-light-premium .audit-table td {
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
  border-right: 1px solid var(--retro-sheet-grid) !important;
  border-bottom: 1px solid var(--retro-sheet-grid) !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table tbody tr:nth-child(odd) td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:nth-child(odd) td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:nth-child(odd) .keyword-col,
html[data-theme="retro"] body.theme-light-premium .keywords-table tbody tr:nth-child(odd) td,
html[data-theme="retro"] body.theme-light-premium .frequency-table tbody tr:nth-child(odd) td,
html[data-theme="retro"] body.theme-light-premium .audit-table tbody tr:nth-child(odd) {
  background: var(--retro-sheet-bg) !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table tbody tr:nth-child(even) td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:nth-child(even) td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:nth-child(even) .keyword-col,
html[data-theme="retro"] body.theme-light-premium .keywords-table tbody tr:nth-child(even) td,
html[data-theme="retro"] body.theme-light-premium .frequency-table tbody tr:nth-child(even) td,
html[data-theme="retro"] body.theme-light-premium .audit-table tbody tr:nth-child(even) {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table tbody tr:hover td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:hover td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:hover .keyword-col,
html[data-theme="retro"] body.theme-light-premium .keywords-table tbody tr:hover td,
html[data-theme="retro"] body.theme-light-premium .frequency-table tbody tr:hover td,
html[data-theme="retro"] body.theme-light-premium .audit-table tbody tr:hover {
  background: var(--retro-sheet-bg-hover) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table thead th:first-child,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody td:first-child {
  box-shadow: 8px 0 14px rgba(55, 52, 25, 0.13) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:nth-child(odd) td:first-child {
  background: var(--retro-sheet-bg) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table tbody tr:nth-child(even) td:first-child {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table a,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-url-cell a,
html[data-theme="retro"] body.theme-light-premium .audit-table a,
html[data-theme="retro"] body.theme-light-premium .keywords-table a {
  color: var(--retro-sheet-link) !important;
  text-decoration: none !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table a:hover,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-url-cell a:hover,
html[data-theme="retro"] body.theme-light-premium .audit-table a:hover,
html[data-theme="retro"] body.theme-light-premium .keywords-table a:hover {
  color: #004a91 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table-name b,
html[data-theme="retro"] body.theme-light-premium .project-table .project-name-cell b,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-keyword,
html[data-theme="retro"] body.theme-light-premium .keywords-table td,
html[data-theme="retro"] body.theme-light-premium .frequency-table td {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table-name em,
html[data-theme="retro"] body.theme-light-premium .project-table .project-name-cell small,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-date-cell,
html[data-theme="retro"] body.theme-light-premium.project-page .keyword-col small {
  color: var(--retro-sheet-muted) !important;
}

html[data-theme="retro"] body.theme-light-premium .rank-badge,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-pos,
html[data-theme="retro"] body.theme-light-premium.project-page .history-chip {
  border: 1px solid rgba(122, 103, 35, 0.18) !important;
  background: var(--retro-sheet-note) !important;
  color: #121407 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.34) !important;
}

html[data-theme="retro"] body.theme-light-premium .rank-badge.pos-good,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-pos.pos-good,
html[data-theme="retro"] body.theme-light-premium.project-page .history-chip.pos-good,
html[data-theme="retro"] body.theme-light-premium .rank-badge.pos-top10 {
  background: var(--retro-sheet-good) !important;
  color: #142009 !important;
}

html[data-theme="retro"] body.theme-light-premium .rank-badge.pos-mid,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-pos.pos-mid,
html[data-theme="retro"] body.theme-light-premium.project-page .history-chip.pos-mid {
  background: var(--retro-sheet-note-strong) !important;
  color: #1b1605 !important;
}

html[data-theme="retro"] body.theme-light-premium .rank-badge.pos-neutral,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-pos.pos-neutral,
html[data-theme="retro"] body.theme-light-premium.project-page .history-chip.pos-neutral {
  background: #dfdec1 !important;
  color: #77734f !important;
}

html[data-theme="retro"] body.theme-light-premium .project-table-actions .icon-btn,
html[data-theme="retro"] body.theme-light-premium .project-row-menu,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar .btn,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-count {
  border-color: rgba(217, 218, 154, 0.20) !important;
  background: var(--retro-sheet-control) !important;
  color: #f9f1ce !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-check-note {
  border-color: rgba(217, 218, 154, 0.22) !important;
  background: var(--retro-sheet-head-dark-2) !important;
  color: #ece5b9 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-sort-head select,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar select,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar input[type="number"] {
  border-color: rgba(217, 218, 154, 0.24) !important;
  background: #10190b !important;
  color: #f9f1ce !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-card {
  background: rgba(31, 43, 22, 0.72) !important;
  border-color: rgba(217, 218, 154, 0.14) !important;
}

/* Compact matrix utility columns */
html[data-theme] body.theme-light-premium {
  --pa-matrix-frequency-width: 72px;
  --pa-matrix-current-width: 88px;
  --pa-matrix-delta-width: 58px;
  --pa-matrix-first-width: 78px;
  --pa-matrix-best-width: 78px;
  --pa-matrix-url-width: 150px;
  --pa-matrix-date-width: 96px;
  --pa-matrix-min-width: calc(
    var(--pa-matrix-keyword-width) +
    var(--pa-matrix-frequency-width) +
    var(--pa-matrix-current-width) +
    var(--pa-matrix-delta-width) +
    var(--pa-matrix-first-width) +
    var(--pa-matrix-best-width) +
    var(--pa-matrix-url-width) +
    var(--pa-matrix-date-width)
  );
}

@media (min-width: 761px) {
  html[data-theme] body.theme-light-premium .matrix-table {
    width: var(--pa-matrix-min-width) !important;
    min-width: var(--pa-matrix-min-width) !important;
    max-width: none !important;
    table-layout: fixed !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-keyword,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(1),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(1) {
    width: var(--pa-matrix-keyword-width) !important;
    min-width: var(--pa-matrix-keyword-width) !important;
    max-width: var(--pa-matrix-keyword-width) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-frequency,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(2),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2) {
    width: var(--pa-matrix-frequency-width) !important;
    min-width: var(--pa-matrix-frequency-width) !important;
    max-width: var(--pa-matrix-frequency-width) !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: right !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-current,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(3),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(3) {
    width: var(--pa-matrix-current-width) !important;
    min-width: var(--pa-matrix-current-width) !important;
    max-width: var(--pa-matrix-current-width) !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-delta,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(4),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(4) {
    width: var(--pa-matrix-delta-width) !important;
    min-width: var(--pa-matrix-delta-width) !important;
    max-width: var(--pa-matrix-delta-width) !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-first,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(5),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(5) {
    width: var(--pa-matrix-first-width) !important;
    min-width: var(--pa-matrix-first-width) !important;
    max-width: var(--pa-matrix-first-width) !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-best,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(6),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(6) {
    width: var(--pa-matrix-best-width) !important;
    min-width: var(--pa-matrix-best-width) !important;
    max-width: var(--pa-matrix-best-width) !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-url,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(7),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(7) {
    width: var(--pa-matrix-url-width) !important;
    min-width: var(--pa-matrix-url-width) !important;
    max-width: var(--pa-matrix-url-width) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-date,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(8),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(8) {
    width: var(--pa-matrix-date-width) !important;
    min-width: var(--pa-matrix-date-width) !important;
    max-width: var(--pa-matrix-date-width) !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: right !important;
  }

  html[data-theme] body.theme-light-premium .matrix-frequency-head .matrix-sort-button {
    justify-content: flex-end !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  html[data-theme] body.theme-light-premium .matrix-delta-head {
    white-space: nowrap !important;
  }

  html[data-theme] body.theme-light-premium .matrix-delta-head span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-weight: 800;
    line-height: 1;
  }

  html[data-theme] body.theme-light-premium .matrix-first-head {
    text-align: center !important;
  }
}

html[data-theme] body.theme-light-premium .matrix-dynamics-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .matrix-pos-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
}

html[data-theme] body.theme-light-premium .matrix-pos-stack small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.1;
}

html[data-theme] body.theme-light-premium .date-updates {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 8px;
}

html[data-theme] body.theme-light-premium .date-update-chip,
html[data-theme] body.theme-light-premium .history-update-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 220px;
  padding: 3px 7px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .updates-panel {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-secondary);
}

html[data-theme] body.theme-light-premium .updates-form {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: end;
  gap: 10px;
}

html[data-theme] body.theme-light-premium .updates-note-field textarea {
  min-height: 38px;
  resize: vertical;
}

html[data-theme] body.theme-light-premium .updates-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

html[data-theme] body.theme-light-premium .update-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-primary);
}

html[data-theme] body.theme-light-premium .update-item time {
  display: inline-block;
  min-width: 74px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 740;
}

html[data-theme] body.theme-light-premium .update-item b {
  color: var(--text-primary);
  font-size: 13px;
}

html[data-theme] body.theme-light-premium .update-item p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

html[data-theme] body.theme-light-premium .calendar-day.has-update b,
html[data-theme] body.theme-light-premium .dot-update {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d78223;
}

html[data-theme] body.theme-light-premium .calendar-day.has-update b {
  position: absolute;
  right: 5px;
  bottom: 4px;
}

html[data-theme] body.theme-light-premium .keyword-history-table-wrap {
  max-height: 360px;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

html[data-theme] body.theme-light-premium .keyword-history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-primary);
}

html[data-theme] body.theme-light-premium .keyword-history-table th,
html[data-theme] body.theme-light-premium .keyword-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-size: 12px;
  text-align: left;
  vertical-align: middle;
}

html[data-theme] body.theme-light-premium .keyword-history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-header-bg);
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

html[data-theme] body.theme-light-premium .schedule-status-error {
  color: var(--pa-danger) !important;
}

@media (max-width: 860px) {
  html[data-theme] body.theme-light-premium .updates-form {
    grid-template-columns: 1fr;
  }
}

html[data-theme="retro"] body.theme-light-premium.project-page .semantics-panel input,
html[data-theme="retro"] body.theme-light-premium.project-page .semantics-panel textarea,
html[data-theme="retro"] body.theme-light-premium.project-page .updates-panel input,
html[data-theme="retro"] body.theme-light-premium.project-page .updates-panel textarea,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar select,
html[data-theme="retro"] body.theme-light-premium.project-page .range-panel input,
html[data-theme="retro"] body.theme-light-premium.project-page #edit-keywords-textarea {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.38) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .semantics-panel input::placeholder,
html[data-theme="retro"] body.theme-light-premium.project-page .semantics-panel textarea::placeholder,
html[data-theme="retro"] body.theme-light-premium.project-page .updates-panel input::placeholder,
html[data-theme="retro"] body.theme-light-premium.project-page .updates-panel textarea::placeholder,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search::placeholder {
  color: #5f5c3f !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .updates-panel,
html[data-theme="retro"] body.theme-light-premium.project-page .update-item,
html[data-theme="retro"] body.theme-light-premium.project-page .keyword-history-table,
html[data-theme="retro"] body.theme-light-premium.project-page .keyword-history-table td {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .keyword-history-table th {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-head-light) !important;
  color: var(--retro-sheet-text) !important;
}

/* Semantic workspace and adaptive matrix polish */
html[data-theme] body.theme-light-premium {
  --pa-matrix-current-width: 94px;
  --pa-matrix-first-width: 84px;
  --pa-matrix-best-width: 86px;
  --pa-matrix-date-width: 112px;
  --pa-matrix-url-min-width: 180px;
  --pa-matrix-min-width: calc(
    var(--pa-matrix-keyword-width) +
    var(--pa-matrix-frequency-width) +
    var(--pa-matrix-current-width) +
    var(--pa-matrix-delta-width) +
    var(--pa-matrix-first-width) +
    var(--pa-matrix-best-width) +
    var(--pa-matrix-url-min-width) +
    var(--pa-matrix-date-width)
  );
}

@media (min-width: 761px) {
  html[data-theme] body.theme-light-premium .matrix-table {
    width: max(100%, var(--pa-matrix-min-width)) !important;
    min-width: var(--pa-matrix-min-width) !important;
    table-layout: fixed !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-url,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(7),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(7) {
    width: auto !important;
    min-width: var(--pa-matrix-url-min-width) !important;
    max-width: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell a {
    max-width: 100% !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table thead th {
    vertical-align: middle !important;
  }
}

html[data-theme] body.theme-light-premium .matrix-head-stack span,
html[data-theme] body.theme-light-premium .matrix-delta-head span {
  text-transform: none !important;
}

html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3)::before { content: "Сейчас" !important; }
html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4)::before { content: "+/-" !important; }
html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5)::before { content: "Старт" !important; }
html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6)::before { content: "Лучшее" !important; }
html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8)::before { content: "Проверка" !important; }

html[data-theme] body.theme-light-premium .semantic-workspace {
  width: 100% !important;
  max-width: none !important;
  margin: 28px 0 30px !important;
  padding: 0 20px !important;
}

html[data-theme] body.theme-light-premium .semantic-head {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: start;
  gap: 18px;
  margin-bottom: 16px;
}

html[data-theme] body.theme-light-premium .semantic-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1.15;
}

html[data-theme] body.theme-light-premium .semantic-head p {
  max-width: 660px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
}

html[data-theme] body.theme-light-premium .semantic-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

html[data-theme] body.theme-light-premium .semantic-actions .btn,
html[data-theme] body.theme-light-premium .semantic-selection-bar .btn,
html[data-theme] body.theme-light-premium .semantic-zone-head .btn {
  min-height: 38px;
}

html[data-theme] body.theme-light-premium .semantic-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

html[data-theme] body.theme-light-premium .semantic-stat-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-primary);
}

html[data-theme] body.theme-light-premium .semantic-stat-card i {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-size: 19px;
}

html[data-theme] body.theme-light-premium .semantic-stat-card span,
html[data-theme] body.theme-light-premium .semantic-stat-card em {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-style: normal;
}

html[data-theme] body.theme-light-premium .semantic-stat-card b {
  display: block;
  margin: 3px 0;
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1.1;
}

html[data-theme] body.theme-light-premium .keyword-add-panel,
html[data-theme] body.theme-light-premium .semantic-zone {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-primary);
}

html[data-theme] body.theme-light-premium .keyword-add-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 14px;
}

html[data-theme] body.theme-light-premium .keyword-add-panel.hidden {
  display: none;
}

html[data-theme] body.theme-light-premium .keyword-add-panel textarea {
  min-height: 96px;
}

html[data-theme] body.theme-light-premium .semantic-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

html[data-theme] body.theme-light-premium .semantic-zone-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-primary);
  font-size: 17px;
}

html[data-theme] body.theme-light-premium .semantic-zone-head h3 span {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-size: 12px;
  text-align: center;
}

html[data-theme] body.theme-light-premium .clusters-table,
html[data-theme] body.theme-light-premium .keywords-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

html[data-theme] body.theme-light-premium .clusters-table th,
html[data-theme] body.theme-light-premium .clusters-table td,
html[data-theme] body.theme-light-premium .keywords-table th,
html[data-theme] body.theme-light-premium .keywords-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-size: 13px;
}

html[data-theme] body.theme-light-premium .clusters-table th,
html[data-theme] body.theme-light-premium .keywords-table th {
  background: var(--table-header-bg);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

html[data-theme] body.theme-light-premium .clusters-table th:nth-child(2),
html[data-theme] body.theme-light-premium .clusters-table td:nth-child(2),
html[data-theme] body.theme-light-premium .clusters-table th:nth-child(3),
html[data-theme] body.theme-light-premium .clusters-table td:nth-child(3),
html[data-theme] body.theme-light-premium .keywords-table th:nth-child(1),
html[data-theme] body.theme-light-premium .keywords-table td:nth-child(1),
html[data-theme] body.theme-light-premium .keywords-table th:nth-child(4),
html[data-theme] body.theme-light-premium .keywords-table td:nth-child(4),
html[data-theme] body.theme-light-premium .keywords-table th:nth-child(5),
html[data-theme] body.theme-light-premium .keywords-table td:nth-child(5) {
  width: 112px;
}

html[data-theme] body.theme-light-premium .keywords-table th:nth-child(1),
html[data-theme] body.theme-light-premium .keywords-table td:nth-child(1) {
  width: 44px;
  text-align: center;
}

html[data-theme] body.theme-light-premium .keyword-title-cell {
  font-weight: 720;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .keyword-actions-cell,
html[data-theme] body.theme-light-premium .clusters-table td:last-child {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

html[data-theme] body.theme-light-premium .cluster-pill,
html[data-theme] body.theme-light-premium .cluster-empty {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .cluster-empty {
  background: var(--surface-secondary);
  color: var(--text-muted);
}

html[data-theme] body.theme-light-premium .semantic-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, auto) minmax(150px, auto) minmax(150px, auto) auto;
  gap: 10px;
  margin-bottom: 12px;
}

html[data-theme] body.theme-light-premium .semantic-filters select,
html[data-theme] body.theme-light-premium .semantic-selection-bar select,
html[data-theme] body.theme-light-premium .keyword-add-panel select,
html[data-theme] body.theme-light-premium .semantic-workspace input,
html[data-theme] body.theme-light-premium .semantic-workspace textarea {
  min-height: 38px;
}

html[data-theme] body.theme-light-premium .semantic-tool-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-secondary);
}

html[data-theme] body.theme-light-premium .wordstat-card,
html[data-theme] body.theme-light-premium .wordstat-results {
  padding: 16px;
}

html[data-theme] body.theme-light-premium .wordstat-card h4 {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 16px;
}

html[data-theme] body.theme-light-premium .wordstat-card p {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 13px;
}

html[data-theme] body.theme-light-premium .operator-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 12px;
}

html[data-theme] body.theme-light-premium .operator-row span {
  color: var(--text-muted);
  font-size: 12px;
}

html[data-theme] body.theme-light-premium .operator-row button {
  min-width: 30px;
  height: 28px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-weight: 800;
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .wordstat-results-head,
html[data-theme] body.theme-light-premium .semantic-frequency-row,
html[data-theme] body.theme-light-premium .semantic-selection-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 12px;
  align-items: center;
}

html[data-theme] body.theme-light-premium .wordstat-results-head {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 760;
}

html[data-theme] body.theme-light-premium .wordstat-results-head b {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-primary);
  color: var(--text-secondary);
}

html[data-theme] body.theme-light-premium .semantic-frequency-results {
  max-height: 260px;
  overflow: auto;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row {
  grid-template-columns: 26px minmax(0, 1fr) 120px;
  min-height: 36px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-size: 13px;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row b {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

html[data-theme] body.theme-light-premium .semantic-selection-bar {
  grid-template-columns: auto minmax(180px, 260px) auto auto auto;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-secondary);
}

@media (max-width: 1180px) {
  html[data-theme] body.theme-light-premium .semantic-head,
  html[data-theme] body.theme-light-premium .keyword-add-panel,
  html[data-theme] body.theme-light-premium .semantic-tool-grid {
    grid-template-columns: 1fr;
  }

  html[data-theme] body.theme-light-premium .semantic-actions {
    justify-content: flex-start;
  }

  html[data-theme] body.theme-light-premium .semantic-stats,
  html[data-theme] body.theme-light-premium .semantic-filters,
  html[data-theme] body.theme-light-premium .semantic-selection-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .semantic-workspace {
    padding: 0 !important;
  }

  html[data-theme] body.theme-light-premium .semantic-stats {
    grid-template-columns: 1fr;
  }
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search-wrap,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-search-wrap {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search-wrap i,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-search-wrap i {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search-wrap input,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-search-wrap input {
  background: transparent !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .semantic-zone,
html[data-theme="retro"] body.theme-light-premium.project-page .keyword-add-panel,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-stat-card,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-selection-bar,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-tool-grid {
  border-color: rgba(217, 218, 154, 0.16) !important;
  background: rgba(31, 43, 22, 0.72) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .clusters-table th,
html[data-theme="retro"] body.theme-light-premium.project-page .keywords-table th {
  background: var(--retro-sheet-head-dark) !important;
  color: #f9f1ce !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .clusters-table td,
html[data-theme="retro"] body.theme-light-premium.project-page .keywords-table td,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-card,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-results {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme] body.theme-light-premium .keyword-actions-cell,
html[data-theme] body.theme-light-premium .clusters-table td:last-child {
  display: table-cell !important;
  text-align: right !important;
  white-space: nowrap !important;
}

html[data-theme] body.theme-light-premium .keyword-actions-cell .btn,
html[data-theme] body.theme-light-premium .clusters-table td:last-child .btn {
  margin-left: 4px;
}

/* Semantic cluster cards */
html[data-theme] body.theme-light-premium .semantic-cluster-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

html[data-theme] body.theme-light-premium .cluster-create-inline {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 8px;
  align-items: center;
}

html[data-theme] body.theme-light-premium .semantic-dnd-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .cluster-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 12px;
  margin: 0 0 14px;
  align-items: stretch;
}

html[data-theme] body.theme-light-premium .cluster-card {
  display: flex;
  min-width: 0;
  min-height: 360px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-primary);
  color: var(--text-primary);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

html[data-theme] body.theme-light-premium .cluster-card.is-drop-target {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 24%, transparent);
  transform: translateY(-1px);
}

html[data-theme] body.theme-light-premium .cluster-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 64px;
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-secondary);
}

html[data-theme] body.theme-light-premium .cluster-card-title {
  display: grid;
  min-width: 0;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

html[data-theme] body.theme-light-premium .cluster-card-title i {
  margin-top: 2px;
  color: var(--accent-primary);
}

html[data-theme] body.theme-light-premium .cluster-card-title strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .cluster-card-title span {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.25;
}

html[data-theme] body.theme-light-premium .cluster-card-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

html[data-theme] body.theme-light-premium .cluster-icon-btn {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface-primary);
  color: var(--text-primary);
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .cluster-icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

html[data-theme] body.theme-light-premium .cluster-icon-btn.danger {
  color: var(--danger);
}

html[data-theme] body.theme-light-premium .cluster-query-head,
html[data-theme] body.theme-light-premium .cluster-query-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
}

html[data-theme] body.theme-light-premium .cluster-query-head {
  min-height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--table-header-bg);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 820;
  text-transform: uppercase;
}

html[data-theme] body.theme-light-premium .cluster-query-head::before {
  content: "";
}

html[data-theme] body.theme-light-premium .cluster-query-list {
  flex: 1 1 auto;
  max-height: 360px;
  overflow: auto;
  background: var(--surface-primary);
}

html[data-theme] body.theme-light-premium .cluster-query-row {
  min-height: 38px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  cursor: grab;
}

html[data-theme] body.theme-light-premium .cluster-query-row:nth-child(even) {
  background: var(--table-row-alt-bg);
}

html[data-theme] body.theme-light-premium .cluster-query-row:hover {
  background: var(--table-row-hover-bg);
}

html[data-theme] body.theme-light-premium .cluster-query-row.is-dragging {
  opacity: .55;
}

html[data-theme] body.theme-light-premium .cluster-query-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

html[data-theme] body.theme-light-premium .cluster-query-text {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .cluster-query-frequency {
  color: var(--text-primary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  text-align: right;
}

html[data-theme] body.theme-light-premium .cluster-query-empty,
html[data-theme] body.theme-light-premium .cluster-empty-state,
html[data-theme] body.theme-light-premium .cluster-filter-empty {
  padding: 18px 14px;
  color: var(--text-secondary);
  font-size: 13px;
}

html[data-theme] body.theme-light-premium .cluster-empty-state,
html[data-theme] body.theme-light-premium .cluster-filter-empty {
  grid-column: 1 / -1;
}

html[data-theme] body.theme-light-premium .cluster-add-query {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-secondary);
  color: var(--text-primary);
  font-weight: 760;
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .cluster-add-query:hover {
  background: var(--surface-hover);
}

html[data-theme] body.theme-light-premium .semantic-selection-bar {
  display: none !important;
  grid-template-columns: minmax(130px, auto) minmax(180px, 270px) auto auto;
  margin: 0 0 14px;
}

html[data-theme] body.theme-light-premium .semantic-selection-bar.is-visible {
  display: grid !important;
}

html[data-theme] body.theme-light-premium .wordstat-query-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 112px auto;
  gap: 8px;
}

html[data-theme] body.theme-light-premium .wordstat-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

html[data-theme] body.theme-light-premium .semantic-frequency-row {
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

@media (max-width: 920px) {
  html[data-theme] body.theme-light-premium .semantic-cluster-controls,
  html[data-theme] body.theme-light-premium .wordstat-add-row,
  html[data-theme] body.theme-light-premium .wordstat-query-row {
    grid-template-columns: 1fr;
  }

  html[data-theme] body.theme-light-premium .semantic-cluster-controls {
    display: grid;
  }

  html[data-theme] body.theme-light-premium .cluster-create-inline {
    grid-template-columns: 1fr;
  }

  html[data-theme] body.theme-light-premium .semantic-dnd-hint {
    white-space: normal;
  }
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-card,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-card,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-results {
  border-color: var(--retro-sheet-grid-strong) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 251, 227, 0.68) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-card-head,
html[data-theme="retro"] body.theme-light-premium.project-page .cluster-add-query,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-add-row {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg-alt) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-head {
  border-color: var(--retro-sheet-grid-strong) !important;
  background: var(--retro-sheet-head-light) !important;
  color: #101508 !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-list,
html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-row {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-row:nth-child(even) {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-row:hover {
  background: var(--retro-sheet-bg-hover) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-card-title strong,
html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-text,
html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-frequency,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-card h4,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-card p,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-results-head,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-frequency-row,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-frequency-row span,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-frequency-row b,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-results .matrix-empty {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-card-title span,
html[data-theme="retro"] body.theme-light-premium.project-page .cluster-query-empty,
html[data-theme="retro"] body.theme-light-premium.project-page .semantic-dnd-hint,
html[data-theme="retro"] body.theme-light-premium.project-page .operator-row span {
  color: var(--retro-sheet-muted) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .cluster-icon-btn,
html[data-theme="retro"] body.theme-light-premium.project-page .operator-row button {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-control) !important;
  color: #fff6cf !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-add-row select,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-query-row select,
html[data-theme="retro"] body.theme-light-premium.project-page .cluster-create-inline input {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

/* V2 theme switcher and positions matrix */
html[data-theme] body.theme-light-premium .theme-menu-wrap {
  display: none !important;
}

html[data-theme] body.theme-light-premium .premium-sidebar-theme-button {
  position: relative;
  justify-content: flex-start;
}

html[data-theme] body.theme-light-premium .premium-sidebar-theme-button .theme-label {
  min-width: 44px;
}

html[data-theme] body.theme-light-premium .premium-sidebar-theme-button .theme-dots {
  display: none;
  align-items: center;
  gap: 7px;
}

html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:hover .theme-label,
html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:focus-visible .theme-label {
  display: none;
}

html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:hover .theme-dots,
html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:focus-visible .theme-dots {
  display: inline-flex;
}

html[data-theme] body.theme-light-premium .theme-dot {
  display: inline-flex;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.55), inset 0 0 0 1px rgba(255,255,255,0.18);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
}

html[data-theme] body.theme-light-premium .theme-dot:hover {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

html[data-theme] body.theme-light-premium .theme-dot.active {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent-primary) 34%, transparent),
    inset 0 0 0 1px rgba(255,255,255,0.35);
}

html[data-theme] body.theme-light-premium .theme-dot-light {
  background: #fffaf0;
  border-color: #d7cab8;
}

html[data-theme] body.theme-light-premium .theme-dot-dark {
  background: #101827;
  border-color: #556178;
}

html[data-theme] body.theme-light-premium .theme-dot-retro {
  background: #273a1f;
  border-color: #a2a14f;
}

html[data-theme] body.theme-light-premium {
  --pa-matrix-keyword-width: var(--matrix-keyword-width, 380px);
  --pa-matrix-frequency-width: 74px;
  --pa-matrix-current-width: 88px;
  --pa-matrix-history-width: 156px;
  --pa-matrix-first-width: 112px;
  --pa-matrix-best-width: 134px;
  --pa-matrix-url-min-width: 190px;
  --pa-matrix-date-width: 126px;
  --pa-matrix-min-width: calc(
    var(--pa-matrix-keyword-width) +
    var(--pa-matrix-frequency-width) +
    var(--pa-matrix-current-width) +
    var(--pa-matrix-history-width) +
    var(--pa-matrix-first-width) +
    var(--pa-matrix-best-width) +
    var(--pa-matrix-url-min-width) +
    var(--pa-matrix-date-width)
  );
}

@media (min-width: 761px) {
  html[data-theme] body.theme-light-premium .matrix-table {
    width: max(100%, var(--pa-matrix-min-width)) !important;
    min-width: var(--pa-matrix-min-width) !important;
    max-width: none !important;
    table-layout: fixed !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td::before {
    content: none !important;
    display: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-keyword,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(1),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(1) {
    width: var(--pa-matrix-keyword-width) !important;
    min-width: var(--pa-matrix-keyword-width) !important;
    max-width: var(--pa-matrix-keyword-width) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-frequency,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(2),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(2) {
    width: var(--pa-matrix-frequency-width) !important;
    min-width: var(--pa-matrix-frequency-width) !important;
    max-width: var(--pa-matrix-frequency-width) !important;
    text-align: right !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-current,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(3),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(3) {
    width: var(--pa-matrix-current-width) !important;
    min-width: var(--pa-matrix-current-width) !important;
    max-width: var(--pa-matrix-current-width) !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-history,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(4),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(4) {
    width: var(--pa-matrix-history-width) !important;
    min-width: var(--pa-matrix-history-width) !important;
    max-width: var(--pa-matrix-history-width) !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-first,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(5),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(5) {
    width: var(--pa-matrix-first-width) !important;
    min-width: var(--pa-matrix-first-width) !important;
    max-width: var(--pa-matrix-first-width) !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-best,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(6),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(6) {
    width: var(--pa-matrix-best-width) !important;
    min-width: var(--pa-matrix-best-width) !important;
    max-width: var(--pa-matrix-best-width) !important;
    text-align: center !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-url,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(7),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(7) {
    width: auto !important;
    min-width: var(--pa-matrix-url-min-width) !important;
    max-width: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-date,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(8),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(8) {
    width: var(--pa-matrix-date-width) !important;
    min-width: var(--pa-matrix-date-width) !important;
    max-width: var(--pa-matrix-date-width) !important;
    text-align: right !important;
  }
}

html[data-theme] body.theme-light-premium .matrix-current-position {
  min-width: 46px;
  min-height: 34px;
  font-size: 16px;
  font-weight: 880;
}

html[data-theme] body.theme-light-premium .matrix-history-trail {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 740;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .matrix-history-trail:hover {
  border-color: var(--border-default);
  background: var(--surface-hover);
  color: var(--text-link);
}

html[data-theme] body.theme-light-premium .matrix-pos-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

html[data-theme] body.theme-light-premium .matrix-start-stack,
html[data-theme] body.theme-light-premium .matrix-best-stack {
  min-width: 0;
}

html[data-theme] body.theme-light-premium .matrix-progress-badge {
  display: inline-flex;
  min-width: 30px;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--success) 45%, var(--border-default));
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 18%, var(--surface-primary));
  color: var(--success);
  font-size: 11px;
  font-weight: 860;
  line-height: 1;
}

html[data-theme] body.theme-light-premium .matrix-date-cell {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before { content: "Запрос" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(2)::before { content: "Частота" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3)::before { content: "Сейчас" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4)::before { content: "История" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5)::before { content: "Старт" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6)::before { content: "Лучшая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7)::before { content: "URL" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8)::before { content: "Проверка" !important; }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1) { order: 0 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(2) { order: 1 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3) { order: 2 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4) { order: 3 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5) { order: 4 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6) { order: 5 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7) { order: 6 !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8) { order: 7 !important; }
}

html[data-theme] body.modal-open {
  overflow: hidden !important;
}

html[data-theme] body.theme-light-premium .keyword-history-modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

html[data-theme] body.theme-light-premium .keyword-history-content {
  display: grid !important;
  width: min(1100px, 92vw) !important;
  max-height: 90vh !important;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden !important;
  padding: 0 !important;
}

html[data-theme] body.theme-light-premium .keyword-history-content .modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}

html[data-theme] body.theme-light-premium .keyword-history-content .modal-header h2 {
  margin: 0 0 4px;
}

html[data-theme] body.theme-light-premium .keyword-history-content .modal-header p {
  margin: 0;
  color: var(--text-secondary);
}

html[data-theme] body.theme-light-premium .keyword-history-scroll {
  min-height: 0;
  padding: 16px 20px 20px;
  overflow-y: auto;
}

html[data-theme] body.theme-light-premium .keyword-history-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

html[data-theme] body.theme-light-premium .keyword-history-meta span {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 860;
  line-height: 1.05;
}

html[data-theme] body.theme-light-premium .keyword-history-meta b,
html[data-theme] body.theme-light-premium .keyword-history-meta small {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 740;
  line-height: 1.2;
}

html[data-theme] body.theme-light-premium .keyword-history-chart-wrap {
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-primary);
}

html[data-theme] body.theme-light-premium .history-chart {
  width: 100%;
  height: 340px;
  overflow: visible;
}

html[data-theme] body.theme-light-premium .history-chart .history-grid-line {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

html[data-theme] body.theme-light-premium .history-chart path {
  stroke-width: 4;
}

html[data-theme] body.theme-light-premium .history-chart circle {
  stroke-width: 3;
}

html[data-theme] body.theme-light-premium .history-chart text {
  font-size: 14px;
  font-weight: 850;
}

html[data-theme] body.theme-light-premium .history-chart .history-date-label {
  font-size: 11px;
  font-weight: 720;
}

html[data-theme] body.theme-light-premium .keyword-history-table-wrap {
  max-height: 320px;
  margin-top: 14px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

html[data-theme] body.theme-light-premium .keyword-history-table th,
html[data-theme] body.theme-light-premium .keyword-history-table td {
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.25;
}

html[data-theme] body.theme-light-premium .keyword-history-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

html[data-theme] body.theme-light-premium .keyword-history-table .is-current-history-row td {
  background: var(--table-row-selected-bg);
  font-weight: 740;
}

@media (max-width: 820px) {
  html[data-theme] body.theme-light-premium .keyword-history-modal.show {
    padding: 12px;
  }

  html[data-theme] body.theme-light-premium .keyword-history-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-theme] body.theme-light-premium .keyword-history-chart-wrap {
    min-height: 300px;
  }

  html[data-theme] body.theme-light-premium .history-chart {
    height: 300px;
  }
}

/* V2 matrix history readability and responsive repair */
html[data-theme] body.theme-light-premium {
  --pa-matrix-history-width: 184px;
  --pa-matrix-url-min-width: 180px;
  --pa-matrix-date-width: 118px;
  --pa-matrix-min-width: calc(
    var(--pa-matrix-keyword-width) +
    var(--pa-matrix-frequency-width) +
    var(--pa-matrix-current-width) +
    var(--pa-matrix-history-width) +
    var(--pa-matrix-first-width) +
    var(--pa-matrix-best-width) +
    var(--pa-matrix-url-min-width) +
    var(--pa-matrix-date-width)
  );
}

html[data-theme] body.theme-light-premium .matrix-history-head {
  white-space: nowrap !important;
}

html[data-theme] body.theme-light-premium .matrix-history-cell {
  overflow: visible !important;
}

html[data-theme] body.theme-light-premium .matrix-history-trail {
  width: auto !important;
  min-width: 136px;
  max-width: none !important;
  padding: 5px 8px;
  overflow: visible !important;
  border-color: var(--border-soft);
  background: var(--surface-secondary);
  color: var(--text-primary) !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

html[data-theme] body.theme-light-premium .matrix-history-trail:hover,
html[data-theme] body.theme-light-premium .matrix-history-trail:focus-visible {
  background: var(--surface-hover);
  color: var(--text-primary) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-history-trail {
  border-color: rgba(217, 218, 154, 0.34) !important;
  background: #223719 !important;
  color: #fff4be !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-history-trail:hover,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-history-trail:focus-visible {
  background: #2d4521 !important;
  color: #fff8d5 !important;
}

html[data-theme] body.theme-light-premium .keyword-history-modal.show {
  padding: 16px !important;
}

html[data-theme] body.theme-light-premium .keyword-history-content {
  width: min(1480px, calc(100vw - 32px)) !important;
  max-height: 94vh !important;
}

html[data-theme] body.theme-light-premium .keyword-history-scroll {
  padding: 18px 22px 22px !important;
}

html[data-theme] body.theme-light-premium .keyword-history-chart-wrap {
  min-height: 460px !important;
  padding: 18px !important;
  overflow: hidden;
}

html[data-theme] body.theme-light-premium .history-chart {
  display: block;
  width: 100% !important;
  height: 430px !important;
}

html[data-theme] body.theme-light-premium .history-chart text {
  paint-order: stroke;
  stroke: var(--surface-primary);
  stroke-width: 3px;
  stroke-linejoin: round;
}

html[data-theme="dark"] body.theme-light-premium .history-chart text,
html[data-theme="retro"] body.theme-light-premium .history-chart text {
  stroke: var(--page-bg);
}

@media (min-width: 761px) {
  html[data-theme] body.theme-light-premium .matrix-col-history,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(4),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(4) {
    width: var(--pa-matrix-history-width) !important;
    min-width: var(--pa-matrix-history-width) !important;
    max-width: var(--pa-matrix-history-width) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-col-date,
  html[data-theme] body.theme-light-premium .matrix-table th:nth-child(8),
  html[data-theme] body.theme-light-premium .matrix-table td:nth-child(8) {
    width: var(--pa-matrix-date-width) !important;
    min-width: var(--pa-matrix-date-width) !important;
    max-width: var(--pa-matrix-date-width) !important;
  }
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .matrix-shell {
    max-height: none !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    contain: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table,
  html[data-theme] body.theme-light-premium .matrix-table tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table colgroup,
  html[data-theme] body.theme-light-premium .matrix-table thead {
    display: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 12px !important;
    padding: 12px !important;
    border: 1px solid var(--border-soft) !important;
    border-radius: 10px !important;
    background: var(--surface-primary) !important;
    box-shadow: 0 8px 22px rgba(0,0,0,0.05) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td {
    display: grid !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    grid-template-columns: 94px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border-soft) !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    text-align: left !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td:last-child {
    border-bottom: 0 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td::before {
    display: block !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
    font-weight: 780 !important;
    letter-spacing: 0 !important;
    line-height: 1.15 !important;
    text-transform: uppercase !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before { content: "Запрос" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(2)::before { content: "Частота" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3)::before { content: "Сейчас" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4)::before { content: "История" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5)::before { content: "Старт" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6)::before { content: "Лучшая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7)::before { content: "URL" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8)::before { content: "Проверка" !important; }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1) {
    grid-template-columns: 1fr !important;
    padding-top: 0 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before {
    margin-bottom: 4px;
  }

  html[data-theme] body.theme-light-premium .matrix-keyword {
    white-space: normal !important;
  }

  html[data-theme] body.theme-light-premium .matrix-frequency,
  html[data-theme] body.theme-light-premium .matrix-positions-cell,
  html[data-theme] body.theme-light-premium .matrix-history-cell,
  html[data-theme] body.theme-light-premium .matrix-first-cell,
  html[data-theme] body.theme-light-premium .matrix-best-cell,
  html[data-theme] body.theme-light-premium .matrix-date-cell {
    justify-items: start !important;
    text-align: left !important;
  }

  html[data-theme] body.theme-light-premium .matrix-history-trail {
    min-width: 0 !important;
    max-width: 100% !important;
    justify-content: flex-start !important;
    white-space: normal !important;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell a {
    max-width: 100% !important;
    justify-content: flex-start !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-modal.show {
    align-items: stretch !important;
    padding: 8px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-content {
    width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    border-radius: 10px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-content .modal-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-content .modal-header h2 {
    font-size: 20px !important;
    line-height: 1.15 !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-scroll {
    padding: 10px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-meta span {
    min-height: 66px !important;
    padding: 10px !important;
    font-size: 18px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-chart-wrap {
    min-height: 280px !important;
    padding: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  html[data-theme] body.theme-light-premium .history-chart {
    width: max(760px, 100%) !important;
    min-width: 760px !important;
    height: 260px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-table-wrap {
    max-height: 280px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-table {
    min-width: 720px;
  }
}

@media (max-width: 420px) {
  html[data-theme] body.theme-light-premium .matrix-table td {
    grid-template-columns: 82px minmax(0, 1fr) !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-meta {
    grid-template-columns: 1fr !important;
  }
}

/* V2 unified history modal and position matrix responsive pass */
html[data-theme="light"] body.theme-light-premium {
  --history-overlay-bg: rgba(45, 38, 30, 0.54);
  --history-modal-bg: #fffaf0;
  --history-modal-text: #211915;
  --history-modal-border: #d8ccbc;
  --history-panel-bg: #fffdf7;
  --history-panel-text: #211915;
  --history-panel-muted: #75695d;
  --history-panel-border: #e1d5c6;
  --history-chart-bg: #f6eddd;
  --history-chart-inner-border: rgba(104, 24, 39, 0.12);
  --history-chart-grid: #dacbb8;
  --history-chart-axis: #bcae9d;
  --history-chart-line: #681827;
  --history-chart-point: #fffdf7;
  --history-chart-start: #8b6a36;
  --history-chart-best: #5d9837;
  --history-chart-current: #c1901e;
  --history-chart-text: #211915;
  --history-chart-text-stroke: #fffaf0;
  --matrix-compact-card-bg: #fffaf0;
  --matrix-compact-cell-bg: #fffdf7;
  --matrix-compact-label: #8b7c6d;
}

html[data-theme="dark"] body.theme-light-premium {
  --history-overlay-bg: rgba(0, 0, 0, 0.68);
  --history-modal-bg: #0d1524;
  --history-modal-text: #f4f6fb;
  --history-modal-border: #263248;
  --history-panel-bg: #121c2d;
  --history-panel-text: #f4f6fb;
  --history-panel-muted: #9da7b8;
  --history-panel-border: #263248;
  --history-chart-bg: #09111f;
  --history-chart-inner-border: rgba(133, 116, 255, 0.16);
  --history-chart-grid: #263248;
  --history-chart-axis: #38455d;
  --history-chart-line: #8574ff;
  --history-chart-point: #0d1524;
  --history-chart-start: #e0b85f;
  --history-chart-best: #5dd39e;
  --history-chart-current: #ff6b7a;
  --history-chart-text: #f4f6fb;
  --history-chart-text-stroke: #09111f;
  --matrix-compact-card-bg: #0d1524;
  --matrix-compact-cell-bg: #121c2d;
  --matrix-compact-label: #9da7b8;
}

html[data-theme="retro"] body.theme-light-premium {
  --history-overlay-bg: rgba(7, 12, 5, 0.74);
  --history-modal-bg: #172610;
  --history-modal-text: #f1efc6;
  --history-modal-border: #4d5c31;
  --history-panel-bg: #fff7d6;
  --history-panel-text: #211915;
  --history-panel-muted: #81784c;
  --history-panel-border: #d8cc8e;
  --history-chart-bg: #fff2c6;
  --history-chart-inner-border: rgba(76, 91, 40, 0.22);
  --history-chart-grid: #d7c98c;
  --history-chart-axis: #9a9654;
  --history-chart-line: #5c6d27;
  --history-chart-point: #fffbe5;
  --history-chart-start: #b78b26;
  --history-chart-best: #83ad3a;
  --history-chart-current: #d0a621;
  --history-chart-text: #1d1a12;
  --history-chart-text-stroke: #fff2c6;
  --matrix-compact-card-bg: #fff7d6;
  --matrix-compact-cell-bg: #fffbe5;
  --matrix-compact-label: #746f42;
}

html[data-theme] body.theme-light-premium .premium-project-dashboard,
html[data-theme] body.theme-light-premium .matrix-card,
html[data-theme] body.theme-light-premium .matrix-shell,
html[data-theme] body.theme-light-premium .matrix-table,
html[data-theme] body.theme-light-premium .matrix-table tbody,
html[data-theme] body.theme-light-premium .matrix-table tr,
html[data-theme] body.theme-light-premium .matrix-table td,
html[data-theme] body.theme-light-premium .keyword-history-content,
html[data-theme] body.theme-light-premium .keyword-history-content * {
  box-sizing: border-box;
  min-width: 0;
}

@media (min-width: 761px) and (max-width: 1180px) {
  html[data-theme] body.home-page.theme-light-premium,
  html[data-theme] body.project-page.theme-light-premium {
    padding-left: 104px !important;
    padding-right: 18px !important;
  }

  html[data-theme] body.theme-light-premium .premium-sidebar {
    display: flex !important;
    width: 74px !important;
  }

  html[data-theme] body.theme-light-premium .premium-sidebar span {
    display: none !important;
  }
}

html[data-theme] body.theme-light-premium .keyword-history-modal.show {
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 32px !important;
  overflow: hidden !important;
  background: var(--history-overlay-bg) !important;
}

html[data-theme] body.theme-light-premium .keyword-history-content {
  display: grid !important;
  width: min(1120px, calc(100vw - 64px)) !important;
  max-width: 1120px !important;
  max-height: calc(100dvh - 64px) !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  overflow: hidden !important;
  padding: 0 !important;
  border: 1px solid var(--history-modal-border) !important;
  border-radius: 18px !important;
  background: var(--history-modal-bg) !important;
  color: var(--history-modal-text) !important;
  box-shadow: var(--shadow-modal) !important;
}

html[data-theme] body.theme-light-premium .keyword-history-content .modal-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 16px !important;
  align-items: start !important;
  padding: 22px 26px !important;
  border-bottom: 1px solid var(--history-modal-border) !important;
  background: color-mix(in srgb, var(--history-modal-bg) 94%, var(--history-panel-bg)) !important;
}

html[data-theme] body.theme-light-premium .keyword-history-content .modal-header h2 {
  color: var(--history-modal-text) !important;
  overflow-wrap: anywhere;
}

html[data-theme] body.theme-light-premium .keyword-history-content .modal-header p {
  color: color-mix(in srgb, var(--history-modal-text) 68%, transparent) !important;
}

html[data-theme] body.theme-light-premium .keyword-history-scroll {
  max-height: calc(100dvh - 180px) !important;
  min-height: 0 !important;
  padding: 22px 26px 26px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}

html[data-theme] body.theme-light-premium .keyword-history-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 12px !important;
  margin-bottom: 16px !important;
}

html[data-theme] body.theme-light-premium .keyword-history-meta span {
  min-height: 86px !important;
  padding: 14px !important;
  border-color: var(--history-panel-border) !important;
  background: var(--history-panel-bg) !important;
  color: var(--history-panel-text) !important;
  overflow-wrap: anywhere;
}

html[data-theme] body.theme-light-premium .keyword-history-meta b,
html[data-theme] body.theme-light-premium .keyword-history-meta small {
  color: var(--history-panel-muted) !important;
}

html[data-theme] body.theme-light-premium .keyword-history-chart-wrap {
  height: clamp(420px, 52vh, 560px) !important;
  min-height: 420px !important;
  padding: 18px !important;
  overflow: hidden !important;
  border-color: var(--history-panel-border) !important;
  background: var(--history-chart-bg) !important;
  box-shadow: inset 0 0 0 1px var(--history-chart-inner-border) !important;
}

html[data-theme] body.theme-light-premium .history-chart {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  overflow: visible !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-grid-line {
  stroke: var(--history-chart-grid) !important;
  stroke-width: 1 !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-axis-line {
  stroke: var(--history-chart-axis) !important;
  stroke-width: 1.4 !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-line {
  fill: none !important;
  stroke: var(--history-chart-line) !important;
  stroke-width: 3.4 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-point circle {
  fill: var(--history-chart-point) !important;
  stroke: var(--history-chart-line) !important;
  stroke-width: 2.6 !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-point.is-start circle {
  stroke: var(--history-chart-start) !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-point.is-best circle {
  fill: color-mix(in srgb, var(--history-chart-best) 32%, var(--history-chart-point)) !important;
  stroke: var(--history-chart-best) !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-point.is-current circle {
  fill: color-mix(in srgb, var(--history-chart-current) 32%, var(--history-chart-point)) !important;
  stroke: var(--history-chart-current) !important;
}

html[data-theme] body.theme-light-premium .history-chart text {
  fill: var(--history-chart-text) !important;
  stroke: var(--history-chart-text-stroke) !important;
  stroke-width: 3px !important;
  paint-order: stroke !important;
  font-size: 13px !important;
  font-weight: 850 !important;
  text-anchor: middle !important;
}

html[data-theme] body.theme-light-premium .history-chart .history-date-label {
  fill: color-mix(in srgb, var(--history-chart-text) 74%, transparent) !important;
  font-size: 11px !important;
  font-weight: 720 !important;
}

html[data-theme] body.theme-light-premium .keyword-history-table-wrap {
  max-height: 320px !important;
  overflow: auto !important;
  border-color: var(--history-panel-border) !important;
  background: var(--history-panel-bg) !important;
}

@media (max-width: 1180px) {
  html[data-theme] body.theme-light-premium .matrix-shell {
    max-height: none !important;
    overflow: visible !important;
    contain: none !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table,
  html[data-theme] body.theme-light-premium .matrix-table tbody {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tbody {
    gap: 12px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table colgroup,
  html[data-theme] body.theme-light-premium .matrix-table thead {
    display: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 12px !important;
    margin: 0 !important;
    padding: 12px !important;
    overflow: hidden !important;
    border: 1px solid var(--history-panel-border) !important;
    border-radius: 10px !important;
    background: var(--matrix-compact-card-bg) !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table th,
  html[data-theme] body.theme-light-premium .matrix-table td {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td {
    position: static !important;
    left: auto !important;
    display: grid !important;
    grid-template-columns: 104px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 10px !important;
    overflow: hidden !important;
    border: 1px solid color-mix(in srgb, var(--history-panel-border) 76%, transparent) !important;
    border-radius: 8px !important;
    background: var(--matrix-compact-cell-bg) !important;
    color: var(--history-panel-text, var(--text-primary)) !important;
    text-align: left !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td::before {
    display: block !important;
    content: "" !important;
    color: var(--matrix-compact-label) !important;
    font-size: 10px !important;
    font-weight: 820 !important;
    letter-spacing: 0 !important;
    line-height: 1.1 !important;
    text-transform: uppercase !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before { content: "Запрос" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(2)::before { content: "Частота" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(3)::before { content: "Сейчас" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(4)::before { content: "История" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(5)::before { content: "Старт" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(6)::before { content: "Лучшая" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7)::before { content: "URL" !important; }
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8)::before { content: "Проверка" !important; }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1),
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(7),
  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(8) {
    grid-column: 1 / -1 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1) {
    grid-template-columns: 1fr !important;
    align-items: start !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table tr > td:nth-child(1)::before {
    margin-bottom: 2px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-keyword,
  html[data-theme] body.theme-light-premium .matrix-url-cell a span,
  html[data-theme] body.theme-light-premium .matrix-date-cell {
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }

  html[data-theme] body.theme-light-premium .matrix-frequency,
  html[data-theme] body.theme-light-premium .matrix-positions-cell,
  html[data-theme] body.theme-light-premium .matrix-history-cell,
  html[data-theme] body.theme-light-premium .matrix-first-cell,
  html[data-theme] body.theme-light-premium .matrix-best-cell,
  html[data-theme] body.theme-light-premium .matrix-url-cell,
  html[data-theme] body.theme-light-premium .matrix-date-cell {
    justify-items: start !important;
    text-align: left !important;
  }

  html[data-theme] body.theme-light-premium .matrix-pos-line {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }

  html[data-theme] body.theme-light-premium .matrix-history-trail {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    text-align: left !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    scrollbar-width: thin;
  }

  html[data-theme] body.theme-light-premium .matrix-url-cell a {
    max-width: 100% !important;
    justify-content: flex-start !important;
  }
}

@media (max-width: 900px) {
  html[data-theme] body.theme-light-premium .keyword-history-modal.show {
    padding: 16px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-content {
    width: calc(100vw - 32px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 32px) !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-scroll {
    max-height: calc(100dvh - 150px) !important;
    padding: 16px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-chart-wrap {
    height: clamp(340px, 48vh, 460px) !important;
    min-height: 340px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  html[data-theme] body.theme-light-premium .history-chart {
    width: max(760px, 100%) !important;
    min-width: 760px !important;
  }
}

@media (max-width: 720px) {
  html[data-theme] body.theme-light-premium .matrix-table tr {
    grid-template-columns: 1fr !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table td {
    grid-template-columns: 96px minmax(0, 1fr) !important;
  }
}

@media (max-width: 560px) {
  html[data-theme] body.theme-light-premium .keyword-history-modal.show {
    align-items: stretch !important;
    padding: 0 !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-content {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-content .modal-header {
    padding: 14px 16px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-content .modal-header h2 {
    font-size: 20px !important;
    line-height: 1.15 !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-scroll {
    max-height: none !important;
    padding: 12px !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-meta {
    grid-template-columns: 1fr !important;
  }

  html[data-theme] body.theme-light-premium .keyword-history-chart-wrap {
    height: 320px !important;
    min-height: 320px !important;
    padding: 10px !important;
  }

  html[data-theme] body.theme-light-premium .history-chart {
    width: 720px !important;
    min-width: 720px !important;
  }

  html[data-theme] body.theme-light-premium .history-chart .history-point text {
    display: none;
  }

  html[data-theme] body.theme-light-premium .history-chart .history-point.is-start text,
  html[data-theme] body.theme-light-premium .history-chart .history-point.is-best text,
  html[data-theme] body.theme-light-premium .history-chart .history-point.is-current text {
    display: block;
  }

  html[data-theme] body.theme-light-premium .keyword-history-table {
    min-width: 720px !important;
  }
}

@media (max-width: 420px) {
  html[data-theme] body.theme-light-premium .matrix-table td {
    grid-template-columns: 82px minmax(0, 1fr) !important;
    padding-inline: 8px !important;
  }
}

/* Client UX and access settings polish */
html[data-theme] body.theme-light-premium .premium-periods {
  display: none !important;
}

.admin-modal-content {
  width: min(1320px, calc(100vw - 32px)) !important;
  max-width: 1320px !important;
  max-height: min(90vh, 980px) !important;
  overflow: hidden !important;
}

.admin-modal-content .modal-header {
  flex: 0 0 auto;
}

.admin-grid {
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 2px 8px 2px 2px !important;
  align-items: start !important;
}

.admin-panel {
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
}

.admin-section-block {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-soft, rgba(135,151,186,0.16));
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-secondary, rgba(255,255,255,0.04)) 78%, transparent);
}

.admin-section-block h4 {
  margin: 0 0 10px;
  color: var(--text-primary, var(--text));
  font-size: 13px;
  letter-spacing: 0;
}

.admin-create-user {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: 0 !important;
}

.admin-users-block {
  min-height: 0;
}

.admin-users-block .admin-list,
.admin-access-projects {
  max-height: min(54vh, 560px);
  scrollbar-gutter: stable;
}

.admin-access-projects {
  padding-bottom: 4px;
}

.project-action-menu {
  z-index: 5000 !important;
}

.project-action-menu.is-fixed-menu {
  position: fixed !important;
  right: auto !important;
  z-index: 2147483647 !important;
}

html[data-theme] body.theme-light-premium .semantic-tool-grid {
  grid-template-columns: minmax(390px, 0.78fr) minmax(560px, 1.22fr) !important;
  align-items: stretch !important;
  overflow: visible !important;
}

html[data-theme] body.theme-light-premium .wordstat-card,
html[data-theme] body.theme-light-premium .wordstat-results {
  min-height: 0 !important;
}

html[data-theme] body.theme-light-premium .wordstat-results {
  display: grid !important;
  grid-template-rows: auto minmax(180px, auto) auto !important;
}

html[data-theme] body.theme-light-premium .semantic-frequency-results {
  max-height: min(62vh, 720px) !important;
  min-height: 180px !important;
  overflow: auto !important;
  scrollbar-gutter: stable !important;
}

html[data-theme] body.theme-light-premium .wordstat-results-head,
html[data-theme] body.theme-light-premium .semantic-frequency-row {
  grid-template-columns: 28px minmax(260px, 1fr) minmax(110px, 150px) !important;
}

html[data-theme] body.theme-light-premium .wordstat-select-all {
  display: contents;
}

html[data-theme] body.theme-light-premium .wordstat-select-all input {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row {
  min-height: 42px !important;
  padding: 8px 0 !important;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row span {
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  line-height: 1.25 !important;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row.has-error {
  opacity: 0.72;
}

html[data-theme] body.theme-light-premium .semantic-frequency-row.has-error b {
  color: var(--danger, #b91c1c) !important;
  white-space: normal !important;
}

html[data-theme] body.theme-light-premium .wordstat-result-note,
html[data-theme] body.theme-light-premium .wordstat-state {
  margin-top: 10px;
  color: var(--text-secondary) !important;
  font-size: 13px;
  line-height: 1.35;
}

html[data-theme] body.theme-light-premium .wordstat-add-row .btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 1240px) {
  html[data-theme] body.theme-light-premium .semantic-tool-grid {
    grid-template-columns: 1fr !important;
  }
}

.audit-back-link {
  white-space: nowrap;
}

@media (max-width: 980px) {
  .admin-grid {
    grid-template-columns: 1fr !important;
  }

  .admin-users-block .admin-list,
  .admin-access-projects {
    max-height: none;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  html[data-theme] body.theme-light-premium .premium-sidebar span:not(.theme-dots):not(.theme-dot) {
    display: none !important;
  }

  html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:hover .theme-dot,
  html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:focus-visible .theme-dot {
    display: inline-flex !important;
  }

  html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:hover .theme-dots,
  html[data-theme] body.theme-light-premium .premium-sidebar-theme-button:focus-visible .theme-dots {
    display: inline-flex !important;
  }
}

/* Project category shelves on the dashboard */
.project-category-board {
  display: grid;
  gap: 22px;
  width: 100%;
}

.project-category-section {
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--border2) 78%, transparent);
  border-radius: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 44%),
    color-mix(in srgb, var(--panel) 86%, transparent);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.22);
}

.project-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--border2) 72%, transparent);
}

.project-category-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.project-category-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border2));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.project-category-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 21px;
  line-height: 1.15;
}

.project-category-title p {
  margin: 4px 0 0;
  max-width: 780px;
  color: var(--muted);
  font-size: 13px;
}

.project-category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--border2) 75%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 84%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.project-category-table-shell {
  margin: 0;
  border: 0;
  border-radius: 0 0 16px 16px;
  box-shadow: none;
}

.project-empty-row td {
  height: 76px;
  color: var(--muted);
  text-align: center !important;
}

.project-action-menu-caption {
  padding: 8px 12px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  pointer-events: none;
}

html[data-theme="light"] body.theme-light-premium .project-category-section {
  background:
    linear-gradient(135deg, rgba(104, 24, 39, 0.045), transparent 44%),
    #fff9ed;
  border-color: #c9b8a5;
  box-shadow: 0 18px 48px rgba(57, 45, 34, 0.12);
}

html[data-theme="light"] body.theme-light-premium .project-category-head {
  border-bottom-color: #d8c8b6;
}

html[data-theme="retro"] body.theme-light-premium .project-category-section {
  background:
    linear-gradient(135deg, rgba(198, 195, 108, 0.12), transparent 44%),
    #213418;
  border-color: rgba(198, 195, 108, 0.34);
}

html[data-theme="dark"] body.theme-light-premium .project-category-section {
  background:
    linear-gradient(135deg, rgba(112, 92, 255, 0.12), transparent 44%),
    #111a2a;
  border-color: rgba(135, 151, 186, 0.28);
}

@media (max-width: 760px) {
  .project-category-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-category-title {
    align-items: flex-start;
  }

  .project-category-count {
    align-self: stretch;
  }
}

.wordstat-mvp-tool {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.28));
  border-radius: 8px;
  background: var(--card-bg, #fff);
}

.wordstat-mvp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.wordstat-mvp-head h4 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.25;
}

.wordstat-mvp-head p {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 14px;
}

.wordstat-mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.28));
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
}

.wordstat-mode-toggle button {
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-weight: 700;
  cursor: pointer;
}

.wordstat-mode-toggle button.active {
  background: var(--primary-color, #2563eb);
  color: #fff;
}

.wordstat-mvp-form textarea,
.wordstat-mvp-form select,
.wordstat-result-toolbar select {
  width: 100%;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.35));
  border-radius: 8px;
  background: var(--input-bg, #fff);
  color: var(--text-color, #0f172a);
}

.wordstat-mvp-form textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
}

.wordstat-mvp-controls {
  display: grid;
  grid-template-columns: minmax(180px, 240px) auto;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.wordstat-advanced {
  margin-top: 12px;
}

.wordstat-advanced summary {
  cursor: pointer;
  color: var(--text-muted, #64748b);
  font-weight: 700;
}

.wordstat-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.wordstat-advanced-grid label {
  display: grid;
  gap: 6px;
  color: var(--text-muted, #64748b);
  font-size: 13px;
}

.wordstat-wide-field {
  grid-column: 1 / -1;
}

.wordstat-check {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px !important;
}

.wordstat-check input {
  width: 16px;
  height: 16px;
}

.wordstat-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.wordstat-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.11);
  color: var(--text-muted, #64748b);
  font-size: 13px;
}

.wordstat-summary b {
  color: var(--text-color, #0f172a);
}

.wordstat-result-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.wordstat-result-toolbar select {
  max-width: 230px;
}

.wordstat-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.28));
  border-radius: 8px;
}

.wordstat-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.wordstat-table th,
.wordstat-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
  text-align: left;
  vertical-align: middle;
}

.wordstat-table th:first-child,
.wordstat-table td:first-child {
  width: 44px;
}

.wordstat-table th:nth-child(3),
.wordstat-table td:nth-child(3) {
  width: 120px;
  text-align: right;
}

.wordstat-table th:nth-child(4),
.wordstat-table td:nth-child(4) {
  width: 170px;
}

.wordstat-table th:nth-child(5),
.wordstat-table td:nth-child(5) {
  width: 150px;
}

.wordstat-table tbody tr:last-child td {
  border-bottom: 0;
}

.wordstat-row td strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.wordstat-row td span {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(37, 99, 235, 0.11);
  color: #1d4ed8;
}

.wordstat-row td small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted, #64748b);
  font-size: 12px;
}

.wordstat-row.status-existing td span {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.wordstat-row.status-excluded {
  opacity: 0.72;
}

.wordstat-row.status-excluded td span {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

@media (max-width: 860px) {
  .wordstat-mvp-head,
  .wordstat-result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .wordstat-mode-toggle,
  .wordstat-result-toolbar select,
  .wordstat-result-toolbar .btn {
    width: 100%;
  }

  .wordstat-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .wordstat-mvp-controls,
  .wordstat-advanced-grid {
    grid-template-columns: 1fr;
  }
}

/* V2 Topvisor-like date matrix */
html[data-theme] body.theme-light-premium .matrix-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--surface-secondary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
}

html[data-theme] body.theme-light-premium .matrix-view-toggle button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 780;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .matrix-view-toggle button:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

html[data-theme] body.theme-light-premium .matrix-view-toggle button.active {
  background: var(--accent-primary);
  color: var(--accent-primary-text);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-primary) 22%, transparent);
}

html[data-theme] body.theme-light-premium .matrix-view-toggle i {
  font-size: 12px;
}

html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode {
  overflow: auto !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor {
  width: max(100%, var(--pa-topvisor-min-width, 960px)) !important;
  min-width: var(--pa-topvisor-min-width, 960px) !important;
  max-width: none !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-col-keyword,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor th:nth-child(1),
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor td:nth-child(1) {
  width: var(--pa-matrix-keyword-width) !important;
  min-width: var(--pa-matrix-keyword-width) !important;
  max-width: var(--pa-matrix-keyword-width) !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-col-frequency,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor th:nth-child(2),
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor td:nth-child(2) {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  text-align: right !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-col-date,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor th:nth-child(n+3),
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor td:nth-child(n+3) {
  width: 116px !important;
  min-width: 116px !important;
  max-width: 116px !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor thead th {
  height: 68px;
  padding: 9px 10px !important;
  vertical-align: top;
  white-space: normal !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .matrix-sort-button {
  width: 100%;
  min-width: 0;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-date-head .matrix-sort-button {
  gap: 5px;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-date-head span {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 860;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-date-head small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.15;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-date-head.is-active-date {
  background: color-mix(in srgb, var(--accent-primary) 12%, var(--surface-secondary)) !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-keyword-head,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-keyword-cell {
  left: 0;
  position: sticky !important;
  z-index: 5;
  box-shadow: 1px 0 0 var(--border-soft);
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-frequency-head,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-frequency-cell {
  left: var(--pa-matrix-keyword-width);
  position: sticky !important;
  z-index: 5;
  box-shadow: 1px 0 0 var(--border-soft);
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor thead .topvisor-frequency-head {
  z-index: 8;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-frequency-cell {
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor tbody tr:hover .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium .matrix-table.is-topvisor tbody tr:hover .topvisor-frequency-cell {
  background: var(--surface-hover) !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor tbody td {
  height: 58px;
  padding: 0 !important;
  vertical-align: middle;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-keyword-cell {
  padding: 10px 12px !important;
}

html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-frequency-cell {
  padding: 10px !important;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 820;
}

html[data-theme] body.theme-light-premium .topvisor-position-cell {
  background: color-mix(in srgb, var(--surface-primary) 90%, var(--text-primary) 4%) !important;
}

html[data-theme] body.theme-light-premium .topvisor-position-cell.is-up,
html[data-theme] body.theme-light-premium .topvisor-position-cell.is-new {
  background: color-mix(in srgb, var(--success) 22%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium .topvisor-position-cell.is-down,
html[data-theme] body.theme-light-premium .topvisor-position-cell.is-lost {
  background: color-mix(in srgb, var(--danger) 20%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium .topvisor-position-cell.is-same,
html[data-theme] body.theme-light-premium .topvisor-position-cell.is-neutral {
  background: color-mix(in srgb, var(--surface-secondary) 82%, var(--text-primary) 5%) !important;
}

html[data-theme] body.theme-light-premium .topvisor-position-cell.is-missing {
  background: color-mix(in srgb, var(--surface-secondary) 90%, transparent) !important;
}

html[data-theme] body.theme-light-premium .topvisor-cell-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: 12px 10px 9px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

html[data-theme] body.theme-light-premium .topvisor-cell-button:hover {
  background: color-mix(in srgb, var(--surface-hover) 50%, transparent);
}

html[data-theme] body.theme-light-premium .topvisor-position-value {
  display: inline-flex;
  min-width: 26px;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 880;
  line-height: 1;
}

html[data-theme] body.theme-light-premium .topvisor-position-cell.is-missing .topvisor-position-value,
html[data-theme] body.theme-light-premium .topvisor-position-cell.is-lost .topvisor-position-value {
  color: var(--text-muted);
}

html[data-theme] body.theme-light-premium .topvisor-delta {
  display: inline-flex;
  min-width: 24px;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 860;
  line-height: 1;
  white-space: nowrap;
}

html[data-theme] body.theme-light-premium .topvisor-delta i {
  font-size: 9px;
}

html[data-theme] body.theme-light-premium .topvisor-delta.delta-up,
html[data-theme] body.theme-light-premium .topvisor-delta.delta-new {
  color: var(--success);
}

html[data-theme] body.theme-light-premium .topvisor-delta.delta-down,
html[data-theme] body.theme-light-premium .topvisor-delta.delta-lost {
  color: var(--danger);
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle {
  border-color: var(--retro-sheet-grid-strong) !important;
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-up,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-new {
  background: rgba(85, 132, 52, 0.24) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-down,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-lost {
  background: rgba(121, 54, 71, 0.28) !important;
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode {
    max-height: 68vh !important;
    overflow: auto !important;
    border: 1px solid var(--border-default) !important;
    border-radius: 10px !important;
    background: var(--surface-primary) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18) !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor {
    display: table !important;
    width: max(100%, var(--pa-topvisor-mobile-min-width, 760px)) !important;
    min-width: var(--pa-topvisor-mobile-min-width, 760px) !important;
    max-width: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor tbody {
    display: table-row-group !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor .topvisor-col-keyword {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor .topvisor-col-frequency {
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor .topvisor-col-date {
    width: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor colgroup {
    display: table-column-group !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor thead {
    display: table-header-group !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor th,
  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor td {
    display: table-cell !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    border-bottom: 1px solid var(--border-soft) !important;
    text-align: inherit !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor th:nth-child(1),
  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor td:nth-child(1) {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor th:nth-child(2),
  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor td:nth-child(2) {
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor th:nth-child(n+3),
  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor td:nth-child(n+3) {
    width: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor td::before {
    content: none !important;
    display: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-keyword-head,
  html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-keyword-cell {
    left: 0 !important;
  }

  html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-frequency-head,
  html[data-theme] body.theme-light-premium .matrix-table.is-topvisor .topvisor-frequency-cell {
    left: auto !important;
    position: static !important;
    box-shadow: none !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor .topvisor-keyword-cell {
    padding: 9px 10px !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .matrix-table.is-topvisor .matrix-keyword {
    white-space: normal !important;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .topvisor-cell-button {
    min-height: 52px;
    padding: 10px 8px 8px;
  }

  html[data-theme] body.theme-light-premium .matrix-shell.is-topvisor-mode .topvisor-position-value {
    font-size: 17px;
  }

  html[data-theme] body.theme-light-premium .matrix-view-toggle {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  html[data-theme] body.theme-light-premium .matrix-view-toggle button {
    width: 100%;
  }
}

/* V2 readability and sticky fixes */
html[data-theme] body.theme-light-premium.project-page .project-meta-row span,
html[data-theme] body.theme-light-premium.project-page .project-domain-link,
html[data-theme] body.theme-light-premium.project-page .access-pill {
  border: 1px solid var(--border-soft) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .project-meta-row b,
html[data-theme] body.theme-light-premium.project-page .project-meta-row i,
html[data-theme] body.theme-light-premium.project-page .project-domain-link span,
html[data-theme] body.theme-light-premium.project-page .access-pill i {
  color: var(--text-primary) !important;
}

html[data-theme="light"] body.theme-light-premium.project-page .project-meta-row span,
html[data-theme="light"] body.theme-light-premium.project-page .project-domain-link,
html[data-theme="light"] body.theme-light-premium.project-page .access-pill {
  background: #fffdf7 !important;
  color: #241b16 !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mvp-tool,
html[data-theme] body.theme-light-premium.project-page .wordstat-table-wrap,
html[data-theme] body.theme-light-premium.project-page .wordstat-table {
  border-color: var(--border-soft) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mvp-head h4,
html[data-theme] body.theme-light-premium.project-page .wordstat-table th,
html[data-theme] body.theme-light-premium.project-page .wordstat-table td,
html[data-theme] body.theme-light-premium.project-page .wordstat-row td strong,
html[data-theme] body.theme-light-premium.project-page .wordstat-summary b,
html[data-theme] body.theme-light-premium.project-page .wordstat-advanced-grid label span {
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mvp-head p,
html[data-theme] body.theme-light-premium.project-page .wordstat-advanced summary,
html[data-theme] body.theme-light-premium.project-page .wordstat-advanced-grid label,
html[data-theme] body.theme-light-premium.project-page .wordstat-row td small,
html[data-theme] body.theme-light-premium.project-page .wordstat-result-note,
html[data-theme] body.theme-light-premium.project-page .wordstat-state {
  color: var(--text-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mvp-form textarea,
html[data-theme] body.theme-light-premium.project-page .wordstat-mvp-form select,
html[data-theme] body.theme-light-premium.project-page .wordstat-result-toolbar select,
html[data-theme] body.theme-light-premium.project-page .wordstat-advanced-grid textarea,
html[data-theme] body.theme-light-premium.project-page .wordstat-advanced-grid select {
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mvp-form textarea::placeholder,
html[data-theme] body.theme-light-premium.project-page .wordstat-advanced-grid textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mode-toggle,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle {
  min-height: 42px !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 4px !important;
  border-color: var(--border-default) !important;
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mode-toggle button,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button {
  min-height: 34px !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  padding: 8px 12px !important;
  overflow: visible !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 780 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-mode-toggle button.active,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button.active {
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button i {
  display: inline-flex !important;
  width: 14px !important;
  height: 14px !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 14px !important;
  line-height: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-table th {
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-table td {
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-table tbody tr:nth-child(odd) td {
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-row td span {
  background: color-mix(in srgb, var(--accent-primary) 14%, var(--surface-primary)) !important;
  color: var(--accent-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-row.status-existing td span {
  background: color-mix(in srgb, #b45309 14%, var(--surface-primary)) !important;
  color: #8a3d00 !important;
}

html[data-theme] body.theme-light-premium.project-page .wordstat-row.status-excluded td span,
html[data-theme] body.theme-light-premium.project-page .semantic-frequency-row.has-error b {
  background: color-mix(in srgb, var(--danger) 13%, var(--surface-primary)) !important;
  color: var(--danger) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-shell.is-topvisor-mode {
  contain: none !important;
  isolation: isolate;
  overflow: auto !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell {
  position: sticky !important;
  left: 0 !important;
  z-index: 9 !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: 1px 0 0 var(--border-soft) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  position: sticky !important;
  left: var(--pa-matrix-keyword-width) !important;
  z-index: 10 !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: 1px 0 0 var(--border-soft) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
  z-index: 14 !important;
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:hover .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:hover .topvisor-frequency-cell {
  background: var(--surface-hover) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head span,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head small,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-keyword,
html[data-theme] body.theme-light-premium.project-page .topvisor-cell-button,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-value {
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-keyword {
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-up,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-new {
  background: var(--success-bg, color-mix(in srgb, var(--success) 18%, var(--surface-primary))) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-down,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-lost {
  background: var(--danger-bg, color-mix(in srgb, var(--danger) 16%, var(--surface-primary))) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-same,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-neutral,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-missing {
  background: var(--surface-secondary) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mvp-tool,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-table-wrap,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-table,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-table th,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-table td,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-summary span,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mode-toggle {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-table th,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead th,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
  background: var(--retro-sheet-head-light) !important;
  color: #101508 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mvp-head h4,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mvp-head p,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-advanced summary,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-advanced-grid label,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-advanced-grid label span,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-table th,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-table td,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-row td strong,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-row td small,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-summary,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-summary b,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-state,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-result-note,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-empty,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor th,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor td,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-keyword,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-cell-button,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-value {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-keyword {
  background: transparent !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mvp-form textarea,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mvp-form select,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-result-toolbar select,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-advanced-grid textarea,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-advanced-grid select {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg-alt) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mvp-form textarea::placeholder,
html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-advanced-grid textarea::placeholder {
  color: var(--retro-sheet-muted) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mode-toggle button,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle button {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .wordstat-mode-toggle button.active,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle button.active {
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-up,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-new {
  background: #dfe7c2 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-down,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-lost {
  background: #ead3c5 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-same,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-neutral,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-cell.is-missing {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-position-value,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-cell-button {
  color: #101508 !important;
}

html[data-theme="dark"] body.theme-light-premium.project-page .wordstat-row.status-existing td span {
  color: #f7c56a !important;
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-head,
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
    position: sticky !important;
    left: 150px !important;
    z-index: 10 !important;
    background: var(--surface-primary) !important;
    box-shadow: 1px 0 0 var(--border-soft) !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
    z-index: 14 !important;
    background: var(--surface-secondary) !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button,
  html[data-theme] body.theme-light-premium.project-page .wordstat-mode-toggle button {
    padding: 8px 9px !important;
    font-size: 12px !important;
  }

  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-head,
  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell,
  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-head,
  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
    background: var(--retro-sheet-bg) !important;
    color: var(--retro-sheet-text) !important;
  }

  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
    background: var(--retro-sheet-head-light) !important;
    color: #101508 !important;
  }

  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
  html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
    background: var(--retro-sheet-bg-alt) !important;
    color: var(--retro-sheet-text) !important;
  }
}

/* V2 final Topvisor table pass: keep this at the end of the cascade. */
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar {
  display: grid !important;
  grid-template-columns: minmax(280px, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 14px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 14px !important;
  background: color-mix(in srgb, var(--surface-secondary) 84%, transparent) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-primary,
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-actions {
  justify-content: flex-end !important;
  flex-wrap: wrap !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-search-wrap {
  height: 38px !important;
  min-width: 220px !important;
  max-width: 560px !important;
  flex: 1 1 360px !important;
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-search {
  height: 36px !important;
  color: var(--text-primary) !important;
  font-size: 14px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-search::placeholder {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  min-height: 38px !important;
  padding: 3px !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 10px !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button,
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme] body.theme-light-premium.project-page .matrix-filter-select {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 10px !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme] body.theme-light-premium.project-page .matrix-filter-select {
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button.active,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button.active {
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button:disabled {
  color: var(--text-muted) !important;
  cursor: not-allowed !important;
  opacity: .72 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment i,
html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle i,
html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn i,
html[data-theme] body.theme-light-premium.project-page .matrix-filter-select i {
  display: inline-flex !important;
  width: 14px !important;
  height: 14px !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 14px !important;
  line-height: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-filter-select select {
  width: auto !important;
  min-width: 76px !important;
  height: 30px !important;
  padding: 0 18px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 720 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-filter-count {
  min-height: 28px !important;
  padding: 6px 10px !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 8px !important;
  background: var(--surface-primary) !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-check-note,
html[data-theme] body.theme-light-premium.project-page .matrix-check-note span,
html[data-theme] body.theme-light-premium.project-page .matrix-check-note small {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-check-note {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 8px 2px 10px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-shell.is-topvisor-mode {
  border-color: var(--border-default) !important;
  border-radius: 12px !important;
  background: var(--surface-primary) !important;
  contain: none !important;
  isolation: isolate !important;
  overflow: auto !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor {
  width: max(100%, var(--pa-topvisor-min-width, 960px)) !important;
  min-width: var(--pa-topvisor-min-width, 960px) !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: var(--surface-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-col-frequency,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor th:nth-child(2),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor td:nth-child(2) {
  width: 84px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-col-date,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor th:nth-child(n+3),
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor td:nth-child(n+3) {
  width: 104px !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead th,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody td {
  border-right: 1px solid var(--border-soft) !important;
  border-bottom: 1px solid var(--border-soft) !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead th {
  height: 44px !important;
  padding: 5px 7px !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody td {
  height: 40px !important;
  padding: 0 !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-sort-button {
  min-height: 32px !important;
  padding: 0 2px !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  line-height: 1.12 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head span {
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 780 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head small {
  margin-top: 2px !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  font-weight: 650 !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell {
  position: sticky !important;
  left: 0 !important;
  z-index: 18 !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  position: sticky !important;
  left: var(--pa-matrix-keyword-width) !important;
  z-index: 19 !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  border-right-color: color-mix(in srgb, var(--border-default) 78%, var(--text-primary)) !important;
  box-shadow: 8px 0 12px -12px rgba(0, 0, 0, .7) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
  z-index: 28 !important;
  background: var(--surface-secondary) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: color-mix(in srgb, var(--surface-secondary) 78%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:hover .topvisor-keyword-cell,
html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:hover .topvisor-frequency-cell {
  background: var(--surface-hover) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .matrix-keyword {
  display: block !important;
  padding: 8px 10px !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  line-height: 1.18 !important;
  box-shadow: none !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  padding: 0 8px !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  text-align: center !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-cell-button {
  min-height: 40px !important;
  height: 40px !important;
  padding: 6px 8px !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  color: var(--text-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-value {
  color: var(--text-primary) !important;
  font-size: 15px !important;
  font-weight: 780 !important;
  line-height: 1 !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-delta {
  min-width: 24px !important;
  padding: 2px 4px !important;
  border-radius: 5px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-up,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-new {
  background: color-mix(in srgb, var(--success) 13%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-down,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-lost {
  background: color-mix(in srgb, var(--danger) 13%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-same,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-neutral,
html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-missing {
  background: color-mix(in srgb, var(--surface-secondary) 82%, var(--surface-primary)) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-up,
html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-new {
  background: color-mix(in srgb, var(--success) 18%, transparent) !important;
  color: var(--success) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-down,
html[data-theme] body.theme-light-premium.project-page .topvisor-delta.delta-lost {
  background: color-mix(in srgb, var(--danger) 18%, transparent) !important;
  color: var(--danger) !important;
}

html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-date-head.is-active-date {
  background: color-mix(in srgb, var(--accent-primary) 12%, var(--surface-secondary)) !important;
  box-shadow: inset 0 2px 0 var(--accent-primary) !important;
}

html[data-theme] body.theme-light-premium.project-page .topvisor-position-cell.is-active-date-cell {
  box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--accent-primary) 6%, transparent) !important;
}

html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-up,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-new {
  background: #eaf4ec !important;
}

html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-down,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-lost {
  background: #f5e5e9 !important;
}

html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-same,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-neutral,
html[data-theme="light"] body.theme-light-premium.project-page .topvisor-position-cell.is-missing {
  background: #f6f7f9 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search-wrap,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-mode-segment,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-select,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-count,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-shell.is-topvisor-mode {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-search,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-select select,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-toolbar-btn,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-filter-count {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-check-note,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-check-note span,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-check-note small {
  color: var(--text-secondary) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-mode-segment button:not(.active),
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-view-toggle button:not(.active) {
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead th,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .matrix-sort-button,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .matrix-sort-button span,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .matrix-sort-button em,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .matrix-sort-button small {
  background: var(--retro-sheet-head-light) !important;
  color: #101508 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-date-head.is-active-date,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-date-head.is-active-date .matrix-sort-button,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-date-head.is-active-date .matrix-sort-button span,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor thead .topvisor-date-head.is-active-date .matrix-sort-button small {
  background: #31471d !important;
  color: #f6f0c8 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody td {
  border-color: var(--retro-sheet-grid) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-keyword-cell .matrix-keyword {
  color: #101508 !important;
  opacity: 1 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-theme="retro"] body.theme-light-premium.project-page .matrix-table.is-topvisor tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-up,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-new {
  background: #e5ebcf !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-down,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-lost {
  background: #eeddd1 !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-same,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-neutral,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-cell.is-missing {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-position-value,
html[data-theme="retro"] body.theme-light-premium.project-page .topvisor-cell-button {
  color: #101508 !important;
}

@media (max-width: 980px) {
  html[data-theme] body.theme-light-premium.project-page .matrix-toolbar {
    grid-template-columns: 1fr !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-actions {
    justify-content: flex-start !important;
  }
}

@media (max-width: 760px) {
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor {
    width: max(100%, var(--pa-topvisor-mobile-min-width, 760px)) !important;
    min-width: var(--pa-topvisor-mobile-min-width, 760px) !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-col-date,
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor th:nth-child(n+3),
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor td:nth-child(n+3) {
    width: 82px !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-head,
  html[data-theme] body.theme-light-premium.project-page .matrix-table.is-topvisor .topvisor-frequency-cell {
    left: 150px !important;
  }

  html[data-theme] body.theme-light-premium.project-page .matrix-mode-segment button,
  html[data-theme] body.theme-light-premium.project-page .matrix-view-toggle button,
  html[data-theme] body.theme-light-premium.project-page .matrix-toolbar-btn,
  html[data-theme] body.theme-light-premium.project-page .matrix-filter-select {
    padding: 0 8px !important;
    font-size: 12px !important;
  }
}
.audit-quality-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.audit-quality-line span {
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
}

.audit-quality-line .is-ok {
  color: var(--success-color);
  border-color: color-mix(in srgb, var(--success-color) 45%, transparent);
}

.audit-seo-section {
  margin-top: 18px;
}

.audit-seo-section .audit-table-head h3 {
  margin: 0;
  font-size: 18px;
}

.audit-recommendation-list {
  display: grid;
  gap: 10px;
}

.audit-recommendation {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.audit-recommendation > strong {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-color);
  color: var(--button-text, #fff);
  font-size: 15px;
}

.audit-recommendation b,
.audit-recommendation p,
.audit-recommendation small,
.audit-recommendation a,
.audit-recommendation em {
  display: block;
}

.audit-recommendation b {
  color: var(--text-primary);
  margin-bottom: 4px;
}

.audit-recommendation p {
  margin: 0 0 5px;
  color: var(--text-secondary);
}

.audit-recommendation small {
  color: var(--text-primary);
  line-height: 1.45;
}

.audit-recommendation a,
.audit-recommendation em {
  margin-top: 6px;
  color: var(--accent-color);
  font-style: normal;
  word-break: break-word;
}

.audit-loss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.audit-loss-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-secondary);
}

.audit-loss-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text-primary);
}

.audit-loss-item {
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
}

.audit-loss-item:first-of-type {
  border-top: 0;
}

.audit-loss-item b,
.audit-loss-item small {
  display: block;
}

.audit-loss-item b {
  color: var(--text-primary);
}

.audit-loss-item small {
  color: var(--text-secondary);
  margin-top: 2px;
}
/* Wordstat frequency history */
.frequency-summary-cell {
  display: grid;
  gap: 4px;
  min-width: 92px;
}

.frequency-summary-cell strong {
  font-size: 13px;
  line-height: 1.1;
}

.frequency-summary-cell small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.frequency-history-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.frequency-history-link:hover {
  color: var(--accent2);
}

.frequency-delta-badge {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 7px;
  white-space: nowrap;
}

.frequency-delta-badge.is-up {
  background: rgba(46, 204, 113, .12);
  border-color: rgba(46, 204, 113, .32);
  color: #1f9d55;
}

.frequency-delta-badge.is-down {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .32);
  color: #dc2626;
}

.frequency-delta-badge.is-same,
.frequency-delta-badge.is-first,
.frequency-delta-badge.is-empty {
  background: rgba(148, 163, 184, .12);
}

.frequency-history-filters {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.frequency-history-filters label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 4px;
}

.frequency-history-filters select {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  min-height: 34px;
  padding: 6px 9px;
}

/* Compact Wordstat admin widget in the premium sidebar */
#wordstat-sidebar-slot {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.wordstat-sidebar-card {
  box-sizing: border-box;
  color: var(--sidebar-text, #1f2937);
  display: grid;
  gap: 7px;
  margin: 8px 0 10px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px;
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--border, #d9dee8) 78%, transparent);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent, #3b82f6) 9%, transparent), transparent 72%),
    color-mix(in srgb, var(--sidebar-bg, #fff) 88%, #fff);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.wordstat-sidebar-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent, #3b82f6) 35%, var(--border, #d9dee8));
}

.wordstat-sidebar-card-head,
.wordstat-sidebar-limits,
.wordstat-sidebar-grid {
  min-width: 0;
}

.wordstat-sidebar-card-head span {
  align-items: center;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
  letter-spacing: .02em;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wordstat-sidebar-card-head b {
  display: none;
}

.wordstat-sidebar-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.wordstat-sidebar-card-head::after {
  content: "";
  background: #22c55e;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
  flex: 0 0 auto;
  height: 7px;
  width: 7px;
}

.wordstat-sidebar-card.is-paused .wordstat-sidebar-card-head::after {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
}

.wordstat-sidebar-limits span,
.wordstat-sidebar-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.wordstat-sidebar-limits b {
  font-size: 16px;
  line-height: 1;
}

.wordstat-sidebar-limits small,
.wordstat-sidebar-grid em {
  color: var(--muted, #6b7280);
  font-size: 9px;
  font-style: normal;
  line-height: 1;
}

.wordstat-sidebar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.wordstat-sidebar-limits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.wordstat-sidebar-grid b {
  font-size: 12px;
  line-height: 1.1;
}

.wordstat-sidebar-card.has-errors #wordstat-sidebar-errors {
  color: #dc2626;
}

@media (max-width: 1180px) {
  .wordstat-sidebar-card {
    display: none;
  }
}
