:root {
  color: #20231f;
  background: #f4f5f1;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
  --ink: #20231f;
  --muted: #6b7068;
  --line: #daddd5;
  --surface: #ffffff;
  --soft: #eef0ea;
  --green: #176b58;
  --green-soft: #e1f0ea;
  --coral: #c84f3b;
  --amber: #9a6814;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  color: var(--ink);
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.seo-card { color: inherit; text-decoration: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand > div { display: flex; align-items: baseline; gap: 9px; }
.brand strong { font-family: Georgia, serif; font-size: 25px; font-weight: 700; }
.brand div span { color: var(--muted); font-size: 12px; }

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 3px;
}
.brand-mark span { display: block; border-radius: 2px; background: var(--green); }
.brand-mark span:nth-child(2) { background: var(--coral); }
.brand-mark span:nth-child(3) { grid-column: 1 / 3; background: #d5a12e; }

.metrics { display: flex; align-items: center; height: 42px; }
.metrics div {
  min-width: 74px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-left: 1px solid var(--line);
}
.metrics strong { font-size: 16px; line-height: 20px; font-variant-numeric: tabular-nums; }
.metrics span { color: var(--muted); font-size: 11px; line-height: 16px; }
.admin-access { margin-left: 7px; border-color: var(--line); }

.workspace {
  height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: minmax(350px, 430px) minmax(0, 1fr);
}

.browser-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f8f9f6;
  border-right: 1px solid var(--line);
}

.toolbar { padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.search-box { height: 40px; position: relative; display: block; }
.search-box svg {
  position: absolute;
  left: 12px;
  top: 11px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 39px;
  border: 1px solid #cfd3ca;
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}
.search-box input:focus { border-color: var(--green); box-shadow: 0 0 0 3px #176b5817; }

.source-tabs {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  border: 1px solid #cfd3ca;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.source-tab {
  grid-column: span 3;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid #dfe2db;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.source-tab:nth-child(4),
.source-tab:last-child { border-right: 0; }
.source-tab:nth-child(n + 5) { border-top: 1px solid #dfe2db; }
.source-tab:hover { background: var(--soft); color: var(--ink); }
.source-tab.is-active { background: var(--ink); color: #fff; }

.filter-row { margin-top: 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.select-control { position: relative; min-width: 0; }
.select-control svg {
  position: absolute;
  left: 10px;
  top: 9px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.select-control select {
  width: 100%;
  height: 34px;
  padding: 0 24px 0 31px;
  border: 1px solid #cfd3ca;
  border-radius: 6px;
  background: var(--surface);
  color: #4f554d;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0;
}

.list-meta {
  height: 36px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.not-found-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: var(--soft);
}
.not-found-page main { max-width: 520px; }
.not-found-page strong { color: var(--coral); font-size: 14px; }
.not-found-page h1 { margin: 10px 0; font-family: Georgia, serif; font-size: 32px; }
.not-found-page p { color: var(--muted); }
.not-found-page a { color: var(--green); font-weight: 700; }
.icon-button:hover { background: var(--soft); border-color: var(--line); }
.icon-button svg { width: 17px; height: 17px; }

.card-list { flex: 1; overflow-y: auto; padding: 8px; }
.pagination {
  min-height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.pagination:empty, .pagination[hidden] { display: none; }
.page-link { color: var(--ink); text-decoration: none; }
.page-link.is-disabled { cursor: default; }
.page-status { min-width: 58px; text-align: center; color: var(--muted); font-size: 12px; }
.signal-card {
  width: 100%;
  min-height: 152px;
  margin: 0 0 7px;
  padding: 15px;
  display: block;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.signal-card:hover { background: var(--surface); border-color: var(--line); }
.signal-card.is-selected { background: var(--surface); border-color: #aeb5aa; box-shadow: 3px 0 0 var(--green) inset; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-meta, .card-review-summary { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.review-badge {
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--soft);
  color: var(--muted);
  font-size: 9px;
  line-height: 16px;
  white-space: nowrap;
}
.review-badge.is-keep { background: var(--green-soft); color: var(--green); }
.review-badge.is-follow_up { background: #fff0cb; color: #7a5511; }
.review-badge.is-dismissed { background: #ececeb; color: #666a64; }
.favorite-mark { width: 14px; height: 14px; color: #a06c0c; }
.favorite-mark svg { width: 14px; height: 14px; fill: currentColor; }
.source-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.source-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.source-label[data-source="hn"] .source-dot { background: var(--amber); }
.source-label[data-source="github"] .source-dot { background: #252525; }
.source-label[data-source="producthunt"] .source-dot { background: var(--coral); }
.source-label[data-source="stackexchange"] .source-dot { background: #2f6fbe; }
.source-label[data-source="travel"] .source-dot { background: #14866d; }
.source-label[data-source="diy"] .source-dot { background: #7a5634; }
.source-label[data-source="steam"] .source-dot { background: #345a7a; }
.scope { color: var(--muted); font-size: 10px; }
.signal-date { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.source-context { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.card-detail > .source-context { margin: -7px 0 15px; font-size: 11px; }
.signal-card h2 { margin: 7px 0 8px; font-size: 15px; line-height: 1.42; font-weight: 700; }
.signal-card p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: #555b53;
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.card-tags { margin-top: 11px; display: flex; gap: 6px; overflow: hidden; }
.card-tags span { color: var(--green); font-size: 10px; white-space: nowrap; }

.detail-pane { position: relative; min-height: 0; overflow-y: auto; background: var(--surface); }
.card-detail { width: min(820px, calc(100% - 72px)); margin: 0 auto; padding: 44px 0 80px; }
.detail-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.detail-kicker .scope { padding-left: 10px; border-left: 1px solid var(--line); }
.detail-kicker .signal-date { margin: 0 0 0 auto; }
.card-detail h1 { margin: 0; max-width: 760px; font-family: Georgia, serif; font-size: 34px; line-height: 1.22; font-weight: 700; }
.summary { margin: 18px 0 0; max-width: 760px; color: #4e554c; font-size: 16px; line-height: 1.75; }
.detail-actions { margin: 24px 0 36px; display: flex; gap: 10px; align-items: center; }
.review-panel {
  margin: 28px 0 26px;
  padding: 18px 0 20px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.review-panel.is-disabled { opacity: .62; }
.review-heading, .review-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-heading h2 { margin: 0; font-size: 14px; }
.favorite-button { border-color: var(--line); }
.favorite-button.is-active { color: #a06c0c; background: #fff8e5; border-color: #d9bb72; }
.favorite-button.is-active svg { fill: currentColor; }
.review-status-control {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #cfd3ca;
  border-radius: 6px;
}
.review-status {
  height: 34px;
  border: 0;
  border-right: 1px solid #dfe2db;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}
.review-status:last-child { border-right: 0; }
.review-status:hover { background: var(--soft); color: var(--ink); }
.review-status.is-active { background: var(--ink); color: #fff; }
.review-status:disabled, .favorite-button:disabled { cursor: not-allowed; }
.review-note {
  width: 100%;
  min-height: 92px;
  margin-top: 12px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid #cfd3ca;
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  line-height: 1.55;
}
.review-note:focus { border-color: var(--green); box-shadow: 0 0 0 3px #176b5817; }
.review-footer { margin-top: 10px; }
.review-save-state { color: var(--muted); font-size: 11px; }
.primary-button, .secondary-button {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.primary-button { border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.primary-button:disabled { cursor: not-allowed; opacity: .55; }
.primary-button svg { width: 15px; height: 15px; }
.source-link {
  height: 36px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.source-link:hover { border-color: var(--green); color: var(--green); }
.source-link svg { width: 15px; height: 15px; }
.topic-id { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

.research-report { margin-top: 15px; padding-top: 32px; border-top: 3px solid var(--ink); }
.report-error { margin-top: 18px; padding: 12px 14px; display: flex; align-items: center; gap: 9px; background: #fff7f5; border-left: 3px solid var(--coral); color: #7b3a2f; font-size: 12px; }
.report-error svg { width: 17px; height: 17px; flex: 0 0 auto; }
.report-heading { max-width: 760px; }
.report-label { color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.report-heading h2 { margin: 9px 0 12px; font-family: Georgia, serif; font-size: 27px; line-height: 1.3; }
.report-heading p { margin: 0; color: #4e554c; font-size: 14px; line-height: 1.7; }
.report-overview, .report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 34px; margin-top: 18px; }
.report-evidence { margin-top: 22px; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.report-evidence > h3, .report-grid h3 { margin: 0 0 13px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.report-evidence-item { padding: 17px 0; border-top: 1px solid var(--line); }
.report-evidence-item:first-of-type { border-top: 0; }
.evidence-meta { display: flex; gap: 7px; align-items: center; }
.evidence-meta span { padding: 3px 6px; border-radius: 3px; font-size: 10px; }
.evidence-type { background: var(--soft); color: #4d554c; }
.supports { background: var(--green-soft); color: var(--green); }
.contradicts { background: #f8e4df; color: var(--coral); }
.report-evidence-item h4 { margin: 9px 0 7px; font-size: 14px; }
.report-evidence-item blockquote { margin: 0; color: #4e554c; font-family: Georgia, serif; font-size: 14px; line-height: 1.7; }
.report-evidence-item a { display: inline-block; margin-top: 8px; color: var(--green); font-size: 11px; }
.report-grid { margin-top: 0; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 34px; border-top: 1px solid var(--line); }
.detail-section { padding: 25px 0; border-bottom: 1px solid var(--line); }
.detail-section.full { grid-column: 1 / -1; }
.detail-section h3 { margin: 0 0 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.detail-section p { margin: 0; font-size: 14px; line-height: 1.75; }
.detail-section ul { margin: 0; padding: 0; list-style: none; }
.detail-section li { position: relative; margin: 8px 0; padding-left: 16px; font-size: 13px; line-height: 1.65; }
.detail-section li::before { content: ""; position: absolute; left: 0; top: .65em; width: 6px; height: 2px; background: var(--green); }
.evidence-block { padding: 26px; background: #f1f5f0; border-left: 3px solid var(--green); }
.evidence-claim { margin-bottom: 14px !important; font-weight: 700; }
.evidence-block blockquote { margin: 0; color: #465046; font-family: Georgia, serif; font-size: 15px; line-height: 1.75; }
.evidence-block a { display: inline-block; margin-top: 14px; color: var(--green); font-size: 11px; overflow-wrap: anywhere; }
.evidence-block .source-attribution { margin-top: 10px; color: var(--muted); font-size: 11px; }
.evidence-block .source-attribution a { margin-top: 0; }
.model-section { background: #fff8ed; margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.model-section li::before { background: #c47d18; }
.topic-list { display: flex; flex-wrap: wrap; gap: 7px; }
.topic-list span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; color: #4d554c; font-size: 11px; }

.empty-state { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.empty-state strong { color: #535952; font-family: Georgia, serif; font-size: 18px; }
.empty-mark { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; }
.empty-mark svg { width: 24px; height: 24px; }
.close-detail { display: none; position: absolute; right: 14px; top: 14px; z-index: 2; background: var(--surface); }
.mobile-backdrop { display: none; }
.error-state, .no-results { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.token-dialog {
  width: min(390px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  box-shadow: 0 18px 60px #20231f2e;
}
.token-dialog::backdrop { background: #20231f66; }
.token-dialog form { padding: 22px; }
.dialog-heading { display: flex; align-items: center; gap: 9px; }
.dialog-heading svg { width: 19px; height: 19px; color: var(--green); }
.dialog-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 21px; }
.token-dialog label { display: block; margin-top: 20px; }
.token-dialog label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.token-dialog input {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #cfd3ca;
  border-radius: 6px;
  outline: none;
}
.token-dialog input:focus { border-color: var(--green); box-shadow: 0 0 0 3px #176b5817; }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 840px) {
  .topbar { height: 60px; padding: 0 16px; }
  .brand div span { display: none; }
  .metrics div { min-width: 51px; padding: 0 9px; }
  .workspace { height: calc(100vh - 60px); display: block; }
  .browser-pane { height: 100%; border-right: 0; }
  .toolbar { padding: 12px 12px 8px; }
  .card-list { padding: 7px; }
  .signal-card { min-height: 142px; padding: 14px; }
  .detail-pane {
    position: fixed;
    inset: 60px 0 0;
    z-index: 10;
    transform: translateX(100%);
    transition: transform 180ms ease;
  }
  .detail-pane.is-open { transform: translateX(0); }
  .close-detail { display: inline-grid; }
  .card-detail { width: auto; padding: 52px 20px 60px; }
  .card-detail h1 { font-size: 27px; }
  .summary { font-size: 15px; }
  .detail-grid { display: block; }
  .report-overview, .report-grid { display: block; }
  .model-section { margin-left: -8px; margin-right: -8px; padding-left: 8px; padding-right: 8px; }
  .review-panel { margin-top: 24px; }
  .mobile-backdrop { display: none; }
}

@media (max-width: 430px) {
  .metrics div { min-width: 44px; padding: 0 6px; }
  .metrics span { font-size: 10px; }
  .source-tab { padding: 0 4px; font-size: 10px; }
  .filter-row { grid-template-columns: 1fr; }
  .review-status-control { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-status:nth-child(2) { border-right: 0; }
  .review-status:nth-child(n + 3) { border-top: 1px solid #dfe2db; }
}
