/* Fonte servida pelo próprio CRM; nada é carregado de fora. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/plex-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/plex-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/plex-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url("/fonts/plex-700.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --side: #0f172a;
  --side-surface: #1e293b;
  --side-text: #94a3b8;
  --side-active: #2563eb;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --bar: #3b82f6;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --due: #b45309;
  --due-soft: #fef3c7;
  --due-fill: #f59e0b;
  --late: #b91c1c;
  --late-soft: #fee2e2;
  --late-fill: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --side-width: 244px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 32px -6px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 "IBM Plex Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; color: var(--ink); }
h1 { font-size: 1.65rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }
small, .muted { color: var(--muted); }
small { font-size: 0.82rem; }
.num { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Estrutura ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-width);
  background: var(--side); color: var(--side-text);
  border-right: 1px solid #1e293b;
  display: flex; flex-direction: column; gap: 20px; padding: 20px 14px;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 8px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em;
}
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--side-text); text-decoration: none; font-weight: 500; font-size: 0.94rem;
}
.nav a:hover { background: var(--side-surface); color: #f8fafc; }
.nav a[aria-current="page"] {
  background: var(--side-active); color: #fff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}
.nav svg { width: 19px; height: 19px; flex: none; }
.sidebar > .button {
  margin: 4px 0 0; justify-content: center;
  background: #f8fafc; border-color: #f8fafc; color: var(--side);
  box-shadow: 0 1px 2px rgba(2, 6, 23, 0.25);
}
.sidebar > .button:hover { background: #e2e8f0; border-color: #e2e8f0; color: var(--side); }

.sidebar-user {
  margin-top: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--side-surface);
  border: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-user-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-user-info > div { min-width: 0; }
.sidebar-user-info strong {
  display: block; color: #f8fafc; font-size: 0.88rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-info small { display: block; color: var(--side-text); font-size: 0.74rem; line-height: 1.2; }
.sidebar-user .avatar {
  width: 32px; height: 32px; font-size: 0.76rem;
  background: rgba(59, 130, 246, 0.2); color: #93c5fd;
}
.logout-btn {
  min-height: 30px; padding: 4px 10px; font-size: 0.78rem; font-weight: 600;
  background: rgba(15, 23, 42, 0.55); color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 6px;
}
.logout-btn:hover { background: #0f172a; color: #fff; border-color: rgba(148, 163, 184, 0.45); }

.page { margin-left: var(--side-width); padding: 28px 36px 64px; }
.container { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.94rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Botões e campos ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  font: inherit; font-weight: 600; font-size: 0.92rem; line-height: 1.2; text-decoration: none; cursor: pointer;
  color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.16);
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button svg, button svg { width: 17px; height: 17px; }
.secondary, button.secondary, .button.secondary {
  background: var(--surface); color: var(--ink); border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.secondary:hover, button.secondary:hover, .button.secondary:hover { background: var(--surface-subtle); border-color: var(--muted); }
button.small, .button.small { min-height: 32px; padding: 4px 12px; font-size: 0.84rem; }
button.destructive { background: var(--surface); color: var(--late); border-color: #fca5a5; box-shadow: none; }
button.destructive:hover { background: var(--late-soft); border-color: var(--late); }

input, select, textarea {
  width: 100%; min-width: 0; min-height: 40px; padding: 8px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
input[type="file"] { padding: 6px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 500; margin-right: 10px; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); cursor: pointer; }
input::placeholder { color: #94a3b8; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 500; color: var(--muted); }
label input, label select, label textarea { font-size: 0.94rem; font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: 8px; min-height: 40px; color: var(--ink); }
label.check input { width: 17px; height: 17px; min-height: 0; accent-color: var(--accent); }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; align-items: end; }
.fields .span-2 { grid-column: span 2; }
.fields > button { justify-self: start; }

/* ---------- Painéis ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 0; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 18px 22px 14px; }
.panel-head a { font-size: 0.88rem; font-weight: 500; }
.panel-body { padding: 0 22px 22px; }
.panel > .panel-body:first-child { padding-top: 22px; }
.panel-sub { margin: -8px 0 14px; color: var(--muted); font-size: 0.88rem; }
.empty { padding: 30px 22px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; align-items: start; }

/* ---------- Filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.toolbar label { flex: 0 1 170px; }
.toolbar label.grow { flex: 1 1 220px; }
.segments { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.segments a { padding: 6px 13px; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.88rem; }
.segments a:hover { color: var(--ink); background: var(--bg); }
.segments a[aria-current="true"] { background: var(--side); color: #fff; }
.custom-period > summary { font-size: 0.88rem; font-weight: 500; }
.custom-period[open] { flex-basis: 100%; }

/* ---------- Painel inicial ---------- */
.overview { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 20px; }
.headline { margin: 0; font-size: 2.35rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.headline-label { color: var(--muted); font-weight: 500; font-size: 0.88rem; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); }
.stats dt { font-size: 0.8rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.15rem; font-weight: 600; }

.chart { display: block; width: 100%; height: 170px; margin-top: 18px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar { fill: var(--bar); }
.chart .hit { fill: transparent; }
.chart .col:hover .hit { fill: rgba(15, 23, 42, 0.05); }
.chart .col:hover .bar { fill: var(--accent-hover); }
.chart-axis { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--muted); margin-top: 6px; }
.chart-note { font-size: 0.76rem; color: var(--muted); text-align: right; margin: 12px 0 -14px; }

.split { display: block; width: 100%; height: 10px; margin: 14px 0 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.split .fill-late { fill: var(--late-fill); }
.split .fill-due { fill: var(--due-fill); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; font-size: 0.85rem; }
.legend li::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 2px; background: var(--due-fill); }
.legend li.is-late::before { background: var(--late-fill); }
.legend b { font-weight: 600; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--line); }
.rows .main { min-width: 0; overflow-wrap: anywhere; }
.rows .main > a, .rows .main > strong { display: block; font-weight: 500; }
.rows .main > a { color: var(--ink); text-decoration: none; }
.rows .main > a:hover { color: var(--accent); text-decoration: underline; }
.rows .end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rows .end b { font-weight: 600; }
.is-late-text, .is-late-text small { color: var(--late); }
.debts { max-height: 292px; overflow-y: auto; margin-top: 16px; }

.meter { display: block; width: 100%; height: 6px; margin-top: 6px; border-radius: 3px; overflow: hidden; background: var(--bg); }
.meter rect { fill: var(--bar); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; vertical-align: middle; border-top: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
th {
  font-size: 0.73rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); background: var(--surface-subtle); white-space: nowrap;
}
tbody tr:hover { background: #f8fafc; }
td.right, th.right { text-align: right; }
td.nowrap { white-space: nowrap; }
td .primary { display: block; font-weight: 500; color: var(--ink); text-decoration: none; }
td a.primary:hover { color: var(--accent); text-decoration: underline; }
td small { display: block; }
tr.is-cancelled td { color: var(--muted); }
tr.is-cancelled .amount { text-decoration: line-through; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.due { background: var(--due-soft); color: var(--due); }
.tag.late { background: var(--late-soft); color: var(--late); }
.tag.off { background: #e2e8f0; color: #475569; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 0.82rem; }
.avatar.large { width: 52px; height: 52px; font-size: 1.05rem; }
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.identity > div { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Venda (romaneio) ---------- */
.sale-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.slip-head { padding: 20px 24px 16px; border-top: 4px solid var(--side); border-radius: var(--radius) var(--radius) 0 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.lines { list-style: none; margin: 0; padding: 0 24px; border-top: 1px solid var(--line); }
.lines li { display: grid; grid-template-columns: 4rem minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 14px 0; border-bottom: 1px dashed var(--line-strong); }
.lines li:last-child { border-bottom: 0; }
.lines .qty { font-size: 1.45rem; font-weight: 600; text-align: right; }
.lines .what { font-weight: 500; overflow-wrap: anywhere; }
.lines small { display: block; font-weight: 400; }
.totals { margin: 0; padding: 14px 24px 20px; background: var(--surface-subtle); border-top: 2px solid var(--side); border-radius: 0 0 var(--radius) var(--radius); }
.totals div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.totals dd { margin: 0; font-weight: 600; }
.totals div:first-child { font-size: 1.2rem; font-weight: 600; }
.totals dd.late { color: var(--late); }

.proofs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.proofs li { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.proofs img, .proofs .pdf { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.proofs .pdf { display: grid; place-items: center; background: var(--bg); font-weight: 600; }
.assign { display: flex; gap: 6px; }
.assign input { min-height: 32px; padding: 3px 8px; font-size: 0.85rem; }
.upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 14px; }
.upload label { flex: 1 1 200px; }

summary { cursor: pointer; color: var(--accent); }
details > summary + * { margin-top: 12px; }
.danger-zone summary { color: var(--late); font-weight: 500; }

/* ---------- Formulário de venda ---------- */
.items { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 14px 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.item label:nth-of-type(1), .item label:nth-of-type(5) { grid-column: 1 / -1; }
.item label:nth-of-type(2), .item label:nth-of-type(3), .item label:nth-of-type(4) { grid-column: span 2; }
.form-footer { display: flex; justify-content: flex-end; gap: 10px; }
@media (min-width: 1100px) {
  .item { grid-template-columns: 2.6fr 0.7fr 1.1fr 1.1fr 2fr; }
  .item label:nth-of-type(n) { grid-column: auto; }
}

/* ---------- Linha do tempo do cliente ---------- */
.activity-done .main { color: var(--muted); }

/* ---------- Janelas ---------- */
.sheet {
  width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto;
  margin: auto; padding: 0 22px 22px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md);
}
.sheet::backdrop { background: rgba(15, 23, 42, 0.55); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 -22px 14px; padding: 16px 22px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet .close { min-height: 36px; width: 36px; justify-content: center; padding: 0; font-size: 1.4rem; font-weight: 400; color: var(--muted); background: transparent; border-color: transparent; box-shadow: none; }
.sheet .close:hover { background: var(--bg); color: var(--ink); }
.sheet .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sheet .fields > button { grid-column: 1 / -1; justify-self: end; }
.sheet .fields .muted { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .sheet:popover-open { animation: sheet-in 0.16s ease-out; }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(8px); } }
}

/* ---------- Catálogo ---------- */
.toolbar-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.toolbar-row .toolbar { flex: 1 1 260px; justify-content: flex-end; }
.picker { margin: 0; padding: 14px 0 4px; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.picker legend { padding: 0; font-weight: 600; float: left; width: 100%; margin-bottom: 10px; }
.chips { clear: both; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { flex-direction: row; align-items: center; gap: 0; font-size: 0.92rem; color: var(--ink); cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-weight: 500; }
.chip span::before { content: ""; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.chip input:checked + span::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2.5px var(--accent-soft); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-new input { width: 170px; min-height: 36px; border-style: dashed; border-radius: 999px; padding: 6px 14px; }
input.price { max-width: 150px; text-align: right; }
td input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.choices .main > a { font-size: 1.05rem; }
.panel-head h2 small { margin-left: 8px; font-weight: 400; }
.stack-sm { display: flex; flex-direction: column; gap: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inline-form label.grow { flex: 1 1 220px; }
.inline-form > input { flex: 1 1 160px; width: auto; }
.option-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.option-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); }
.option-list li:first-child { border-top: 0; }
.option-list li .inline-form { flex: 1 1 240px; }
.option-list li.is-off input { color: var(--muted); text-decoration: line-through; }

/* ---------- Simulador ---------- */
.phone { max-width: 600px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.phone-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--side); color: #fff; }
.phone-head small { color: var(--side-text); display: block; }
.chat { list-style: none; margin: 0; padding: 16px; min-height: 320px; display: flex; flex-direction: column; gap: 8px; background: #f1f5f9; }
.chat li { max-width: 86%; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; }
.chat li.you { align-self: flex-end; background: #dbeafe; border-color: #bfdbfe; border-radius: 12px 4px 12px 12px; }
.chat li.hint { align-self: center; background: var(--due-soft); border-color: #fde68a; color: var(--due); font-size: 0.85rem; text-align: center; border-radius: 8px; }
.composer { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.composer button { align-self: flex-end; }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 72%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 24px 50px -12px rgba(2, 6, 23, 0.48);
}
.login-card .brand { padding: 0; color: var(--ink); margin-bottom: 20px; font-size: 1.1rem; }
.login-card h1 { font-size: 1.4rem; margin: 0 0 4px; }
.login-card .login-sub { margin: 0 0 20px; color: var(--muted); font-size: 0.9rem; }
.login-card .stack-sm button { width: 100%; margin-top: 4px; }
.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--late-soft);
  color: var(--late);
  border: 1px solid #fecaca;
  margin: 0 0 16px;
  font-size: 0.88rem;
  font-weight: 500;
}

/* ---------- Responsivo ---------- */
@media (max-width: 1040px) {
  .overview, .sale-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  body { padding-bottom: 68px; }
  .sidebar { position: static; width: auto; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; }
  .sidebar > .button { margin: 0; min-height: 34px; padding: 6px 12px; font-size: 0.85rem; }
  .sidebar-user { margin-top: 0; padding: 4px 8px; gap: 8px; }
  .sidebar-user .avatar, .sidebar-user-info small { display: none; }
  .nav { position: fixed; z-index: 10; inset: auto 0 0 0; flex-direction: row; justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--side); border-top: 1px solid #1e293b; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 0.7rem; }
  .page { margin-left: 0; padding: 18px 16px 32px; }
  .headline { font-size: 1.95rem; }
  .fields .span-2 { grid-column: 1 / -1; }
  .toolbar label { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .toolbar label.grow { flex-basis: 100%; }
  input[type="date"] { appearance: none; -webkit-appearance: none; }
  .lines, .slip-head, .totals { padding-left: 16px; padding-right: 16px; }
  .lines li { grid-template-columns: 3rem minmax(0, 1fr); }
  .lines li > .num { grid-column: 2; font-weight: 600; }
  .sheet { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .sheet .fields { grid-template-columns: minmax(0, 1fr); }
  input.price { max-width: none; }

  /* Cada linha de tabela vira um bloco, com o nome da coluna ao lado do valor. */
  table.stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stacked, table.stacked tbody, table.stacked tr, table.stacked td { display: block; width: 100%; }
  table.stacked tr { padding: 10px 0; border-top: 1px solid var(--line); }
  table.stacked td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 3px 16px; border: 0; text-align: right; }
  table.stacked td:first-child, table.stacked td:last-child { padding-left: 16px; padding-right: 16px; }
  table.stacked td::before { content: attr(data-label); flex: none; font-size: 0.8rem; color: var(--muted); text-align: left; }
  table.stacked td.title { display: block; text-align: left; }
  table.stacked td.title::before { content: none; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .button, .nav a, .segments a, input, select, textarea { transition: background-color 0.14s, border-color 0.14s, box-shadow 0.14s; }
}
