:root {
  --blue: #0a84ff;
  --blue-accessible: #075bb8;
  --blue-soft: #edf6ff;
  --green: #30d158;
  --green-accessible: #11845b;
  --green-soft: #ecfaf4;
  --ink: #0a0a0a;
  --body: #24303f;
  --muted: #667085;
  --border: #d9e0e7;
  --canvas: #f5f7f9;
  --surface: #fff;
  --warning: #a96c08;
  --warning-soft: #fff7e8;
  --error: #b6433d;
  --error-soft: #fff2f1;
  --purple: #6853a8;
  --purple-soft: #f4f1ff;
  --shadow: 0 14px 38px rgba(25, 42, 62, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--body); }

body {
  font-family: Inter, "SF Pro Display", "PingFang TC", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(10, 132, 255, 0.28); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
}

.brand-group, .top-actions, .breadcrumb, .eyebrow-row, .section-heading, .source-card,
.option-card, .issue-file, .detail-head { display: flex; align-items: center; }

.brand-group { min-width: 0; gap: 22px; }
.logo { display: block; width: 158px; height: 50px; object-fit: contain; object-position: left center; }
.breadcrumb { min-width: 0; gap: 9px; color: #778294; font-size: 13px; }
.breadcrumb b { overflow: hidden; color: #314054; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { gap: 10px; }

.read-only {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green-accessible);
  font-size: 12px;
  font-weight: 750;
}

.read-only span { color: var(--green); font-size: 10px; }
.icon-button, .close-button, .open-issue {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--body);
  cursor: pointer;
}
.icon-button { width: 36px; height: 36px; border-radius: 50%; font-weight: 800; }

main {
  flex: 1;
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 22px 28px 14px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.8fr);
  gap: 42px;
  align-items: end;
}

.eyebrow-row { gap: 12px; margin-bottom: 9px; }
.eyebrow { color: var(--blue-accessible); font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.synthetic-badge {
  border: 1px solid #cbd6e2;
  border-radius: 999px;
  padding: 3px 8px;
  color: #59677a;
  font-size: 10px;
  font-weight: 750;
}

h1, h2, p { margin: 0; }
h1 { color: var(--ink); font-size: clamp(30px, 3vw, 48px); line-height: 1.08; letter-spacing: -0.035em; }
.lead { max-width: 800px; margin-top: 10px; color: #4d5b6d; font-size: 14px; line-height: 1.65; }

.hero-facts {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.hero-facts > div { min-width: 0; padding: 13px 15px; border-left: 1px solid var(--border); }
.hero-facts > div:first-child { border-left: 0; }
.hero-facts span, .hero-facts strong { display: block; }
.hero-facts span { color: var(--muted); font-size: 10px; font-weight: 700; }
.hero-facts strong { margin-top: 5px; color: var(--ink); font-size: 15px; line-height: 1.2; }

.trust-path {
  display: flex;
  align-items: center;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.path-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--body);
  text-align: left;
  cursor: pointer;
}

.path-step:hover, .path-step:focus-visible { background: var(--blue-soft); }
.step-index {
  display: grid;
  place-items: center;
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  border: 1px solid #a9c7e8;
  border-radius: 50%;
  color: var(--blue-accessible);
  font: 800 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.path-step b, .path-step small { display: block; white-space: nowrap; }
.path-step b { color: var(--ink); font-size: 11px; }
.path-step small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.path-step.is-active .step-index { border-color: var(--blue); background: var(--blue); color: #fff; }
.final-step .step-index { border-color: var(--green-accessible); background: var(--green-soft); color: var(--green-accessible); }
.path-line { flex: 1 1 32px; min-width: 12px; height: 1px; margin: 0 3px; background: #bfd1e4; }

.workspace {
  display: grid;
  grid-template-columns: minmax(480px, 1.35fr) minmax(250px, 0.72fr) minmax(330px, 0.95fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.sources-panel, .reasoning-panel, .outlook-panel { padding: 16px; }
.section-heading { justify-content: space-between; gap: 14px; }
.section-heading.compact { align-items: flex-start; }
.section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--blue-accessible);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h2 { color: var(--ink); font-size: 17px; line-height: 1.25; letter-spacing: -0.015em; }
.text-button { border: 0; background: transparent; color: var(--blue-accessible); font-size: 11px; font-weight: 800; cursor: pointer; }

.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.source-card {
  position: relative;
  min-width: 0;
  min-height: 75px;
  gap: 9px;
  padding: 11px 10px 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--body);
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.source-card:hover, .source-card:focus-visible { border-color: #9dc5ec; background: #fbfdff; }
.source-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid #b8d6f2;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue-accessible);
  font-size: 9px;
  font-weight: 850;
}
.source-icon.external { border-color: #cfc6ef; background: var(--purple-soft); color: var(--purple); }
.source-main { min-width: 0; }
.source-main b, .source-main small { display: block; }
.source-main b { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.source-main small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.3; }
.status { margin-left: auto; align-self: flex-start; white-space: nowrap; font-size: 9px; font-weight: 800; }
.status.confirmed { color: var(--green-accessible); }
.status.conflict { color: var(--error); }
.status.unconfirmed { color: var(--warning); }
.asof { position: absolute; right: 10px; bottom: 7px; color: #7a8797; font-size: 8px; }
.coverage-note {
  display: flex;
  gap: 8px;
  margin-top: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f2f5f8;
  color: #536174;
  font-size: 10px;
  line-height: 1.4;
}
.coverage-note span { color: var(--blue-accessible); font-weight: 900; }

.reasoning-stack { display: grid; gap: 9px; margin-top: 13px; }
.reason-card {
  display: block;
  width: 100%;
  min-height: 78px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 9px;
  background: #fff;
  color: var(--body);
  text-align: left;
  cursor: pointer;
}
.reason-card:hover, .reason-card:focus-visible { background: #fbfdff; }
.reason-card.current { border-left-color: var(--green-accessible); }
.reason-card.guard { border-left-color: var(--warning); }
.reason-label { display: block; margin-bottom: 5px; color: var(--blue-accessible); font-size: 9px; font-weight: 850; }
.reason-card.current .reason-label { color: var(--green-accessible); }
.reason-card.guard .reason-label { color: var(--warning); }
.reason-card b, .reason-card small { display: block; }
.reason-card b { color: var(--ink); font-size: 11px; line-height: 1.38; }
.reason-card small { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.4; }

.option-list { display: grid; gap: 8px; margin-top: 13px; }
.option-card {
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--body);
  text-align: left;
  cursor: pointer;
}
.option-card:hover, .option-card:focus-visible { border-color: #9dc5ec; background: #fbfdff; }
.option-card.focus { border-color: #9fd6bd; background: var(--green-soft); }
.option-card.no { background: #fffafa; }
.option-number {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef2f6;
  color: #59677a;
  font: 800 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.option-card.focus .option-number { background: #d5f2e4; color: var(--green-accessible); }
.option-card > span:nth-child(2) { min-width: 0; }
.option-card b, .option-card small { display: block; }
.option-card b { color: var(--ink); font-size: 11px; }
.option-card small { margin-top: 3px; color: var(--muted); font-size: 8.5px; line-height: 1.25; }
.metric { margin-left: auto; color: var(--ink); font-size: 14px; font-weight: 850; text-align: right; white-space: nowrap; }
.metric small { color: var(--muted); font-size: 8px; font-weight: 650; }

.issue-file {
  gap: 10px;
  margin-top: 11px;
  padding: 11px;
  border: 1px solid #b5dcc8;
  border-radius: 10px;
  background: var(--green-soft);
}
.issue-mark {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green-accessible);
  color: #fff;
  font-weight: 900;
}
.issue-file > div:nth-child(2) { min-width: 0; }
.issue-file span, .issue-file b, .issue-file small { display: block; }
.issue-file span { color: var(--green-accessible); font-size: 9px; font-weight: 850; }
.issue-file b { margin-top: 3px; color: var(--ink); font-size: 11px; line-height: 1.25; }
.issue-file small { margin-top: 3px; color: #547062; font-size: 8.5px; }
.open-issue { margin-left: auto; padding: 7px 10px; border-color: #9ac9b1; border-radius: 8px; color: var(--green-accessible); font-size: 9px; font-weight: 850; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 28px 12px;
  color: #6e7a8a;
  font-size: 9px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 25, 37, 0.25);
}

.detail-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 40;
  width: min(430px, calc(100vw - 28px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: auto;
}

.detail-head { align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-kicker { display: block; margin-bottom: 6px; color: var(--blue-accessible); font-size: 10px; font-weight: 850; letter-spacing: 0.08em; }
.detail-head h2 { font-size: 22px; }
.close-button { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; font-size: 22px; line-height: 1; }
.drawer-grip { display: none; }
.detail-body { padding: 20px 0; }
.detail-block { padding: 13px 0; border-top: 1px solid var(--border); }
.detail-block:first-child { border-top: 0; padding-top: 0; }
.detail-block h3 { margin: 0 0 6px; color: var(--ink); font-size: 12px; }
.detail-block p, .detail-block li { color: #4d5b6d; font-size: 11px; line-height: 1.6; }
.detail-block p { margin: 0; }
.detail-block ul { margin: 0; padding-left: 18px; }
.detail-meta { display: grid; grid-template-columns: 100px 1fr; gap: 7px 12px; }
.detail-meta dt { color: var(--muted); font-size: 10px; }
.detail-meta dd { margin: 0; color: var(--body); font-size: 10px; font-weight: 700; }
.detail-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-accessible);
  font-size: 10px;
  font-weight: 850;
}
.detail-status.is-warning { background: var(--warning-soft); color: var(--warning); }
.detail-status.is-error { background: var(--error-soft); color: var(--error); }
.detail-status.is-confirmed { background: var(--green-soft); color: var(--green-accessible); }
.detail-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 9px; }
.detail-foot code { color: #526174; font-size: 9px; }

[hidden] { display: none !important; }

@media (min-width: 1680px) and (min-height: 1000px) {
  .topbar { min-height: 74px; padding-inline: 40px; }
  .logo { width: 176px; height: 54px; }
  main { padding: 30px 40px 18px; }
  .hero { gap: 54px; }
  h1 { font-size: 53px; }
  .lead { font-size: 16px; }
  .hero-facts > div { padding: 16px 18px; }
  .hero-facts strong { font-size: 17px; }
  .trust-path { margin-top: 20px; padding: 13px 16px; }
  .path-step { gap: 10px; padding: 7px 8px; }
  .path-step b { font-size: 13px; }
  .path-step small { font-size: 10px; }
  .workspace { gap: 18px; margin-top: 18px; }
  .sources-panel, .reasoning-panel, .outlook-panel { padding: 20px; }
  h2 { font-size: 19px; }
  .source-grid, .reasoning-stack, .option-list { gap: 11px; margin-top: 15px; }
  .source-card { min-height: 86px; padding: 13px 12px 26px; }
  .source-main b, .reason-card b, .option-card b { font-size: 13px; }
  .source-main small, .reason-card small, .option-card small { font-size: 10px; }
  .reason-card { min-height: 92px; padding: 14px; }
  .option-card { min-height: 66px; padding: 11px 12px; }
  .issue-file { margin-top: 14px; padding: 14px; }
  .issue-file b { font-size: 13px; }
  footer { padding-inline: 40px; font-size: 10px; }
}

@media (max-width: 1200px) {
  main { padding-inline: 18px; }
  .hero { grid-template-columns: 1fr; gap: 14px; }
  .hero-facts { max-width: 100%; }
  .workspace { grid-template-columns: 1.15fr 0.85fr; }
  .outlook-panel { grid-column: 1 / -1; }
  .option-list { grid-template-columns: repeat(3, 1fr); }
  .option-card { align-items: flex-start; min-height: 76px; }
  .metric { margin-top: 2px; }
  .issue-file { max-width: 560px; }
  .path-step small { display: none; }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .topbar { min-height: 58px; padding-block: 7px; }
  .logo { width: 142px; height: 43px; }
  main { padding-top: 16px; }
  .hero { grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.9fr); gap: 20px; }
  h1 { font-size: 34px; }
  .lead { font-size: 12px; }
  .hero-facts > div { padding: 10px; }
  .hero-facts strong { font-size: 12px; }
  .trust-path { margin-top: 12px; padding: 8px; }
  .path-step { gap: 5px; padding: 4px; }
  .path-step b { font-size: 9px; }
  .path-step small { display: block; font-size: 7.5px; white-space: normal; }
  .step-index { flex-basis: 22px; width: 22px; height: 22px; }
  .workspace { grid-template-columns: minmax(390px, 1.18fr) minmax(210px, 0.68fr) minmax(280px, 0.9fr); gap: 10px; margin-top: 10px; }
  .outlook-panel { grid-column: auto; }
  .sources-panel, .reasoning-panel, .outlook-panel { padding: 12px; }
  h2 { font-size: 15px; }
  .source-grid, .reasoning-stack, .option-list { gap: 7px; margin-top: 10px; }
  .source-card { min-height: 69px; padding: 9px 8px 22px; }
  .source-icon { flex-basis: 30px; width: 30px; height: 30px; }
  .source-main b { font-size: 10px; }
  .source-main small, .reason-card small, .option-card small { font-size: 8px; }
  .status { font-size: 8px; }
  .reason-card { min-height: 75px; padding: 9px; }
  .reason-card b { font-size: 9.5px; }
  .option-list { grid-template-columns: 1fr; }
  .option-card { min-height: 52px; padding: 7px 8px; }
  .option-card b { font-size: 9.5px; }
  .option-number { flex-basis: 24px; width: 24px; height: 24px; }
  .metric { font-size: 11px; }
  .issue-file { margin-top: 8px; padding: 8px; }
  .issue-mark { flex-basis: 25px; width: 25px; height: 25px; }
  .issue-file b { font-size: 9.5px; }
  .issue-file small { font-size: 7.5px; }
  .open-issue { padding: 6px; }
}

@media (max-width: 760px) {
  .topbar { min-height: 58px; padding: 8px 12px; }
  .logo { width: 128px; height: 40px; }
  .breadcrumb { display: none; }
  .read-only { gap: 4px; font-size: 8px; }
  .icon-button { width: 34px; height: 34px; }
  main { padding: 14px 12px 10px; }
  .hero { display: block; }
  .desktop-break { display: none; }
  .eyebrow-row { align-items: flex-start; flex-wrap: wrap; gap: 7px; }
  .eyebrow { width: 100%; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  h1 { font-size: 30px; line-height: 1.12; }
  .lead { margin-top: 8px; font-size: 12px; line-height: 1.55; }
  .hero-facts { grid-template-columns: 1fr 1fr; margin-top: 12px; }
  .hero-facts > div { padding: 10px; }
  .hero-facts > div:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--border); border-left: 0; }
  .hero-facts strong { font-size: 12px; }
  .trust-path { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 7px; }
  .path-line { display: none; }
  .path-step { min-height: 51px; padding: 5px; }
  .step-index { flex-basis: 22px; width: 22px; height: 22px; }
  .path-step b { font-size: 9px; white-space: normal; }
  .path-step small { display: block; font-size: 8px; line-height: 1.2; white-space: normal; }
  .workspace { display: block; }
  .panel { margin-top: 10px; }
  .sources-panel, .reasoning-panel, .outlook-panel { padding: 13px; }
  h2 { font-size: 16px; }
  .source-grid { grid-template-columns: 1fr; gap: 7px; }
  .source-card { min-height: 65px; }
  .reasoning-panel, .outlook-panel { margin-top: 10px; }
  .reasoning-stack { grid-template-columns: 1fr; }
  .option-list { grid-template-columns: 1fr; }
  footer { display: block; padding: 8px 12px 14px; line-height: 1.5; }
  footer span { display: block; }
  footer span:last-child { margin-top: 3px; }
  .detail-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 78vh;
    padding: 12px 16px 16px;
    border-radius: 16px 16px 0 0;
  }
  .drawer-grip { display: block; width: 44px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: #ccd5df; }
  .detail-head h2 { font-size: 19px; }
  .detail-foot { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .detail-panel { animation: drawer-in 180ms ease-out; }
  @keyframes drawer-in {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
  }
  @media (max-width: 760px) {
    .detail-panel { animation-name: sheet-in; }
    @keyframes sheet-in {
      from { opacity: 0; transform: translateY(24px); }
      to { opacity: 1; transform: translateY(0); }
    }
  }
}
