/* Artifex visual system (tokens from app/components/theme.py). System fonts only: no third-party requests. */
:root {
  --ax-accent: #8a3324; --ax-accent-dark: #6f281c; --ax-ink: #1f1d1a; --ax-ink-2: #55504a; --ax-ink-3: #6f685f;
  --ax-rule: #ddd5c7; --ax-surface: #f7f4ee; --ax-card: #fcfbf8; --ax-blue: #2a78d6;
  --ax-serif: 'Source Serif', 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --ax-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ax-surface); color: var(--ax-ink); font-family: var(--ax-sans); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; }
a { color: var(--ax-accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--ax-accent); outline-offset: 2px; }
code { font-size: 0.86em; background: #efe9df; padding: 0.05rem 0.3rem; border-radius: 3px; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--ax-rule); margin: 2rem 0; }
h1, h2, h3, h4, h5, .ax-serif { font-family: var(--ax-serif); font-weight: 500; letter-spacing: 0.005em; color: var(--ax-ink); }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.12; margin: 0.2rem 0 0.8rem; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); margin: 2.2rem 0 0.9rem; }
h3 { font-size: 1.4rem; margin: 1.6rem 0 0.7rem; }
h4 { font-size: 1.2rem; margin: 1.8rem 0 0.6rem; }
.ax-h5 { font-size: 1.05rem; margin: 1.4rem 0 0.5rem; }
p, li { line-height: 1.62; }

.ax-skip { position: absolute; left: -999px; top: 0; background: var(--ax-card); padding: 0.5rem 1rem; z-index: 10; }
.ax-skip:focus { left: 1rem; }
.ax-header { border-bottom: 1px solid var(--ax-rule); background: var(--ax-surface); position: sticky; top: 0; z-index: 5; }
.ax-nav { max-width: 1180px; margin: 0 auto; padding: 0.55rem 1.5rem; display: flex; gap: 0.25rem; align-items: center; overflow-x: auto; scrollbar-width: none; }
.ax-nav a { color: var(--ax-ink-2); text-decoration: none; padding: 0.3rem 0.6rem; border-radius: 4px; font-size: 0.93rem; white-space: nowrap; }
.ax-nav a:hover { background: #efe9df; color: var(--ax-ink); }
.ax-nav a.active { background: #e9e1d4; color: var(--ax-ink); font-weight: 600; }
.ax-nav .ax-logo { padding: 0 0.6rem 0 0; display: flex; }
.ax-nav .ax-logo:hover { background: none; }
.ax-main { max-width: 1180px; margin: 0 auto; padding: 2.2rem 1.5rem 3rem; outline: none; }
.ax-footer { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1.5rem 3rem; border-top: 1px solid var(--ax-rule); font-size: 0.86rem; color: var(--ax-ink-3); }
.ax-footer > div + div { margin-top: 0.5rem; }
.ax-footer a { color: var(--ax-ink-2); }

.ax-eyebrow { font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ax-ink-3); margin-bottom: 0.35rem; }
.ax-lede { font-size: 1.12rem; color: var(--ax-ink-2); max-width: 46rem; }
.ax-muted { color: var(--ax-ink-3); font-size: 0.9rem; }
.ax-small { color: var(--ax-ink-3); font-size: 0.86rem; line-height: 1.5; }
.ax-links { font-size: 0.95rem; }
.ax-card { background: var(--ax-card); border: 1px solid var(--ax-rule); border-radius: 6px; padding: 1.1rem 1.2rem; height: 100%; }
.ax-card h4 { font-size: 1.08rem; margin: 0 0 0.35rem; }
.ax-step { font-family: var(--ax-serif); color: var(--ax-accent); font-size: 1.5rem; line-height: 1; }
.ax-note { border-left: 3px solid var(--ax-accent); background: #f3ede4; padding: 0.85rem 1.05rem; border-radius: 0 4px 4px 0; color: var(--ax-ink-2); margin: 0.8rem 0; }
.ax-note ul { margin: 0.3rem 0 0 1rem; padding: 0; }
.ax-banner { border: 1px solid var(--ax-rule); border-radius: 6px; padding: 0.85rem 1.05rem; margin: 0.2rem 0 1rem; }
.ax-banner.success { border-left: 4px solid #2f6f4f; background: #f1f5f0; }
.ax-banner.caution { border-left: 4px solid #a8661b; background: #f8f1e6; }
.ax-banner.critical { border-left: 4px solid #9b2c2c; background: #f8ecea; }
.ax-banner strong { color: var(--ax-ink); }
.ax-pred { font-family: var(--ax-serif); font-size: 1.7rem; line-height: 1.2; color: var(--ax-ink); margin-bottom: 0.4rem; }
.ax-pred.abstained { color: var(--ax-ink-3); font-style: italic; }
.ax-bars { display: block; width: 100%; margin: 0.4rem 0 0.8rem; }
.ax-bar-row { width: 100%; display: grid; grid-template-columns: minmax(0, 44%) minmax(2.5rem, 1fr) 2.8rem; gap: 0.6rem; align-items: center; margin: 0.28rem 0; font-size: 0.92rem; }
.ax-bar-track { background: #ebe5da; height: 10px; border-radius: 0 4px 4px 0; overflow: hidden; }
.ax-bar-fill { background: var(--ax-blue); height: 10px; border-radius: 0 4px 4px 0; }
.ax-bar-fill.top { background: var(--ax-accent); }
.ax-bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--ax-ink-2); }
.ax-evidence { list-style: none; padding-left: 0; margin: 0; }
.ax-evidence li { padding: 0.5rem 0 0.5rem 1.6rem; border-bottom: 1px solid var(--ax-rule); position: relative; font-size: 0.95rem; }
.ax-evidence li::before { position: absolute; left: 0.1rem; top: 0.5rem; font-weight: 600; }
.ax-evidence li.info::before { content: "i"; color: var(--ax-ink-3); font-family: var(--ax-serif); font-style: italic; }
.ax-evidence li.agreement::before { content: "="; color: #2f6f4f; }
.ax-evidence li.disagreement::before { content: "≠"; color: #9b2c2c; }
.ax-evidence li.caution::before { content: "!"; color: #a8661b; }
.ax-meta { display: grid; grid-template-columns: 11rem 1fr; gap: 0.3rem 0.9rem; font-size: 0.93rem; margin: 0; }
.ax-meta dt { color: var(--ax-ink-3); }
.ax-meta dd { margin: 0; color: var(--ax-ink); overflow-wrap: anywhere; }
.ax-caption { font-size: 0.85rem; line-height: 1.4; color: var(--ax-ink-2); margin-top: 0.35rem; overflow-wrap: anywhere; }
.ax-caption b { color: var(--ax-ink); font-weight: 600; }
.ax-stat { font-family: var(--ax-serif); font-size: 2rem; line-height: 1.1; color: var(--ax-ink); font-variant-numeric: tabular-nums; }
.ax-stats { margin: 1rem 0 0.5rem; }

/* Layout */
.ax-grid4, .ax-grid5, .ax-grid6 { display: grid; gap: 1.1rem; align-items: start; }
.ax-grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ax-grid5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ax-grid6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ax-cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.ax-cols-5-7 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.4rem; align-items: start; }
.ax-cols-7-5 { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2.4rem; align-items: start; }

/* Images */
.ax-work { min-width: 0; }
.ax-thumb-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; border-radius: 3px; }
.ax-thumb { display: block; max-width: 100%; max-height: 360px; width: auto; height: auto; border-radius: 3px; background: #ebe5da; }
.ax-noimg { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.ax-preview { display: block; max-width: 100%; max-height: 620px; margin-top: 1rem; border-radius: 3px; }
.ax-detail { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2rem; }
.ax-detail-img { display: block; max-width: 100%; max-height: 620px; border-radius: 3px; margin-bottom: 0.4rem; }

/* Controls */
.ax-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border: 1px solid var(--ax-accent); border-radius: 4px; padding: 0.55rem 1.1rem;
  font: 600 0.95rem var(--ax-sans); text-decoration: none; cursor: pointer; line-height: 1.2; }
.ax-btn-primary { background: var(--ax-accent); color: #fff; }
.ax-btn-primary:hover:not(:disabled) { background: var(--ax-accent-dark); }
.ax-btn-secondary { background: transparent; color: var(--ax-accent); }
.ax-btn-secondary:hover:not(:disabled) { background: #f1e7e2; }
.ax-btn-quiet { border-color: var(--ax-rule); background: var(--ax-card); color: var(--ax-ink-2); font-weight: 500; }
.ax-btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; width: 100%; margin-top: 0.5rem; }
.ax-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ax-cta-row, .ax-btn-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.3rem 0; }
.ax-btn-row .ax-btn { flex: 1 1 10rem; }
.ax-drop { display: flex; flex-direction: column; gap: 0.3rem; padding: 1.2rem; background: var(--ax-card); border: 1.5px dashed #c9bfae; border-radius: 6px; cursor: pointer; }
.ax-drop.over { border-color: var(--ax-accent); background: #f6eee8; }
.ax-drop:focus-within { outline: 2px solid var(--ax-accent); outline-offset: 2px; }
.ax-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ax-drop-title { font-weight: 600; }
.ax-status { border: 1px solid var(--ax-rule); border-radius: 6px; padding: 0.7rem 1rem; background: var(--ax-card); margin-bottom: 1rem; }
.ax-status-title { font-weight: 600; }
.ax-status ul { margin: 0.4rem 0 0 1.1rem; padding: 0; color: var(--ax-ink-2); font-size: 0.92rem; }
.ax-status.done { color: var(--ax-ink-2); font-size: 0.92rem; }
.ax-status.done::before { content: "✓ "; color: #2f6f4f; }
.ax-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--ax-rule); border-radius: 5px; overflow: hidden; background: var(--ax-card); }
.ax-seg button { border: 0; border-right: 1px solid var(--ax-rule); background: none; padding: 0.45rem 0.9rem; font: 0.9rem var(--ax-sans); color: var(--ax-ink-2); cursor: pointer; }
.ax-seg button:last-child { border-right: 0; }
.ax-seg button[aria-checked="true"] { background: #f1e7e2; color: var(--ax-accent); font-weight: 600; }
.ax-tabs { display: flex; flex-wrap: wrap; gap: 0.2rem; border-bottom: 1px solid var(--ax-rule); margin: 1.4rem 0 0.4rem; }
.ax-tabs button { border: 0; background: none; padding: 0.55rem 0.8rem; font: 0.95rem var(--ax-sans); color: var(--ax-ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ax-tabs button[aria-selected="true"] { color: var(--ax-accent); border-bottom-color: var(--ax-accent); font-weight: 600; }
.ax-details { border: 1px solid var(--ax-rule); border-radius: 6px; padding: 0.6rem 1rem; margin: 1rem 0; background: var(--ax-card); }
.ax-details summary { cursor: pointer; font-weight: 500; }
.ax-details[open] summary { margin-bottom: 0.7rem; }
.ax-filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin: 1rem 0; }
.ax-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--ax-ink-2); flex: 1 1 12rem; min-width: 0; }
.ax-field-wide { flex: 3 1 18rem; }
.ax-field input[type="search"], .ax-field select { font: 1rem var(--ax-sans); padding: 0.5rem 0.65rem; border: 1px solid var(--ax-rule); border-radius: 4px; background: var(--ax-card); color: var(--ax-ink); width: 100%; }
.ax-check { flex-direction: row; align-items: center; gap: 0.5rem; padding-bottom: 0.55rem; }
.ax-multi { position: relative; }
.ax-multi summary { list-style: none; cursor: pointer; padding: 0.5rem 0.65rem; border: 1px solid var(--ax-rule); border-radius: 4px; background: var(--ax-card); color: var(--ax-ink); }
.ax-multi summary::-webkit-details-marker { display: none; }
.ax-multi summary::after { content: "▾"; float: right; color: var(--ax-ink-3); }
.ax-multi-list { position: absolute; z-index: 4; left: 0; right: 0; min-width: 14rem; max-height: 18rem; overflow: auto; background: var(--ax-card); border: 1px solid var(--ax-rule); border-radius: 4px; padding: 0.4rem 0.6rem; box-shadow: 0 6px 18px rgba(31, 29, 26, 0.12); }
.ax-multi-list label { display: flex; gap: 0.45rem; padding: 0.2rem 0; color: var(--ax-ink); }
.ax-pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.6rem 0 0.4rem; }

/* Tables */
.ax-table-wrap { overflow-x: auto; margin: 0.6rem 0 0.8rem; border: 1px solid var(--ax-rule); border-radius: 6px; background: var(--ax-card); }
.ax-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.ax-table th, .ax-table td { padding: 0.4rem 0.7rem; border-bottom: 1px solid #ebe5da; text-align: left; vertical-align: top; }
.ax-table th { background: #f3eee6; font-weight: 600; color: var(--ax-ink-2); white-space: nowrap; }
.ax-table tr:last-child td { border-bottom: 0; }
.ax-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ax-cellbar { display: inline-block; width: 5rem; height: 8px; background: #ebe5da; border-radius: 0 3px 3px 0; margin-right: 0.5rem; vertical-align: middle; }
.ax-cellbar span { display: block; height: 8px; background: var(--ax-accent); border-radius: 0 3px 3px 0; }
.ax-chart { width: 100%; min-height: 160px; }

/* Documents */
.ax-doc { max-width: 52rem; }
.ax-doc table { border-collapse: collapse; font-size: 0.9rem; margin: 0.8rem 0; display: block; overflow-x: auto; }
.ax-doc th, .ax-doc td { border: 1px solid var(--ax-rule); padding: 0.35rem 0.6rem; text-align: left; vertical-align: top; }
.ax-doc th { background: #f3eee6; }
.ax-doc pre { background: #efe9df; padding: 0.8rem 1rem; border-radius: 4px; overflow-x: auto; }
.ax-doc pre code { background: none; padding: 0; }
.ax-doc blockquote { border-left: 3px solid var(--ax-rule); margin: 1rem 0; padding: 0 1rem; color: var(--ax-ink-2); }

/* Dialog */
.ax-dialog { width: min(1100px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 1px solid var(--ax-rule); border-radius: 8px; padding: 0; background: var(--ax-surface); color: var(--ax-ink); }
.ax-dialog::backdrop { background: rgba(31, 29, 26, 0.45); }
.ax-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1.4rem; border-bottom: 1px solid var(--ax-rule); position: sticky; top: 0; background: var(--ax-surface); }
.ax-dialog-body { padding: 1.2rem 1.4rem 1.6rem; }

@media (max-width: 900px) {
  .ax-grid5, .ax-grid6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ax-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ax-cols-5-7, .ax-cols-7-5, .ax-detail, .ax-cols-2 { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
}
@media (max-width: 640px) {
  .ax-main { padding: 1.2rem 1rem 2rem; }
  .ax-nav { padding: 0.5rem 1rem; }
  .ax-footer { padding: 1rem 1rem 2rem; }
  .ax-grid5, .ax-grid6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ax-bar-row { font-size: 0.86rem; }
  .ax-meta { grid-template-columns: 1fr; gap: 0; }
  .ax-meta dd { margin-bottom: 0.5rem; }
  .ax-dialog-body { padding: 1rem; }
  .ax-pager .ax-btn { padding: 0.5rem 0.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
