@font-face { font-family: "Roboto"; src: url("/fonts/roboto-latin.woff2") format("woff2"); font-style: normal; font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-400-latin.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-700-latin.woff2") format("woff2"); font-style: normal; font-weight: 700; font-display: swap; }
:root {
  color-scheme: light;
  --canvas: #f4f3f1;
  --head: "Barlow", "Arial Narrow", Arial, sans-serif;
  --surface: #fff;
  --ink: #222;
  --text: #333;
  --muted: #6f6f6f;
  --line: #dcdcda;
  --line-strong: #c4c4c2;
  --wine: #7b2039;
  --wine-dark: #5e1530;
  --wine-wash: #f4e9ec;
  --copper: #982e4f;
  --warning: #845519;
  --danger: #963e3e;
  font-family: "Roboto", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
[hidden] { display: none !important; }
a { color: var(--wine-dark); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--head); }
h1 { font-size: 30px; line-height: 1.2; font-weight: 700; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 700; }
h3 { margin: 17px 0 8px; font-size: 16px; font-weight: 700; }
.paper-head h2, .section-head h2, .hypothesis-title h2, .scenario-heading h2, .assistant > header h2, .home-recent h2, .outcome-strip h2 { font-family: "Roboto", "Segoe UI", Arial, sans-serif; }
small, .muted { color: var(--muted); }
code, .fiscal-code, .result-code, .number { font-family: "Roboto", "Segoe UI", Arial, sans-serif; font-variant-numeric: tabular-nums; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 50; top: -60px; left: 12px; padding: 9px 12px; color: white; background: var(--wine-dark); }
.skip-link:focus { top: 12px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; }
.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px clamp(18px, 3.4vw, 48px);
  background: #1d0f16;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-family: var(--head); font-size: 24px; line-height: 1; white-space: nowrap; }
.brand strong { font-weight: 400; color: #e9b3c3; }
.brand-button { padding: 0; border: 0; background: none; text-align: left; }
.brand-mark {
  width: 31px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  padding-right: 2px;
  color: white;
  background: var(--wine-dark);
  box-shadow: inset 0 0 0 1px #ffffff25;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -2px;
}
.brand-mark span { color: #e7c9d2; }
.topbar-meta { display: flex; align-items: center; gap: 16px; color: #e7dadd; font-size: 13px; }
.topbar-meta a { color: #f3e8eb; }
.topbar-meta span:first-child { color: #e7c9d2; font-weight: 650; }
.dot { display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 0; border-radius: 50%; background: var(--wine); }

.flowbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 43px;
  overflow-x: auto;
  padding: 0 clamp(14px, 2.8vw, 38px);
  border-bottom: 1px solid var(--line);
  background: #ebe5e4;
  scrollbar-width: thin;
}
.flow-step {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
}
.flow-step:not(:disabled):hover { color: var(--wine-dark); background: #f3e8eb; }
.flow-step.active { color: var(--wine-dark); border-bottom-color: var(--wine); font-weight: 650; }
.flow-number { color: #82787a; font-family: "Roboto", "Segoe UI", Arial, sans-serif; font-size: 12px; }
.flow-step.active .flow-number { color: var(--copper); }

.page { width: min(100%, 1400px); margin: 0 auto; padding: 23px clamp(18px, 3.3vw, 46px) 42px; }
.home-page { min-height: calc(100vh - 100px); padding-top: clamp(40px, 9vh, 88px); }
.home-grid { max-width: 1040px; margin: 0 auto; }
.home-content { max-width: 790px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .09em; }
.home-title { margin: 7px 0 17px; font-family: var(--head); font-size: 32px; font-weight: 700; }
.search-form { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong); background: var(--surface); }
.home-search { min-height: 54px; max-width: 790px; gap: 12px; padding: 5px 6px 5px 14px; border-radius: 3px; }
.input-wrap { min-width: 0; display: flex; align-items: center; flex: 1; gap: 10px; }
.input-wrap .icon, .search-icon { color: var(--wine); }
.search-form input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.home-search input { padding: 9px 0; font-size: 14px; }
.search-form input::placeholder, .field input::placeholder { color: #95888d; }
.button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  transition: color .14s ease, background-color .14s ease, border-color .14s ease;
}
.button.primary { color: white; background: var(--wine); }
.button.primary:hover:enabled { background: var(--wine-dark); }
.button.secondary { border-color: var(--line-strong); }
.button.secondary:hover:enabled { border-color: #ac939b; background: #f9f4f3; }
.home-search .button { min-height: 40px; padding-inline: 15px; }
.home-note { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.home-note .icon { width: 14px; height: 14px; color: var(--wine); }
.inline-status { min-height: 0; margin-top: 9px; color: var(--danger); font-size: 14px; }
.inline-status:empty { display: none; }
.inline-status.loading { color: var(--muted); }

.workspace { min-height: calc(100vh - 100px); }
.workspace-header {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 62px;
  padding: 9px clamp(18px, 3.3vw, 46px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.compact-search { flex: 1; max-width: 760px; gap: 9px; padding: 3px 4px 3px 10px; border-radius: 2px; }
.compact-search input { padding: 6px 0; font-size: 14px; }
.compact-search .button { min-height: 29px; padding: 4px 10px; font-size: 12px; }
.reference-date { display: grid; gap: 3px; margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.reference-date input { width: 132px; min-height: 29px; padding: 4px 7px; border: 1px solid var(--line-strong); border-radius: 2px; color: var(--text); background: var(--surface); font-size: 13px; }
.workspace-ambiguity { width: min(100% - 36px, 1310px); margin: 10px auto 0; }
.notice { width: min(100% - 36px, 1310px); margin: 10px auto 0; padding: 8px 11px; border-left: 3px solid var(--wine); color: var(--text); background: var(--wine-wash); font-size: 13px; }
.notice strong { margin-right: 5px; }
.notice.warning { border-color: #b27b2c; color: #6d4a15; background: #f5f0e4; }
.notice.danger { border-color: var(--danger); color: #7c3434; background: #f5e9e7; }
.notice.good { border-color: var(--wine); color: var(--wine-dark); background: #f7eeee; }
.notice.loading:before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border: 1.5px solid #dfc7ce; border-top-color: var(--wine); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
.page-head, .record-header, .analysis-header, .outcome-strip { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.page-head h1, .record-header h1, .analysis-header h1 { font-size: 28px; }
.page-head p, .record-header p, .analysis-header p { margin-top: 3px; font-size: 13px; }
.page-state { display: flex; align-items: center; gap: 12px; }
.result-count { color: var(--muted); font-size: 12px; white-space: nowrap; }

.result-table { border-top: 1px solid var(--line-strong); }
.result-table-head, .result-row { display: grid; grid-template-columns: minmax(125px, .75fr) minmax(240px, 2fr) minmax(190px, 1.1fr) 26px; gap: 14px; align-items: center; }
.result-table-head { min-height: 31px; padding: 0 11px; color: var(--muted); font-size: 12px; font-weight: 650; border-bottom: 1px solid var(--line); }
.result-row { width: 100%; min-height: 58px; padding: 8px 11px; border: 0; border-bottom: 1px solid var(--line); text-align: left; color: var(--text); background: transparent; }
.result-row:hover, .result-row[aria-pressed="true"] { background: #f3e8eb; }
.result-code { color: var(--wine-dark); font-size: 13px; font-weight: 650; }
.result-name { display: block; font-size: 14px; font-weight: 620; }
.result-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.result-source { color: var(--muted); font-size: 12px; }
.result-arrow { color: var(--wine); text-align: right; font-size: 18px; }
.pagination { display: flex; justify-content: flex-end; gap: 7px; margin-top: 11px; }
.empty-inline { padding: 14px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.record-header { align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.record-header .eyebrow { margin-bottom: 4px; }
.record-header>div:last-child { display: flex; align-items: center; gap: 12px; }
.detail-content { min-width: 0; }
.paper { margin: 0; padding: 0 0 13px; border-bottom: 1px solid var(--line); background: transparent; }
.paper + .paper { margin-top: 13px; }
.paper-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 29px; padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.paper-head h2 { font-size: 14px; }
.paper-body { padding: 8px 0 0; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; margin: 0; padding: 0; }
.facts>div { display: grid; grid-template-columns: minmax(145px, .44fr) minmax(0, 1fr); align-items: baseline; gap: 12px; min-height: 32px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.facts>div.full { grid-column: 1 / -1; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: 13px; font-weight: 550; }
.fiscal-code { color: var(--wine-dark); font-size: 12px !important; letter-spacing: -.025em; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 14px; }
.badge, .status { display: inline-flex; align-items: center; width: fit-content; min-height: 19px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 2px; color: #51484b; background: #f1eeed; font-size: 12px; font-weight: 650; line-height: 1.25; }
.badge.good, .status.good { border-color: #d8b8bf; color: var(--wine-dark); background: #f7eeee; }
.badge.warning, .status.warning { border-color: #dfcfad; color: #765418; background: #f6f0e4; }
.badge.danger, .status.danger { border-color: #dfc2be; color: #873c38; background: #f5e9e7; }
.badge.info, .status.info { border-color: #d7cecc; color: #51484b; background: #f1eeed; }
.list-rows { margin: 0; padding: 0; list-style: none; }
.list-rows>li { display: grid; grid-template-columns: minmax(125px, .42fr) minmax(0, 1fr); gap: 4px 14px; align-items: baseline; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.list-rows>li:last-child { border-bottom: 0; }
.list-rows>li>strong { grid-row: span 2; font-size: 13px; }
.list-rows>li>p { margin: 0; color: var(--text); font-size: 12px; }
.metadata, .list-rows .metadata { grid-column: 2; display: flex; flex-wrap: wrap; gap: 5px 14px; color: var(--muted); font-size: 12px; }
.source-link { display: inline-flex; grid-column: 2; width: fit-content; margin-top: 2px; font-size: 12px; }
.diagnostic-list { margin: 7px 0 0; padding-left: 17px; color: var(--text); font-size: 12px; }
.diagnostic-list li + li { margin-top: 4px; }
.evidence-source { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.evidence-source strong { font-size: 13px; }
.fact-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 8px 0 0; }
.fact-lines>div { display: grid; grid-template-columns: minmax(110px, .48fr) minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 5px 1px; border-bottom: 1px solid var(--line); }
.fact-lines dt { color: var(--muted); font-size: 12px; }
.fact-lines dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 12px; }
.technical-details { margin-top: 8px; color: var(--muted); font-size: 12px; }
.technical-details summary { width: fit-content; cursor: pointer; }
.technical-details pre { max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; }

.analysis-header { margin-bottom: 10px; }
.analysis-header>.button { flex: none; }
.analysis-form { margin: 0; }
.form-section { margin: 0; padding: 11px 0 13px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.section-head h2, .hypothesis-title h2 { margin: 0; font-size: 14px; letter-spacing: .005em; }
.field-grid { display: grid; gap: 9px 10px; align-items: end; }
.field-grid-main { grid-template-columns: minmax(175px, 1.45fr) minmax(92px, .78fr) minmax(135px, 1.1fr) minmax(125px, 1fr) minmax(74px, .62fr) minmax(74px, .62fr); }
.field-grid-secondary { grid-template-columns: minmax(155px, 1.05fr) minmax(180px, 1.2fr) minmax(130px, .85fr) minmax(170px, 1.1fr); max-width: 930px; margin-top: 9px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field>span, .field-label-row label { color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; }
.field-label-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.field-label-row label { margin: 0; }
.help-trigger { position: relative; z-index: 1; display: inline-flex; flex: none; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; color: var(--wine-dark); background: transparent; font-size: 13px; line-height: 1; cursor: help; }
.help-trigger::after { content: ""; position: absolute; left: -5px; bottom: 100%; width: calc(100% + 10px); height: 8px; }
.help-trigger:hover, .help-trigger:focus-visible { color: white; background: var(--wine); }
.tooltip { position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 7px); width: min(260px, calc(100vw - 32px)); padding: 8px 10px; border: 1px solid var(--line-strong); color: var(--text); background: var(--surface); box-shadow: none; font-size: 12px; font-weight: 450; line-height: 1.45; text-align: left; white-space: normal; opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 3px); transition: opacity .12s ease, transform .12s ease, visibility .12s; }
.help-trigger:hover .tooltip, .help-trigger:focus .tooltip, .help-trigger:focus-visible .tooltip { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }
.paper-head .tooltip, .scenario.user .scenario-heading .tooltip { right: 0; left: auto; transform: translateY(3px); }
.paper-head .help-trigger:hover .tooltip, .paper-head .help-trigger:focus .tooltip, .paper-head .help-trigger:focus-visible .tooltip,
.scenario.user .scenario-heading .help-trigger:hover .tooltip, .scenario.user .scenario-heading .help-trigger:focus .tooltip, .scenario.user .scenario-heading .help-trigger:focus-visible .tooltip { transform: translateY(0); }
.field input, .field select { width: 100%; min-width: 0; min-height: 31px; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 2px; color: var(--text); background: var(--surface); font-size: 13px; }
.field input:focus, .field select:focus { border-color: var(--wine); outline: 2px solid #711c3517; }
.field-cfop input, .field-tax-code input, .field-rate input, .field-alt-ncm input { font-family: "Roboto", "Segoe UI", Arial, sans-serif; font-variant-numeric: tabular-nums; font-size: 12px; }
.field-ncm input, .field-alt-ncm input { font-family: "Roboto", "Segoe UI", Arial, sans-serif; font-size: 13px; font-variant-numeric: tabular-nums; }
.field-origin, .field-destination { max-width: 93px; }
.field-cfop { max-width: 115px; }
.field-ncm { max-width: 220px; }
.field-operation { max-width: 190px; }
.field-purpose { max-width: 180px; }
.field-crt, .field-document, .field-consumer, .field-recipient { max-width: 220px; }

.advanced { margin: 0; padding: 9px 0 11px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced>summary { width: fit-content; display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer; }
.advanced>summary::marker { color: var(--wine); }
.micro { color: var(--muted); font-size: 12px; font-weight: 500; }
.advanced-body { padding-top: 4px; }
.field-grid-advanced { grid-template-columns: minmax(180px, 1.2fr) minmax(145px, 1fr) minmax(100px, .7fr) minmax(145px, .9fr); max-width: 850px; }
.field-grid-contributions { grid-template-columns: minmax(75px, .55fr) minmax(145px, 1.1fr) minmax(105px, .75fr) minmax(75px, .55fr) minmax(145px, 1.1fr) minmax(105px, .75fr); max-width: 1090px; }
.field-grid-origin { grid-template-columns: minmax(225px, 1.3fr) minmax(190px, 1fr); max-width: 650px; }
.field-grid-reference { grid-template-columns: minmax(145px, 1fr) minmax(85px, .55fr) minmax(115px, .8fr) minmax(160px, 1fr) minmax(230px, 1.5fr); margin-top: 10px; }
.field-tax-code { max-width: 125px; }
.field-amount { max-width: 185px; }
.field-rate { max-width: 120px; }
.field-evidence-id { max-width: 280px; }
.field-publication { max-width: 130px; }
.field-source-uri { max-width: 430px; }
.field-grid-hypothesis { grid-template-columns: minmax(175px, 220px); }
.field-alt-ncm { max-width: 220px; }
.hypothesis-section { margin-top: 2px; border-bottom: 1px solid var(--line); }
.hypothesis-title { display: flex; align-items: center; gap: 5px; }
.analysis-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 11px; }
.analysis-actions .button { min-height: 35px; }

.comparison-result { min-width: 0; }
.outcome-strip { align-items: flex-end; margin: 0 0 13px; padding: 0 0 10px; border-bottom: 1px solid var(--line-strong); }
.outcome-strip h2 { margin-top: 3px; font-size: 16px; }
.outcome-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--muted); font-size: 12px; }
.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.scenario { min-width: 0; border-top: 2px solid #8f8384; }
.scenario.current { border-top-color: #8f8384; }
.scenario.fiscal { border-top-color: var(--wine); }
.scenario.user { border-top-color: var(--copper); }
.scenario + .scenario { border-left: 1px solid var(--line); }
.scenario-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 39px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.scenario-heading { min-width: 0; display: flex; align-items: center; gap: 4px; }
.scenario-heading h2 { font-size: 13px; }
.scenario-body { padding: 8px 10px 10px; }
.scenario-finding { margin-bottom: 6px; color: var(--ink); font-size: 14px; font-weight: 650; }
.scenario-body .fact-lines { display: block; margin-top: 4px; }
.scenario-body .fact-lines>div { display: flex; justify-content: space-between; gap: 9px; padding: 5px 0; }
.scenario-body .fact-lines dt, .scenario-body .fact-lines dd { font-size: 12px; }
.scenario-body .fact-lines dd { text-align: right; font-weight: 600; }
.decision-note { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.impact-summary { display: grid; gap: 4px; margin: 1px 10px 10px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12px; }
.impact-summary>span { font-family: "Roboto", "Segoe UI", Arial, sans-serif; font-size: 13px; font-weight: 650; }
.impact-summary small, .impact-summary p { font-size: 12px; }
.comparison-result>.paper { margin-top: 14px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.tax-table { width: 100%; min-width: 880px; border-collapse: collapse; font-size: 12px; }
.tax-table th, .tax-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tax-table thead th { color: var(--muted); background: #ebe5e4; font-size: 12px; font-weight: 650; white-space: nowrap; }
.tax-table tbody th { font-size: 12px; font-weight: 650; }
.tax-table td.number { text-align: right; white-space: nowrap; }
.tax-table .unknown { color: var(--muted); font-size: 12px; }
.cell-state { display: block; margin-top: 2px; color: var(--muted); font-family: "Roboto", "Segoe UI", Arial, sans-serif; font-size: 12px; white-space: normal; }
.coverage { min-width: 150px; color: var(--muted); font-size: 12px; }
.coverage>span { display: block; }
.coverage-reasons { margin-top: 3px; }
.coverage-reasons summary { width: fit-content; cursor: pointer; color: var(--wine-dark); font-size: 12px; }
.coverage-reasons ul { margin: 3px 0 0; padding-left: 14px; }
.coverage-reasons li + li { margin-top: 3px; }
.limitations { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.limitations .paper-head { min-height: 24px; }
.limitations ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 7px 0 0; padding-left: 15px; color: var(--muted); font-size: 12px; }

.ambiguity { margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line-strong); background: #ebe5e4; }
.ambiguity>p { margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.ambiguity .choices { display: flex; flex-wrap: wrap; gap: 6px; }
.ambiguity .button { min-height: 28px; }

@media (max-width: 1050px) {
  .field-grid-main { grid-template-columns: minmax(165px, 1.4fr) minmax(88px, .75fr) repeat(2, minmax(125px, 1fr)); }
  .field-grid-main .field-origin, .field-grid-main .field-destination { grid-column: span 1; }
  .field-grid-secondary { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .field-grid-secondary .field { max-width: none; }
  .field-grid-contributions { grid-template-columns: repeat(3, minmax(100px, 1fr)); }
  .field-grid-reference { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .scenario-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { min-height: 51px; padding-inline: 13px; }
  .topbar-meta { gap: 0; font-size: 12px; }
  .topbar-meta span:last-child { display: none; }
  .brand { font-size: 14px; }
  .brand-mark { width: 28px; height: 28px; }
  .flowbar { padding-inline: 5px; }
  .flow-step { min-height: 39px; padding-inline: 9px; font-size: 12px; }
  .page { padding: 17px 13px 30px; }
  .home-page { min-height: calc(100vh - 90px); padding-top: 48px; }
  .home-title { font-size: 26px; }
  .home-search { align-items: stretch; min-height: 48px; padding-left: 9px; gap: 6px; }
  .home-search .icon { display: none; }
  .home-search input { font-size: 14px; }
  .home-search .button { min-height: 36px; padding-inline: 10px; font-size: 12px; }
  .home-search .button .icon { display: none; }
  .workspace-header { flex-wrap: wrap; gap: 8px; padding: 9px 12px; }
  .compact-search { flex-basis: 100%; order: 2; }
  .reference-date { grid-auto-flow: column; align-items: center; gap: 7px; margin: 0 0 0 auto; }
  .reference-date input { width: 125px; }
  .workspace-ambiguity, .notice { width: calc(100% - 24px); }
  .page-head, .analysis-header { align-items: flex-start; }
  .page-head h1, .analysis-header h1, .record-header h1 { font-size: 24px; }
  .result-table-head { display: none; }
  .result-row { grid-template-columns: minmax(90px, .65fr) minmax(0, 1.6fr) 20px; gap: 8px; min-height: 62px; padding-inline: 5px; }
  .result-source { display: none; }
  .result-arrow { grid-column: 3; grid-row: 1; }
  .record-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .record-header>div:last-child { flex-wrap: wrap; }
  .facts { grid-template-columns: 1fr; }
  .facts>div.full { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; gap: 15px; }
  .list-rows>li { grid-template-columns: 1fr; gap: 4px; }
  .list-rows>li>strong { grid-row: auto; }
  .metadata, .list-rows .metadata, .source-link { grid-column: 1; }
  .fact-lines { grid-template-columns: 1fr; }
  .field-grid-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid-main .field-ncm, .field-grid-main .field-operation, .field-grid-main .field-purpose { grid-column: span 2; max-width: none; }
  .field-grid-main .field-origin, .field-grid-main .field-destination, .field-grid-main .field-cfop { grid-column: span 1; max-width: none; }
  .field-grid-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid-secondary .field { max-width: none; }
  .field-grid-advanced, .field-grid-contributions, .field-grid-reference { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid-origin { grid-template-columns: 1fr; }
  .field-grid-hypothesis { grid-template-columns: minmax(0, 220px); }
  .analysis-actions { flex-direction: column-reverse; }
  .analysis-actions .button { width: 100%; }
  .outcome-strip { align-items: flex-start; flex-direction: column; }
  .outcome-meta { align-items: flex-start; }
  .scenario-grid { grid-template-columns: 1fr; }
  .scenario + .scenario { border-left: 0; border-top-width: 1px; }
  .scenario.current { border-top-width: 2px; }
  .limitations ul { grid-template-columns: 1fr; gap: 5px; }
  .tax-table { min-width: 820px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.comparison-stack{display:flex;flex-direction:column;gap:16px}
.comparison-stack>.assistant{order:-1}
#comparison-result[hidden]+.assistant{display:none}
.assistant{border:1px solid var(--line);border-left:3px solid var(--wine);background:var(--surface);padding:14px 18px}
.assistant>header{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:8px}
.assistant>header h2{font-size:14px;letter-spacing:.04em;text-transform:uppercase;color:var(--wine-dark);margin:0}
.assistant>header span{color:var(--muted);font-size:12px}
.assistant-body{font-size:14px;line-height:1.5}
.assistant-headline{font-weight:600;margin:0 0 8px;color:var(--ink)}
.assistant-asked{color:var(--muted);font-size:12px;margin:0 0 4px}
.assistant-loading{color:var(--muted);margin:0}
.assistant-body section{margin:10px 0 0}
.assistant-body h3{font-size:12px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:0 0 4px}
.assistant-body ul{margin:0;padding-left:18px}
.assistant-body li{margin:2px 0}
.assistant-ask{background:var(--wine-wash);padding:8px 12px}
.assistant-notice{color:var(--muted);font-size:12px;margin:12px 0 0}
.assistant-chips{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 8px}
.assistant-chips button{border:1px solid var(--line-strong);background:transparent;color:var(--wine-dark);padding:5px 10px;font:inherit;font-size:13px;cursor:pointer}
.assistant-chips button:hover:not(:disabled){background:var(--wine-wash)}
.assistant-chips button:disabled{opacity:.5;cursor:default}
.assistant-form{display:flex;gap:8px}
.assistant-form input{flex:1;min-width:0;border:1px solid var(--line-strong);background:#fff;padding:7px 10px;font:inherit;font-size:14px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Ficha fiscal: identification first, then hierarchy, CEST and the points that limit the reading */
.record-header{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid var(--line-strong)}
.ficha-title h1{margin:4px 0 3px;font-size:19px;line-height:1.3;font-weight:650;max-width:92ch}
.ficha-ncm{display:flex;align-items:center;gap:10px;margin:0}
.ficha-ncm .fiscal-code{font-size:20px;font-weight:700;letter-spacing:.01em;color:var(--wine-dark)}
.ficha-meta{margin:0;color:var(--muted);font-size:13px}
.record-header .header-actions{display:flex;gap:8px;flex-shrink:0}
.ficha{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:30px;align-items:start}
.ficha-main>.paper{margin-bottom:16px}
.ficha-side{position:sticky;top:12px}
.ficha-side>.paper,.ficha-side>.notice{margin-bottom:12px}
.facts-dense{grid-template-columns:repeat(4,minmax(0,1fr))}
.hierarchy{margin:0;padding:0;list-style:none}
.hierarchy li{display:grid;grid-template-columns:92px minmax(0,1fr);gap:12px;padding:6px 0;border-bottom:1px solid var(--line);font-size:13px}
.hierarchy li:last-child{border-bottom:0}
.limits{margin:6px 0 0;padding-left:18px;color:var(--muted);font-size:13px}
.limits li{margin:3px 0}
.data-table{width:100%;border-collapse:collapse;font-size:13px}
.data-table th{text-align:left;font-size: 12px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);font-weight:650;padding:6px 10px 6px 0;border-bottom:1px solid var(--line-strong)}
.data-table td{padding:6px 10px 6px 0;border-bottom:1px solid var(--line);vertical-align:top}
.data-table td:first-child{white-space:nowrap}
.more-link{margin:8px 0 0}
.link-button{border:0;background:none;padding:0;color:var(--wine-dark);font:inherit;font-size:13px;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
@media(max-width:1100px){.ficha{grid-template-columns:minmax(0,1fr)}.ficha-side{position:static}.facts-dense{grid-template-columns:repeat(2,minmax(0,1fr))}.record-header{flex-direction:column}}

/* Comparison: the result keeps the wide column and the Assistant sits beside it */
@media(min-width:1180px){
.comparison-stack{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:26px;align-items:start}
.comparison-stack>#comparison-result{grid-column:1;grid-row:1}
.comparison-stack>.assistant{order:0;grid-column:2;grid-row:1;position:sticky;top:12px;max-height:calc(100vh - 24px);overflow:auto}
}
.facts-dense{grid-template-columns:repeat(4,minmax(0,1fr));gap:0 24px}
.facts-dense>div{display:block;padding:6px 0 8px;border-bottom:0}
.facts-dense dt{font-size: 12px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);font-weight:650}
.facts-dense dd{margin:2px 0 0;font-weight:600;font-size:14px;white-space:normal;overflow-wrap:anywhere}
.data-table td:nth-child(3),.data-table td:nth-child(4){white-space:nowrap}

.home-examples{margin:10px 0 0;color:var(--muted);font-size:13px}
.home-examples .link-button{margin-left:12px}
.home-grid{display:grid;grid-template-columns:minmax(0,790px) minmax(260px,1fr);gap:56px;max-width:1280px}
.home-recent{border-left:1px solid var(--line-strong);padding-left:28px;align-self:start;margin-top:41px}
.home-recent h2{margin:0 0 8px;font-size:12px;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.recent-list{list-style:none;margin:0 0 10px;padding:0}
.recent-list a{display:flex;flex-direction:column;gap:2px;padding:7px 0;border-bottom:1px solid var(--line);text-decoration:none;color:var(--ink)}
.recent-list a:hover strong{color:var(--wine)}
.recent-list strong{font-size:13px}
.recent-list span{font-size:12px;color:var(--muted)}
@media(max-width:980px){.home-grid{grid-template-columns:minmax(0,1fr)}.home-recent{border-left:0;padding-left:0;margin-top:8px}}

/* Typography: Roboto body 14px, dense tables 13px; Barlow 700 for large titles */
h1 { font-weight: 650; }
.fact-lines dt, .fact-lines dd, .scenario-body .fact-lines dt, .scenario-body .fact-lines dd { font-size: 13px; }
.tax-table, .tax-table tbody th { font-size: 13px; }
.cell-state, .decision-note, .impact-summary small, .impact-summary p { font-size: 12px; }
.fiscal-code, .number, code { font-variant-numeric: tabular-nums; }

/* Folded detail: technical material stays one click away */
.fold { margin: 14px 0 0; border-top: 1px solid var(--line); }
.fold>summary { cursor: pointer; padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--wine-dark); }
.fold>ul, .fold>.list-rows { margin-bottom: 8px; }
.fold h4, .assistant-details h4 { margin: 10px 0 3px; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.fact-origin { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.same-as { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.list-rows { list-style: none; margin: 0; padding: 0; }
.list-rows li { padding: 4px 0; font-size: 13px; }

/* Assistant: conclusion, pendencies and main facts first; the rest folds */
.assistant-headline { font-size: 15px; font-weight: 650; line-height: 1.4; }
.assistant-body h3 { font-size: 12px; font-weight: 650; }
.assistant-pending { border-left: 3px solid var(--warning); background: var(--wine-wash); padding: 8px 12px; margin-top: 12px; }
.assistant-pending h3 { color: var(--warning); }
.assistant-pending ul { padding-left: 16px; }
.assistant-facts dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; margin: 4px 0 0; }
.assistant-facts dl>div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.assistant-facts dt { color: var(--muted); }
.assistant-facts dd { margin: 0; font-weight: 600; text-align: right; }
.assistant-facts p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.assistant-details { margin-top: 12px; border-top: 1px solid var(--line); }
.assistant-details>summary { cursor: pointer; padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--wine-dark); }
.assistant-details ul { font-size: 13px; color: var(--muted); }
@media(max-width:560px){ .assistant-facts dl { grid-template-columns: 1fr; } }

/* Header: brand on the left, only the account actions on the right */
a.brand-button { color: #fff; text-decoration: none; }
.topbar-meta a, .topbar-meta button { color: #f3e8eb; font-size: 13px; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.topbar-meta a:hover, .topbar-meta button:hover { text-decoration: underline; text-underline-offset: 3px; }
.topbar-meta a[data-login-link] { border: 1px solid #9a7f87; padding: 5px 12px; }
.topbar-meta a[data-login-link]:hover { background: #4b1020; text-decoration: none; }

/* Step navigation: small round buttons that really move between steps */
.flowbar { align-items: center; }
.flow-nav { flex: 0 0 auto; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 6px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--wine-dark); }
.flow-nav .icon { width: 15px; height: 15px; stroke-width: 2; }
.flow-nav:not(:disabled):hover { background: var(--wine-wash); }
.flow-nav:not(.next) .icon { transform: scaleX(-1); }
.flow-nav.next { margin: 0 0 0 6px; }
.flow-nav:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
.flow-step:not(.active) { font-size: 12px; }

.flow-nav:has(.flow-back-label:not([hidden])){width:auto;border-radius:14px;padding:0 11px 0 6px;gap:4px;display:inline-flex;align-items:center;font:inherit;font-size:12px;font-weight:600;color:var(--wine-dark)}.flow-back-label{white-space:nowrap}
.context-hint{margin:8px 0 0;font-size:13px;color:var(--wine-dark)}.analysis-form .auto-filled{background:#f6eef0;border-color:#c9a6ae}
