:root {
  --brand-primary: #17375e;
  --brand-accent: #275c9c;
  --brand-secondary: #f3c545;
  --brand-muted: #7d7f82;
  --brand-teal: #4b9589;
  --brand-background: #f1f1f1;
  --brand-ink: #0b0b0b;
  --brand-font: Geologica, Arial, sans-serif;
  --line: #e1e8f0;
  --surface: #ffffff;
  --radius: 20px;
  color-scheme: light;
  font-family: var(--brand-font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--brand-ink); background: linear-gradient(180deg, #fff 0%, var(--brand-background) 78%); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
.is-hidden { display: none !important; }

.topbar { min-height: 84px; padding: 0 max(6vw, 36px); display: flex; align-items: center; gap: 34px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 12px; }
.wordmark__symbol { width: 40px; height: 40px; display: grid; place-items: center; border: 2px solid var(--brand-accent); color: var(--brand-primary); border-radius: 12px; font-size: 20px; font-weight: 800; }
.wordmark strong, .wordmark small { display: block; }
.wordmark strong { letter-spacing: 1px; font-size: 16px; }
.wordmark small { margin-top: 3px; font-size: 8px; font-weight: 700; letter-spacing: 1.2px; color: var(--brand-muted); }
.topbar__status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #5f7183; font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-teal); box-shadow: 0 0 0 4px rgba(75,149,137,.12); }
.quiet-link { color: var(--brand-accent); font-size: 13px; font-weight: 600; }

.workspace { width: min(1360px, calc(100% - 72px)); margin: 0 auto; padding: 74px 0 96px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .77fr); gap: 88px; align-items: start; }
.eyebrow { color: var(--brand-teal); font-size: 11px; font-weight: 800; letter-spacing: 1.55px; margin: 0 0 16px; }
h1 { font-size: clamp(35px, 5vw, 63px); line-height: 1.06; letter-spacing: -2px; max-width: 790px; margin: 0; color: var(--brand-primary); }
.hero__lead { max-width: 700px; line-height: 1.72; font-size: 16px; color: #526678; margin: 22px 0 34px; }
.research-form > label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 9px; }
textarea, input { width: 100%; border: 1px solid #d4deea; border-radius: 12px; background: #fff; color: var(--brand-ink); transition: border-color .18s ease, box-shadow .18s ease; }
textarea { min-height: 118px; padding: 16px; line-height: 1.55; resize: vertical; }
input { height: 43px; padding: 0 12px; }
textarea:focus, input:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 4px rgba(39,92,156,.11); }
.advanced-options { margin-top: 13px; color: #5c6f80; font-size: 13px; }
.advanced-options summary { cursor: pointer; width: fit-content; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 17px 0 3px; }
.field-grid label { font-size: 11px; font-weight: 700; color: #526678; }
.field-grid input { margin-top: 6px; }
.form-actions { margin-top: 21px; display: flex; align-items: center; gap: 17px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 20px; border-radius: 11px; border: 1px solid transparent; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .18s ease, transform .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .62; cursor: wait; transform: none; }
.button--primary { color: #fff; background: var(--brand-primary); }
.button--primary:hover { background: var(--brand-accent); }
.button--secondary { color: var(--brand-primary); background: #fff; border-color: #ccd7e3; }
.form-note { color: #728394; font-size: 11px; }
.hero__preview { padding-top: 50px; }
.preview-card { padding: 20px 0 22px 19px; border-left: 2px solid var(--line); }
.preview-card:first-child { border-left-color: var(--brand-teal); }
.preview-card span { font-size: 11px; font-weight: 700; color: var(--brand-muted); }
.preview-card strong { display: block; color: var(--brand-primary); font-size: 16px; margin-top: 8px; }
.preview-card p { font-size: 12px; line-height: 1.6; color: #617486; margin: 8px 0 0; }

.research-dashboard { margin-top: 78px; }
.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 22px; margin-bottom: 22px; }
.dashboard-heading h2 { max-width: 960px; font-size: clamp(25px, 3vw, 36px); line-height: 1.18; letter-spacing: -.7px; margin: 0; color: var(--brand-primary); }
.state-chip { align-self: center; flex: 0 0 auto; padding: 8px 13px; border-radius: 999px; background: #eaf3f3; font-size: 11px; font-weight: 700; color: var(--brand-teal); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 27px 0; }
.metric-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 18px 17px 17px; }
.metric-card span, .metric-card small { display: block; }
.metric-card span { font-size: 9px; letter-spacing: 1px; color: #607488; font-weight: 800; }
.metric-card strong { display: block; margin: 12px 0 3px; color: var(--brand-accent); font-size: 32px; }
.metric-card--patent strong { color: var(--brand-secondary); }
.metric-card--fulltext strong { color: var(--brand-teal); }
.metric-card small { font-size: 11px; color: #738394; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: start; gap: 18px; }
.dashboard-main, .dashboard-side { display: grid; gap: 17px; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 23px; }
.panel h3, .history h3 { margin: 0; color: var(--brand-primary); font-size: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-wrap: wrap; }
.panel-note { color: var(--brand-muted); font-size: 10px; }
.panel-description { color: #596c7d; line-height: 1.65; font-size: 13px; }
.source-list { margin-top: 13px; }
.source-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid #edf1f5; }
.source-row:first-child { border-top: 0; }
.source-kind { flex: 0 0 auto; width: 90px; margin-top: 2px; color: var(--brand-accent); font-size: 10px; font-weight: 700; }
.source-kind--patent { color: var(--brand-secondary); }
.source-copy { line-height: 1.5; color: #34485b; font-size: 12px; }
.source-copy a, .upload-card h4 a { color: var(--brand-primary); text-decoration: none; }
.source-copy a:hover, .upload-card h4 a:hover { color: var(--brand-accent); text-decoration: underline; }
.source-copy small { display: block; margin-top: 3px; color: var(--brand-muted); }
.source-more { margin-top: 9px; color: var(--brand-accent); font-size: 11px; }
.source-browser > summary { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; color: var(--brand-primary); font-size: 12px; font-weight: 700; }
.source-browser > summary span { color: var(--brand-muted); font-size: 10px; font-weight: 400; }
.source-browser__body { margin-top: 12px; }
.source-filters, .source-pagination, .process-downloads { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.source-filters { margin-bottom: 8px; }
.source-filters button, .source-pagination button { border: 1px solid var(--line); background: white; color: var(--brand-primary); border-radius: 999px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 10px; }
.source-filters button.active { background: var(--brand-primary); color: white; }
.source-pagination { justify-content: flex-end; margin-top: 12px; color: var(--brand-muted); font-size: 10px; }
.source-pagination button:disabled { opacity: .4; cursor: default; }
.upload-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid #edf1f5; }
.upload-card h4 { margin: 0 0 4px; color: var(--brand-primary); font-size: 12px; line-height: 1.5; }
.upload-card p { margin: 0; color: #728394; font-size: 11px; }
.upload-card input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.upload-label { cursor: pointer; color: var(--brand-accent); font-size: 11px; font-weight: 700; white-space: nowrap; }
.upload-label--ready { color: var(--brand-teal); }
.upload-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.upload-resume { padding: 0; border: 0; background: transparent; color: var(--brand-primary); }
#finalize-button { margin-top: 15px; }
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.analysis-card { border-radius: 13px; background: var(--brand-background); padding: 13px; }
.analysis-card strong, .analysis-card small { display: block; }
.analysis-card strong { color: var(--brand-primary); font-size: 12px; }
.analysis-card small { margin-top: 6px; color: #617385; font-size: 10px; }
.timeline { list-style: none; padding: 0; margin: 18px 0 0; }
.timeline li { position: relative; padding: 0 0 18px 19px; color: #7a8998; font-size: 12px; line-height: 1.45; border-left: 1px solid #e1e8ef; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 2px; width: 9px; height: 9px; border-radius: 50%; background: #dbe3eb; }
.timeline li.done { color: var(--brand-primary); }
.timeline li.done::before { background: var(--brand-teal); }
.timeline li.active::before { background: var(--brand-accent); box-shadow: 0 0 0 4px rgba(39,92,156,.13); }
.evidence-panel p:not(.eyebrow) { color: #586a7b; font-size: 12px; line-height: 1.65; }
.report-ready { border-color: #b8d9d9; background: linear-gradient(135deg, #fff 0%, #f3f9f9 100%); }
.report-ready h3 { margin-bottom: 8px; }
.report-ready > p:not(.eyebrow) { color: #536779; font-size: 13px; }
.download-actions { display: flex; gap: 11px; margin-top: 17px; flex-wrap: wrap; }
.figure-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.figure-gallery:empty { display: none; }
.figure-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.figure-card img { display: block; width: 100%; height: 145px; object-fit: contain; background: white; }
.figure-card p { margin: 0; padding: 9px; color: #45596a; font-size: 10px; line-height: 1.45; }
.history { margin-top: 56px; }
.history-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 12px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; }
.history-row strong { color: var(--brand-primary); font-size: 13px; }
.history-row small { display: block; margin-top: 5px; color: var(--brand-muted); font-size: 10px; }
.text-button { border: 0; background: transparent; color: var(--brand-accent); font-size: 12px; font-weight: 700; cursor: pointer; }
.notification { position: fixed; right: 24px; bottom: 24px; max-width: 450px; padding: 14px 17px; border-radius: 12px; color: #fff; background: var(--brand-primary); font-size: 13px; line-height: 1.5; box-shadow: 0 12px 35px rgba(11,11,11,.2); }
.notification--error { background: #a63d35; }
.loading { cursor: progress; }
.loading .process-panel, .loading .process-panel summary { cursor: auto; }

.process-panel { border-color: #d8e3ed; }
.process-live { display: inline-flex; align-items: center; gap: 7px; color: #687a8b; font-size: 11px; }
.process-live__dot { width: 8px; height: 8px; border-radius: 50%; background: #a9b7c3; }
.process-live--active { color: var(--brand-teal); }
.process-live--active .process-live__dot { background: var(--brand-teal); animation: process-pulse 1.5s infinite; }
@keyframes process-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(75,149,137,.30); } 55% { box-shadow: 0 0 0 6px rgba(75,149,137,0); } }
.process-placeholder { padding: 12px 0; color: #728394; font-size: 12px; line-height: 1.6; }
.process-details { margin-top: 10px; border: 1px solid #e3eaf0; border-radius: 11px; background: #fbfcfd; }
.process-details summary { display: flex; justify-content: space-between; gap: 12px; padding: 12px 13px; color: var(--brand-primary); font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.process-details summary::-webkit-details-marker { display: none; }
.process-details summary span { color: #708294; font-size: 10px; font-weight: 400; text-align: right; }
.process-details__body { padding: 0 13px 13px; color: #41566a; font-size: 12px; line-height: 1.6; }
.process-details__body h5 { margin: 15px 0 5px; color: var(--brand-primary); font-size: 11px; }
.process-details__body p { margin: 8px 0; }
.process-details__body ul { margin: 5px 0 11px; padding-left: 20px; }
.process-table-wrap { overflow-x: auto; }
.process-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.process-table th, .process-table td { padding: 8px 7px; border-top: 1px solid #e6edf2; text-align: left; vertical-align: top; }
.process-table th { color: #667a8c; white-space: nowrap; }
.process-search { padding: 11px 0; border-top: 1px solid #e7edf2; }
.process-search:first-child { border-top: 0; }
.process-search strong, .process-research strong { color: var(--brand-primary); font-size: 11px; }
.process-search--warning strong, .process-warning { color: #a63d35; }
.process-search__meta { display: flex; gap: 11px; flex-wrap: wrap; margin-top: 5px; color: #66798a; font-size: 10px; }
.process-research { margin-top: 10px; }
.process-research p { color: #708294; font-size: 10px; }
.process-journal h4 { display: flex; justify-content: space-between; margin: 18px 0 9px; color: var(--brand-primary); font-size: 12px; }
.process-journal h4 span { color: #738597; font-weight: 400; }
.process-entries { max-height: 365px; overflow-y: auto; padding-right: 4px; }
.process-entry { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid #edf1f5; color: #41566a; font-size: 11px; line-height: 1.55; }
.process-entry time { color: #748697; font-variant-numeric: tabular-nums; }
.process-entry--warning span { color: #a63d35; }
.process-audit-link { display: inline-block; margin-top: 14px; text-decoration: none; }
.process-downloads { gap: 18px; }

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .hero__preview { display: grid; grid-template-columns: repeat(3, 1fr); padding-top: 6px; }
  .dashboard-columns { grid-template-columns: 1fr; }
  .dashboard-side { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 650px) {
  .topbar { padding: 0 17px; gap: 12px; }
  .quiet-link { display: none; }
  .workspace { width: calc(100% - 30px); padding-top: 45px; }
  h1 { font-size: 39px; letter-spacing: -1px; }
  .hero__preview { grid-template-columns: 1fr; }
  .field-grid, .metric-grid, .analysis-grid, .figure-gallery { grid-template-columns: 1fr 1fr; }
  .dashboard-heading, .dashboard-side { display: block; }
  .state-chip { display: inline-block; margin-top: 12px; }
  .dashboard-side .panel + .panel { margin-top: 14px; }
  .source-kind { width: 77px; }
  .panel { padding: 17px; }
  .form-note { width: 100%; }
  .process-details summary { display: block; }
  .process-details summary span { display: block; margin-top: 4px; text-align: left; }
  .process-entry { grid-template-columns: 55px minmax(0, 1fr); gap: 7px; }
}
