/* =========================================================================
   AGR CRM — complementos de layout das telas (usa só os tokens de agr.css).
   Tokens novos: nenhum. Valores fixos abaixo vêm das medidas dos mockups.
   ========================================================================= */

/* foco programático do FocusOnNavigate no título não precisa de anel visível */
h1[tabindex="-1"]:focus { outline: none; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: var(--sp-3); }
@media (min-width: 768px) { .only-mobile { display: none !important; } }
.page-head { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: flex-end; justify-content: space-between; position: relative; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; }
.back { font-size: var(--fs-md); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 12px; top: 12px; pointer-events: none; }
.search .input { padding-left: 36px; }
.check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); font-weight: 500; cursor: pointer; min-height: var(--ctl-h); }
.check input { width: 18px; height: 18px; accent-color: var(--c-primary); margin: 0; }
.icon-btn { width: var(--ctl-h-touch); height: var(--ctl-h-touch); border-radius: var(--r-md); border: 1px solid var(--c-border-input); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--c-text); flex: none; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.btn--secondary .spinner { border-color: var(--c-border); border-top-color: var(--c-primary); }
.offline { background: var(--c-amber-bg); border-bottom: 1px solid var(--c-amber); color: var(--c-amber-ink); text-align: center; font-size: var(--fs-md); font-weight: 600; padding: 6px var(--sp-4); position: sticky; top: var(--topbar-h); z-index: 19; }
.state { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--c-text-muted); padding: var(--sp-8) 0; }
.banner--error .btn { margin-left: auto; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.inline-warn { font-size: var(--fs-sm); font-weight: 600; color: var(--c-amber-ink); background: var(--c-amber-bg); border: 1px solid var(--c-amber); border-radius: var(--r-md); padding: 6px 10px; }
.saved { animation: fade-in .2s ease; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- KPIs ---------- */
.kpis--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi--urgent .kpi__label { display: flex; align-items: center; gap: 6px; }
.kpi__row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kpi__cta { font-size: var(--fs-sm); font-weight: 600; }
a.kpi:hover { border-color: var(--c-amber); }

/* ---------- Kanban ---------- */
.col__dot, .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.col__collapse { margin-left: 2px; width: 24px; height: 24px; border: 0; background: none; border-radius: var(--r-sm); color: var(--c-text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.col__collapse:hover { background: var(--c-primary-soft-2); color: var(--c-text); }
.col--pulse { animation: col-pulse 1.2s ease-in-out; }
@keyframes col-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,165,38,0); } 40% { box-shadow: 0 0 0 6px rgba(224,165,38,.45); } }
.col-strip--hidden { border-style: dashed; background: transparent; color: var(--c-text-muted); }
.col-strip--hidden .col-strip__label { font-weight: 600; }
.lead { position: relative; transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease-out; }
/* lugar de origem durante o arraste (o navegador desenha a cópia que acompanha o mouse) */
.lead--origin { border: 2px dashed var(--c-border-btn2); background: rgba(255,255,255,.4); box-shadow: none; }
.lead--origin > * { visibility: hidden; }
.lead__body { display: block; color: inherit; text-decoration: none; }
.lead__body:hover { color: inherit; }
.lead__ask { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--c-border-soft); font-size: var(--fs-md); font-weight: 600; color: var(--c-text-2); display: flex; flex-direction: column; gap: 8px; }
.lead__ask div { display: flex; gap: 8px; }
.col__more { margin-top: 2px; }
.lead-skeleton { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 10px 11px; display: flex; flex-direction: column; gap: 8px; }
.lead-skeleton .skeleton:nth-child(1) { height: 14px; width: 60%; }
.lead-skeleton .skeleton:nth-child(2) { height: 10px; width: 40%; }
.lead-skeleton .skeleton:nth-child(3) { height: 26px; width: 100%; }
@media (prefers-reduced-motion: reduce) { .lead--dragging { transform: none; } .col--pulse { animation: none; } .lead { transition: none; } }

/* Funil no celular */
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; margin: 0 -14px; padding: 0 14px 2px; scrollbar-width: none; }
.chip { font: inherit; font-size: var(--fs-md); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--c-border-input); border-radius: var(--r-pill); background: #fff; color: var(--c-text); white-space: nowrap; cursor: pointer; }
.chip b { font-variant-numeric: tabular-nums; color: var(--c-text-muted); }
.chip--venda { background: var(--c-amber-bg); border-color: var(--c-amber); }
.chip--venda b { color: var(--c-amber-ink); }
.chip[aria-selected="true"] { background: var(--c-navy); border-color: var(--c-navy); color: #fff; }
.chip[aria-selected="true"] b { color: var(--c-nav-text); }
.kpi-strip { display: flex; gap: var(--sp-2); overflow-x: auto; margin: 0 -14px; padding: 0 14px; scrollbar-width: none; }
.kpi-strip .kpi { flex: none; min-width: 120px; padding: 10px 12px; }
.kpi-strip .kpi__value { font-size: 20px; }
.mcards { display: flex; flex-direction: column; gap: 10px; }
.mcard { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 12px; }
.mcard__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: 10px; }
.mcard__foot .lead__tags { margin-top: 0; }
.mv { font: inherit; font-size: var(--fs-md); font-weight: 600; min-height: var(--ctl-h); padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--c-border-btn2); background: #fff; color: var(--c-primary); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex: none; cursor: pointer; }

/* Gaveta inferior */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(9,22,42,.45); z-index: 40; animation: fade-in .2s ease-out; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(9,22,42,.25); padding-bottom: max(12px, env(safe-area-inset-bottom)); animation: sheet-up .2s ease-out; max-height: 90vh; overflow-y: auto; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-backdrop { animation: none; } }
.sheet__handle { width: 40px; height: 4px; border-radius: 4px; background: var(--c-border-input); margin: 8px auto 4px; }
.sheet__head { padding: 8px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.sheet__title { font-weight: 700; font-size: 16px; }
.sheet__close { width: var(--ctl-h-touch); height: var(--ctl-h-touch); border: 0; background: var(--c-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sheet__list { border-top: 1px solid var(--c-border-soft); }
.opt-row { font: inherit; width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--c-border-soft); background: #fff; text-align: left; color: var(--c-text); cursor: pointer; }
.opt-row:disabled { background: var(--c-bg); font-weight: 600; cursor: default; color: var(--c-text); }
.opt-row--venda { background: var(--c-amber-bg); font-weight: 600; }
.opt-row__hint { margin-left: auto; font-size: var(--fs-sm); color: var(--c-text-muted); font-weight: 500; }

/* ---------- Clientes ---------- */
.filters { padding: var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 28px); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); box-shadow: var(--shadow-pop); z-index: 30; }
.popover__title { font-weight: 700; font-size: var(--fs-lg); }
.popover__actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.cell-client { display: flex; gap: 10px; align-items: center; }
.cell-client__name { display: flex; gap: 6px; align-items: center; min-width: 0; }
.rowlink { font-weight: 600; color: var(--c-text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.rowlink:hover { color: var(--c-primary); text-decoration: underline; }
.cell-sub { font-size: var(--fs-sm); color: var(--c-text-muted); }
.avatar--34 { width: 34px; height: 34px; font-size: 12px; }
.ccard { display: block; background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 12px; text-decoration: none; color: var(--c-text); }
.ccard:hover { color: var(--c-text); border-color: #9db5d6; }
.ccard__top { display: flex; gap: 10px; align-items: flex-start; }
.ccard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--c-border-soft); font-size: var(--fs-md); color: var(--c-text-muted); }
.fchips { display: flex; gap: var(--sp-2); overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.fchip { position: relative; display: inline-flex; align-items: center; gap: 4px; min-height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--c-border-input); border-radius: var(--r-pill); background: #fff; font-size: var(--fs-md); font-weight: 600; white-space: nowrap; }
.fchip select { position: absolute; inset: 0; opacity: 0; font-size: 16px; cursor: pointer; }
.fchip--on { background: var(--c-navy); border-color: var(--c-navy); color: #fff; }
.fchip__clear { border: 0; background: none; color: inherit; padding: 0 0 0 4px; cursor: pointer; display: inline-flex; position: relative; z-index: 1; min-height: 32px; align-items: center; }

/* ---------- Detalhe do cliente ---------- */
.client-head { padding: 20px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.client-head__id { display: flex; gap: var(--sp-4); align-items: center; min-width: 0; }
.client-head__name { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.client-head__name h1 { margin: 0; font-size: var(--fs-h1); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.client-head__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; font-size: var(--fs-md); color: var(--c-text-muted); align-items: center; }
.client-head__phone { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: var(--fs-base); }
.client-head__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.client-head__actions .field { width: 200px; }
.tag--icon { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); padding: 2px 8px; }
.tabs { overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .chips::-webkit-scrollbar, .kpi-strip::-webkit-scrollbar, .fchips::-webkit-scrollbar { display: none; }
.split { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: flex-start; }
.split__main { flex: 999 1 640px; min-width: 0; }
.split__aside { flex: 1 1 300px; padding: 18px 20px; }
.narrow { max-width: 920px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-4); }
.form-section { padding: 20px; border-bottom: 1px solid var(--c-border-soft); }
.grid { display: grid; gap: 14px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.s1 { grid-column: span 1; } .s2 { grid-column: span 2; } .s4 { grid-column: span 4; }
.form-foot { padding: var(--sp-4) 20px; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; background: var(--c-surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.form-foot__hint { margin: 0; font-size: var(--fs-sm); color: var(--c-text-muted); display: flex; gap: 6px; align-items: center; }
.form-foot__actions { display: flex; gap: 12px; align-items: center; }
.segmented { display: flex; border: 1px solid var(--c-border-input); border-radius: var(--r-md); overflow: hidden; min-height: var(--ctl-h); }
.segmented label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--fs-base); font-weight: 500; color: var(--c-text); cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--c-border-input); }
.segmented input { margin: 0; accent-color: #fff; }
.segmented label:has(input:checked) { background: var(--c-primary); color: #fff; font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--c-amber-bright); outline-offset: -3px; }
.dl { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: 9px 0; border-bottom: 1px solid var(--c-border-soft); font-size: var(--fs-base); }
.dl > span:first-child { color: var(--c-text-muted); }
.dl b { font-weight: 600; text-align: right; }
.ok-text { color: var(--c-success); }
.unsaved { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Conversa */
.chat-card { overflow: hidden; }
.chat-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: 12px 18px; border-bottom: 1px solid var(--c-border-soft); font-size: var(--fs-sm); color: var(--c-text-muted); flex-wrap: wrap; }
.legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend .l-cli { background: #fff; border: 1px solid var(--c-border-input); }
.legend .l-ia { background: var(--st-ia-bg); border: 1px solid #c9bdf3; }
.legend .l-vend { background: var(--c-primary); }
.chat { max-height: 65vh; overflow-y: auto; }
.chat__more { align-self: center; }
.msg__text { white-space: pre-line; overflow-wrap: anywhere; }
.msg__text--img { font-style: italic; color: var(--c-text-2); }
.msg--vendedor .msg__media { color: #fff; background: rgba(255,255,255,.16); }
.chat-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--c-border-soft); font-size: var(--fs-md); color: var(--c-text-muted); flex-wrap: wrap; }

/* Notas */
.list-head { padding: 12px 18px; border-bottom: 1px solid var(--c-border-soft); font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--c-text-2); }
.note { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--c-border-soft); }
.note:last-child { border-bottom: 0; }
.note--confirm, .file--confirm { background: var(--c-danger-row); }
.note__meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.note__date { color: var(--c-text-muted); font-size: var(--fs-sm); }
.note__text { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.confirm { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 600; color: var(--c-danger-ink); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }

/* Documentos */
.drop { position: relative; border: 2px dashed #9db5d6; background: #f5f8fc; border-radius: var(--r-lg); padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; text-align: center; transition: background-color .12s ease, border-color .12s ease; }
.drop:hover, .drop--over { border-color: var(--c-primary); border-style: solid; background: var(--c-primary-soft); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop__link { color: var(--c-primary); text-decoration: underline; }
.file-pill { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); background: var(--c-primary-soft-2); border-radius: var(--r-md); padding: 0 10px; min-height: var(--ctl-h); max-width: 100%; }
.file-pill b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--c-border-soft); }
.file:last-child { border-bottom: 0; }
.file__ico { width: 40px; height: 46px; border-radius: 6px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: .04em; flex: none; }
.file__ico--PDF { background: var(--st-perd-bg); color: var(--st-perd-fg); }
.file__ico--IMG { background: var(--st-vend-bg); color: var(--st-vend-fg); }
.file__ico--XLS { background: var(--st-cli-bg); color: var(--st-cli-fg); }
.file__ico--DOC { background: var(--st-novo-bg); color: var(--st-novo-fg); }
.file__main { flex: 1; min-width: 0; }
.file__main a { font-weight: 600; overflow-wrap: anywhere; }
.file__desc { font-size: var(--fs-md); color: var(--c-text-muted); }
.file__size { font-size: var(--fs-md); color: var(--c-text-muted); width: 72px; text-align: right; }
.file__date { font-size: var(--fs-md); color: var(--c-text-muted); width: 92px; text-align: right; }
.file__action { width: 170px; display: flex; justify-content: flex-end; }

/* ---------- Pedidos ---------- */
.table tbody tr.is-cancel td.total { text-decoration: line-through; color: var(--c-text-muted); }
.order-num { font-weight: 700; text-decoration: none; }
.ocard__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.order-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.order-head h1 { margin: 0; font-size: var(--fs-h1); font-weight: 700; }
.tag--consumidor { background: var(--c-primary-soft); color: #174f8f; font-size: var(--fs-sm); padding: 2px 8px; }
.tag--revenda.tag--lg { font-size: var(--fs-sm); padding: 2px 8px; }
.items { display: flex; flex-direction: column; gap: 10px; }
.irow { display: grid; grid-template-columns: minmax(0, 1fr) 80px 150px 140px 40px; gap: 10px; align-items: start; }
.ih { font-size: var(--fs-sm); font-weight: 600; color: var(--c-text-muted); }
.irow__sub { text-align: right; font-weight: 600; padding-top: 9px; }
.irow__hint { font-size: var(--fs-sm); color: var(--c-amber-ink); margin-top: 4px; }
.x { width: 40px; height: 40px; border: 1px solid transparent; border-radius: var(--r-md); background: none; color: var(--c-text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.x:hover { background: var(--c-danger-bg); color: var(--c-danger-ink); }
.combo { position: relative; }
.combo__list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--c-border-input); border-radius: var(--r-md); box-shadow: var(--shadow-pop); z-index: 25; overflow-y: auto; max-height: 300px; padding: 4px 0; margin: 0; list-style: none; }
.combo__opt { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; font-size: var(--fs-base); cursor: pointer; }
.combo__opt:hover, .combo__opt--active { background: var(--c-primary-soft-2); }
.combo__opt--active { font-weight: 600; }
.combo__opt .num { color: var(--c-text-muted); font-weight: 400; }
.summary { flex: 1 1 320px; padding: 18px 20px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.sl { display: flex; justify-content: space-between; padding: 7px 0; font-size: var(--fs-base); }
.sl > span { color: var(--c-text-muted); }
.sl b { font-weight: 500; }
.sum-total { border-top: 1px solid var(--c-border); margin-top: 8px; padding-top: 12px; display: flex; justify-content: space-between; align-items: baseline; }
.sum-total b { font-size: var(--fs-total); letter-spacing: -.02em; }
.sum-inst { text-align: right; color: var(--c-text-muted); font-size: var(--fs-md); }
.sum-note { margin: 10px 0 0; font-size: var(--fs-sm); color: var(--c-text-muted); text-align: center; }
.sum-note b, .free { color: var(--c-success); }
.btn--lg { min-height: 48px; font-size: var(--fs-lg); margin-top: var(--sp-4); }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: #fff; border-top: 1px solid var(--c-border); box-shadow: 0 -6px 20px rgba(15,39,71,.1); padding: 10px 14px max(10px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; }
.bottom-bar__total { flex: 1; min-width: 0; }
.bottom-bar__total span { display: block; font-size: var(--fs-xs); color: var(--c-text-muted); font-weight: 600; }
.bottom-bar__total b { font-size: 18px; }

/* ---------- Produtos ---------- */
.thumb { width: 40px; height: 40px; flex: none; border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text-muted); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img, .img-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-field { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.img-box { width: 140px; height: 140px; flex: none; border-radius: var(--r-lg); border: 1px dashed var(--c-border-btn2); background: var(--c-surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.combo__opt .thumb { width: 28px; height: 28px; }

#blazor-error-ui { background: var(--c-amber-bg); bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; border: 0; background: none; font: inherit; }

/* ---------- Faixas intermediárias ---------- */
@media (max-width: 1279px) {
  .kpis--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .summary { position: static; flex-basis: 100%; }
  .grid--4, .grid--6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid .s1, .grid .s2, .grid .s4 { grid-column: auto; }
  .grid .wide { grid-column: 1 / -1; }
}

/* ---------- Celular (< 768 px) ---------- */
@media (max-width: 767px) {
  .only-desktop { display: none !important; }
  .offline { top: var(--topbar-h-mobile); }
  .page-head { align-items: center; flex-wrap: nowrap; }
  .client-head { padding: 16px; }
  .client-head__actions, .client-head__actions .field { width: 100%; }
  .client-head__actions .btn { flex: 1; }
  .avatar--lg { width: 48px; height: 48px; font-size: 17px; }
  .grid--4, .grid--6 { grid-template-columns: minmax(0, 1fr); }
  .grid .wide { grid-column: auto; }
  .grid--pay { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--pay .wide { grid-column: 1 / -1; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .form-foot__actions { justify-content: flex-end; }
  .chat { padding: 12px; }
  .file { flex-wrap: wrap; gap: 10px; }
  .file__main { flex-basis: calc(100% - 54px); }
  .file__size, .file__date { width: auto; }
  .file__action { width: auto; margin-left: auto; }
  .irow { grid-template-columns: 80px minmax(0, 1fr) 44px; border: 1px solid var(--c-border-soft); border-radius: var(--r-md); padding: 12px; background: #fafbfd; }
  .irow--head { display: none; }
  .irow .combo-wrap { grid-column: 1 / 3; grid-row: 1; }
  .irow .x { grid-column: 3; grid-row: 1; width: 44px; height: 44px; border-color: var(--c-border); background: #fff; }
  .irow .q { grid-column: 1; }
  .irow .v { grid-column: 2 / 4; }
  .irow__sub { grid-column: 1 / -1; display: flex; justify-content: space-between; padding-top: 0; font-size: var(--fs-md); }
  .irow__sub::before { content: "Subtotal"; color: var(--c-text-muted); font-weight: 400; }
  .page--order { padding-bottom: 96px; }
  .summary .btn--lg { display: none; }
  .split__aside { padding: 16px; }
  .popover { right: -4px; }
}

/* ---------- Login e telas sem menu ---------- */
.auth { min-height: 100vh; background: var(--c-navy); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-6); padding: var(--sp-6) 16px; }
.auth__marca { display: flex; align-items: center; gap: 10px; }
.auth__marca img { height: 44px; width: auto; display: block; }
.auth__card { width: 100%; max-width: 400px; padding: 28px; display: flex; flex-direction: column; gap: var(--sp-4); }
.auth__card h1 { font-size: var(--fs-h1); font-weight: 700; margin: 0; }
.auth__card form { display: flex; flex-direction: column; gap: 14px; }
.auth__links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: var(--fs-md); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: var(--fs-md); color: var(--c-text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--c-primary); }

/* ---------- Menu do usuário (topbar) ---------- */
.usermenu { margin-left: auto; position: relative; }
.usermenu__btn { background: none; border: 1px solid var(--c-navy-line); color: #fff; border-radius: var(--r-md); padding: 6px 10px; display: flex; align-items: center; gap: 8px; font: inherit; cursor: pointer; min-height: 40px; }
.usermenu__btn:hover { background: rgba(255,255,255,.08); }
.usermenu__nome { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu__perfil { font-size: 12px; color: var(--c-nav-text); }
.usermenu__lista { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(15,39,71,.18); padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.usermenu__lista a, .usermenu__lista button { display: flex; gap: 8px; align-items: center; padding: 9px 10px; border-radius: var(--r-md); color: var(--c-text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.usermenu__lista a:hover, .usermenu__lista button:hover { background: var(--c-primary-soft-2); }
@media (max-width: 720px) { .usermenu__nome, .usermenu__perfil { display: none; } }

/* ---------- Admin ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--c-bg); color: var(--c-text-2); border: 1px solid var(--c-border); }
.tag--admin { background: var(--c-primary-soft-2); color: var(--c-primary); border-color: #cfdcee; }
.tag--off { background: var(--c-danger-bg); color: #8a1a12; border-color: var(--c-danger-line); }
.tag--warn { background: var(--c-amber-bg); color: #5c3400; border-color: #f0cf7a; }
.tabela { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.tabela th { text-align: left; font-size: var(--fs-sm); color: var(--c-text-muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--c-border); }
.tabela td { padding: 10px 14px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela a { color: var(--c-primary); font-weight: 600; text-decoration: none; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tabela-wrap { overflow-x: auto; }
