:root {
  --bg: #f4f6f8;
  --surface: #fff;
  --ink: #142033;
  --muted: #687385;
  --line: #dfe5ee;
  --teal: #0f766e;
  --teal-soft: #e7f5f2;
  --nav: #111827;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: var(--nav);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  background: #173d45;
  color: #8fe0d2;
  font-weight: 800;
}

.brand-title {
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: rgba(255, 255, 255, .6);
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-item.active {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-weight: 700;
}

.main {
  width: 100%;
  max-width: 1180px;
  padding: 28px;
}

.dashboard-hero {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: 8px;
  background: #111827;
}

.dashboard-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-hero:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(17, 24, 39, .92), rgba(17, 24, 39, .58), rgba(17, 24, 39, .1));
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 560px;
  padding: 32px;
  color: #fff;
}

.eyebrow {
  color: #8fe0d2;
  font-size: 12px;
  font-weight: 800;
}

.hero-content h1 {
  margin: 8px 0 12px;
  font-size: 34px;
  line-height: 1.15;
}

.hero-content p {
  color: rgba(255, 255, 255, .78);
}

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

p {
  color: #3c4657;
  line-height: 1.65;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  font-size: 28px;
}

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

.grid {
  display: grid;
  gap: 18px;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(360px, .92fr);
}

.ai-grid {
  grid-template-columns: minmax(0, .92fr) minmax(360px, 1fr);
  margin-top: 18px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

h2 {
  font-size: 18px;
}

h3 {
  font-size: 20px;
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef1f5;
  color: #465164;
  font-size: 12px;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.primary,
.secondary,
.link-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary,
.secondary {
  min-height: 40px;
  padding: 0 16px;
  font-weight: 800;
}

.primary {
  background: #111827;
  color: #fff;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger {
  color: #b42318;
}

.full {
  width: 100%;
}

.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.link-button {
  background: transparent;
  color: var(--teal);
  font-weight: 800;
}

.tool-row,
.question-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

#questionList {
  margin-top: 14px;
}

.tool-row.active,
.question-row.active {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.row-title {
  color: var(--ink);
  font-weight: 800;
}

.row-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
}

input,
select {
  height: 42px;
  margin-top: 10px;
  padding: 0 12px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 10px;
  padding: 5px;
  border-radius: 8px;
  background: #eef1f5;
}

.segmented button {
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

pre {
  min-height: 92px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: 8px;
  background: #111827;
  color: #d7f7ef;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.answer-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.answer-block h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.answer-block.accent {
  padding: 14px;
  border: 1px solid #b7e0d9;
  border-radius: 8px;
  background: var(--teal-soft);
}

ol {
  margin: 0;
  padding-left: 20px;
  color: #3c4657;
  line-height: 1.7;
}

.score-number {
  color: var(--teal);
  font-size: 78px;
  font-weight: 900;
  line-height: 1;
}

.score-level {
  margin: 8px 0 16px;
  font-size: 18px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.admin-grid {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
}

.admin-queue {
  position: sticky;
  top: 20px;
}

.batch-panel {
  grid-column: 1;
}

.today-preview {
  grid-column: 1;
}

.push-log-panel {
  grid-column: 1;
}

.subscriber-panel {
  grid-column: 1;
}

.admin-editor {
  grid-column: 2;
  grid-row: 1 / span 5;
}

.wechat-config {
  grid-column: 2;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.filter.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(140px, .36fr) minmax(0, 1fr);
  gap: 12px;
}

.checkbox-label {
  align-content: center;
  grid-template-columns: 18px 1fr;
  min-height: 42px;
  margin-top: 32px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.wrap {
  flex-wrap: wrap;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.hotspot-map {
  display: grid;
  gap: 12px;
}

.hotspot-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.hotspot-topic {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hotspot-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1f5;
}

.hotspot-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e, #2563eb);
}

.hotspot-score {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.hotspot-sample {
  grid-column: 2 / 4;
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.news-list {
  display: grid;
  gap: 12px;
}

.news-item {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.news-item:hover {
  border-color: #b7e0d9;
  background: #f8fbfb;
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.news-title {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.4;
}

.news-summary {
  margin-top: 6px;
  color: #3c4657;
  font-size: 13px;
  line-height: 1.55;
}

.today-question {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.config-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.status-dot.ready {
  background: #0f766e;
}

.status-dot.blocked {
  background: #b54708;
}

.push-preview {
  min-height: 104px;
  margin: 12px 0;
  white-space: pre-wrap;
}

.compact-news .news-item {
  padding: 10px;
}

.compact-news .news-summary {
  display: none;
}

.push-log-item {
  padding: 12px 0;
  border-bottom: 1px solid #edf0f5;
}

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

.push-log-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.push-error {
  margin-top: 8px;
  color: #b42318;
  font-size: 12px;
  line-height: 1.45;
}

.subscriber-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #edf0f5;
}

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

.subscriber-item.disabled {
  opacity: .58;
}

.subscriber-openid {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.news-topic {
  color: var(--teal);
  font-weight: 800;
}

.batch-item,
.meta-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.batch-item {
  margin-bottom: 10px;
}

.batch-title {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
}

.batch-meta,
.meta-grid {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.meta-panel {
  margin-bottom: 14px;
  background: #f8fbfb;
}

.meta-panel.hidden {
  display: none !important;
}

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

.meta-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.risk-low {
  color: #0f766e;
}

.risk-mid {
  color: #b54708;
}

.risk-high {
  color: #b42318;
}

.source-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.source-link {
  overflow: hidden;
  color: #2563eb;
  font-size: 12px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.audit-item {
  padding: 12px 0;
  border-bottom: 1px solid #edf0f5;
}

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

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

.audit-action {
  font-weight: 800;
  color: var(--ink);
}

.audit-time {
  color: var(--muted);
  font-size: 12px;
}

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

.audit-changes {
  margin-top: 8px;
  color: #344054;
  font-size: 12px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .nav-item {
    text-align: center;
    padding: 0 6px;
  }

  .main {
    padding: 16px;
  }

  .metrics,
  .two-col,
  .ai-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-queue {
    position: static;
  }

  .wechat-config {
    grid-column: auto;
  }

  .batch-panel,
  .today-preview,
  .subscriber-panel,
  .push-log-panel,
  .admin-editor {
    grid-column: auto;
    grid-row: auto;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .checkbox-label {
    margin-top: 12px;
  }

  .hero-content h1 {
    font-size: 28px;
  }
}
