@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap");

/* Cense components. Every value comes from tokens.css; the only literal sizes are the type styles' own. */
body { margin: 0; font-family: var(--font-sans); font-size: 15px; line-height: 23px; background: var(--surface); color: var(--ink); -webkit-font-smoothing: antialiased; }
.cn-stage { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); align-items: flex-start; }
.cn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.cn-stack { display: flex; flex-direction: column; gap: var(--space-3); width: 100%; }

/* focus: one ring everywhere */
.cn-focusable:focus-visible, .cn-btn:focus-visible, .cn-cite:focus-visible, .cn-tab:focus-visible, .cn-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Wordmark — the supplied lowercase mark with the amber citation dot; never redrawn */
.cn-wm { display: inline-flex; align-items: center; gap: var(--space-3); box-sizing: content-box; line-height: 0; }
.cn-wm img { display: block; height: auto; }
.cn-wm-dark { display: none !important; }
[data-theme="dark"] .cn-wm-auto .cn-wm-light { display: none !important; }
[data-theme="dark"] .cn-wm-auto .cn-wm-dark { display: block !important; }
.cn-wm-navy { background: var(--brand-ground); }
.cn-wm-navy .cn-wm-dark { display: block !important; }
.cn-wm-text { font-family: var(--font-serif); font-weight: 600; font-size: 17px; line-height: 20px; color: var(--ink); letter-spacing: -0.01em; }
.cn-wm-navy .cn-wm-text { color: var(--on-brand-ground); }
.cn-wm-by { font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.cn-wm-navy .cn-wm-by { color: var(--on-brand-ground); }

/* Button — verb first, sentence case */
.cn-btn { font: inherit; font-size: 13px; line-height: 16px; font-weight: 500; display: inline-flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--ink); cursor: pointer; }
.cn-btn:hover { background: var(--surface-sunken); }
.cn-btn-primary { background: var(--judgment); border-color: var(--judgment); color: var(--on-judgment); }
.cn-btn-primary:hover { background: var(--judgment); filter: brightness(1.12); }
.cn-btn-quiet { background: transparent; border-color: transparent; color: var(--judgment); padding: 0 var(--space-2); }
.cn-btn-quiet:hover { background: var(--judgment-soft); }
.cn-btn-sm { height: 28px; padding: 0 var(--space-3); }
.cn-btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }

/* CiteMark — the brand asset. The only place --cite is painted. */
.cn-cite { font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; display: inline-flex; align-items: center; gap: 3px; height: 16px; padding: 0 var(--space-1); margin: 0 1px; border: 0; border-radius: var(--radius-sm); background: var(--cite); color: var(--on-cite); vertical-align: 1px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.cn-cite:hover, .cn-cite[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--on-cite); }
.cn-cite-loc { opacity: .78; }

/* EvidenceTag — direction is a glyph AND a word, never colour alone */
.cn-ev { display: flex; gap: var(--space-2); align-items: flex-start; font-size: 15px; line-height: 23px; }
.cn-ev-tag { flex: none; display: inline-flex; align-items: center; gap: var(--space-1); height: 20px; margin-top: 2px; padding: 0 var(--space-2) 0 var(--space-1); border-radius: var(--radius-sm); font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.cn-ev-glyph { font-family: var(--font-mono); font-size: 13px; font-weight: 500; width: 12px; text-align: center; }
.cn-ev-supports .cn-ev-tag { background: var(--supports-soft); color: var(--supports); }
.cn-ev-against .cn-ev-tag { background: var(--argues-against-soft); color: var(--argues-against); }
.cn-ev-missing .cn-ev-tag { background: transparent; color: var(--ink-muted); outline: 1px dashed var(--line-strong); outline-offset: -1px; }
.cn-ev-text { color: var(--ink); }

/* EvidenceGrade — guideline grading, four steps */
.cn-grade { display: inline-flex; align-items: center; gap: var(--space-2); }
.cn-grade-bars { display: inline-flex; gap: 2px; }
.cn-grade-bar { width: 4px; height: 12px; border-radius: 1px; background: var(--line); }
.cn-grade-bar.on { background: var(--judgment); }
.cn-grade-name { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }

/* DifferentialItem */
.cn-dx { display: grid; grid-template-columns: 40px 1fr; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-5) var(--space-4); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); width: 100%; box-sizing: border-box; }
.cn-dx-top { border-color: var(--judgment); }
.cn-dx-rank { font-family: var(--font-serif); font-size: 24px; line-height: 32px; font-weight: 600; color: var(--judgment); text-align: center; }
.cn-dx-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-2) var(--space-4); }
.cn-dx-verb { font-size: 13px; line-height: 20px; color: var(--ink-muted); margin-right: var(--space-1); }
.cn-dx-name { font-family: var(--font-serif); font-size: 19px; line-height: 26px; font-weight: 600; color: var(--ink); }
.cn-dx-body { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }

/* ResultTabs */
.cn-tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--line); }
.cn-tab { font: inherit; font-size: 13px; line-height: 16px; font-weight: 500; display: inline-flex; align-items: center; gap: var(--space-2); height: 30px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); cursor: pointer; }
.cn-tab:hover { color: var(--ink); }
.cn-tab[aria-selected="true"] { background: var(--judgment-soft); color: var(--judgment); }
.cn-tab-count { font-family: var(--font-mono); font-size: 11px; line-height: 16px; color: var(--ink-muted); }
.cn-tab[aria-selected="true"] .cn-tab-count { color: var(--judgment); }

/* TracePanel — the source passage behind a cite mark */
.cn-trace { width: 100%; max-width: 520px; box-sizing: border-box; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.cn-trace-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.cn-trace-type { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.cn-trace-title { font-family: var(--font-serif); font-size: 17px; line-height: 24px; font-weight: 600; margin: 0; color: var(--ink); }
.cn-trace-loc { font-family: var(--font-mono); font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.cn-trace-passage { margin: 0; padding: var(--space-3) var(--space-4); background: var(--surface-sunken); border-radius: var(--radius-md); font-family: var(--font-serif); font-size: 15px; line-height: 24px; color: var(--ink); }
.cn-trace-passage mark { background: var(--cite-soft); color: var(--ink); padding: 1px 0; }
.cn-trace-foot { display: flex; justify-content: space-between; align-items: center; }
.cn-link { color: var(--link); text-decoration: underline; text-underline-offset: 2px; font-size: 13px; line-height: 20px; }

/* MissingItem — what is missing / what to order */
.cn-miss { display: grid; grid-template-columns: 20px 1fr auto; gap: var(--space-3); align-items: start; padding: var(--space-3) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); width: 100%; box-sizing: border-box; }
.cn-miss-done { border-style: solid; border-color: var(--line); background: var(--surface-raised); }
.cn-miss-glyph { font-family: var(--font-mono); font-size: 15px; line-height: 23px; color: var(--ink-muted); text-align: center; }
.cn-miss-done .cn-miss-glyph { color: var(--judgment); }
.cn-miss-test { font-weight: 500; color: var(--ink); }
.cn-miss-why { font-size: 13px; line-height: 20px; color: var(--ink-muted); }

/* ReferralCard */
.cn-ref { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); width: 100%; max-width: 420px; box-sizing: border-box; }
.cn-ref-type { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.cn-ref-name { font-family: var(--font-serif); font-size: 17px; line-height: 24px; font-weight: 600; color: var(--ink); }
.cn-ref-facts { font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.cn-ref-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }

/* EmptyState */
.cn-empty { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); width: 100%; max-width: 560px; box-sizing: border-box; }
.cn-empty-title { font-family: var(--font-serif); font-size: 19px; line-height: 26px; font-weight: 600; margin: 0; }
.cn-empty ul { margin: 0; padding-left: var(--space-5); color: var(--ink); }
.cn-empty li { margin: var(--space-1) 0; }

/* CaseInput */
.cn-field { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; }
.cn-field-label { font-size: 13px; line-height: 16px; font-weight: 500; color: var(--ink); }
.cn-field-help { font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.cn-input { font: inherit; font-size: 15px; line-height: 23px; min-height: 120px; resize: vertical; padding: var(--space-3) var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-raised); color: var(--ink); box-sizing: border-box; width: 100%; }
.cn-input::placeholder { color: var(--ink-muted); }

/* ResultFooter */
.cn-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2) var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); font-size: 13px; line-height: 20px; color: var(--ink-muted); width: 100%; }

/* High contrast theme: shape, not shade, sets marks apart */
[data-theme="contrast"] .cn-cite { box-shadow: inset 0 0 0 1px var(--on-cite); }
[data-theme="contrast"] .cn-grade-bar { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="contrast"] .cn-grade-bar.on { background: var(--judgment); box-shadow: none; }
[data-theme="contrast"] .cn-ev-supports .cn-ev-tag, [data-theme="contrast"] .cn-ev-against .cn-ev-tag { box-shadow: inset 0 0 0 1px currentColor; }
[data-theme="contrast"] .cn-tab[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--judgment); }
[data-theme="contrast"] .cn-btn-quiet { text-decoration: underline; text-underline-offset: 3px; }
[data-theme="contrast"] .cn-cite:focus-visible, [data-theme="contrast"] .cn-btn:focus-visible, [data-theme="contrast"] .cn-tab:focus-visible, [data-theme="contrast"] .cn-input:focus-visible { outline-width: 3px; }
