/* MMS Custas Judiciais — visual alinhado ao tema B do MMS Gestão de Demandas. */
:root {
  --paper: #f7f6f3;
  --surface: #ffffff;
  --line: #dfe2e3;
  --line-strong: #d2d7d8;
  --line-soft: #eceeee;
  --muted: #626b72;
  --ink: #191d20;
  --graphite: #31383d;
  --primary: #1d252d;
  --primary-hover: #313b43;
  --gold: #b89219;
  --gold-soft: #f8f0d0;
  --gold-select: #f7edc8;
  --gold-wash: #fdf9ec;
  --focus-ring: rgba(184, 146, 25, .24);
  --shadow: 0 1px 2px rgba(17, 24, 28, .035);
  --shadow-float: 0 10px 30px rgba(20, 29, 35, .08);
  --warn-bg: #fff8e1; --warn-line: #e9d79a; --warn-text: #6f5112;
  --err-bg: #faeaea; --err-line: #f0caca; --err-text: #9f3434;
  --ok: #15803d; --ok-soft: #e3f5e8;
  --radius: 10px;
  --radius-sm: 7px;
  --side: 232px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.45 Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif; }
a { color: var(--ink); }
h1, h2, h3 { margin: 0; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 2.2vw, 2.1rem); line-height: 1.18; letter-spacing: -.025em; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }

/* ---------- barra lateral ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column; width: var(--side); height: 100dvh; padding: 16px 10px 14px; overflow-y: auto; border-right: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0 6px 22px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: #111; color: #fff; box-shadow: inset 0 -3px 0 var(--gold); font-size: .64rem; font-weight: 800; letter-spacing: .05em; }
.brand-text { display: grid; line-height: 1.2; }
.brand-text strong { font-size: .86rem; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: .72rem; }
.nav { display: flex; flex: 1 0 auto; flex-direction: column; gap: 1px; }
.nav-heading { padding: 16px 10px 5px; color: #7a8389; font-size: 10px; font-weight: 800; letter-spacing: .09em; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-link { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: .5rem .65rem; border-radius: var(--radius-sm); color: #3d4951; font-size: .82rem; font-weight: 560; text-decoration: none; }
.nav-link:hover { background: #f2f4f5; }
.nav-link.is-current { background: var(--gold-select); color: #171b1e; font-weight: 750; }
.nav-icon { display: inline-flex; justify-content: center; width: 18px; color: #58636a; font-size: 15px; line-height: 1; }
.nav-sigla { flex: 0 0 auto; min-width: 40px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--graphite); font-size: .64rem; font-weight: 800; letter-spacing: .03em; text-align: center; }
.nav-link.is-current .nav-sigla { border-color: #e2cf8b; }
.sidebar-foot { margin: 16px 6px 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; line-height: 1.4; }
.backdrop { display: none; }

/* ---------- barra superior ---------- */
.workbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 56px; margin-left: var(--side); padding: 0 clamp(20px, 2.5vw, 38px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .98); }
.workbar-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; color: var(--muted); font-size: .86rem; white-space: nowrap; }
.workbar-crumbs a { color: var(--muted); text-decoration: none; }
.workbar-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.workbar-crumbs .sep { color: #b3b9bd; }
.workbar-crumbs strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; }
.menu-button { display: none; }

.container { min-width: 0; margin-left: var(--side); padding: 24px clamp(20px, 2.5vw, 38px) 56px; }

/* ---------- botões e campos ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 .9rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--graphite); font: inherit; font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .12s ease, border-color .12s ease; }
.button:hover { border-color: var(--gold); background: var(--gold-wash); color: var(--ink); }
.button-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.button-primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); color: #fff; }
.button-quiet { border-color: transparent; background: transparent; color: #4e5a63; }
.button-quiet:hover { border-color: var(--line); background: #f2f4f5; }
.button.is-done { border-color: #a8c9b1; background: #f5fbf6; color: #2b6541; }

input[type="text"], input[type="number"], input[type="search"] { width: 100%; min-height: 38px; padding: .45rem .65rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink); font: inherit; font-size: .86rem; }
input:hover { border-color: #b9bfc2; }
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus-ring); }
input:disabled { border-color: var(--line); background: #f1f2f1; color: var(--muted); }
input.invalid { border-color: #c0392b; box-shadow: 0 0 0 3px var(--err-bg); }
input[type="checkbox"] { flex: 0 0 auto; width: 17px; height: 17px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.field { display: grid; gap: 4px; }
.field > span { color: var(--graphite); font-size: .74rem; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--graphite); font-size: .82rem; cursor: pointer; }
.search-box { position: relative; display: block; width: 100%; max-width: 440px; }
.search-box::before { content: "⌕"; position: absolute; top: 50%; left: 11px; color: #7a8389; font-size: 1.1rem; line-height: 1; transform: translateY(-55%); pointer-events: none; }
.search-box input { min-height: 40px; padding-left: 32px; }
.money-input { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.money-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus-ring); }
.money-input > span { display: flex; align-items: center; padding: 0 0 0 .65rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.money-input input { border: 0; background: transparent; box-shadow: none !important; font-variant-numeric: tabular-nums; }
.money-input.invalid { border-color: #c0392b; box-shadow: 0 0 0 3px var(--err-bg); }
.money-input.disabled { border-color: var(--line); background: #f1f2f1; }

/* ---------- cabeçalhos e cartões ---------- */
.page-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; }
.page-heading p { max-width: 720px; margin-top: .4rem; color: var(--muted); }
.heading-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.card { margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head small { color: var(--muted); font-size: .78rem; }
.card-body { padding: 16px 18px; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 800; vertical-align: 1px; }

.alert { margin-bottom: 14px; padding: .7rem .9rem; border: 1px solid; border-left-width: 4px; border-radius: 8px; font-size: .82rem; }
.alert ul { margin: .3rem 0 0; padding-left: 18px; }
.alert li + li { margin-top: 2px; }
.alert.warn { border-color: var(--warn-line); border-left-color: var(--gold); background: var(--warn-bg); color: var(--warn-text); }
.alert.error { border-color: var(--err-line); border-left-color: #b73931; background: var(--err-bg); color: var(--err-text); }
details.alert > summary { font-weight: 750; cursor: pointer; }

/* ---------- página inicial ---------- */
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 10px; }
.section-title h2 { font-size: .95rem; }
.section-title .count-pill { margin-left: 2px; }
.count-pill { display: inline-flex; align-items: center; min-width: 22px; padding: 1px 8px; border-radius: 999px; background: #eceeee; color: var(--graphite); font-size: .7rem; font-weight: 800; }
.count-pill.gold { background: var(--gold-soft); color: #6c5410; }
.tj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.tj-card { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 16px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.tj-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tj-sigla { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.tj-nome { margin-top: 2px; color: var(--muted); font-size: .82rem; }
.uf-pill { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--graphite); font-size: .7rem; font-weight: 800; }
.tj-tabelas { display: grid; gap: 8px; }
.tj-tabela { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; color: var(--ink); text-decoration: none; transition: border-color .12s ease, background .12s ease; }
.tj-tabela strong { display: block; font-size: .9rem; }
.tj-tabela small { display: block; color: var(--muted); font-size: .76rem; }
.tj-tabela .go { flex: 0 0 auto; color: var(--graphite); font-size: .78rem; font-weight: 750; }
.tj-tabela:hover, .tj-tabela:focus-visible { border-color: var(--gold); background: var(--gold-wash); }
.tj-tabela:hover .go { color: var(--ink); }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.soon { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 11px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); }
.soon strong { flex: 0 0 auto; min-width: 46px; color: #4e5a63; font-size: .8rem; }
.soon span { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 28px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }

/* ---------- simulador ---------- */
.sim-heading .tabs { display: flex; flex-wrap: wrap; gap: 1.25rem; width: 100%; margin-top: 4px; border-bottom: 1px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; min-height: 38px; padding: .45rem .1rem; border-bottom: 2px solid transparent; color: #5c666d; font-size: .84rem; font-weight: 650; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { border-bottom-color: var(--gold); color: #171b1f; font-weight: 750; }
.sources { margin: .5rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .78rem; }
.sources li::before { content: "§ "; color: var(--gold); font-weight: 800; }

.sim-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.sim-main { min-width: 0; }

/* cenários */
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.scenario { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-top: 3px solid var(--primary); border-radius: 8px; background: #fff; }
.scenario-head { display: flex; align-items: center; gap: 6px; }
.scenario-name { min-height: 32px !important; padding: .2rem .4rem !important; border-color: transparent !important; font-weight: 750; }
.scenario-name:hover { border-color: var(--line) !important; }
.scenario-name:focus { border-color: var(--gold) !important; }
.icon-button { display: inline-grid; flex: 0 0 auto; place-items: center; width: 30px; height: 30px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #6a747a; font-size: 1.05rem; line-height: 1; cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: #f2f4f5; color: var(--ink); }
.icon-button:disabled { opacity: .35; cursor: default; }
.icon-button:disabled:hover { border-color: transparent; background: transparent; }
.scenario-add { display: grid; place-items: center; align-content: center; gap: 2px; min-height: 120px; border: 1px dashed var(--line-strong); border-radius: 8px; background: transparent; color: var(--graphite); font: inherit; font-size: .84rem; font-weight: 750; cursor: pointer; }
.scenario-add span { font-size: 1.4rem; font-weight: 400; line-height: 1; }
.scenario-add small { color: var(--muted); font-weight: 500; }
.scenario-add:hover { border-color: var(--gold); background: var(--gold-wash); }

/* casos */
.case-list { display: grid; gap: 12px; }
.case { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafaf9; }
.case-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.case-head .case-name { flex: 1 1 200px; min-height: 36px !important; border-color: transparent !important; background: transparent !important; font-size: 1rem; font-weight: 800; }
.case-head .case-name:hover { border-color: var(--line) !important; background: #fff !important; }
.case-head .case-name:focus { border-color: var(--gold) !important; background: #fff !important; }
.case-party { flex: 1 1 220px; min-height: 36px !important; }
.case-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; margin-top: 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: transparent; color: var(--graphite); font: inherit; font-size: .9rem; font-weight: 750; cursor: pointer; }
.case-add span { font-size: 1.4rem; font-weight: 400; line-height: 1; }
.case-add small { color: var(--muted); font-weight: 500; }
.case-add:hover { border-color: var(--gold); background: var(--gold-wash); }
.result thead tr:not(.sub) th:not(:first-child) { min-width: 120px; max-width: 220px; white-space: normal; }
.result .th-party { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.result thead tr.case-row th:not(:first-child) { border-left: 1px solid var(--line); text-align: center; color: var(--ink); }
.result tfoot tr.grand td { border-top: 2px solid var(--gold); }
.summary-list li.summary-grand { border-top: 2px solid var(--gold); }
.summary-grand .s-total { grid-row: auto; }

/* itens */
.items-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.items-toolbar .search-box { flex: 1 1 260px; }
details.group { margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
details.group > summary { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: #fafaf9; font-size: .86rem; font-weight: 750; list-style: none; cursor: pointer; user-select: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "›"; display: inline-block; width: 10px; color: #7a8389; font-size: 1.1rem; line-height: 1; transition: transform .12s ease; }
details.group[open] > summary::before { transform: rotate(90deg); }
details.group > summary:hover { background: #f4f4f2; }
details.group[open] > summary { border-bottom: 1px solid var(--line); }
.group-title { flex: 1; min-width: 0; }
.group-meta { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; color: var(--muted); font-size: .74rem; font-weight: 600; }

.rule { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 10px; padding: 11px 14px; border-top: 1px solid var(--line-soft); transition: background .12s ease; }
.rule:first-child { border-top: 0; }
.rule:hover { background: #fcfcfb; }
.rule.selected { background: var(--gold-wash); box-shadow: inset 3px 0 0 var(--gold); }
.rule-check { padding-top: 2px; }
.rule-name { display: block; font-size: .86rem; font-weight: 700; line-height: 1.35; cursor: pointer; }
.rule-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 5px; }
.badge { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: #f4f5f4; color: var(--graphite); font-size: .72rem; font-weight: 700; }
.source { color: var(--muted); font-size: .72rem; }
.rule-options { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.rule-options .check { font-size: .8rem; }
.rule-inputs { display: none; grid-column: 2; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 10px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed #e6dcb6; }
.rule.selected .rule-inputs { display: grid; }
.rule-inputs .grow { grid-column: span 2; }
.rule-inputs .field > span { color: var(--muted); font-size: .7rem; }
.rule-inputs input { min-height: 34px; }
details.notes { margin-top: 6px; color: var(--muted); font-size: .76rem; }
details.notes summary { width: max-content; font-weight: 650; cursor: pointer; }
details.notes summary:hover { color: var(--ink); }
details.notes ul { margin: 4px 0 0; padding-left: 18px; }
.no-match { padding: 14px; color: var(--muted); font-size: .84rem; text-align: center; }

/* resumo fixo */
.summary { position: sticky; top: 72px; padding: 16px; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-float); }
.summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.summary-head .eyebrow { margin: 0; }
.summary-head small { color: var(--muted); font-size: .74rem; }
.summary-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.summary-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.summary-list li:first-child { border-top: 0; padding-top: 0; }
.s-name { overflow: hidden; font-size: .8rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.s-base { grid-column: 1; color: var(--muted); font-size: .72rem; }
.s-total { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.summary-empty { color: var(--muted); font-size: .82rem; }
.summary-warn { margin-top: 10px; padding: 6px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-text); font-size: .74rem; font-weight: 650; }
.summary-actions { display: grid; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.summary-actions .button { width: 100%; }

/* resultado */
.result-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.result { width: 100%; min-width: 640px; border-collapse: collapse; }
.result th, .result td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; white-space: nowrap; }
.result th:first-child, .result td:first-child { position: sticky; left: 0; min-width: 280px; background: #fff; text-align: left; white-space: normal; }
.result thead th { background: #f9faf9; color: #657078; font-size: .7rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.result thead tr.sub th { color: var(--ink); font-size: .78rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.result tbody tr:hover td { background: #fbfaf5; }
.result tbody td { font-size: .84rem; }
.result tfoot td { border-bottom: 0; background: #f6f4ec; font-size: .98rem; font-weight: 800; }
.result tfoot td:first-child { background: #f6f4ec; }
.zero { color: var(--muted); }
.pending { color: var(--warn-text); font-style: italic; }
.cell-name { font-weight: 700; }
.cell-src, .cell-obs { color: var(--muted); font-size: .72rem; }
details.memo-box { margin-top: 14px; }
details.memo-box > summary { display: inline-flex; align-items: center; gap: 6px; color: var(--graphite); font-size: .84rem; font-weight: 750; cursor: pointer; }
.memo { max-height: 420px; margin: 10px 0 0; padding: 12px 14px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fafaf9; font: 12px/1.5 Consolas, "Cascadia Mono", Monaco, monospace; white-space: pre-wrap; }

/* ---------- exportação, relatório do cliente e janelas ---------- */
.nav-grow { flex: 1; min-width: 0; }
.field-hint { color: var(--muted); font-size: .72rem; }
dialog.modal { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); background: #fff; color: var(--ink); box-shadow: var(--shadow-float); }
dialog.modal::backdrop { background: rgba(19, 27, 33, .42); }
.modal-card { display: grid; gap: 14px; padding: 18px 20px 20px; }
.modal-card .alert { margin: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { font-size: 1.08rem; }
.modal-text { margin: 0; color: var(--muted); font-size: .82rem; }
.modal-body { display: grid; gap: 12px; }
.modal-body .summary-warn { margin: 0; }
.modal-fieldset { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.modal-fieldset legend { padding: 0 4px; color: var(--graphite); font-size: .74rem; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); padding: 10px 16px; border-radius: 999px; background: var(--primary); color: #fff; box-shadow: 0 8px 24px rgba(20, 29, 35, .25); font-size: .84rem; font-weight: 650; transform: translateX(-50%); }
.toast a { color: var(--gold-soft); font-weight: 800; white-space: nowrap; }
.empty p { margin: 0 0 10px; }
.print-head, .print-foot { display: none; }

/* ---------- entrada (login) e usuário ---------- */
input[type="email"], input[type="password"], textarea { width: 100%; min-height: 38px; padding: .45rem .65rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink); font: inherit; font-size: .86rem; }
textarea { resize: vertical; line-height: 1.4; }
textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus-ring); }
body.auth .sidebar, body.auth .workbar, body.auth .backdrop { display: none; }
body.auth .container { display: grid; place-items: center; min-height: 100dvh; margin-left: 0; padding: 24px 16px; }
.login-card { display: grid; gap: 14px; width: min(380px, 100%); padding: 26px 24px; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-float); }
.login-card h1 { font-size: 1.35rem; }
.login-card .alert { margin: 0; }
.login-card .button { width: 100%; min-height: 42px; }
.login-brand { margin: 0 0 4px; }
.user-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 6px 0; padding: 10px 0 0; border-top: 1px solid var(--line); }
.user-name { overflow: hidden; color: var(--graphite); font-size: .8rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.user-box .button { min-height: 30px; padding: 0 .6rem; font-size: .76rem; }
.user-box + .sidebar-foot { margin-top: 10px; }

/* ---------- assistente ---------- */
.asst-fab { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--primary); border-radius: 999px; background: var(--primary); color: #fff; box-shadow: 0 8px 24px rgba(20, 29, 35, .22); font: inherit; font-size: .86rem; font-weight: 750; cursor: pointer; }
.asst-fab:hover { background: var(--primary-hover); }
.asst-fab-icon { color: var(--gold); font-size: 1rem; }
body.asst-open .asst-fab { display: none; }
.asst-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 90; display: none; flex-direction: column; width: min(420px, 100vw); border-left: 1px solid var(--line); background: var(--paper); box-shadow: -14px 0 30px rgba(20, 29, 35, .1); }
.asst-panel.is-open { display: flex; }
.asst-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.asst-title { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.asst-title strong { font-size: .92rem; }
.asst-title small { color: var(--muted); font-size: .74rem; }
.asst-head .button { min-height: 32px; padding: 0 .6rem; font-size: .76rem; }
.asst-log { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 14px; overflow-y: auto; }
.asst-msg { max-width: 92%; padding: 9px 12px; border-radius: 10px; font-size: .86rem; overflow-wrap: anywhere; }
.asst-msg.user { align-self: flex-end; background: var(--primary); color: #fff; white-space: pre-wrap; }
.asst-msg.ia { align-self: flex-start; border: 1px solid var(--line); background: #fff; }
.asst-msg.erro { align-self: stretch; max-width: none; border: 1px solid var(--err-line); background: var(--err-bg); color: var(--err-text); }
.asst-msg.pensando { color: var(--muted); font-style: italic; }
.asst-text p + p, .asst-text p + ul, .asst-text ul + p { margin-top: .5rem; }
.asst-text ul { margin: 0; padding-left: 18px; }
.asst-text li + li { margin-top: 2px; }
.asst-card { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); background: #fff; }
.asst-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.asst-card-head strong { font-size: .84rem; }
.asst-card-head small { flex: 0 0 auto; color: var(--muted); font-size: .72rem; }
.asst-card .summary-warn { margin: 0; }
.asst-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.asst-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.asst-table th, .asst-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: right; vertical-align: top; white-space: nowrap; }
.asst-table th:first-child, .asst-table td:first-child { min-width: 150px; text-align: left; white-space: normal; }
.asst-table thead th { background: #f9faf9; color: #657078; font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.asst-table thead tr.sub th { color: var(--ink); font-size: .72rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.asst-table tfoot td { border-bottom: 0; background: #f6f4ec; font-weight: 800; }
.asst-empty { display: grid; gap: 12px; color: var(--muted); font-size: .84rem; }
.asst-examples { display: grid; gap: 6px; }
.asst-example { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--graphite); font: inherit; font-size: .8rem; text-align: left; cursor: pointer; }
.asst-example:hover { border-color: var(--gold); background: var(--gold-wash); }
.asst-form { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.asst-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.asst-uso { color: var(--muted); font-size: .72rem; }
@media (min-width: 1400px) {
  body.asst-open .workbar, body.asst-open .container { margin-right: 420px; }
}

/* ---------- janelas médias: resumo vira faixa fixa no rodapé ---------- */
@media (max-width: 1180px) {
  .sim-layout { grid-template-columns: minmax(0, 1fr); }
  .summary { position: sticky; top: auto; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 14px; margin: 0 -2px; padding: 10px 14px; border-top-width: 3px; border-radius: 10px 10px 0 0; }
  .summary-head { flex-direction: column; align-items: flex-start; gap: 0; margin: 0; }
  .summary-list { display: flex; flex: 1; gap: 18px; min-width: 0; overflow-x: auto; }
  .summary-list li { flex: 0 0 auto; padding: 0; border: 0; }
  .s-total { grid-column: 1; grid-row: auto; font-size: .98rem; }
  .s-base { display: none; }
  .summary-warn { flex: 0 0 auto; margin: 0; }
  .summary-actions { display: none; }
}

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .sidebar { z-index: 70; width: min(270px, 84vw); box-shadow: 14px 0 30px rgba(20, 29, 35, .13); transform: translateX(-105%); transition: transform .18s ease; }
  body.menu-open .sidebar { transform: translateX(0); }
  .backdrop { position: fixed; inset: 0; z-index: 65; width: 100%; border: 0; background: rgba(19, 27, 33, .4); }
  body.menu-open .backdrop { display: block; }
  .workbar { height: 52px; margin-left: 0; padding: 0 .75rem; }
  .menu-button { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; min-height: 36px; padding: 0 .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: #232b31; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
  .container { margin-left: 0; padding: 16px 12px 40px; }
  .tj-grid { grid-template-columns: minmax(0, 1fr); }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1 1 auto; }
  .scenario-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .card-head, .card-body { padding-left: 12px; padding-right: 12px; }
  .rule { padding: 11px 12px; }
  .rule-inputs { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-inputs .grow { grid-column: 1 / -1; }
  .summary { flex-wrap: wrap; gap: 4px 14px; }
  .summary-head { flex-direction: row; align-items: baseline; gap: 8px; width: 100%; }
  input[type="text"], input[type="number"], input[type="search"] { font-size: 16px; }
}
@media (max-width: 480px) {
  .workbar-crumbs .crumb-mid { display: none; }
  .scenario-grid { grid-template-columns: minmax(0, 1fr); }
  .scenario-add { min-height: 56px; grid-auto-flow: column; gap: 8px; }
  .scenario-add small { display: none; }
  .case { padding: 10px; }
  .case-add small { display: none; }
}

/* ---------- impressão ---------- */
@media print {
  body { background: #fff; font-size: 12px; }
  .sidebar, .backdrop, .workbar, .summary, .heading-actions, .no-print, .tabs, .step, .asst-fab, .asst-panel { display: none !important; }
  body.asst-open .container { margin-right: 0; }
  .container { margin: 0; padding: 0; }
  .sim-layout { display: block; }
  .card { border: 0; box-shadow: none; }
  .card-head, .card-body { padding-left: 0; padding-right: 0; }
  .result-wrap { overflow: visible; border: 0; }
  table.result { min-width: 0; }
  .result th:first-child, .result td:first-child { position: static; }
  .memo { max-height: none; padding: 0; border: 0; background: #fff; }
  details.memo-box > summary { display: none; }

  /* PDF sem os textos explicativos da tela: só o cabeçalho próprio, as tabelas e o rodapé. */
  @page { margin: 14mm 12mm; }
  .sim-heading, #resultado > .card-head, .toast, dialog { display: none !important; }
  body:not(.print-memo) .memo-box { display: none !important; }
  .print-head { display: block; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--primary); }
  .print-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .print-brand .brand-mark { width: 36px; height: 36px; font-size: 9px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-brand strong { display: block; font-size: 12px; }
  .print-brand small { color: var(--muted); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
  .print-head h1 { margin-bottom: 8px; font-size: 18px; }
  .print-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 24px; margin: 0; }
  .print-meta div { display: flex; gap: 6px; }
  .print-meta dt { color: var(--muted); font-weight: 700; }
  .print-meta dt::after { content: ":"; }
  .print-meta dd { margin: 0; }
  .print-foot { display: block; margin-top: 14px; color: var(--muted); font-size: 10px; }
  .result tfoot td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .result tr { break-inside: avoid; }
  .card-head h2 { font-size: 14px; }
}
