:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --text: #16232b;
  --muted: #64717a;
  --line: #dce3e7;
  --primary: #263c4a;
  --primary-strong: #152733;
  --accent: #6f8a99;
  --error: #9a3b32;
  --shadow: 0 18px 48px rgba(28, 47, 59, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(231, 237, 240, 0.74), rgba(245, 247, 248, 0) 360px),
    var(--bg);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 24px 18px 0;
}

.page-with-bottom {
  padding-bottom: 112px;
}

.topbar,
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  color: var(--primary-strong);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.avatar-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 8px 24px rgba(28, 47, 59, 0.06);
}

.avatar-button span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.icon-button {
  flex: 0 0 auto;
  font-size: 30px;
  line-height: 1;
}

.page-header {
  justify-content: flex-start;
  margin-bottom: 24px;
}

.page-header h1,
.hero h1 {
  margin: 0;
  color: var(--primary-strong);
  font-weight: 850;
  letter-spacing: 0;
}

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

.hero {
  padding: 72px 0 34px;
}

.eyebrow,
.card-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(42px, 8vw, 76px);
  line-height: 1.02;
}

.hero-copy {
  max-width: 560px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.input-panel,
.entry-card,
.detected-panel,
.fallback-panel,
.content-card,
.empty-state,
.action-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 18px;
}

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

.entry-card {
  display: grid;
  align-content: space-between;
  gap: 24px;
  min-height: 220px;
  padding: 22px;
}

.entry-card.primary-entry {
  background: #f8fbfb;
  border-color: #cbd8de;
}

.entry-kicker {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.entry-card h2 {
  margin: 0;
  color: var(--primary-strong);
  font-size: 24px;
  line-height: 1.35;
}

.entry-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.entry-card .primary-button,
.entry-card .secondary-button {
  justify-self: start;
}

.detected-panel,
.fallback-panel {
  margin-top: 14px;
  padding: 18px;
}

.detected-panel[hidden] {
  display: none;
}

.detected-panel span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.detected-panel p {
  margin: 8px 0 14px;
  color: var(--primary-strong);
  font-size: 18px;
  line-height: 1.7;
}

.fallback-panel {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.fallback-toggle {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  text-align: left;
}

.fallback-toggle::after {
  content: "+";
  float: right;
  color: var(--accent);
}

.fallback-toggle[aria-expanded="true"]::after {
  content: "-";
}

.fallback-body {
  padding-top: 12px;
}

.fallback-body[hidden] {
  display: none;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: #f1f5f6;
}

.mode-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-tab.is-active {
  background: var(--surface);
  color: var(--primary-strong);
  box-shadow: 0 8px 20px rgba(28, 47, 59, 0.08);
}

textarea {
  width: 100%;
  min-height: 142px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  padding: 16px;
  background: #fbfcfc;
  color: var(--text);
  line-height: 1.7;
}

textarea:focus {
  border-color: #9ab0bc;
  box-shadow: 0 0 0 4px rgba(111, 138, 153, 0.16);
}

.form-error {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--error);
  font-size: 14px;
}

.input-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.input-hints span {
  border-left: 2px solid #b7c7cf;
  padding-left: 9px;
}

.action-row,
.more-actions,
.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 20px;
  font-weight: 760;
}

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

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--primary);
}

.secondary-button.dark {
  background: #e4ebee;
  color: var(--primary-strong);
}

.text-button {
  background: transparent;
  color: var(--primary);
  padding-inline: 8px;
}

.quiet-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.quiet-strip div {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.quiet-strip strong,
.quiet-strip span {
  display: block;
}

.quiet-strip strong {
  margin-bottom: 8px;
  color: var(--primary-strong);
}

.quiet-strip span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.lead-list,
.analysis-grid,
.thread-list,
.profile-grid,
.candidate-list {
  display: grid;
  gap: 14px;
}

.lead-card,
.candidate-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 10px 28px rgba(28, 47, 59, 0.06);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.lead-card:hover,
.lead-card:focus,
.candidate-card:hover {
  border-color: #a8bac4;
  outline: none;
  transform: translateY(-2px);
}

.lead-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.lead-card h2,
.content-card h2 {
  margin: 0;
  color: var(--primary-strong);
  font-size: 19px;
  line-height: 1.45;
}

.lead-card time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.lead-card p,
.candidate-card p,
.content-card p,
.empty-state h2 {
  color: var(--muted);
  line-height: 1.75;
}

.lead-card p {
  margin: 12px 0 14px;
}

.candidate-card {
  display: grid;
  gap: 14px;
}

.candidate-card p {
  margin: 0;
  color: var(--primary-strong);
  font-size: 18px;
}

.candidate-card .primary-button {
  justify-self: start;
}

.candidate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.candidate-meta strong,
.candidate-meta > span {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 14px;
}

.candidate-meta > span {
  color: var(--muted);
}

.source-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #f8fafb;
}

.source-panel span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.source-panel p {
  margin: 6px 0 0;
  color: var(--primary-strong);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.candidate-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.72);
}

.candidate-summary strong {
  color: var(--primary-strong);
  font-size: 15px;
}

.candidate-summary span {
  color: var(--muted);
  font-size: 14px;
}

.tag-row,
.capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row span,
.capability-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #f7fafb;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.content-card,
.empty-state,
.action-panel {
  padding: 20px;
}

.imported-comment p {
  margin: 0;
  color: var(--primary-strong);
  font-size: 18px;
}

.strong-card {
  background: #f9fbfb;
}

.suggestion-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.suggestion-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f6f9fa;
}

.suggestion-item span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #dfe9ed;
  color: var(--primary);
  font-weight: 800;
}

.suggestion-item p {
  margin: 1px 0 0;
}

.verdict-card h2 {
  display: inline-flex;
  margin-bottom: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e8eff2;
  font-size: 16px;
}

.action-panel {
  margin-top: 14px;
}

.more-actions {
  margin-top: 12px;
}

.generated-result {
  margin-top: 14px;
}

.generated-result:empty {
  display: none;
}

.generated-result > div {
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: 8px;
  background: #f5f8f9;
}

.generated-result > div > span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.generated-result > div > p {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.7;
}

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

.hot-idea-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8fafb;
}

.hot-idea-card > span {
  display: inline-flex;
  margin-bottom: 10px;
  border: 1px solid #cbd8de;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.hot-idea-card h2 {
  margin: 0 0 14px;
  color: var(--primary-strong);
  font-size: 18px;
  line-height: 1.45;
}

.hot-idea-card dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.hot-idea-card dl div {
  display: grid;
  gap: 4px;
}

.hot-idea-card dt {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.hot-idea-card dd {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

.thread-followup-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f5f8f9;
}

.thread-followup-card div {
  display: grid;
  gap: 5px;
}

.thread-followup-card span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.thread-followup-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

.thread-card p {
  margin: 0;
  color: var(--primary-strong);
  font-size: 18px;
}

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

.mini-list button {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
  text-align: left;
}

.mini-list strong {
  color: var(--primary-strong);
  line-height: 1.45;
}

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

.capability-card {
  background: #f8fbfb;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 16px;
  margin-top: 26px;
}

.empty-state h2 {
  max-width: 520px;
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(560px, calc(100% - 28px));
  transform: translateX(-50%);
  border: 1px solid rgba(220, 227, 231, 0.92);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 48px rgba(28, 47, 59, 0.16);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  border-radius: 6px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.nav-icon {
  font-size: 18px;
  line-height: 1;
}

.nav-item.is-active {
  background: var(--primary);
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  z-index: 30;
  max-width: min(420px, calc(100% - 32px));
  transform: translate(-50%, 12px);
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--primary-strong);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 760px) {
  .analysis-grid {
    grid-template-columns: 1fr 1fr;
  }

  .imported-comment,
  .strong-card {
    grid-column: span 2;
  }

  .profile-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    padding-inline: 14px;
  }

  .hero {
    padding-top: 52px;
  }

  .hero h1 {
    font-size: 44px;
  }

  .hero-copy {
    font-size: 16px;
  }

  .quiet-strip {
    grid-template-columns: 1fr;
  }

  .entry-stack {
    grid-template-columns: 1fr;
  }

  .lead-card-head {
    display: grid;
  }

  .action-row,
  .more-actions,
  .split-actions,
  .candidate-meta,
  .candidate-summary {
    display: grid;
  }

  .primary-button,
  .secondary-button,
  .text-button {
    width: 100%;
  }

  .candidate-card .primary-button {
    justify-self: stretch;
  }

  .entry-card .primary-button,
  .entry-card .secondary-button {
    justify-self: stretch;
  }
}
