:root {
  color-scheme: light;
  --bg: #f3efe4;
  --surface: #fbf8ef;
  --surface-muted: #f7f1e4;
  --surface-raised: #fffdf8;
  --surface-hover: #efe7d6;
  --ink: #191713;
  --ink-soft: #403b33;
  --muted: #6c6558;
  --faint: #a29886;
  --line: rgba(25, 23, 19, 0.12);
  --line-strong: rgba(25, 23, 19, 0.22);
  --primary: #191713;
  --blue: #2563eb;
  --green: #0f7a55;
  --amber: #a16207;
  --red: #b42318;
  --violet: #6d28d9;
  --cyan: #087990;
  --shadow-subtle: 0 1px 2px rgba(25, 23, 19, 0.05);
  --shadow-drawer: -12px 0 36px rgba(25, 23, 19, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus,
input:focus,
select:focus,
a:focus {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.34);
  outline-offset: 2px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

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

.nav {
  display: grid;
  gap: 3px;
}

.nav button {
  position: relative;
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 7px;
  padding: 0 10px 0 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 560;
}

.nav button:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.nav button.active {
  background: #f0f2f5;
  color: var(--ink);
}

.nav button.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 11px;
  width: 3px;
  height: 14px;
  border-radius: 99px;
  background: var(--primary);
}

.main {
  min-width: 0;
  padding: 24px 28px 36px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 25px;
  line-height: 1.18;
  font-weight: 720;
}

h2 {
  margin-bottom: 3px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

h3 {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.subtle,
.muted {
  color: var(--muted);
}

.subtle {
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.55;
}

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

.primary,
.ghost,
.small-btn {
  height: 34px;
  border-radius: 7px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: var(--shadow-subtle);
}

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

.primary:hover,
.ghost:hover,
.small-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.primary:hover {
  border-color: #23272f;
  background: #23272f;
}

.primary:disabled,
.small-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.small-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  box-shadow: none;
}

.small-btn.danger {
  color: var(--red);
  border-color: #f2c9c4;
  background: #fff8f7;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font: inherit;
  text-align: left;
  box-shadow: none;
}

.link-btn:hover,
.article-links a:hover,
.drawer-article a:hover {
  text-decoration: underline;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1.45fr 0.85fr 0.9fr 0.85fr;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.filters label span,
.manage-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 640;
}

select,
input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}

input::placeholder {
  color: var(--faint);
}

input:focus,
select:focus {
  border-color: #9db8ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.metric-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.metric-grid .metric {
  min-height: 82px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 16px;
  background: transparent;
}

button.metric {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
}

.metric-click:hover {
  background: var(--surface-hover);
}

.metric-click:active {
  background: #eef1f5;
}

.metric-grid .metric:last-child {
  border-right: 0;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  line-height: 1;
  font-weight: 760;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.inline-setting {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 210px;
}

.inline-setting span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.inline-setting select {
  width: 132px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(316px, 0.9fr);
  gap: 14px;
}

.fetch-control {
  margin-bottom: 14px;
}

.fetch-control-status {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.fetch-control-action {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fetch-control-action select {
  width: 150px;
}

.fetch-control-summary {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 14px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 54px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 14px 16px;
}

.manage-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) 128px auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.manage-form.account-form {
  grid-template-columns: minmax(150px, 1.1fr) minmax(120px, 0.8fr) minmax(150px, 1fr) minmax(140px, 1fr) minmax(180px, 1.2fr) auto;
}

.manage-form.keyword-form {
  grid-template-columns: minmax(200px, 1fr) minmax(180px, 1fr) auto;
}

.manage-form.account-search-form {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.actions {
  white-space: nowrap;
}

.actions .small-btn + .small-btn {
  margin-left: 6px;
}

.trend {
  margin-left: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
}

.table-note {
  display: block;
  min-width: 220px;
  max-width: 380px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

td {
  color: var(--ink-soft);
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: #fafafa;
}

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

.article-title {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  max-width: 580px;
}

.article-title:hover {
  color: var(--blue);
}

.article-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.article-links {
  margin-top: 7px;
  font-size: 12px;
}

.article-links a,
.drawer-article a {
  color: var(--blue);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.red {
  color: var(--red);
  border-color: #f3c6c0;
  background: #fff5f3;
}

.badge.amber {
  color: var(--amber);
  border-color: #f1d59b;
  background: #fff8e8;
}

.badge.green {
  color: var(--green);
  border-color: #bfe5d7;
  background: #effaf5;
}

.badge.blue {
  color: var(--blue);
  border-color: #c9d8ff;
  background: #f3f7ff;
}

.badge.violet {
  color: var(--violet);
  border-color: #dac8ff;
  background: #f7f3ff;
}

.list {
  display: grid;
}

.list-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.signal-list {
  display: grid;
}

.signal-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.signal-split > div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.signal-split > div:last-child {
  border-right: 0;
}

.compact-list {
  gap: 6px;
}

.signal-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-muted);
  color: var(--ink);
  text-align: left;
}

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

.signal-button span,
.signal-button small {
  display: block;
}

.signal-button span {
  font-weight: 700;
}

.signal-button small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.signal-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.signal-item.as-button {
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.signal-item.as-button:hover {
  background: var(--surface-hover);
}

.signal-item:last-child {
  border-bottom: 0;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.bar-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  margin-bottom: 11px;
  font-size: 12px;
}

.bar-row:last-child {
  margin-bottom: 0;
}

.bar {
  height: 7px;
  border-radius: 99px;
  background: #edf0f4;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #121417, #2563eb);
}

.idea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-muted);
  margin-bottom: 10px;
}

.idea:last-child {
  margin-bottom: 0;
}

.idea strong {
  display: block;
  margin-bottom: 7px;
  line-height: 1.45;
}

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

.card {
  padding: 13px;
  background: var(--surface-muted);
}

.card strong {
  display: block;
  margin-bottom: 7px;
}

.daily-summary {
  margin-bottom: 14px;
}

.daily-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.daily-summary-grid > div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.daily-summary-grid > div:last-child {
  border-right: 0;
}

.daily-summary-grid p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.report-preview {
  border-top: 1px solid var(--line);
}

.report-preview summary {
  cursor: pointer;
  padding: 12px 16px;
  color: var(--muted);
  font-weight: 650;
}

.report-preview .report-box {
  margin: 0 16px 16px;
}

.radar-hero {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0;
}

.radar-hero-main {
  padding: 18px;
}

.radar-hero h2 {
  margin: 12px 0 8px;
  font-size: 24px;
}

.radar-hero p {
  max-width: 880px;
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.radar-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.radar-score-card {
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--surface-muted);
}

.radar-score-card > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.radar-score-card > strong {
  display: block;
  margin: 8px 0 14px;
  font-size: 42px;
  line-height: 1;
}

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

.score-meter {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.score-meter .row {
  align-items: center;
}

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

.score-meter strong {
  font-size: 13px;
}

.score-meter > i {
  display: block;
  height: 6px;
  border-radius: 99px;
  background: var(--blue);
}

.score-meter.green > i {
  background: var(--green);
}

.score-meter.amber > i {
  background: var(--amber);
}

.score-meter.red > i {
  background: var(--red);
}

.opportunity-command {
  margin-bottom: 14px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.panel-head .segmented {
  padding: 0;
  border-top: 0;
  background: transparent;
  justify-content: flex-end;
}

.board-command {
  margin-bottom: 14px;
}

.segmented button,
.chip-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.segmented button {
  padding: 0 10px;
}

.segmented button.active,
.segmented button:hover,
.chip-button:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.segmented button.active {
  background: var(--primary);
  color: #fff;
}

.chip-button {
  padding: 3px 8px;
}

.opportunity-list {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.opportunity-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.opportunity-card.wide {
  grid-template-columns: 88px minmax(0, 1fr);
}

.opportunity-score {
  min-height: 100%;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 4px;
}

.opportunity-score strong {
  font-size: 24px;
  line-height: 1;
}

.opportunity-score span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.opportunity-score.red strong {
  color: var(--red);
}

.opportunity-score.amber strong {
  color: var(--amber);
}

.opportunity-score.green strong {
  color: var(--green);
}

.opportunity-score.blue strong {
  color: var(--blue);
}

.opportunity-content {
  min-width: 0;
  padding: 14px;
}

.opportunity-title {
  display: block;
  width: 100%;
  margin: 8px 0 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.32;
}

.opportunity-title:hover {
  color: var(--blue);
}

.opportunity-main-source {
  margin-top: 11px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.opportunity-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.opportunity-reasons.detail {
  margin-top: 12px;
}

.opportunity-reasons span {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
}

.opportunity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.related-source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.related-source-list button {
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.related-source-list strong,
.related-source-list span {
  display: block;
}

.related-source-list strong {
  line-height: 1.42;
}

.related-source-list span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.source-tier-list {
  display: grid;
}

.source-tier-list.compact {
  gap: 8px;
}

.source-tier-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.source-tier-list.compact .source-tier-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-muted);
}

.source-tier-item:last-child {
  border-bottom: 0;
}

.tier-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.tier-mark.red {
  background: var(--red);
}

.tier-mark.green {
  background: var(--green);
}

.tier-mark.blue {
  background: var(--blue);
}

.tier-mark.violet {
  background: var(--violet);
}

.timeline-list {
  display: grid;
}

.timeline-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 9px;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-item:hover {
  background: var(--surface-hover);
}

.timeline-item strong,
.timeline-item small {
  display: block;
}

.timeline-item small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 99px;
  background: var(--blue);
}

.dot.green {
  background: var(--green);
}

.dot.amber {
  background: var(--amber);
}

.dot.red {
  background: var(--red);
}

.keyword-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.keyword-card {
  position: relative;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.keyword-card.is-expanded {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f8fbff;
}

.keyword-card.is-paused,
.keyword-row.is-paused {
  opacity: 0.62;
}

.keyword-card-main,
.keyword-row-main {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.keyword-card-main {
  min-height: 66px;
  padding: 12px 34px 6px 12px;
}

.keyword-card-main strong,
.keyword-card-main span,
.keyword-row-main strong,
.keyword-row-main span {
  display: block;
}

.keyword-card-main span,
.keyword-row-main span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.icon-x {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 1;
  width: 22px;
  height: 22px;
  border: 1px solid #f2c9c4;
  border-radius: 6px;
  background: #fff8f7;
  color: var(--red);
  line-height: 1;
}

.keyword-card:hover,
.keyword-row:hover {
  background: var(--surface-hover);
}

.keyword-drawer-list {
  display: grid;
  gap: 8px;
}

.keyword-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-muted);
}

.keyword-overview-collapsed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.keyword-table-trigger {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0;
}

.keyword-table-trigger strong,
.keyword-table-trigger span {
  display: block;
}

.keyword-table-trigger span {
  margin-top: 4px;
  color: var(--blue);
  font-size: 12px;
}

.priority-toggle {
  display: inline-grid;
  grid-template-columns: repeat(3, 34px);
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.keyword-card .priority-toggle {
  margin: 0 12px 10px;
}

.priority-toggle button {
  height: 26px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.priority-toggle button:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.priority-toggle button.active {
  background: var(--primary);
  color: #fff;
}

.keyword-detail-row > td {
  padding: 0;
  background: #fbfcfe;
}

.keyword-inline-detail {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.keyword-inline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mini-status {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.chip {
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
}

.topic-inline {
  margin-top: 8px;
}

.topic-board {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
}

.topic-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.topic-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.topic-card-head h3 {
  margin: 9px 0 6px;
  font-size: 16px;
}

.topic-card-head select {
  width: 112px;
  flex: 0 0 auto;
}

.topic-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.topic-card-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface-muted);
}

.topic-card-grid span,
.topic-review span,
.snapshot-grid span,
.topic-notes span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.topic-card-grid p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.topic-review {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(150px, 0.8fr) minmax(220px, 1fr) 130px;
  gap: 10px;
  margin-top: 12px;
}

.topic-velocity {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 12px;
}

.topic-velocity-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.topic-velocity-head strong {
  display: block;
  margin-bottom: 4px;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.snapshot-grid label {
  display: block;
}

.topic-notes {
  display: block;
  margin-top: 10px;
}

.topic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.profile-hero {
  margin-bottom: 14px;
}

.profile-positioning {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.creator-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.creator-profile-grid > div {
  min-height: 92px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.creator-profile-grid > div:nth-child(3n) {
  border-right: 0;
}

.creator-profile-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.creator-profile-grid p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.profile-positioning p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.template-card {
  min-height: 148px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.template-card:nth-child(3n) {
  border-right: 0;
}

.template-card.active {
  background: #f6fbf8;
}

.template-card p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-keyword-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.profile-keyword {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.profile-keyword:nth-child(2n) {
  border-right: 0;
}

.profile-keyword strong {
  font-size: 13px;
}

.profile-keyword p + p {
  margin-top: 6px;
}

.profile-clusters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.profile-clusters > div {
  min-height: 96px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.profile-clusters > div:nth-child(3n) {
  border-right: 0;
}

.empty-state {
  padding: 22px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(540px, 100vw);
  height: 100vh;
  padding: 24px;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-drawer);
  transform: translateX(105%);
  transition: transform 0.2s ease;
  overflow: auto;
}

.detail-drawer.open {
  transform: translateX(0);
}

.detail-page {
  overflow: visible;
}

.detail-toolbar {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.detail-toolbar h2 {
  margin: 8px 0 6px;
  font-size: 26px;
  line-height: 1.28;
}

.detail-body {
  padding: 0 16px 18px;
}

.detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.drawer-close:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.drawer-header {
  padding-right: 34px;
}

.drawer-header h2 {
  margin: 10px 0 7px;
  font-size: 22px;
  line-height: 1.35;
}

.drawer-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.drawer-section {
  margin-top: 19px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.drawer-section ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.75;
}

.drawer-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.drawer-stats.wide {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.drawer-stats > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface-muted);
}

.drawer-stats strong {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.drawer-stats span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.report-box,
.api-box {
  white-space: pre-wrap;
  line-height: 1.75;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.report-box {
  color: var(--ink-soft);
  font-size: 13px;
}

.api-box.compact {
  margin: 0 16px 14px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  background: var(--surface-muted);
}

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

.status-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-muted);
}

.status-grid strong {
  display: block;
  margin-bottom: 4px;
}

.discovery-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 14px;
}

.discovery-flow > div {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  gap: 9px;
}

.discovery-flow strong {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.discovery-flow span {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

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

.api-settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.schedule-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 12px;
}

.schedule-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.schedule-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.schedule-add input {
  width: 112px;
}

.schedule-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.schedule-chip {
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.schedule-chip span {
  margin-left: 5px;
  color: var(--red);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch-row input {
  width: auto;
  height: auto;
}

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

.frequency-grid h3 {
  margin-bottom: 10px;
}

.frequency-row {
  display: grid;
  grid-template-columns: 92px repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.frequency-row strong {
  align-self: center;
}

.range-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.drawer-article-list {
  display: grid;
  gap: 10px;
}

.drawer-article {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-article:last-child {
  border-bottom: 0;
}

.report-actions {
  margin-bottom: 12px;
}

@media (max-width: 1220px) {
  .metric-grid,
  .metric-grid.compact,
  .filters,
  .card-grid,
  .manage-form,
  .manage-form.account-form,
  .discovery-flow,
  .topic-card-grid,
  .topic-review,
  .snapshot-grid,
  .creator-profile-grid,
  .template-grid,
  .profile-keyword-grid,
  .profile-clusters,
  .frequency-grid,
  .frequency-row,
  .status-grid,
  .signal-split,
  .daily-summary-grid,
  .keyword-card-grid,
  .radar-hero,
  .score-grid,
  .related-source-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fetch-control-status,
  .schedule-editor-head {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-grid .metric:nth-child(2n) {
    border-right: 0;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 12px;
  }

  .brand {
    padding-bottom: 10px;
  }

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

  .nav button {
    text-align: center;
    padding: 0 8px;
  }

  .nav button.active::before {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

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

@media (max-width: 640px) {
  .metric-grid,
  .metric-grid.compact,
  .filters,
  .card-grid,
  .manage-form,
  .manage-form.account-form,
  .discovery-flow,
  .topic-card-grid,
  .topic-review,
  .snapshot-grid,
  .creator-profile-grid,
  .template-grid,
  .profile-keyword-grid,
  .profile-clusters,
  .frequency-grid,
  .frequency-row,
  .status-grid,
  .api-settings-grid,
  .signal-split,
  .daily-summary-grid,
  .keyword-card-grid,
  .radar-hero,
  .score-grid,
  .related-source-list,
  .keyword-row,
  .drawer-stats,
  .drawer-stats.wide,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .signal-split > div,
  .daily-summary-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .radar-score-card {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .opportunity-card,
  .opportunity-card.wide {
    grid-template-columns: 1fr;
  }

  .opportunity-score {
    min-height: 68px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    align-content: center;
  }

  .profile-keyword,
  .profile-keyword:nth-child(2n),
  .profile-clusters > div,
  .profile-clusters > div:nth-child(3n),
  .creator-profile-grid > div,
  .creator-profile-grid > div:nth-child(3n),
  .template-card,
  .template-card:nth-child(3n) {
    border-right: 0;
  }

  .topic-card-head {
    flex-direction: column;
  }

  .topic-card-head select {
    width: 100%;
  }

  .metric-grid {
    border: 0;
    background: transparent;
    gap: 10px;
  }

  .metric-grid .metric,
  .metric-grid .metric:nth-child(2n) {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

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

  .top-actions,
  .top-actions button,
  .fetch-control-action,
  .fetch-control-action select,
  .fetch-control-action button,
  .schedule-add,
  .schedule-add input,
  .schedule-add button {
    width: 100%;
  }

  .fetch-control-action,
  .panel-actions,
  .schedule-add {
    flex-direction: column;
    align-items: stretch;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }

  tr:last-child {
    border-bottom: 0;
  }

  td {
    border-bottom: 0;
    padding: 7px 14px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }

  .detail-drawer {
    padding: 20px;
  }
}
