/* Gestor Tec — identidade e componentes */
:root {
  --azul: #4880ff;
  --azul-hover: #2f64e6;
  --azul-claro: #eef3ff;
  --fundo: #f5f6fa;
  --tinta: #202224;
  --texto: #4a4c55;
  --suave: #8a8c99;
  --linha: #e6e8ee;
  --linha-fraca: #eef0f4;
  --verde: #00b69b;
  --vermelho: #f93c65;
  --sombra: 6px 6px 54px rgba(0, 0, 0, .05);
  /* quadrados de ícone (como no modelo) */
  --roxo-bg: #e5e4ff; --roxo: #8280ff;
  --amarelo-bg: #fff3d6; --amarelo: #fec53d;
  --verde-bg: #d9f7e8; --verde-ic: #4ad991;
  --laranja-bg: #ffded1; --laranja: #ff9066;
}

html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Nunito Sans', system-ui, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5; background: var(--fundo); color: var(--texto); }
h1, h2, h3 { color: var(--tinta); }
.num, .table td.num, .kpi .v { font-variant-numeric: tabular-nums; }
a { text-underline-offset: 3px; }
:where(a, button, summary, [tabindex]):focus-visible,
.btn:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; border-radius: 6px; }

/* ---------- Marca ---------- */
.logo { font-weight: 800; font-size: 22px; letter-spacing: -0.01em; color: var(--tinta); line-height: 1; white-space: nowrap; }
.logo b { color: var(--azul); font-weight: 800; }

/* ---------- Estrutura do painel ---------- */
.side { background: #fff; border-right: 1px solid var(--linha); }
.side-head { height: 70px; display: flex; align-items: center; padding: 0 28px; }
.side-nav { padding: 10px 0; }
.side-link { position: relative; display: flex; align-items: center; gap: 14px; margin: 2px 24px; padding: 11px 16px; font-size: 14.5px; font-weight: 600; color: var(--tinta); border-radius: 8px; text-decoration: none; }
.side-link svg { color: var(--tinta); opacity: .8; }
.side-link:hover { background: var(--fundo); }
.side-link.is-active { background: var(--azul); color: #fff; }
.side-link.is-active svg { color: #fff; opacity: 1; }
.side-link.is-active::before { content: ''; position: absolute; left: -24px; top: 0; bottom: 0; width: 5px; border-radius: 0 4px 4px 0; background: var(--azul); }
.side-sep { height: 1px; background: var(--linha); margin: 12px 0; }

.topbar { background: #fff; border-bottom: 1px solid var(--linha); }
.search { display: flex; align-items: center; gap: 10px; background: var(--fundo); border: 1px solid #d5d5d5; border-radius: 999px; padding: 0 16px; height: 40px; width: 100%; max-width: 390px; color: var(--suave); }
.search input { border: 0; background: transparent; outline: none; font-size: 14px; color: var(--tinta); width: 100%; font-family: inherit; }
.search:focus-within { border-color: var(--azul); }
.avatar { width: 42px; height: 42px; border-radius: 999px; background: linear-gradient(135deg, #8faeff, #4880ff); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }
.bell { position: relative; color: var(--azul); padding: 8px; border-radius: 999px; }
.bell:hover { background: var(--azul-claro); }

/* Menus suspensos (notificações e conta) */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 12px); z-index: 50; max-width: calc(100vw - 24px); background: #fff; border-radius: 14px; padding: 8px; box-shadow: 0 24px 60px rgba(30, 66, 153, .18), 0 0 0 1px rgba(0, 0, 0, .03); animation: dd-in .14s ease-out; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dd-head { padding: 8px 12px 10px; font-weight: 800; color: var(--tinta); border-bottom: 1px solid var(--linha-fraca); margin-bottom: 4px; }
.dd-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--tinta); text-decoration: none; text-align: left; }
.dd-item:hover { background: var(--fundo); }
.dd-foot { display: block; text-align: center; padding: 10px; margin-top: 4px; border-top: 1px solid var(--linha-fraca); font-size: 13.5px; font-weight: 700; color: var(--azul); }
.dd-foot:hover { text-decoration: underline; }
.bell-count { position: absolute; top: -2px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--vermelho); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid #fff; box-sizing: content-box; }
.bell { display: inline-flex; }

.page-title { font-size: 30px; font-weight: 800; color: var(--tinta); line-height: 1.15; letter-spacing: -0.015em; }

/* ---------- Componentes ---------- */
.card { background: #fff; border: 0; border-radius: 14px; box-shadow: var(--sombra); }
.card-h { padding: 20px 24px 14px; font-weight: 800; font-size: 18px; color: var(--tinta); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-h a, .card-h span { font-size: 14px; font-weight: 600; }
.card-b { padding: 20px 24px; }
.link { color: var(--azul); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 700; border: 1px solid transparent; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; text-decoration: none; line-height: 1.4; }
.btn.btn-primary { background: var(--azul); color: #fff; }
.btn.btn-primary:hover { background: var(--azul-hover); box-shadow: 0 6px 16px rgba(72, 128, 255, .3); }
.btn.btn-dark { background: var(--tinta); color: #fff; }
.btn.btn-dark:hover { background: #000; }
.btn.btn-light { background: #fff; color: var(--tinta); border-color: #d5d5d5; }
.btn.btn-light:hover { background: var(--fundo); }
.btn.btn-green { background: var(--verde); color: #fff; }
.btn.btn-green:hover { background: #009a83; }
.btn.btn-danger { background: #fff; color: #e0284f; border-color: #fcd0da; }
.btn.btn-danger:hover { background: #fff1f4; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
/* Botões de documento com ícone e texto: OS, Recibo (sem valor fiscal) e NFS-e (fiscal) */
.doc-btn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--linha); background: #fff; color: var(--texto); font-size: 12.5px; font-weight: 800; text-decoration: none; transition: background .15s, color .15s, border-color .15s; }
.doc-btn:hover { background: var(--azul-claro); border-color: #bacdff; color: var(--azul); }
.doc-btn.is-fiscal { border-color: #bacdff; color: var(--azul); }
.doc-btn.is-ok { background: #ccf0eb; border-color: #a3e3d9; color: #00927c; }
.doc-btn.is-ok:hover { background: #b5e9e1; }
/* Botões só de ícone */
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--linha); background: #fff; color: var(--texto); transition: background .15s, color .15s, border-color .15s; }
.icon-btn:hover { background: var(--azul-claro); border-color: #bacdff; color: var(--azul); }
.icon-btn.is-ok { background: #ccf0eb; border-color: #a3e3d9; color: #00927c; }
.icon-btn.is-ok:hover { background: #b5e9e1; }
.btn:disabled { opacity: .55; cursor: wait; }

.input, select.input, textarea.input { width: 100%; border: 1px solid #d5d5d5; border-radius: 8px; padding: 9px 12px; font-size: 15px; font-family: inherit; background: #f5f6fa; color: var(--tinta); }
.input::placeholder { color: #a6a8b3; }
.input:focus { outline: none; border-color: var(--azul); background: #fff; box-shadow: 0 0 0 3px rgba(72, 128, 255, .15); }
/* Campo de arquivo: botão azul claro no lugar do botão cinza do navegador */
input[type=file].input { padding: 6px; cursor: pointer; color: var(--suave); font-size: 14px; }
input[type=file].input::file-selector-button { margin-right: 12px; padding: 8px 16px; border: 0; border-radius: 6px; background: var(--azul-claro); color: var(--azul); font: inherit; font-weight: 700; cursor: pointer; transition: background .15s; }
input[type=file].input:hover::file-selector-button { background: #dce6ff; }
.label { display: block; font-size: 14px; font-weight: 700; color: var(--tinta); margin-bottom: 6px; }
.help { font-size: 13px; color: var(--suave); margin-top: 4px; }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 5px; font-size: 12.5px; font-weight: 700; line-height: 20px; white-space: nowrap; }
.badge-green { background: #ccf0eb; color: #00927c; }
.badge-amber { background: #ffedd5; color: #c76f00; }
.badge-orange { background: #ffe4d6; color: #d9531e; }
.badge-blue { background: #dce6ff; color: #2f64e6; }
.badge-indigo { background: #e0d4fc; color: #6226ef; }
.badge-violet { background: #e5e4ff; color: #5d5ae0; }
.badge-red { background: #fcd7d4; color: #ef3826; }
.badge-slate { background: #eef0f4; color: #4a4c55; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.table th { text-align: left; font-size: 14px; color: var(--tinta); font-weight: 800; padding: 13px 16px; background: #f1f4f9; white-space: nowrap; }
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child { border-radius: 0 10px 10px 0; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--linha-fraca); vertical-align: top; color: var(--tinta); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table tfoot td { border-top: 1px solid var(--linha); border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; padding: 0 12px 8px; }
.card > .table-wrap:first-child { padding-top: 12px; }

/* Abas em botões, como filtros do modelo */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tab { padding: 7px 14px; font-size: 14px; font-weight: 700; color: var(--texto); white-space: nowrap; text-decoration: none; background: #fff; border: 1px solid var(--linha); border-radius: 8px; }
.tab:hover { border-color: #c5c8d1; }
.tab.active { background: var(--azul); border-color: var(--azul); color: #fff; }
.tab .count { margin-left: 6px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--suave); }
.tab.active .count { color: #dce6ff; }

.alert { padding: 13px 16px; border-radius: 10px; font-size: 14.5px; font-weight: 600; }
.alert-success { background: #ccf0eb; color: #00735f; }
.alert-error { background: #fcd7d4; color: #b4241a; }
.alert-info { background: #dce6ff; color: #2552c2; }
.alert-warning { background: #ffedd5; color: #a35a00; }

/* Barra de ferramentas das listas: filtros à esquerda, resumo à direita */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 16px; }
.toolbar .grow { flex: 1 1 260px; }
.search.on-page { background: #fff; border-color: var(--linha); max-width: 460px; height: 42px; box-shadow: var(--sombra); }
.search.on-page:focus-within { border-color: var(--azul); }
.toolbar .input { height: 42px; width: auto; background: #fff; }
.toolbar .sum { margin-left: auto; font-size: 14px; color: var(--suave); font-weight: 600; white-space: nowrap; }
.toolbar .sum b { color: var(--tinta); font-weight: 800; }
.toolbar .dates { display: contents; }
.filters-btn { display: none; }

/* ---------- Lista de serviços em cartões (celular) ---------- */
.os-list { display: flex; flex-direction: column; gap: 12px; }
.os-card { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1.5px solid transparent; border-radius: 16px; padding: 14px 16px; box-shadow: 0 4px 18px rgba(26, 31, 51, .06); text-decoration: none; color: inherit; }
.os-card:active { background: #fafbfd; }
.os-card.is-late { border-color: #fcd7d4; }
.os-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 2px; }
.os-pill { margin-right: auto; padding: 3px 8px; border-radius: 8px; background: var(--azul-claro); color: #2f64e6; font-size: 12px; font-weight: 800; }
.os-cli { font-size: 16px; font-weight: 800; color: var(--tinta); line-height: 1.3; }
.os-serv { font-size: 14px; font-weight: 600; color: var(--texto); line-height: 1.4; }
.os-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--linha-fraca); font-size: 13px; font-weight: 700; color: var(--texto); }
.os-val { margin-left: auto; text-align: right; font-size: 17px; font-weight: 800; color: var(--tinta); }
.os-val small { display: block; font-size: 11px; font-weight: 700; color: #c2410c; }
@media (min-width: 768px) { .os-list { display: none; } }
@media (max-width: 767px) {
  .os-table { display: none; }
  .tabs { margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { border-radius: 999px; padding: 8px 14px; }
  .tab .count { padding: 1px 7px; border-radius: 999px; background: #eef0f4; color: var(--texto); font-weight: 800; }
  .tab.active .count { background: rgba(255, 255, 255, .22); color: #fff; }
  .toolbar .grow { flex: 1 1 0; min-width: 0; }
  .filters-btn { display: inline-flex; height: 42px; }
  .toolbar .dates { display: none; }
  .toolbar.open .dates { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
  .toolbar .sum { margin-left: 0; width: 100%; }
}

/* ---------- Agenda no celular ---------- */
.ag-m { display: none; }
@media (max-width: 767px) {
  .ag-d { display: none; }
  .ag-m { display: block; }
  .ag-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
  .ag-head > b { font-size: 18px; font-weight: 800; color: var(--tinta); }
  .ag-nav { display: flex; align-items: center; gap: 6px; }
  .ag-nav a { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 999px; background: #fff; border: 1px solid var(--linha); color: var(--tinta); font-size: 14px; font-weight: 800; text-decoration: none; }
  .ag-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 8px; background: #fff; border-radius: 18px; box-shadow: 0 4px 18px rgba(26, 31, 51, .06); }
  .ag-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 12px; color: var(--suave); text-decoration: none; }
  .ag-day span { font-size: 11px; font-weight: 700; }
  .ag-day b { font-size: 17px; font-weight: 800; color: var(--tinta); line-height: 1.2; }
  .ag-day i { width: 5px; height: 5px; border-radius: 999px; background: transparent; }
  .ag-day i.on { background: var(--azul); }
  .ag-day.is-today { background: var(--azul); color: #dce6ff; }
  .ag-day.is-today b { color: #fff; }
  .ag-day.is-today i.on { background: #fff; }
  .ag-sum { margin: 12px 2px 4px; font-size: 13px; font-weight: 600; color: var(--suave); }
  .ag-sum b { color: var(--tinta); font-weight: 800; }
  .ag-sec { margin-top: 18px; scroll-margin-top: 84px; display: flex; flex-direction: column; gap: 10px; }
  .ag-sec h2 { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 800; color: var(--tinta); }
  .ag-sec h2.is-today { color: var(--azul); }
  .ag-sec h2.is-late { color: #ef3826; }
  .ag-count { padding: 1px 8px; border-radius: 999px; background: #eef0f4; color: var(--texto); font-size: 12px; }
  .ag-free { padding: 12px 16px; border: 1.5px dashed var(--linha); border-radius: 14px; font-size: 14px; font-weight: 600; color: var(--suave); }
  .ag-item { display: flex; gap: 10px; text-decoration: none; color: inherit; }
  .ag-time { flex: none; width: 50px; padding-top: 14px; text-align: right; font-size: 15px; font-weight: 800; color: var(--tinta); }
  .ag-time small { display: block; font-size: 12px; font-weight: 700; color: inherit; opacity: .8; }
  .ag-time.is-late { color: #ef3826; }
  .ag-card { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: #fff; border-left: 4px solid var(--azul); border-radius: 14px; box-shadow: 0 4px 18px rgba(26, 31, 51, .06); }
  .ag-card.is-late { border-left-color: #ef3826; }
  .ag-item:active .ag-card { background: #fafbfd; }
}

/* ---------- Barra inferior (celular) ---------- */
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--linha); }
.bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 700; color: var(--suave); text-decoration: none; cursor: pointer; }
.bnav .on { color: var(--azul); font-weight: 800; }
.bnav .mic span { display: grid; place-items: center; width: 56px; height: 56px; margin-top: -30px; border-radius: 999px; border: 4px solid #fff; background: var(--azul); color: #fff; box-shadow: 0 8px 18px rgba(72, 128, 255, .35); }
.bnav a:focus-visible, .bnav button:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; border-radius: 10px; }
@media (min-width: 1024px) { .bnav { display: none; } }

/* Abas horizontais (Configurações): barra branca, aba ativa sublinhada em azul */
.htabs { display: flex; gap: 4px; overflow-x: auto; background: #fff; border-radius: 14px; box-shadow: var(--sombra); padding: 0 12px; scrollbar-width: thin; }
.htabs a { display: flex; align-items: center; gap: 9px; padding: 16px 14px 14px; font-weight: 700; font-size: 14.5px; color: var(--texto); white-space: nowrap; text-decoration: none; border-bottom: 3px solid transparent; }
.htabs a svg { color: var(--suave); }
.htabs a:hover { color: var(--tinta); }
.htabs a.active { color: var(--azul); border-bottom-color: var(--azul); }
.htabs a.active svg { color: var(--azul); }

/* Seções de formulário: título à esquerda, campos à direita (telas largas) */
.fs { display: grid; gap: 16px 32px; padding: 24px; border-top: 1px solid var(--linha-fraca); }
.fs:first-child { border-top: 0; }
.fs-h h2 { font-size: 16px; font-weight: 800; color: var(--tinta); }
.fs-h p { font-size: 13.5px; color: var(--suave); margin-top: 4px; }
@media (min-width: 1280px) { .fs { grid-template-columns: 260px 1fr; } }
.card-f { padding: 16px 24px; border-top: 1px solid var(--linha-fraca); display: flex; justify-content: flex-end; gap: 8px; }

/* Cartões de indicador com quadrado de ícone colorido */
.kpi { padding: 20px 22px; display: block; text-decoration: none; }
.kpi-top { display: flex; justify-content: space-between; gap: 12px; }
.kpi .k { font-size: 15px; color: var(--texto); font-weight: 600; }
.kpi .v { font-size: 28px; font-weight: 800; color: var(--tinta); margin-top: 4px; line-height: 1.1; letter-spacing: .01em; white-space: nowrap; }
.kpi .s { font-size: 14px; color: var(--suave); margin-top: 16px; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.kpi .s .up { color: var(--verde); }
.kpi .s .down { color: var(--vermelho); }
.ic { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; flex-shrink: 0; }
.ic-roxo { background: var(--roxo-bg); color: var(--roxo); }
.ic-amarelo { background: var(--amarelo-bg); color: #e8a90c; }
.ic-verde { background: var(--verde-bg); color: #1fbf6f; }
.ic-laranja { background: var(--laranja-bg); color: var(--laranja); }
.ic-azul { background: var(--azul-claro); color: var(--azul); }
.ic-rosa { background: #ffe0e8; color: var(--vermelho); }
a.kpi:hover { box-shadow: 0 10px 40px rgba(72, 128, 255, .14); }
@media (max-width: 640px) {
  .kpi { padding: 16px; }
  .kpi .v { font-size: 21px; }
  .kpi .s { margin-top: 12px; font-size: 13px; }
  .ic { width: 44px; height: 44px; border-radius: 13px; }
}

/* Faixa do assistente de voz no painel */
.voice.voice { display: flex; align-items: center; gap: 20px; width: 100%; text-align: left; background: linear-gradient(110deg, #4880ff 0%, #6b96ff 100%); color: #fff; border-radius: 14px; padding: 22px 26px; cursor: pointer; border: 0; box-shadow: 0 12px 36px rgba(72, 128, 255, .28); }
.voice-mic { flex-shrink: 0; width: 60px; height: 60px; border-radius: 999px; background: #fff; color: var(--azul); display: grid; place-items: center; transition: transform .15s; box-shadow: 0 0 0 8px rgba(255, 255, 255, .18); }
.voice:hover .voice-mic { transform: scale(1.05); }
.voice-hello { font-size: 21px; font-weight: 800; line-height: 1.2; }
.voice-sub { margin-top: 4px; font-size: 14.5px; color: #e8efff; max-width: 70ch; }
.voice-cta { margin-left: auto; background: rgba(255, 255, 255, .18); padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: 14px; white-space: nowrap; }
@media (max-width: 640px) {
  .voice.voice { padding: 18px; gap: 14px; }
  .voice-mic { width: 50px; height: 50px; }
  .voice-hello { font-size: 18px; }
  .voice-cta { display: none; }
}

.when { font-size: 13px; font-weight: 700; color: var(--suave); font-variant-numeric: tabular-nums; }
.when.late { color: var(--vermelho); }
.os-num { font-size: 12.5px; font-weight: 700; color: var(--azul); background: var(--azul-claro); border-radius: 5px; padding: 1px 8px; font-variant-numeric: tabular-nums; }

/* ---------- Assistente ---------- */
.fab.fab { background: var(--azul); color: #fff; box-shadow: 0 10px 28px rgba(72, 128, 255, .45); }
.fab.fab:hover { background: var(--azul-hover); }
.msg-user { margin-left: 15%; background: var(--azul); color: #fff; padding: 9px 13px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg-bot { margin-right: 8%; background: var(--fundo); color: var(--tinta); padding: 9px 13px; border-radius: 14px 14px 14px 4px; }
.msg-bot .btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-bot a { color: var(--azul); text-decoration: underline; }
.recording { animation: pulse 1s infinite; background: var(--vermelho) !important; color: #fff !important; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(249, 60, 101, .2); } }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--linha); background: #fff; font-size: 13.5px; font-weight: 700; text-decoration: none; color: var(--tinta); font-variant-numeric: tabular-nums; }
.pagination a:hover { border-color: var(--azul); color: var(--azul); }
.pagination .cur { background: var(--azul); color: #fff; border-color: var(--azul); }
.muted { color: var(--suave); }
.pre { white-space: pre-wrap; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--azul); position: relative; overflow: hidden; }
.auth::before, .auth::after { content: ''; position: absolute; border-radius: 999px; background: rgba(255, 255, 255, .08); pointer-events: none; }
.auth::before { width: 620px; height: 620px; left: -180px; top: -220px; }
.auth::after { width: 520px; height: 520px; right: -160px; bottom: -200px; }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 460px; background: #fff; border-radius: 24px; padding: 44px 40px; box-shadow: 0 30px 80px rgba(20, 43, 102, .25); }
@media (max-width: 480px) { .auth-card { padding: 32px 22px; border-radius: 18px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Janela de confirmação ---------- */
.cfm { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(32, 34, 36, .45); backdrop-filter: blur(2px); }
.cfm[hidden] { display: none; }
.cfm-box { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 28px 28px 24px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .18); animation: cfm-in .16s ease-out; }
.cfm-ic { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; margin-bottom: 14px; }
.cfm-ic svg { width: 28px; height: 28px; }
.cfm-ic.is-primary { background: var(--azul-claro); color: var(--azul); }
.cfm-ic.is-green { background: var(--verde-bg); color: var(--verde); }
.cfm-ic.is-danger { background: #ffe0e8; color: var(--vermelho); }
.cfm-box h2 { font-size: 19px; font-weight: 800; }
.cfm-box p { margin-top: 6px; font-size: 15px; color: var(--texto); }
.cfm-actions { display: flex; gap: 10px; margin-top: 22px; }
.cfm-actions .btn { flex: 1; padding-top: 11px; padding-bottom: 11px; }
@keyframes cfm-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cfm-box { animation: none; } }
.cfm-actions .btn-danger { background: var(--vermelho); color: #fff; border-color: transparent; }
.cfm-actions .btn-danger:hover { background: #e0284f; }

/* =========================================================
   Celular: painel com cara de app (topo compacto, listas em
   cartões, menus como folha que sobe de baixo)
   ========================================================= */
html { -webkit-tap-highlight-color: transparent; }
.tb-title, .tb-back, .tb-icon { display: none; }
.auth-top { display: none; }
@media (max-width: 1023px) {
  body { background: var(--fundo); }
  .topbar { padding-top: env(safe-area-inset-top); box-shadow: 0 1px 0 var(--linha); border-bottom: 0; user-select: none; -webkit-user-select: none; }
  .topbar:has(.dd[open]) { z-index: 70; }
  .tb-row { height: 58px !important; gap: 4px !important; padding: 0 8px 0 12px !important; }
  .tb-title { display: block; flex: 1; min-width: 0; padding: 0 6px; font-size: 18px; font-weight: 800; color: var(--tinta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
  .tb-back, .tb-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 999px; color: var(--tinta); flex-shrink: 0; }
  .tb-back { margin-left: -6px; }
  .tb-back:active, .tb-icon:active, .bell:active { background: var(--fundo); }
  .topbar .avatar { width: 34px; height: 34px; font-size: 13px; }
  .topbar .bell { color: var(--tinta); }
  .bnav { user-select: none; -webkit-user-select: none; box-shadow: 0 -6px 20px rgba(26, 31, 51, .05); }
  .bnav a:active, .bnav button:active { transform: scale(.94); }

  /* Menu lateral como gaveta, acima da barra inferior */
  #sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); border-radius: 0 20px 20px 0; }
  #sidebar:not(.-translate-x-full) { box-shadow: 12px 0 40px rgba(0, 0, 0, .12); }

  /* Ação única da página (ex.: "+ Novo cliente") vira botão redondo flutuante acima da barra inferior */
  .page-actions:has(> .btn-primary:only-child) { position: fixed; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 35; }
  .page-actions > .btn-primary:only-child { width: 56px; height: 56px; padding: 0; border-radius: 18px; box-shadow: 0 10px 24px rgba(72, 128, 255, .4); }
  .page-actions > .btn-primary:only-child svg { width: 24px; height: 24px; }
  main > div:first-child:has(> .page-actions > .btn-primary:only-child) { margin-bottom: 0; }
  .side-link { padding: 13px 16px; font-size: 15.5px; }

  /* Notificações e conta: folha que sobe de baixo */
  .dd[open]::before { content: ''; position: fixed; inset: 0; z-index: 60; background: rgba(32, 34, 36, .45); }
  .dd-menu { position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 61; width: auto !important; max-width: none; max-height: 80vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 22px 10px calc(14px + env(safe-area-inset-bottom)); animation: sheet-in .2s ease-out; }
  .dd-menu::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 999px; background: #d5d7de; }
  .dd-item { padding: 13px 12px; font-size: 15.5px; }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

@media (max-width: 767px) {
  /* Campos com 16px: o iPhone não dá zoom ao tocar */
  .input, select.input, textarea.input, .search input { font-size: 16px; }
  .input, select.input { min-height: 46px; }
  .btn { min-height: 44px; padding-left: 16px; padding-right: 16px; }
  .btn-sm { min-height: 36px; }
  .btn:active, .doc-btn:active, .icon-btn:active, .tab:active { transform: scale(.97); }
  .card { border-radius: 18px; }
  .card-h { padding: 16px 16px 10px; font-size: 17px; }
  .card-b { padding: 16px; }
  .card-f { padding: 14px 16px; }
  .card-f .btn { flex: 1; }
  .fs { padding: 18px 16px; }
  .htabs { margin: 0 -16px; border-radius: 0; padding: 0 8px; scrollbar-width: none; }
  .htabs::-webkit-scrollbar { display: none; }
  .alert { border-radius: 14px; }
  .pagination { justify-content: center; }
  .pagination a, .pagination span { min-width: 40px; height: 40px; display: grid; place-items: center; }
  .cfm { align-items: flex-end; padding: 0; }
  .cfm-box { max-width: none; border-radius: 22px 22px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); animation: sheet-in .2s ease-out; }
  #assistant { max-height: 88dvh; padding-bottom: env(safe-area-inset-bottom); }

  /* Tabelas viram cartões (rótulo de cada coluna vem do cabeçalho, via app.js) */
  .card.has-rt { background: transparent; box-shadow: none; }
  .card.has-rt > .table-wrap, .table-wrap.has-rt { padding: 0 !important; overflow: visible; max-height: none !important; }
  .table.rt, .table.rt tbody, .table.rt tfoot, .table.rt tr { display: block; width: 100%; }
  .table.rt thead { display: none; }
  .table-wrap.has-rt { padding: 4px 12px 8px !important; }
  .table-wrap.has-rt .table.rt tr { box-shadow: none; border: 1px solid var(--linha); border-radius: 14px; }
  .table.rt tr { background: #fff; border-radius: 16px; padding: 12px 16px; margin-bottom: 10px; box-shadow: 0 4px 18px rgba(26, 31, 51, .06); }
  .table.rt tbody tr:hover td { background: transparent; }
  .table.rt td { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 5px 0 !important; border: 0; text-align: right; min-width: 0; }
  .table.rt td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: 13px; font-weight: 700; color: var(--suave); }
  .table.rt td > * { min-width: 0; }
  .table.rt td:first-child { display: block; text-align: left; padding: 0 0 8px !important; margin-bottom: 4px; border-bottom: 1px solid var(--linha-fraca); font-size: 15.5px; }
  .table.rt td:first-child::before, .table.rt td[data-label=""]::before, .table.rt td[colspan]::before { display: none; }
  .table.rt td[data-label=""] { justify-content: flex-end; }
  .table.rt td[colspan] { display: block; text-align: center; border: 0; margin: 0; padding: 18px 0 !important; }
  .table.rt td.rt-empty { display: none; }
  .table.rt tfoot tr { background: var(--azul-claro); box-shadow: none; }
  .table.rt tfoot td { border: 0; }
}

/* ---------- Login no celular: tela de app ---------- */
@media (max-width: 640px) {
  .auth { flex-direction: column; align-items: stretch; justify-content: flex-end; min-height: 100dvh; padding: 0; }
  .auth::before { width: 420px; height: 420px; left: -160px; top: -200px; }
  .auth::after { width: 300px; height: 300px; right: -120px; top: 80px; bottom: auto; }
  .auth-top { display: block; position: relative; z-index: 1; padding: calc(36px + env(safe-area-inset-top)) 26px 30px; color: #fff; }
  .auth-top b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
  .auth-top span { display: block; margin-top: 6px; font-size: 15.5px; font-weight: 600; color: #dce6ff; }
  .auth-card { max-width: none; flex: 0 0 auto; border-radius: 28px 28px 0 0; padding: 30px 22px calc(26px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(20, 43, 102, .2); animation: sheet-in .28s ease-out; }
}

/* ---------- Celular: ajustes finos de app ---------- */
@media (max-width: 767px) {
  main .grid > * { min-width: 0; }
  .table-wrap.has-rt { overflow: hidden; }
  .table.rt td { white-space: normal; }
  /* Rodapé das tabelas (Desconto / Total): rótulo à esquerda, valor à direita */
  .table.rt tfoot tr { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .table.rt tfoot td, .table.rt tfoot td:first-child, .table.rt tfoot td[colspan] { display: block; width: auto; margin: 0; padding: 4px 0 !important; border: 0; text-align: left; font-size: 15px; }
  .table.rt tfoot td::before { display: none; }
  .table.rt tfoot td:last-child { text-align: right; font-size: 17px; }

  /* Editor de itens (OS e orçamento): cada item vira um cartão com rótulos */
  #itemsEditor .table-wrap { padding: 4px 12px 8px; overflow: visible; }
  #itemsEditor .table thead { display: none; }
  #itemsEditor .table, #itemsEditor .table tbody { display: block; }
  #itemsEditor .table tr { display: grid; grid-template-columns: 1fr 1fr 1fr 40px; gap: 6px 8px; align-items: end; padding: 12px; margin-bottom: 10px; border: 1px solid var(--linha); border-radius: 14px; background: #fff; }
  #itemsEditor .table td { display: block; padding: 0 !important; border: 0; background: transparent !important; }
  #itemsEditor .table td:nth-child(1) { grid-column: 1 / 4; }
  #itemsEditor .table td:nth-child(6) { grid-column: 4; grid-row: 1; display: grid; place-items: center; height: 46px; }
  #itemsEditor .table td:nth-child(2) { grid-column: 1 / -1; }
  #itemsEditor .table td:nth-child(5) { grid-column: 3 / -1; text-align: right; padding-bottom: 12px !important; font-weight: 800; font-size: 16px; }
  #itemsEditor .table td:nth-child(2)::before, #itemsEditor .table td:nth-child(3)::before, #itemsEditor .table td:nth-child(4)::before, #itemsEditor .table td:nth-child(5)::before { display: block; margin: 2px 0 4px; font-size: 12.5px; font-weight: 700; color: var(--suave); text-align: left; }
  #itemsEditor .table td:nth-child(2)::before { content: 'Descrição'; }
  #itemsEditor .table td:nth-child(3)::before { content: 'Qtd'; }
  #itemsEditor .table td:nth-child(4)::before { content: 'Valor'; }
  #itemsEditor .table td:nth-child(5)::before { content: 'Subtotal'; text-align: right; }
  #itemsEditor .table [data-remove] { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
  #itemsEditor .table [data-remove]:active { background: #fff1f4; color: #e0284f; }
  #itemsEditor .card-b { grid-template-columns: 1fr 1fr; }
}
