:root {
  --navy: #102b4d;
  --navy-2: #244c72;
  --ink: #19324b;
  --muted: #6d8194;
  --line: #dce7ef;
  --paper: #f5f8fb;
  --white: #ffffff;
  --mint: #d9f2ed;
  --teal: #159b8b;
  --coral: #ee765f;
  --shadow: 0 18px 55px rgba(27, 62, 91, .09);
  font-family: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: linear-gradient(180deg, #eef5f8 0, var(--paper) 320px); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.topbar { height: 82px; padding: 0 max(22px, calc((100vw - 1360px) / 2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.84); border-bottom: 1px solid rgba(220,231,239,.8); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: white; font-size: 21px; background: var(--navy); box-shadow: 0 8px 20px rgba(16,43,77,.2); }
h1, h2, p { margin: 0; }
h1 { font-size: 19px; letter-spacing: .02em; }
h2 { font-size: 20px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 5px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.mode-badge, .review-state, .count-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; color: var(--navy-2); background: #eaf5f4; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(21,155,139,.12); }
.shell { width: min(1360px, calc(100% - 36px)); margin: 34px auto 70px; }
.intro-card { display: flex; align-items: stretch; justify-content: space-between; gap: 30px; padding: 31px 34px; border-radius: 24px; color: white; background: radial-gradient(circle at 85% 15%, #3b6f95 0, transparent 36%), linear-gradient(120deg, #102b4d 0%, #1e496c 100%); box-shadow: var(--shadow); }
.intro-card h2 { max-width: 690px; font-size: clamp(24px, 3vw, 37px); line-height: 1.18; }
.intro-card .eyebrow { color: #94d8cc; }
.intro-copy { max-width: 720px; margin-top: 13px; color: #d2e4ee; line-height: 1.7; font-size: 14px; }
.safety-note { align-self: center; display: flex; align-items: center; gap: 12px; min-width: 210px; padding: 15px 17px; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; color: #dceef0; font-size: 12px; line-height: 1.55; background: rgba(255,255,255,.09); }
.note-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: var(--navy); background: #b9e7dd; font-weight: 900; }
.workflow { margin-top: 25px; }
.steps { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.step { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.66); }
.step > span { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: var(--muted); background: #edf2f6; font-size: 12px; font-weight: 800; }
.step b, .step small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.step b { font-size: 12px; }
.step small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.step.active { border-color: #acdcd5; background: #f1fbf9; }
.step.active > span { color: white; background: var(--teal); }
.workspace-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.55fr); gap: 18px; align-items: start; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.88); box-shadow: 0 8px 32px rgba(40,71,93,.04); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.ai-provider-row { display: flex; align-items: center; gap: 9px; margin: 0 0 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; }
.ai-provider-row label { color: var(--navy); font-size: 11px; font-weight: 800; white-space: nowrap; }
.ai-provider-row select { min-width: 190px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font-size: 11px; }
.ai-provider-row .helper-text { margin: 0; }
.search-box { display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--muted); }
.search-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(21,155,139,.1); }
.search-box span { font-size: 23px; line-height: 0; transform: translateY(-1px); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); font-size: 13px; background: transparent; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 15px 0 17px; }
.topic-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--navy-2); background: #f9fbfc; font-size: 11px; transition: .18s ease; }
.topic-chip:hover, .topic-chip.selected { border-color: var(--teal); color: #087b6d; background: #eaf8f5; }
.custom-topic-action { width: 100%; padding: 10px 12px; border: 1px dashed #9fcac6; border-radius: 10px; color: #087b6d; background: #f0faf8; font-size: 11px; font-weight: 800; text-align: left; }
.custom-topic-action:hover { border-color: var(--teal); background: #e3f7f2; }
.source-result { min-height: 165px; }
.source-card { padding: 15px; border-radius: 15px; background: #f4f8fa; }
.source-card h3 { margin: 0 0 7px; color: var(--navy); font-size: 15px; }
.source-card p { color: #586f83; font-size: 12px; line-height: 1.65; }
.source-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.source-tag { padding: 4px 7px; border-radius: 6px; color: #477183; background: white; font-size: 10px; }
.source-links { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.source-links a, .source-line a { color: #087b6d; font-size: 11px; text-decoration: none; }
.source-links a:hover, .source-line a:hover { text-decoration: underline; }
.api-card { display: flex; gap: 10px; margin-top: 15px; padding: 13px; border: 1px dashed #bbd5df; border-radius: 14px; background: #f8fcfd; }
.api-icon { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: #116d78; background: #dff3f2; }
.api-card strong { font-size: 12px; }
.api-card p { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.evidence-search-card { margin-top: 17px; padding: 15px; border: 1px solid #cfe4e7; border-radius: 15px; background: #f4fbfa; }
.evidence-search-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; margin-bottom: 11px; }
.evidence-search-heading h3 { color: var(--navy); font-size: 14px; }
.evidence-search-controls { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 9px; }
.evidence-search-controls select { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font-size: 11px; }
.evidence-results { display: flex; flex-direction: column; gap: 8px; margin-top: 11px; max-height: 470px; overflow: auto; }
.evidence-result { padding: 11px; border: 1px solid #dcebed; border-radius: 11px; background: white; }
.evidence-result-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-bottom: 5px; }
.evidence-provider { color: var(--teal); font-size: 10px; font-weight: 800; }
.evidence-result h4 { margin: 0; color: var(--navy); font-size: 12px; line-height: 1.45; }
.evidence-result-meta { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.evidence-result-abstract { margin-top: 7px; color: #5b7284; font-size: 10px; line-height: 1.55; }
.evidence-result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.evidence-result-actions a { color: #087b6d; font-size: 10px; text-decoration: none; }
.evidence-result-actions a:hover { text-decoration: underline; }
.evidence-select-btn { min-height: 27px; padding: 0 8px; border: 1px solid #c9e1df; border-radius: 7px; color: #147e72; background: #f1fbf9; font-size: 10px; font-weight: 800; }
.evidence-select-btn:hover, .evidence-select-btn.selected { color: white; border-color: var(--teal); background: var(--teal); }
.evidence-notice { margin-bottom: 13px; padding: 9px 11px; border-radius: 9px; color: #6c5a3f; background: #fff7e9; font-size: 10px; line-height: 1.55; }
.recommendations-heading { align-items: center; }
.primary-btn, .secondary-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 39px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent; font-size: 12px; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.primary-btn { color: white; background: var(--navy); box-shadow: 0 7px 15px rgba(16,43,77,.13); }
.primary-btn:hover { background: #1d4c70; transform: translateY(-1px); box-shadow: 0 9px 18px rgba(16,43,77,.2); }
.secondary-btn { color: var(--navy-2); border-color: var(--line); background: white; }
.secondary-btn:hover { border-color: #9fcac6; background: #f0faf8; }
.secondary-btn:disabled, .primary-btn:disabled { cursor: not-allowed; opacity: .45; transform: none; box-shadow: none; }
.selected-source { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; color: var(--muted); font-size: 11px; }
.selected-source strong { color: var(--navy); }
.recommendations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; max-height: 665px; overflow: auto; padding: 1px 4px 4px 1px; }
.recommendation-card { position: relative; display: flex; flex-direction: column; min-height: 247px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: white; transition: .18s ease; }
.recommendation-card:hover, .recommendation-card.chosen { border-color: #8ccbc1; box-shadow: 0 8px 22px rgba(21,155,139,.1); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.format-tag { color: #668198; font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.plan-number { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; color: white; background: var(--coral); font-size: 11px; font-weight: 800; }
.recommendation-card h3 { margin: 0 0 8px; color: var(--navy); font-size: 15px; line-height: 1.35; }
.recommendation-card .preview-text { display: -webkit-box; flex: 1; overflow: hidden; color: #5b7284; font-size: 11px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
.card-sources { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0; }
.card-sources span { padding: 4px 6px; border-radius: 5px; color: #147e72; background: #edf9f6; font-size: 9px; }
.choose-btn { width: 100%; min-height: 32px; border: 1px solid #d6e4ea; border-radius: 8px; color: var(--navy-2); background: #f7fafb; font-size: 11px; font-weight: 800; }
.choose-btn:hover, .recommendation-card.chosen .choose-btn { color: white; border-color: var(--teal); background: var(--teal); }
.editor-panel, .infographic-panel { margin-top: 18px; }
.editor-grid, .infographic-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 20px; }
.editor-copy label, .settings-card label { display: block; margin: 0 0 7px; color: var(--navy-2); font-size: 11px; font-weight: 800; }
.editor-copy input, .editor-copy textarea, .settings-card select { width: 100%; margin-bottom: 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: white; font-size: 13px; line-height: 1.65; }
.editor-copy textarea { resize: vertical; min-height: 210px; }
.infographic-points-editor { margin-top: 3px; padding: 13px; border: 1px solid #dce8ed; border-radius: 12px; background: #f8fbfc; }
.infographic-points-editor > label { margin-bottom: 9px; }
.infographic-points-editor input { margin-bottom: 8px; background: white; }
.infographic-points-editor input:last-of-type { margin-bottom: 0; }
.infographic-points-editor .helper-text { margin-bottom: 0; }
.editor-copy input:focus, .editor-copy textarea:focus, .settings-card select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(21,155,139,.1); }
.editor-actions, .download-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.evidence-box { min-height: 250px; padding: 16px; border-radius: 15px; background: #f3f8fa; }
.evidence-header { display: flex; align-items: center; gap: 8px; color: var(--navy); font-size: 13px; }
.evidence-header span { color: var(--teal); }
.source-line { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid #dce8ed; }
.source-line:last-child { border-bottom: 0; }
.source-line strong { font-size: 11px; line-height: 1.45; }
.source-line small { color: #708697; font-size: 10px; line-height: 1.5; }
.claim-map { margin-top: 13px; padding: 10px; border: 1px solid #dce8ed; border-radius: 9px; background: #f8fbfc; }
.claim-map > strong { display: block; margin-bottom: 7px; color: var(--navy-2); font-size: 10px; }
.claim-row { padding: 7px 0; border-top: 1px solid #e6eef1; font-size: 10px; line-height: 1.55; }
.claim-row span { display: block; color: var(--ink); }
.claim-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.risk-line { margin-top: 13px; padding: 9px; border-radius: 8px; color: #8b5b32; background: #fff3e8; font-size: 10px; line-height: 1.6; }
.settings-card { padding: 17px; border-radius: 15px; background: #f3f8fa; }
.ai-visual-controls { margin: 2px 0 14px; padding: 12px; border: 1px solid #dce8ed; border-radius: 11px; background: white; }
.ai-visual-controls[hidden] { display: none; }
.ai-visual-controls > label { margin-top: 0; }
.infographic-checks { display: grid; gap: 8px; margin-top: 2px; }
.infographic-checks label { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 10px; font-weight: 600; }
.infographic-checks input { accent-color: var(--teal); }
.full-btn { width: 100%; margin-top: 4px; }
.helper-text { margin-top: 11px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.preview-card { overflow: hidden; min-height: 330px; border: 1px solid var(--line); border-radius: 15px; background: #eef3f4; }
.preview-toolbar { display: flex; justify-content: space-between; padding: 10px 13px; border-bottom: 1px solid var(--line); color: var(--muted); background: white; font-size: 10px; font-weight: 800; }
.infographic-preview { display: grid; place-items: center; min-height: 290px; padding: 18px; }
.preview-empty { text-align: center; color: #8ca0ae; font-size: 12px; line-height: 1.6; }
.preview-empty span { display: block; margin-bottom: 7px; color: var(--teal); font-size: 25px; }
.infographic-preview svg { display: block; width: 100%; max-height: 460px; border-radius: 10px; box-shadow: 0 12px 26px rgba(16,43,77,.14); }
.download-actions { padding: 0 13px 13px; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 19px max(22px, calc((100vw - 1360px) / 2)); border-top: 1px solid var(--line); color: #8092a1; background: white; font-size: 10px; }
.empty-state { padding: 24px 10px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6; }
@media (max-width: 980px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .source-panel { order: 0; }
  .recommendations-panel { order: 1; }
  .recommendations { max-height: none; }
}
@media (max-width: 680px) {
  .topbar { height: 68px; padding: 0 16px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  h1 { font-size: 16px; }
  .mode-badge { padding: 7px 9px; font-size: 10px; }
  .shell { width: min(100% - 22px, 600px); margin-top: 18px; }
  .intro-card { flex-direction: column; padding: 24px 20px; border-radius: 19px; }
  .intro-card h2 { font-size: 24px; }
  .safety-note { align-self: stretch; min-width: 0; }
  .steps { gap: 5px; }
  .step { justify-content: center; padding: 8px 4px; }
  .step > div { display: none; }
  .step > span { width: 25px; height: 25px; }
  .panel { padding: 18px 15px; border-radius: 17px; }
  .panel-heading { margin-bottom: 14px; }
  .recommendations-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: stretch; }
  .heading-actions button { flex: 1; }
  .ai-provider-row { align-items: stretch; flex-direction: column; }
  .ai-provider-row select { width: 100%; }
  .recommendations { grid-template-columns: 1fr; }
  .editor-grid, .infographic-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; padding: 17px 16px; }
  .evidence-search-controls { grid-template-columns: 1fr; }
}
