/* PANCOTTE — interface interna.
   Minimalista: preto, branco e cinzas; cor só para estado (ok / atenção / erro).
   Fontes do sistema (sem dependências externas) e numerais tabulares para valores. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f5;
  --bg-sunk: #efefed;
  --text: #111214;
  --text-2: #5c6066;
  --text-3: #8e9399;
  --line: #ebebe8;
  --line-2: #d9d9d5;
  --ink: #111214;
  --ink-hover: #2b2d31;
  --ok: #24663a;
  --ok-bg: #edf6f0;
  --warn: #8a5a00;
  --warn-bg: #fcf5e6;
  --error: #a3261e;
  --error-bg: #fbeeed;
  --info: #3b4a5c;
  --info-bg: #f1f3f6;
  --r: 8px;
  --r-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(17, 18, 20, .04), 0 4px 16px rgba(17, 18, 20, .05);
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg-soft); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 .6em; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: .87rem; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.text-error { color: var(--error); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
input, select, textarea, button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ barra superior */
.topbar { background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar__inner { max-width: 1280px; margin: 0 auto; padding: 0 28px; height: 58px; display: flex; align-items: center; gap: 32px; }
.wordmark { font-weight: 700; letter-spacing: .3em; color: var(--text); font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; }
.wordmark img { max-height: 28px; max-width: 160px; display: block; }
.wordmark--lg { font-size: 20px; margin-bottom: 8px; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { color: var(--text-2); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: .95rem; }
.topnav a:hover { color: var(--text); background: var(--bg-soft); }
.topnav a.is-active { color: var(--text); background: var(--bg-sunk); font-weight: 500; }
.topbar__right { display: flex; gap: 6px; align-items: center; }
.topbar__link { color: var(--text-2); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: .93rem; }
.topbar__link:hover, .topbar__link.is-active { color: var(--text); background: var(--bg-soft); }
.usermenu { position: relative; }
.usermenu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { background: var(--bg-soft); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; }
.usermenu__panel { position: absolute; right: 0; top: calc(100% + 6px); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 210px; padding: 6px; }
.usermenu__head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu__panel a, .usermenu__panel button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; background: none; border: 0; cursor: pointer; color: var(--text); font-size: .93rem; }
.usermenu__panel a:hover, .usermenu__panel button:hover { background: var(--bg-soft); }
.inline-form { display: inline; margin: 0; }
.link-quiet { background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; }

/* ------------------------------------------------------------ estrutura */
.container { max-width: 960px; margin: 0 auto; padding: 36px 28px 96px; }
.container--wide { max-width: 1280px; }
.narrow { max-width: 520px; }
.form-narrow { max-width: 860px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 1.6rem; letter-spacing: -.02em; margin-bottom: 4px; }
.page-sub { color: var(--text-2); margin: 0; }
.section-title { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin: 26px 0 12px; font-weight: 600; }
.sub-title { font-size: 1rem; margin: 20px 0 10px; }
.stack > * + * { margin-top: 16px; }
.stack > input[type=hidden] + * { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions.right { justify-content: flex-end; }
.spacer { flex: 1; }

/* cartões */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px; }
.card + .card { margin-top: 16px; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card__title { font-size: 1.02rem; font-weight: 600; }
.card__hint { color: var(--text-3); font-size: .87rem; }
.card--flush { padding: 0; overflow: hidden; }

/* blocos que se fecham (estimativa) */
.block { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 14px; }
.block > summary { list-style: none; cursor: pointer; padding: 18px 22px; display: flex; align-items: center; gap: 12px; }
.block > summary::-webkit-details-marker { display: none; }
.block > summary::after { content: ''; width: 8px; height: 8px; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: rotate(45deg); margin-left: auto; transition: transform .15s; }
.block[open] > summary::after { transform: rotate(-135deg); }
.block__n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; color: var(--text-2); flex: none; }
.block__n.is-done { background: var(--ink); border-color: var(--ink); color: #fff; }
.block__title { font-weight: 600; }
.block__summary { color: var(--text-3); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block__body { padding: 0 22px 22px; }

/* ------------------------------------------------------------ campos */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field__label { font-size: .85rem; color: var(--text-2); font-weight: 500; }
.field__hint { font-size: .8rem; color: var(--text-3); }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field--inline input { width: 110px; }
.field--inline .field__label { white-space: nowrap; }
.req, .opt { font-style: normal; font-size: .75rem; font-weight: 400; margin-left: 4px; color: var(--text-3); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 11px; background: var(--bg); min-height: 38px; transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 18, 20, .08); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.is-invalid { border-color: var(--error) !important; background: var(--error-bg) !important; }
.input-num { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 8px; align-items: baseline; font-size: .93rem; margin: 6px 0; }
.check input { margin: 0; accent-color: var(--ink); }
.input-group { display: flex; }
.input-group > * { border-radius: 0 !important; }
.input-group > :first-child { border-radius: var(--r-sm) 0 0 var(--r-sm) !important; }
.input-group > :last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; margin-left: -1px; }
.input-group select { width: auto; flex: none; background: var(--bg-soft); }

/* ------------------------------------------------------------ botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  padding: 8px 16px; border-radius: var(--r-sm); cursor: pointer; font-size: .93rem; min-height: 38px; white-space: nowrap; text-decoration: none; font-weight: 500; }
.btn:hover { border-color: var(--text-3); }
.btn:disabled { opacity: .4; cursor: default; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn--danger { color: var(--error); }
.btn--danger:hover { border-color: var(--error); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--quiet:hover { background: var(--bg-soft); color: var(--text); border-color: transparent; }
.btn--small { padding: 4px 10px; min-height: 30px; font-size: .86rem; }
.btn--block { width: 100%; }
.btn--lg { min-height: 44px; padding: 10px 20px; font-size: 1rem; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: var(--r-sm); width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); cursor: pointer; font-size: 1rem; line-height: 1; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn--danger:hover { color: var(--error); background: var(--error-bg); }

/* ------------------------------------------------------------ alertas e selos */
.alert { border: 1px solid var(--line); padding: 11px 16px; border-radius: var(--r); margin-bottom: 16px; background: var(--bg); font-size: .94rem; }
.alert--success { border-color: #cfe5d6; background: var(--ok-bg); color: var(--ok); }
.alert--error { border-color: #ecc9c5; background: var(--error-bg); color: var(--error); }
.alert--warning { border-color: #ecdcb4; background: var(--warn-bg); color: var(--warn); }
.alert--info { background: var(--info-bg); }
.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--bg-sunk); color: var(--text-2); white-space: nowrap; font-weight: 500; }
.badge--ok { color: var(--ok); background: var(--ok-bg); }
.badge--warn { color: var(--warn); background: var(--warn-bg); }
.badge--error { color: var(--error); background: var(--error-bg); }
.badge--info { color: var(--info); background: var(--info-bg); }
.badge--muted { color: var(--text-3); }
.hint-box { background: var(--bg-soft); border-radius: var(--r-sm); padding: 9px 12px; font-size: .87rem; color: var(--text-2); margin: 10px 0; }
.hint-box--warn { background: var(--warn-bg); color: var(--warn); }
.temp-password { display: inline-block; font-family: var(--mono); background: var(--bg); border: 1px solid var(--line-2); padding: 2px 8px; margin: 4px 0; font-size: 1.05rem; user-select: all; border-radius: var(--r-sm); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.dot--ok { background: var(--ok); } .dot--warn { background: #c48a12; } .dot--error { background: var(--error); }

/* ------------------------------------------------------------ tabelas */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 500; font-size: .78rem; color: var(--text-3); border-bottom: 1px solid var(--line); padding: 9px 10px; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.table td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table--compact td, .table--compact th { padding: 6px 10px; }
.table tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; padding-top: 12px; font-weight: 600; }
.row--inactive td { color: var(--text-3); }
.row-strong td { font-weight: 600; border-top: 1px solid var(--line-2); }
.row-total td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--ink); border-bottom: 0; }
.row-missing td { background: #fffafa; }
.table-scroll { overflow-x: auto; }
.card > .table { margin: 0 -10px; width: calc(100% + 20px); }

/* ------------------------------------------------------------ autenticação */
body.auth { background: var(--bg-soft); }
.auth-card { max-width: 380px; margin: 14vh auto 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 34px 32px 28px; box-shadow: var(--shadow); }
.auth-sub { color: var(--text-2); margin-bottom: 22px; }
.auth-help { font-size: .85rem; color: var(--text-3); margin-top: 18px; }

/* ------------------------------------------------------------ início */
.hello { margin: 18px 0 30px; }
.hello h1 { font-size: 1.9rem; letter-spacing: -.025em; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tool-card { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 26px 24px 22px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 10px; min-height: 190px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card__icon { width: 38px; height: 38px; border-radius: 10px; background: var(--bg-sunk); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.tool-card__title { font-weight: 600; font-size: 1.1rem; margin-top: 6px; }
.tool-card__desc { color: var(--text-2); font-size: .93rem; flex: 1; }
.tool-card__go { color: var(--text-3); font-size: .88rem; }
.tool-card:hover .tool-card__go { color: var(--text); }
.notice-list { list-style: none; padding: 0; margin: 28px 0 0; }
.notice-list li { display: flex; gap: 12px; align-items: center; padding: 12px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; font-size: .93rem; }
.notice-list li a { margin-left: auto; }

/* ------------------------------------------------------------ áreas de trabalho com resumo lateral */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.aside { position: sticky; top: 78px; }
.aside .card { padding: 20px; }
.total-big { font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 2px 0 2px; }
.total-label { color: var(--text-3); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.kv-list { margin: 14px 0 0; padding: 0; list-style: none; font-size: .92rem; }
.kv-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv-list li:last-child { border-bottom: 0; }
.kv-list li span:last-child { font-variant-numeric: tabular-nums; }
.kv-list li.is-strong { font-weight: 600; border-top: 1px solid var(--line-2); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; padding: 4px 11px; border-radius: 999px; background: var(--bg-sunk); color: var(--text-2); white-space: nowrap; font-weight: 500; }
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
.status-pill[data-status=validada] { color: var(--ok); background: var(--ok-bg); }
.status-pill[data-status=ressalvas], .status-pill[data-status=stale] { color: var(--warn); background: var(--warn-bg); }
.status-pill[data-status=incompleta], .status-pill[data-status=error] { color: var(--error); background: var(--error-bg); }
.status-pill[data-status=loading] { color: var(--text-3); }

/* linhas de produto (calculadora e estimativa) */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 12px; background: var(--bg); }
.line__top { display: grid; gap: 10px; align-items: end; }
.line--calc .line__top { grid-template-columns: 26px minmax(0, 1.6fr) minmax(0, 1.3fr) 110px 150px 30px; grid-template-areas: "n desc ncm qty price x"; }
.line--est .line__top { grid-template-columns: 26px minmax(0, 1.6fr) minmax(0, 1.3fr) 96px 76px 180px 30px; grid-template-areas: "n desc ncm qty unit price x"; }
.l-n { grid-area: n; } .l-desc { grid-area: desc; } .l-ncm { grid-area: ncm; } .l-qty { grid-area: qty; } .l-unit { grid-area: unit; } .l-price { grid-area: price; } .l-x { grid-area: x; }
.line__n { color: var(--text-3); font-size: .85rem; padding-bottom: 10px; font-variant-numeric: tabular-nums; }
.line__foot { display: flex; gap: 14px; align-items: center; margin-top: 10px; padding-left: 36px; flex-wrap: wrap; font-size: .87rem; color: var(--text-2); }
.line__foot .spacer { flex: 1; }
.line__taxes { display: flex; gap: 14px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.line__taxes b { font-weight: 600; color: var(--text); }
.line__more { margin-top: 12px; padding: 14px 0 2px 36px; border-top: 1px dashed var(--line); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; font-size: .87rem; }
.linkbtn:hover { color: var(--text); text-decoration-color: var(--text); }
.ncm-field { display: flex; align-items: center; gap: 8px; min-height: 38px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 4px 6px 4px 11px; background: var(--bg); cursor: pointer; width: 100%; text-align: left; }
.ncm-field:hover { border-color: var(--text-3); }
.ncm-field__code { font-family: var(--mono); font-size: .9rem; white-space: nowrap; }
.ncm-field__desc { color: var(--text-2); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ncm-field__empty { color: var(--text-3); flex: 1; }
.ncm-field.is-ok { border-color: #cfe5d6; }
.ncm-field.is-ok .ncm-field__code::before { content: '✓ '; color: var(--ok); }
.ov-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.add-line { width: 100%; border: 1px dashed var(--line-2); background: transparent; border-radius: var(--r); padding: 12px; color: var(--text-2); cursor: pointer; font-size: .93rem; }
.add-line:hover { border-color: var(--text-3); color: var(--text); background: var(--bg); }

/* diálogo de NCM */
.dialog { border: 1px solid var(--line); border-radius: 12px; padding: 24px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(17, 18, 20, .18); }
.dialog::backdrop { background: rgba(17, 18, 20, .3); }
.dialog--wide { max-width: 760px; padding: 0; }
.dialog__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dialog__body { padding: 16px 22px; max-height: 62vh; overflow: auto; }
.dialog__foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.seg { display: inline-flex; background: var(--bg-sunk); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--text-2); font-size: .9rem; }
.seg button[aria-pressed=true] { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); font-weight: 500; }
.pick-list { list-style: none; margin: 10px 0 0; padding: 0; }
.pick-list li { padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; display: flex; gap: 12px; align-items: baseline; }
.pick-list li:hover { background: var(--bg-soft); }
.pick-list li.is-selected { background: var(--bg-sunk); }
.pick-list li.is-disabled { opacity: .5; cursor: default; }
.pick-list__code { font-family: var(--mono); font-size: .9rem; white-space: nowrap; }
.pick-list__desc { flex: 1; min-width: 0; }
.pick-list__path { color: var(--text-3); font-size: .83rem; }

/* resultado detalhado */
.result-status { padding: 11px 16px; border-radius: var(--r); margin: 0 0 14px; font-size: .94rem; background: var(--bg-soft); }
.result-status--validada { background: var(--ok-bg); color: var(--ok); }
.result-status--ressalvas { background: var(--warn-bg); color: var(--warn); }
.result-status--incompleta { background: var(--error-bg); color: var(--error); }
.warn-list { list-style: none; padding: 0; margin: 0 0 6px; font-size: .9rem; }
.warn-list__item { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.warn-list__item:last-child { border-bottom: 0; }
.warn-list__lvl { flex: 0 0 88px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; font-weight: 600; }
.warn-list__item--error .warn-list__lvl { color: var(--error); }
.warn-list__item--warning .warn-list__lvl { color: var(--warn); }
.warn-list__item--info .warn-list__lvl { color: var(--text-3); }
.item-result { border-top: 1px solid var(--line); padding: 10px 0; }
.item-result summary { cursor: pointer; font-weight: 500; }
.tax-table td.small { max-width: 420px; }
.formula { font-family: var(--mono); font-size: .78rem; }
.assumptions h4 { font-size: .85rem; color: var(--text-2); margin: 4px 0 6px; font-weight: 600; }
.assumptions ul { margin: 0; padding-left: 18px; font-size: .88rem; color: var(--text-2); }
.money-rows { display: flex; flex-direction: column; gap: 10px; }
.money-row { display: grid; grid-template-columns: 220px 170px minmax(0, 1fr); gap: 10px; align-items: center; }
.money-row__label { font-size: .9rem; color: var(--text-2); }
.money-row.is-muted { opacity: .45; }
.pdf-preview { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.pdf-preview__bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); gap: 12px; }
.pdf-preview iframe { width: 100%; height: 820px; border: 0; display: block; background: #fff; }

/* ------------------------------------------------------------ apresentação */
.pres-head { display: grid; grid-template-columns: 1.6fr 1.1fr 1.1fr .9fr 1fr; gap: 14px 18px; }
.pres-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.pres-table { border-collapse: collapse; width: 100%; min-width: 760px; }
.pres-table th, .pres-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px; vertical-align: top; }
.pres-table th:last-child, .pres-table td:last-child { border-right: 0; }
.pres-table thead th { background: var(--bg-soft); text-align: left; font-weight: 500; }
.pres-table input, .pres-table textarea { border-color: transparent; background: transparent; min-height: 34px; padding: 6px 8px; }
.pres-table input:hover, .pres-table textarea:hover { border-color: var(--line-2); }
.pres-table input:focus, .pres-table textarea:focus { border-color: var(--ink); background: var(--bg); }
.pres-table textarea { min-height: 34px; height: 34px; resize: vertical; }
.pres-table thead input { font-weight: 600; font-size: .86rem; }
.pres-col-tools { display: flex; gap: 2px; align-items: center; }
.pres-photo { width: 76px; }
.photo-slot { width: 64px; height: 64px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--text-3); cursor: pointer; overflow: hidden; background: var(--bg-soft); font-size: .75rem; text-align: center; position: relative; }
.photo-slot img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.photo-slot:hover { border-color: var(--text-3); }
.pres-row-tools { display: flex; flex-direction: column; gap: 2px; width: 34px; }
.pres-num { width: 120px; }
.pres-total td { font-weight: 600; background: var(--bg-soft); }
.toggle-row { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ configurações */
.settings-nav { display: flex; gap: 4px; margin: -6px 0 26px; border-bottom: 1px solid var(--line); }
.settings-nav a { padding: 10px 14px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .95rem; }
.settings-nav a:hover { color: var(--text); }
.settings-nav a.is-active { color: var(--text); border-bottom-color: var(--ink); font-weight: 500; }
.admin-section { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 16px; }
.admin-section > .section-title:first-child { margin-top: 0; }
details.admin-section > summary { cursor: pointer; font-weight: 600; list-style: none; }
details.admin-section > summary::-webkit-details-marker { display: none; }
details.admin-section > summary::after { content: ' +'; color: var(--text-3); font-weight: 400; }
details.admin-section[open] > summary::after { content: ' −'; }
details.admin-section[open] > summary { margin-bottom: 14px; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.code-area { font-family: var(--mono); font-size: .85rem; min-height: 180px; }
.audit-details { font-family: var(--mono); font-size: .78rem; color: var(--text-2); max-width: 420px; word-break: break-word; }
.logo-preview { max-height: 56px; max-width: 220px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px; background: #fff; }

/* ------------------------------------------------------------ responsivo */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .aside { position: static; }
  .line--calc .line__top { grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) 30px; grid-template-areas: "n desc desc x" ". ncm ncm ." ". qty price ."; }
  .line--est .line__top { grid-template-columns: 26px minmax(0, 1fr) 90px minmax(0, 1fr) 30px; grid-template-areas: "n desc desc desc x" ". ncm ncm ncm ." ". qty unit price ."; }
}
@media (max-width: 860px) {
  .grid-3, .grid-4, .pres-head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-grid { grid-template-columns: 1fr; }
  .topnav a { padding: 6px 8px; }
  .money-row { grid-template-columns: 1fr 1fr; }
  .money-row > :last-child { grid-column: 1 / -1; }
  .ov-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.settings-title { font-size: 1.2rem; margin: 0 0 4px; letter-spacing: -.01em; }
/* utilitários (a CSP não permite atributos style="") */
.mt-s { margin-top: 8px !important; } .mt-m { margin-top: 12px !important; } .mt-l { margin-top: 18px !important; } .mt-xl { margin-top: 28px !important; }
.mb-0 { margin-bottom: 0 !important; } .mb-s { margin-bottom: 6px !important; } .mb-m { margin-bottom: 14px !important; }
.between { justify-content: space-between; } .grow { flex: 1; } .pointer { cursor: pointer; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 26px 0 10px; }
.is-muted { opacity: .45; }
.input-group input { min-width: 0; }
.line__more.stack > * + * { margin-top: 14px; }
.card--flush > .table th:first-child, .card--flush > .table td:first-child, .card--flush .table th:first-child, .card--flush .table td:first-child { padding-left: 20px; }
.card--flush .table th:last-child, .card--flush .table td:last-child { padding-right: 20px; }
.card--flush .table th { background: var(--bg-soft); }
