/* ============================================================
   Sistema de Atendimento — Design System
   Paleta extraída da logomarca: fundo grafite/preto, prata nos
   textos de destaque e azul técnico (#0A85AD) como assinatura.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root{
  --sidebar-w:216px;

  --bg:#0E0F11;
  --surface:#17181C;
  --surface-2:#1E2024;
  --border:#2B2E33;
  --ink:#ECEDEF;
  --ink-dim:#9AA0A7;
  --ink-faint:#666D74;

  --teal:#0FA0D1;
  --teal-dark:#075E7C;
  --teal-tint:rgba(15,160,209,0.16);
  --teal-text:#5FCBEE;

  --amber:#E0A94A;
  --amber-tint:rgba(224,169,74,0.15);

  --red:#E2695C;
  --red-tint:rgba(226,105,92,0.15);

  --green:#48BA84;
  --green-tint:rgba(72,186,132,0.15);

  --radius:9px;
  --radius-sm:6px;
  --shadow:0 1px 2px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.28);
  --shadow-lg:0 18px 44px rgba(0,0,0,0.55);

  --font-display:'Space Grotesk', sans-serif;
  --font-body:'Inter', sans-serif;
  --font-mono:'IBM Plex Mono', monospace;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:
    radial-gradient(ellipse 900px 500px at 85% -8%, rgba(15,160,209,0.07), transparent 60%),
    var(--bg);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:14.5px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{font-family:var(--font-display);margin:0;color:var(--ink);}
a{color:var(--teal-text);text-decoration:none;}
button{font-family:var(--font-body);}
input,select,textarea{font-family:var(--font-body);}
code{font-family:var(--font-mono);background:var(--surface-2);padding:1px 5px;border-radius:4px;font-size:12px;}

/* ---------- App shell ---------- */
.app{
  display:flex;
  min-height:100vh;
}

/* Sidebar (desktop) */
.sidebar{
  width:var(--sidebar-w);
  flex-shrink:0;
  background:
    radial-gradient(ellipse 340px 260px at 15% 0%, rgba(15,160,209,0.14), transparent 65%),
    #0A0C0E;
  border-right:1px solid var(--border);
  color:#fff;
  padding:22px 14px;
  display:flex;
  flex-direction:column;
  position:sticky;
  top:0;
  height:100vh;
}
.brand{
  font-family:var(--font-display);
  font-weight:700;
  font-size:16.5px;
  color:#fff;
  padding:0 10px 22px 10px;
  display:flex;
  align-items:center;
  gap:9px;
  letter-spacing:.01em;
}
.brand .dot{width:9px;height:9px;border-radius:50%;background:#35C6EE;box-shadow:0 0 10px rgba(53,198,238,0.7);flex-shrink:0;}
.nav-item{
  display:flex;align-items:center;gap:11px;
  padding:10px 12px;border-radius:var(--radius-sm);
  color:rgba(236,237,239,0.62);
  font-size:13.5px;font-weight:500;
  cursor:pointer;margin-bottom:2px;
  border-left:2px solid transparent;
  transition:background .12s ease, color .12s ease, border-color .12s ease;
}
.nav-item svg{width:17px;height:17px;flex-shrink:0;opacity:.9;}
.nav-item:hover{background:rgba(255,255,255,0.05);color:#fff;}
.nav-item.active{background:var(--teal-tint);color:#fff;border-left-color:var(--teal);}
.sidebar-foot{
  margin-top:auto;padding:10px 12px;font-size:11px;color:rgba(236,237,239,0.32);
  font-family:var(--font-mono);
}
.sidebar-theme-pref{display:block;margin-bottom:10px;font-family:var(--font);font-size:11px;color:rgba(236,237,239,.50)}
.sidebar-theme-pref span{display:block;margin-bottom:5px}
.sidebar-theme-pref select{width:100%;min-height:34px;padding:6px 9px;border-radius:8px;border:1px solid rgba(255,255,255,.12);background:#151a1f;color:#e8edf0;font:12px var(--font);outline:none}
.sidebar-theme-pref select:focus{border-color:var(--teal)}
.sidebar-logout{color:rgba(236,237,239,.50)}
html[data-theme="light"] .sidebar-theme-pref{color:#657680}
html[data-theme="light"] .sidebar-theme-pref select{background:#fff;border-color:#cbd6dc;color:#1d2529}
html[data-theme="light"] .sidebar-logout{color:#657680}

/* Main column */
.main{
  flex:1;
  min-width:0;
  padding:26px 30px 90px 30px;
}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:22px;flex-wrap:wrap;gap:12px;
}
.topbar h1{font-size:22px;}
.topbar .topbar-sub{font-size:13px;color:var(--ink-dim);margin-top:3px;}

/* Qualquer ícone solto direto num título (sem estar dentro de .btn/.nav-item/.avatar
   etc, que já têm suas próprias regras) — evita ícones gigantes por acidente. */
h1 svg, h2 svg, h3 svg, h4 svg, p svg, label svg{width:16px;height:16px;flex-shrink:0;vertical-align:-3px;}

/* Bottom nav (mobile) */
.bottom-nav{
  display:none;
  position:fixed;left:0;right:0;bottom:0;
  background:var(--surface);
  border-top:1px solid var(--border);
  padding:6px 4px calc(6px + env(safe-area-inset-bottom)) 4px;
  z-index:40;
  box-shadow:0 -4px 16px rgba(0,0,0,0.4);
}
.bottom-nav-inner{display:flex;justify-content:flex-start;gap:2px;overflow-x:auto;scrollbar-width:none;}
.bottom-nav-inner::-webkit-scrollbar{display:none;}
.bn-item{
  display:flex;flex-direction:column;align-items:center;gap:3px;
  padding:6px 10px;border-radius:8px;color:var(--ink-faint);
  font-size:10px;font-weight:500;flex-shrink:0;white-space:nowrap;
}
.bn-item svg{width:20px;height:20px;}
.bn-item.active{color:var(--teal-text);}

/* ---------- Search bar (toda tela) ---------- */
.search-bar{
  display:flex;align-items:center;gap:9px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:9px 13px;margin-bottom:16px;
  box-shadow:var(--shadow);
}
.search-bar svg{width:17px;height:17px;color:var(--ink-faint);flex-shrink:0;}
.search-bar input{
  border:none;outline:none;flex:1;font-size:14px;background:transparent;color:var(--ink);
}
.search-bar input::placeholder{color:var(--ink-faint);}
.search-count{font-size:11.5px;color:var(--ink-faint);font-family:var(--font-mono);white-space:nowrap;}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;align-items:center;gap:7px;
  padding:9px 16px;border-radius:var(--radius-sm);
  font-size:13.5px;font-weight:600;
  border:1px solid transparent;cursor:pointer;
  transition:filter .12s ease, transform .05s ease;
  white-space:nowrap;
}
.btn:active{transform:scale(0.98);}
.btn svg{width:15px;height:15px;}
.btn-primary{background:var(--teal);color:#fff;}
.btn-primary:hover{filter:brightness(1.1);}
.btn-outline{background:var(--surface);color:var(--ink);border-color:var(--border);}
.btn-outline:hover{border-color:var(--teal);color:var(--teal-text);}
.btn-ghost{background:transparent;color:var(--ink-dim);border-color:transparent;padding:8px 10px;}
.btn-ghost:hover{background:var(--surface-2);color:var(--ink);}
.btn-danger{background:var(--red-tint);color:var(--red);}
.btn-danger:hover{filter:brightness(1.15);}
.btn-wa{background:#1FA855;color:#fff;}
.btn-wa:hover{filter:brightness(1.08);}
.btn-sm{padding:6px 11px;font-size:12.5px;}
.btn-block{width:100%;justify-content:center;}

/* ---------- Cards / panels ---------- */
.panel{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);box-shadow:var(--shadow);
}
.panel-pad{padding:18px;}

/* KPI cards */
.kpi-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:22px;}
.kpi{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 17px;box-shadow:var(--shadow);}
.kpi-label{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-faint);font-weight:600;margin-bottom:8px;}
.kpi-value{font-family:var(--font-display);font-size:24px;font-weight:700;color:var(--ink);}
.kpi-value.teal{color:var(--teal-text);}
.kpi-value.amber{color:var(--amber);}
.kpi-value.red{color:var(--red);}

/* ---------- List / table ---------- */
.list{display:flex;flex-direction:column;gap:8px;}
.list-row{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:13px 15px;display:flex;align-items:center;gap:14px;cursor:pointer;
  transition:border-color .12s ease, box-shadow .12s ease;
}
.list-row:hover{border-color:var(--teal);box-shadow:var(--shadow);}
.list-row .avatar{
  width:38px;height:38px;border-radius:50%;background:var(--teal-tint);color:var(--teal-text);
  display:flex;align-items:center;justify-content:center;font-weight:700;font-family:var(--font-display);
  flex-shrink:0;font-size:14px;
}
.list-row .avatar svg{width:19px;height:19px;flex-shrink:0;}
.list-main{flex:1;min-width:0;}
.list-title{font-weight:600;font-size:14.5px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.list-sub{font-size:12.5px;color:var(--ink-dim);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.list-meta{text-align:right;flex-shrink:0;}
.list-value{font-family:var(--font-mono);font-weight:600;font-size:14px;color:var(--ink);}
.list-chevron{color:var(--ink-faint);flex-shrink:0;}
.list-chevron svg{width:16px;height:16px;}

.empty-state{
  text-align:center;padding:50px 20px;color:var(--ink-faint);
}
.empty-state svg{width:38px;height:38px;margin-bottom:12px;opacity:.5;}
.empty-state p{font-size:13.5px;}

/* Badges */
.badge{
  display:inline-flex;align-items:center;gap:5px;
  padding:3px 9px;border-radius:20px;font-size:11px;font-weight:600;
  font-family:var(--font-mono);white-space:nowrap;
}
.badge::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor;}
.badge-teal{background:var(--teal-tint);color:var(--teal-text);}
.badge-amber{background:var(--amber-tint);color:var(--amber);}
.badge-red{background:var(--red-tint);color:var(--red);}
.badge-green{background:var(--green-tint);color:var(--green);}
.badge-gray{background:var(--surface-2);color:var(--ink-dim);}

/* Filter chips */
.chip-row{display:flex;gap:7px;margin-bottom:16px;flex-wrap:wrap;}
.chip{
  padding:6px 13px;border-radius:20px;font-size:12.5px;font-weight:600;
  background:var(--surface);border:1px solid var(--border);color:var(--ink-dim);cursor:pointer;
}
.chip.active{background:var(--teal);border-color:var(--teal);color:#fff;}

/* ---------- Forms ---------- */
.field{margin-bottom:15px;}
.field label{display:block;font-size:12.5px;font-weight:600;color:var(--ink-dim);margin-bottom:6px;}
.field input, .field select, .field textarea{
  width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);
  font-size:14px;color:var(--ink);background:var(--surface-2);outline:none;
  transition:border-color .12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus{border-color:var(--teal);}
.field select option{background:var(--surface-2);color:var(--ink);}
.field textarea{resize:vertical;min-height:70px;}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.field-hint{font-size:11.5px;color:var(--ink-faint);margin-top:4px;}

/* Autocomplete cliente */
.autocomplete{position:relative;}
.autocomplete-list{
  position:absolute;top:calc(100% + 4px);left:0;right:0;
  background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius-sm);
  box-shadow:var(--shadow-lg);max-height:220px;overflow-y:auto;z-index:30;
}
.autocomplete-item{padding:10px 12px;cursor:pointer;font-size:13.5px;border-bottom:1px solid var(--border);}
.autocomplete-item:last-child{border-bottom:none;}
.autocomplete-item:hover, .autocomplete-item.hl{background:var(--teal-tint);}
.autocomplete-item .ac-sub{font-size:11.5px;color:var(--ink-faint);}

/* Itens (linhas de produto no orçamento/venda) */
.itens-table{width:100%;border-collapse:collapse;margin-bottom:8px;}
.itens-table th{text-align:left;font-size:11px;text-transform:uppercase;color:var(--ink-faint);padding:0 8px 8px 0;font-weight:600;}
.itens-table td{padding:6px 8px 6px 0;vertical-align:middle;}
.itens-table input{padding:7px 9px;font-size:13px;}
.itens-remove{color:var(--red);cursor:pointer;background:none;border:none;padding:6px;}
.itens-total-row{display:flex;justify-content:flex-end;gap:26px;padding:12px 4px 4px 4px;border-top:1px solid var(--border);margin-top:6px;}
.itens-total-row .tl{font-size:12.5px;color:var(--ink-dim);}
.itens-total-row .tv{font-family:var(--font-mono);font-weight:600;}
.itens-total-row .grand .tv{font-size:17px;color:var(--teal-text);}

/* ---------- Modal ----------
   O overlay começa depois da sidebar no desktop, para nunca
   cobrir o menu lateral (só a área de conteúdo fica escurecida). */
.modal-overlay{
  position:fixed;top:0;right:0;bottom:0;left:0;
  background:rgba(0,0,0,0.6);
  display:flex;align-items:flex-start;justify-content:center;
  padding:26px 16px;overflow-y:auto;z-index:100;
}
@media (min-width:881px){
  .modal-overlay{left:var(--sidebar-w);}
}
.modal{
  background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);
  width:100%;max-width:640px;margin:auto 0;
}
.modal-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:18px 22px;border-bottom:1px solid var(--border);
}
.modal-header h3{font-size:16.5px;}
.modal-close{cursor:pointer;color:var(--ink-faint);background:none;border:none;padding:4px;}
.modal-close svg{width:19px;height:19px;}
.modal-body{padding:20px 22px;max-height:70vh;overflow-y:auto;}
.modal-footer{
  display:flex;justify-content:flex-end;gap:9px;flex-wrap:wrap;
  padding:16px 22px;border-top:1px solid var(--border);
}

/* ---------- Detail / print sheet ----------
   Cores FIXAS (não usam o tema escuro do app): isto é uma folha
   de papel A4 branca, tanto na pré-visualização quanto impressa. */
.detail-actions{display:flex;gap:9px;flex-wrap:wrap;margin-bottom:18px;}
.print-sheet{
  --ps-text:#1A1D21;
  --ps-dim:#666D74;
  --ps-faint:#9AA0A7;
  --ps-border:#DDE1E4;
  --ps-accent:#0A85AD;
  background:#fff;color:var(--ps-text);
  border:1px solid var(--border);border-radius:var(--radius);
  padding:34px 38px;box-shadow:var(--shadow);max-width:820px;
}
.ps-header{display:flex;justify-content:space-between;align-items:flex-start;border-bottom:2px solid var(--ps-text);padding-bottom:16px;margin-bottom:20px;}
.ps-company{font-family:var(--font-display);font-weight:700;font-size:19px;color:var(--ps-text);}
.ps-company-meta{font-size:12px;color:var(--ps-dim);margin-top:3px;line-height:1.5;}
.ps-doc-title{text-align:right;}
.ps-doc-title .num{font-family:var(--font-mono);font-size:20px;font-weight:700;color:var(--ps-accent);}
.ps-doc-title .type{font-size:11.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--ps-dim);margin-top:2px;}
.ps-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:22px;}
.ps-block h4{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--ps-faint);margin-bottom:7px;}
.ps-block p{margin:0 0 3px 0;font-size:13.5px;color:var(--ps-text);}
.ps-section{margin-bottom:20px;}
.ps-section h4{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--ps-faint);margin-bottom:9px;border-bottom:1px solid var(--ps-border);padding-bottom:6px;}
.ps-desc{font-size:13.5px;white-space:pre-wrap;line-height:1.6;color:var(--ps-text);}
.ps-table{width:100%;border-collapse:collapse;font-size:13px;}
.ps-table th{text-align:left;padding:6px 8px;background:#F4F6F7;font-size:11px;text-transform:uppercase;color:var(--ps-dim);}
.ps-table td{padding:8px;border-bottom:1px solid var(--ps-border);color:var(--ps-text);}
.ps-table td.num, .ps-table th.num{text-align:right;font-family:var(--font-mono);}
.ps-totals{display:flex;justify-content:flex-end;margin-top:10px;}
.ps-totals table{border-collapse:collapse;}
.ps-totals td{padding:4px 10px;font-size:13.5px;color:var(--ps-text);}
.ps-totals td.tl{color:var(--ps-dim);text-align:right;}
.ps-totals td.tv{font-family:var(--font-mono);text-align:right;min-width:100px;}
.ps-totals tr.grand td{font-weight:700;font-size:16px;border-top:1px solid var(--ps-text);padding-top:8px;}
.ps-footer{margin-top:26px;padding-top:14px;border-top:1px solid var(--ps-border);font-size:11.5px;color:var(--ps-faint);line-height:1.6;}
.ps-sign{display:flex;justify-content:space-between;margin-top:46px;gap:30px;}
.ps-sign div{flex:1;text-align:center;border-top:1px solid var(--ps-faint);padding-top:6px;font-size:11.5px;color:var(--ps-dim);}

/* ---------- Barras de categoria (relatórios) ---------- */
.catbar-row{display:flex;align-items:center;gap:10px;margin-bottom:11px;}
.catbar-name{width:150px;flex-shrink:0;color:var(--ink);font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.catbar-track{flex:1;height:9px;background:var(--surface-2);border-radius:5px;overflow:hidden;}
.catbar-fill{height:100%;border-radius:5px;background:var(--teal);}
.catbar-val{width:104px;text-align:right;flex-shrink:0;font-family:var(--font-mono);font-size:12px;color:var(--ink-dim);}

/* Datas de filtro (relatórios) */
.date-range{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:16px;}
.date-range input[type="date"]{
  padding:9px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);
  background:var(--surface);color:var(--ink);font-size:13.5px;
}
.date-range span{color:var(--ink-faint);font-size:13px;}

/* ---------- Cupom não fiscal (impressora térmica ~80mm) ---------- */
.cupom-sheet{
  --cp-text:#000;
  --cp-dim:#000;
  background:#fff;color:var(--cp-text);
  width:72mm;margin:0 auto;
  font-family:Arial,Helvetica,sans-serif;
  font-size:13.5px;line-height:1.34;font-weight:700;
  -webkit-text-stroke:.18px #000;text-rendering:geometricPrecision;
  padding:10px 8px;
  border:1px dashed var(--border);border-radius:4px;
}
.cupom-sheet .cp-center{text-align:center;}
.cupom-sheet .cp-title{font-weight:800;font-size:16px;line-height:1.2;}
.cupom-sheet .cp-divisor{border-top:2px dashed #000;margin:7px 0;}
.cupom-sheet .cp-row{display:flex;justify-content:space-between;gap:6px;font-weight:700;}
.cupom-sheet .cp-row.total{font-weight:800;font-size:15px;}
.cupom-sheet .cp-small{font-size:11.5px;color:var(--cp-dim);font-weight:700;}

.cupom-sheet .cp-section{margin:8px 0;}
.cupom-sheet .cp-section>b{display:block;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.02em;margin-bottom:2px;}
.cupom-sheet .cp-text{font-size:12.5px;line-height:1.35;white-space:pre-wrap;overflow-wrap:anywhere;font-weight:700;}

/* ---------- Assinatura digital ---------- */
.assinatura-canvas-wrap{
  border:1px dashed var(--border);border-radius:8px;background:#fff;
  touch-action:none;
}
.assinatura-canvas-wrap canvas{display:block;width:100%;height:220px;cursor:crosshair;}

/* ---------- Estoque status ---------- */
.stock-dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:6px;}

/* ---------- Toast ---------- */
.toast{
  position:fixed;bottom:24px;left:50%;transform:translateX(-50%);
  background:var(--surface-2);border:1px solid var(--border);color:var(--ink);padding:11px 20px;border-radius:9px;
  font-size:13.5px;box-shadow:var(--shadow-lg);z-index:200;
  opacity:0;transition:opacity .2s ease, transform .2s ease;pointer-events:none;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(-6px);}

/* ---------- Responsive ---------- */
@media (max-width:880px){
  .sidebar{display:none;}
  .main{padding:18px 16px 100px 16px;}
  .bottom-nav{display:block;}
  .kpi-grid{grid-template-columns:repeat(2,1fr);}
  .field-row{grid-template-columns:1fr;}
  .ps-grid{grid-template-columns:1fr;}
  .print-sheet{padding:22px 18px;}
  .ps-header{flex-direction:column;gap:10px;}
  .ps-doc-title{text-align:left;}
}

/* ---------- Print ---------- */
/* Impressão A4 e cupom usam páginas diferentes.
   A regra antiga forçava @page A4 também para o cupom térmico. */
@page folhaA4{size:A4 portrait;margin:0;}
@page cupomTermico{size:80mm 180mm;margin:0;}

@media print{
  html,body{margin:0!important;padding:0!important;background:#fff!important;}
  body *{visibility:hidden;}
  .print-sheet.folha-ativa, .print-sheet.folha-ativa *,
  .cupom-sheet.folha-ativa, .cupom-sheet.folha-ativa * { visibility:visible; }

  .print-sheet.folha-ativa{
    display:block!important;position:absolute;top:0;left:0;width:100%;
    box-shadow:none;border:none;padding:12mm!important;max-width:none;
    page:folhaA4;box-sizing:border-box;
  }

  .cupom-sheet.folha-ativa{
    display:block!important;position:absolute!important;top:0!important;left:0!important;
    width:80mm!important;max-width:80mm!important;min-width:80mm!important;
    margin:0!important;padding:3mm!important;box-sizing:border-box!important;
    box-shadow:none!important;border:0!important;border-radius:0!important;
    background:#fff!important;color:#000!important;
    page:cupomTermico;break-after:avoid!important;page-break-after:avoid!important;
  }
  .cupom-sheet.folha-ativa .cp-row{break-inside:avoid;page-break-inside:avoid;}
  .cupom-sheet.folha-ativa .cp-divisor{break-after:avoid;page-break-after:avoid;}

  .print-sheet{font-family:Arial,sans-serif;color:#222;background:#fff!important;font-size:11px;}

  /* OS A4: ligeiro ganho de leitura sem sacrificar a regra de uma única folha.
     Ordens extensas recebem automaticamente a variante densa. */
  #folhaImpressao.os-a4-sheet{padding:11mm!important;}
  #folhaImpressao.os-a4-sheet .ps-block p{font-size:14.25px;line-height:1.42;}
  #folhaImpressao.os-a4-sheet .ps-desc{font-size:14.25px;line-height:1.48;}
  #folhaImpressao.os-a4-sheet .ps-table{font-size:13.5px;}
  #folhaImpressao.os-a4-sheet .ps-table th{font-size:11.5px;}
  #folhaImpressao.os-a4-sheet .ps-totals td{font-size:14px;}
  #folhaImpressao.os-a4-sheet .ps-section{margin-bottom:17px;}
  #folhaImpressao.os-a4-sheet .ps-sign{margin-top:38px;}
  #folhaImpressao.os-a4-sheet .ps-footer{margin-top:18px;padding-top:10px;}
  #folhaImpressao.os-a4-sheet.os-a4-dense{padding:10mm!important;}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-block p,
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-desc{font-size:13.25px;line-height:1.38;}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-table{font-size:12.75px;}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-table th{font-size:10.75px;}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-section{margin-bottom:13px;}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-sign{margin-top:30px;}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-footer{margin-top:12px;padding-top:8px;}

  .ps-table{width:100%;border-collapse:collapse;}
  .ps-table th,.ps-table td{padding:5px 6px;border-bottom:1px solid #ddd;text-align:left;}
  .ps-table th.num,.ps-table td.num{text-align:right;}
  .ps-section{break-inside:auto;page-break-inside:auto;}
  .ps-table tr{page-break-inside:avoid;break-inside:avoid;}
}

/* Dashboard analítico dos relatórios */
.rel-charts-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:16px;}
.rel-chart-card{min-width:0;overflow:hidden;}
.rel-chart-card h3{font-size:15px;margin:0 0 16px;}
.rel-chart-pie-wrap{display:flex;align-items:center;justify-content:center;gap:18px;min-height:210px;}
.rel-chart-pie{width:170px;height:170px;border-radius:50%;flex:0 0 auto;box-shadow:inset 0 0 0 1px rgba(0,0,0,.08);}
.rel-chart-legend{display:grid;gap:9px;min-width:120px;max-width:180px;}
.rel-chart-card .catbar-row{grid-template-columns:minmax(70px,1fr) minmax(60px,1.4fr) auto;}
.rel-chart-card .catbar-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
@media(max-width:1050px){.rel-charts-grid{grid-template-columns:1fr 1fr;}.rel-chart-card:last-child{grid-column:1/-1;}}
@media(max-width:700px){.rel-charts-grid{grid-template-columns:1fr;}.rel-chart-card:last-child{grid-column:auto;}.rel-chart-pie-wrap{justify-content:flex-start;}}

/* ============================================================
   DRR Sistema v1.5 — navegação mobile, sinalização de clientes
   e trilha interna de status das OS.
   ============================================================ */
.mobile-appbar,.mobile-menu-close,.mobile-nav-backdrop{display:none}
.cliente-sinal-atencao .list-title{color:#e0ad57}
.cliente-sinal-restricao .list-title{color:#ef766a}
.cliente-sinal-badge{display:inline-flex;align-items:center;padding:2px 7px;border-radius:999px;font-size:10px;font-weight:750;vertical-align:2px;margin-left:5px}
.cliente-sinal-badge.normal{background:#263139;color:#b7c3ca}
.cliente-sinal-badge.atencao{background:rgba(224,169,74,.16);color:#f0c56d;border:1px solid rgba(224,169,74,.3)}
.cliente-sinal-badge.restricao{background:rgba(226,105,92,.14);color:#f18e83;border:1px solid rgba(226,105,92,.3)}
.cliente-link-os{appearance:none;border:0;background:transparent;color:var(--teal-text);padding:0;font:inherit;cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.cliente-obs-box{white-space:pre-wrap;line-height:1.55;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:11px 12px;color:var(--ink)}
.status-history-panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);margin:0 0 18px;overflow:hidden}
.status-history-panel>summary{cursor:pointer;padding:13px 16px;font-weight:700;display:flex;justify-content:space-between;gap:10px;align-items:center}
.status-history-panel>summary span{font-size:11px;color:var(--ink-faint);font-weight:500}
.status-history-list{border-top:1px solid var(--border);padding:5px 16px}
.status-history-row{display:flex;justify-content:space-between;gap:14px;padding:10px 0;border-bottom:1px solid var(--border);align-items:flex-start}
.status-history-row:last-child{border-bottom:0}
.status-history-row b{display:block;font-size:12.5px}
.status-history-row small{display:block;color:var(--ink-faint);font-size:11px;margin-top:2px}
.status-history-row time{font-family:var(--font-mono);font-size:11px;color:var(--ink-dim);white-space:nowrap}

@media (max-width:880px){
  .bottom-nav{display:none!important}
  .mobile-appbar{display:flex;position:sticky;top:0;z-index:34;height:62px;align-items:center;gap:12px;padding:0 16px;background:#0f1114;border-bottom:1px solid var(--border);box-shadow:0 4px 18px rgba(0,0,0,.22)}
  .mobile-appbar strong{display:block;font-size:14px;color:var(--ink)}
  .mobile-appbar small{display:block;font-size:10px;color:var(--ink-faint);letter-spacing:.08em;text-transform:uppercase;margin-top:1px}
  .mobile-menu-btn{width:40px;height:40px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--ink);font-size:23px;line-height:1;cursor:pointer}
  .sidebar{display:flex!important;position:fixed;top:0;left:0;bottom:0;z-index:60;width:min(292px,86vw);transform:translateX(-105%);transition:transform .2s ease;box-shadow:10px 0 35px rgba(0,0,0,.45)}
  .sidebar.mobile-open{transform:translateX(0)}
  .mobile-menu-close{display:inline-flex;margin-left:auto;width:32px;height:32px;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.12);border-radius:8px;background:rgba(255,255,255,.04);color:#fff;font-size:22px;cursor:pointer}
  .mobile-nav-backdrop{display:block;position:fixed;inset:0;z-index:55;background:rgba(0,0,0,.58);opacity:0;pointer-events:none;transition:opacity .2s ease}
  .mobile-nav-backdrop.show{opacity:1;pointer-events:auto}
  body.menu-mobile-aberto{overflow:hidden}
  .main{padding:18px 16px 30px 16px}
  .status-history-row{display:grid;gap:4px}.status-history-row time{white-space:normal}
}

/* OS A4 compacta: preserva conteúdo, mas reduz o espaço estrutural. */
@media print{
  #folhaImpressao.print-sheet.folha-ativa{padding:8mm!important;font-size:9.5px!important;line-height:1.3!important}
  #folhaImpressao .ps-header{padding-bottom:8px!important;margin-bottom:10px!important}
  #folhaImpressao .ps-header img{max-height:38px!important}
  #folhaImpressao .ps-company{font-size:15px!important}#folhaImpressao .ps-company-meta{font-size:9.5px!important;line-height:1.3!important}
  #folhaImpressao .ps-doc-title .num{font-size:16px!important}#folhaImpressao .ps-doc-title .type{font-size:9px!important}
  #folhaImpressao .ps-grid{gap:10px!important;margin-bottom:10px!important}
  #folhaImpressao .ps-block h4,#folhaImpressao .ps-section h4{font-size:8.5px!important;margin-bottom:4px!important;padding-bottom:3px!important}
  #folhaImpressao .ps-block p{font-size:10px!important;margin-bottom:1px!important}
  #folhaImpressao .ps-section{margin-bottom:8px!important}
  #folhaImpressao .ps-desc{font-size:10px!important;line-height:1.35!important}
  #folhaImpressao .ps-table{font-size:9.5px!important}#folhaImpressao .ps-table th{font-size:8.5px!important}#folhaImpressao .ps-table th,#folhaImpressao .ps-table td{padding:3px 4px!important}
  #folhaImpressao .ps-totals{margin-top:5px!important}#folhaImpressao .ps-totals td{font-size:10px!important;padding:2px 7px!important}#folhaImpressao .ps-totals tr.grand td{font-size:12px!important;padding-top:4px!important}
  #folhaImpressao .ps-sign{margin-top:25px!important;gap:20px!important}#folhaImpressao .ps-sign div{font-size:9px!important;padding-top:4px!important}#folhaImpressao .ps-sign img{max-height:34px!important}
  #folhaImpressao .ps-footer{margin-top:10px!important;padding-top:6px!important;font-size:8.5px!important;line-height:1.35!important}
}


/* v1.5.4 RC1 — opção explícita de inclusão de recibo no Financeiro. */
.check-row{display:flex;align-items:flex-start;gap:10px;padding:11px 12px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);cursor:pointer}
.check-row input{margin-top:3px;flex:0 0 auto}
.check-row span{font-size:12.5px;line-height:1.35;color:var(--ink)}


/* v1.6.0 RC2 — menu externo e calendários de filtro */
.nav-item-external{text-decoration:none}
.nav-item-external .nav-external-indicator{margin-left:auto;color:rgba(218,233,241,.78);font-size:14px;font-weight:750;line-height:1;flex:0 0 auto}
.nav-item-external:hover .nav-external-indicator{color:#fff}

/* Desenha um único ícone claro sem depender da cor do ícone nativo do Windows.
   O indicador real continua sobre a área do ícone, invisível mas clicável. */
.date-range input[type="date"]{
  color-scheme:dark;
  padding-right:40px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23D9EAF2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;background-size:17px 17px;
}
.date-range input[type="date"]::-webkit-calendar-picker-indicator{
  opacity:0;width:20px;height:22px;cursor:default;margin:0;
}
@media (max-width:600px){
  .date-range input[type="date"]{max-width:100%;min-width:0}
}


/* v1.6.0 RC3 — calendários operáveis de Ordens/Relatórios.
   O botão real substitui o ícone decorativo que não respondia ao toque. */
.date-range .date-picker-field{
  position:relative;display:inline-flex;align-items:center;min-width:0;
  width:clamp(140px,21vw,190px);max-width:100%;
}
.date-range .date-picker-field>input[type="date"]{
  width:100%;height:39px;min-width:0;box-sizing:border-box;
  padding:9px 45px 9px 11px;background-image:none!important;color-scheme:dark;
}
.date-range .date-picker-field>input[type="date"]::-webkit-calendar-picker-indicator{
  opacity:0!important;pointer-events:none!important;width:0!important;margin:0!important;
}
.date-range .date-picker-launch{
  position:absolute;right:3px;top:3px;bottom:3px;width:37px;
  display:grid;place-items:center;background:transparent;
  border:0;border-radius:6px;color:#e1eef4;cursor:pointer;
  touch-action:manipulation;z-index:2;
}
.date-range .date-picker-launch svg{width:18px;height:18px;pointer-events:none}
.date-range .date-picker-launch:hover,.date-range .date-picker-launch:focus-visible{
  background:rgba(104,191,225,.15);outline:2px solid transparent;
}
.date-range .date-picker-launch:focus-visible{outline:2px solid #5fcbee;outline-offset:1px}
@media(max-width:460px){
  .date-range .date-picker-field{width:min(155px,calc((100vw - 85px)/2))}
  .date-range .date-picker-field>input[type="date"]{font-size:12px;padding-left:7px;padding-right:38px}
  .date-range .date-picker-launch{width:32px}
}

/* 2026-10-06 — padrão monetário visual em todos os campos de valor */
.money-input-wrap{position:relative;display:flex;align-items:center;width:100%}
.money-input-wrap>span{position:absolute;left:11px;top:50%;transform:translateY(-50%);z-index:2;color:var(--ink-dim);font-size:11.5px;font-weight:800;pointer-events:none;white-space:nowrap}
.money-input-wrap>input{padding-left:37px!important;width:100%}
.money-input-wrap.compact>span{left:8px;font-size:10.5px}
.money-input-wrap.compact>input{padding-left:32px!important}

/* 2026-10-06 — A4: leitura um pouco maior, com densidade automática para
   preservar a prioridade de uma única folha nas OS extensas. */
@media print{
  #folhaImpressao.os-a4-sheet.print-sheet.folha-ativa{padding:8mm!important;font-size:10.7px!important;line-height:1.34!important}
  #folhaImpressao.os-a4-sheet .ps-header{padding-bottom:9px!important;margin-bottom:11px!important}
  #folhaImpressao.os-a4-sheet .ps-header img{max-height:40px!important}
  #folhaImpressao.os-a4-sheet .ps-company{font-size:16px!important}
  #folhaImpressao.os-a4-sheet .ps-company-meta{font-size:10.2px!important;line-height:1.32!important}
  #folhaImpressao.os-a4-sheet .ps-doc-title .num{font-size:17px!important}
  #folhaImpressao.os-a4-sheet .ps-doc-title .type{font-size:9.7px!important}
  #folhaImpressao.os-a4-sheet .ps-grid{gap:11px!important;margin-bottom:11px!important}
  #folhaImpressao.os-a4-sheet .ps-block h4,#folhaImpressao.os-a4-sheet .ps-section h4{font-size:9.3px!important;margin-bottom:4px!important;padding-bottom:3px!important}
  #folhaImpressao.os-a4-sheet .ps-block p{font-size:11.35px!important;line-height:1.38!important;margin-bottom:1px!important}
  #folhaImpressao.os-a4-sheet .ps-section{margin-bottom:9px!important}
  #folhaImpressao.os-a4-sheet .ps-desc{font-size:11.35px!important;line-height:1.41!important}
  #folhaImpressao.os-a4-sheet .ps-table{font-size:10.7px!important}
  #folhaImpressao.os-a4-sheet .ps-table th{font-size:9.3px!important}
  #folhaImpressao.os-a4-sheet .ps-table th,#folhaImpressao.os-a4-sheet .ps-table td{padding:3px 4px!important}
  #folhaImpressao.os-a4-sheet .ps-totals{margin-top:6px!important}
  #folhaImpressao.os-a4-sheet .ps-totals td{font-size:11px!important;padding:2px 7px!important}
  #folhaImpressao.os-a4-sheet .ps-totals tr.grand td{font-size:12.8px!important;padding-top:4px!important}
  #folhaImpressao.os-a4-sheet .ps-sign{margin-top:27px!important;gap:20px!important}
  #folhaImpressao.os-a4-sheet .ps-sign div{font-size:9.4px!important;padding-top:4px!important}
  #folhaImpressao.os-a4-sheet .ps-sign img{max-height:35px!important}
  #folhaImpressao.os-a4-sheet .ps-footer{margin-top:10px!important;padding-top:6px!important;font-size:8.8px!important;line-height:1.35!important}

  #folhaImpressao.os-a4-sheet.os-a4-dense{padding:7.5mm!important;font-size:10px!important;line-height:1.3!important}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-block p,#folhaImpressao.os-a4-sheet.os-a4-dense .ps-desc{font-size:10.25px!important;line-height:1.34!important}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-table{font-size:9.7px!important}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-section{margin-bottom:7px!important}
  #folhaImpressao.os-a4-sheet.os-a4-dense .ps-sign{margin-top:22px!important}

  #folhaImpressao.os-a4-sheet.os-a4-ultra{padding:7mm!important;font-size:9px!important;line-height:1.25!important}
  #folhaImpressao.os-a4-sheet.os-a4-ultra .ps-header{padding-bottom:6px!important;margin-bottom:7px!important}
  #folhaImpressao.os-a4-sheet.os-a4-ultra .ps-header img{max-height:32px!important}
  #folhaImpressao.os-a4-sheet.os-a4-ultra .ps-block p,#folhaImpressao.os-a4-sheet.os-a4-ultra .ps-desc{font-size:9.25px!important;line-height:1.28!important}
  #folhaImpressao.os-a4-sheet.os-a4-ultra .ps-table{font-size:8.9px!important}
  #folhaImpressao.os-a4-sheet.os-a4-ultra .ps-section{margin-bottom:5px!important}
  #folhaImpressao.os-a4-sheet.os-a4-ultra .ps-sign{margin-top:16px!important}
  #folhaImpressao.os-a4-sheet.os-a4-ultra .ps-footer{margin-top:6px!important;padding-top:4px!important;font-size:8px!important}

  /* Termo de entrega mantém espaço confortável para assinatura. A impressão
     isolada evita a folha vazia sem sacrificar esse respiro visual. */
  #folhaTermo.termo-a4-sheet.print-sheet.folha-ativa{padding:8mm!important;font-size:10.3px!important;line-height:1.32!important}
  #folhaTermo.termo-a4-sheet .ps-header{padding-bottom:8px!important;margin-bottom:9px!important}
  #folhaTermo.termo-a4-sheet .ps-header img{max-height:38px!important}
  #folhaTermo.termo-a4-sheet .ps-company{font-size:15px!important}
  #folhaTermo.termo-a4-sheet .ps-company-meta{font-size:9.4px!important;line-height:1.28!important}
  #folhaTermo.termo-a4-sheet .ps-doc-title .num{font-size:16px!important}
  #folhaTermo.termo-a4-sheet .ps-doc-title .type{font-size:9px!important}
  #folhaTermo.termo-a4-sheet .ps-grid{gap:9px!important;margin-bottom:9px!important}
  #folhaTermo.termo-a4-sheet .ps-block h4,#folhaTermo.termo-a4-sheet .ps-section h4{font-size:8.8px!important;margin-bottom:3px!important;padding-bottom:3px!important}
  #folhaTermo.termo-a4-sheet .ps-block p{font-size:10.25px!important;line-height:1.32!important;margin-bottom:1px!important}
  #folhaTermo.termo-a4-sheet .ps-section{margin-bottom:7px!important}
  #folhaTermo.termo-a4-sheet .ps-desc{font-size:10.25px!important;line-height:1.36!important}
  #folhaTermo.termo-a4-sheet .ps-sign{margin-top:46px!important;gap:24px!important}
  #folhaTermo.termo-a4-sheet .ps-sign div{font-size:9px!important;padding-top:4px!important}
  #folhaTermo.termo-a4-sheet .ps-sign img{max-height:34px!important}
  #folhaTermo.termo-a4-sheet .ps-footer{margin-top:9px!important;padding-top:5px!important;font-size:8.3px!important;line-height:1.3!important}

  #folhaTermo.termo-a4-sheet.termo-a4-dense{padding:7mm!important}
  #folhaTermo.termo-a4-sheet.termo-a4-dense .ps-header{padding-bottom:5px!important;margin-bottom:6px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-dense .ps-header img{max-height:31px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-dense .ps-block p,#folhaTermo.termo-a4-sheet.termo-a4-dense .ps-desc{font-size:9.3px!important;line-height:1.28!important}
  #folhaTermo.termo-a4-sheet.termo-a4-dense .ps-section{margin-bottom:5px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-dense .ps-sign{margin-top:32px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-dense .ps-footer{margin-top:5px!important;padding-top:4px!important;font-size:7.9px!important}

  #folhaTermo.termo-a4-sheet.termo-a4-ultra{padding:6.5mm!important;font-size:8.6px!important;line-height:1.2!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-header{padding-bottom:4px!important;margin-bottom:5px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-header img{max-height:27px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-company{font-size:13px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-company-meta{font-size:8px!important;line-height:1.18!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-doc-title .num{font-size:14px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-doc-title .type{font-size:7.8px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-grid{gap:7px!important;margin-bottom:6px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-block p,#folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-desc{font-size:8.5px!important;line-height:1.2!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-section{margin-bottom:4px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-sign{margin-top:20px!important}
  #folhaTermo.termo-a4-sheet.termo-a4-ultra .ps-footer{margin-top:4px!important;padding-top:3px!important;font-size:7.4px!important}
}

/* 2026-10-06 — padrão definitivo para datas nos formulários do Sistema Técnico.
   O ícone claro é desenhado pelo sistema; a abertura do calendário é tratada
   pelo JS na faixa direita do campo, sem impedir a digitação manual. */
.field input[type="date"]{
  color-scheme:dark!important;
  padding-right:42px!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23DCECF4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E")!important;
  background-repeat:no-repeat!important;
  background-position:right 12px center!important;
  background-size:17px 17px!important;
  cursor:text!important;
}
.field input[type="date"]::-webkit-calendar-picker-indicator{
  opacity:0!important;
  width:24px!important;
  height:24px!important;
  margin:0!important;
  cursor:pointer!important;
}

/* ============================================================
   Tema global — claro / escuro / automático
   O JavaScript resolve "automático" para data-theme="light|dark".
   Regras de impressão existentes continuam independentes do tema de tela.
   ============================================================ */
html[data-theme="light"]{
  color-scheme:light;
  --bg:#f3f6f8;
  --surface:#ffffff;
  --surface-2:#eef3f6;
  --border:#d2dce2;
  --ink:#182126;
  --ink-dim:#53636d;
  --ink-faint:#74848e;
  --teal:#087fa7;
  --teal-dark:#06627f;
  --teal-tint:rgba(8,127,167,.11);
  --teal-text:#08789d;
  --amber:#a96f13;
  --amber-tint:rgba(196,132,30,.12);
  --red:#c9473e;
  --red-tint:rgba(201,71,62,.11);
  --green:#23865a;
  --green-tint:rgba(35,134,90,.11);
  --shadow:0 1px 2px rgba(22,35,42,.08),0 5px 18px rgba(22,35,42,.07);
  --shadow-lg:0 18px 44px rgba(22,35,42,.18);
}
html[data-theme="light"] body{background:radial-gradient(ellipse 900px 500px at 85% -8%,rgba(15,160,209,.08),transparent 60%),var(--bg);}
html[data-theme="light"] .sidebar{background:radial-gradient(ellipse 340px 260px at 15% 0%,rgba(15,160,209,.10),transparent 65%),#f9fbfc;color:var(--ink);}
html[data-theme="light"] .brand{color:var(--ink);}
html[data-theme="light"] .nav-item{color:#53636d;}
html[data-theme="light"] .nav-item:hover{background:#edf4f7;color:#172126;}
html[data-theme="light"] .nav-item.active{background:var(--teal-tint);color:#075f7c;}
html[data-theme="light"] .sidebar-foot{color:#81919b;}
html[data-theme="light"] .bottom-nav{box-shadow:0 -3px 14px rgba(22,35,42,.10);}
html[data-theme="light"] .modal-overlay{background:rgba(29,43,51,.36);}
html[data-theme="light"] .modal{box-shadow:0 20px 52px rgba(22,35,42,.20);}
html[data-theme="light"] .toast{box-shadow:0 8px 28px rgba(22,35,42,.18);}
html[data-theme="light"] input[type="date"],html[data-theme="light"] input[type="month"]{color-scheme:light;}

/* Identidade visual global */
.global-brand-logo{display:block;max-width:128px;max-height:42px;width:auto;height:auto;object-fit:contain;flex:0 0 auto;}
.mobile-global-logo{display:block;max-width:44px;max-height:34px;width:auto;height:auto;object-fit:contain;flex:0 0 auto;}
.check-line{display:flex!important;grid-template-columns:none!important;align-items:center;gap:9px!important;font-weight:600!important;cursor:pointer;}
.check-line input[type="checkbox"]{width:auto;min-width:16px;height:16px;margin:0;}
@media(max-width:760px){.global-brand-logo{max-width:108px;max-height:34px}.mobile-global-logo{max-width:38px;max-height:30px}}

/* ============================================================
   DRR 1.8.0 RC2 — refinamento do tema claro
   Paleta neutra, contraste estável e hierarquia visual consistente.
   ============================================================ */
html[data-theme="light"]{
  --bg:#f2f3f3;
  --surface:#ffffff;
  --surface-2:#f6f7f7;
  --border:#d8dddf;
  --ink:#1d2529;
  --ink-dim:#56636a;
  --ink-faint:#78848a;
  --teal:#087fa7;
  --teal-dark:#06627f;
  --teal-tint:rgba(8,127,167,.095);
  --teal-text:#076f91;
  --shadow:0 1px 2px rgba(25,33,38,.06),0 5px 18px rgba(25,33,38,.055);
  --shadow-lg:0 18px 44px rgba(25,33,38,.16);
}
html[data-theme="light"] body{background:#f2f3f3!important;}
html[data-theme="light"] .sidebar{background:#f8f9f9!important;border-right-color:#d8dddf!important;}
html[data-theme="light"] .nav-item:hover{background:#edf0f1!important;color:#1d2529!important;}
html[data-theme="light"] .nav-item.active{background:#e5f0f3!important;color:#076f91!important;}
html[data-theme="light"] .card,html[data-theme="light"] .panel,html[data-theme="light"] .metric-card,html[data-theme="light"] .table-card,html[data-theme="light"] .status-history-panel{box-shadow:0 2px 10px rgba(25,33,38,.045);}
html[data-theme="light"] .mobile-appbar{background:rgba(255,255,255,.98)!important;border-bottom-color:#d8dddf!important;box-shadow:0 3px 14px rgba(25,33,38,.09)!important;}
html[data-theme="light"] .mobile-menu-btn{background:#fff!important;border-color:#cfd6d9!important;color:#1d2529!important;}
html[data-theme="light"] .mobile-appbar strong{color:#1d2529!important;}
html[data-theme="light"] .mobile-appbar small{color:#6f7b81!important;}
.check-line{align-items:flex-start!important;}
.check-line>span{display:grid!important;gap:2px!important;min-width:0!important;line-height:1.35!important;}
.check-line>span strong,.check-line>span small{display:block!important;}
.check-line>span small{font-weight:500!important;color:var(--ink-dim)!important;}


/* ============================================================
   DRR 1.8.0 RC3 — tema claro azul suave / contraste final
   Somente tema claro: o tema escuro homologado permanece intacto.
   ============================================================ */
html[data-theme="light"]{
  --bg:#eaf3f7;
  --surface:#f9fcfe;
  --surface-2:#eef7fa;
  --border:#cbdce5;
  --ink:#17242b;
  --ink-dim:#536976;
  --ink-faint:#758b96;
  --teal:#087fa7;
  --teal-dark:#06627f;
  --teal-tint:rgba(8,127,167,.10);
  --teal-text:#076f91;
  --shadow:0 1px 2px rgba(23,52,67,.06),0 5px 18px rgba(23,52,67,.055);
  --shadow-lg:0 18px 44px rgba(23,52,67,.16);
}
html[data-theme="light"] body{background:linear-gradient(180deg,#e7f2f7 0,#edf6f9 38%,#eaf3f7 100%)!important;}
html[data-theme="light"] .sidebar{background:#f2f8fb!important;border-right-color:#cbdce5!important;}
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] .metric-card,
html[data-theme="light"] .table-card,
html[data-theme="light"] .status-history-panel,
html[data-theme="light"] .modal{background:#f9fcfe!important;border-color:#cbdce5!important;}
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea,
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{background:#fbfdff!important;border-color:#c5d8e2!important;color:#17242b!important;}
html[data-theme="light"] .nav-item:hover{background:#e7f2f6!important;color:#17242b!important;}
html[data-theme="light"] .nav-item.active{background:#dceff6!important;color:#076f91!important;}
html[data-theme="light"] .btn-outline{background:#f9fcfe!important;}
html[data-theme="light"] .mobile-appbar{background:rgba(247,252,254,.98)!important;border-bottom-color:#cbdce5!important;}
html[data-theme="light"] .mobile-menu-btn{background:#f9fcfe!important;border-color:#c5d8e2!important;color:#17242b!important;}
html[data-theme="light"] .nav-item-external .nav-external-indicator{color:#4f8195!important;opacity:1!important;}
html[data-theme="light"] .nav-item-external:hover .nav-external-indicator{color:#076f91!important;}


/* ============================================================
   1.9.0 — Professional polish
   Mantém a identidade existente e padroniza ritmo, controles,
   foco, hierarquia e telas de Ajustes sem alterar impressões.
   ============================================================ */
:root{
  --control-h:42px;
  --space-1:6px;
  --space-2:10px;
  --space-3:14px;
  --space-4:18px;
  --space-5:24px;
  --focus-ring:0 0 0 3px rgba(15,160,209,.20);
}
.topbar h1{font-size:23px;line-height:1.15;letter-spacing:-.025em}
.topbar .topbar-sub{line-height:1.45}
.panel,.card,.metric-card,.table-card{transition:border-color .14s ease,box-shadow .14s ease,background-color .14s ease}
.panel-pad{padding:20px}
.field{gap:7px}.field label{font-weight:600;letter-spacing:-.005em}
.field input,.field select,.field textarea{min-height:var(--control-h)}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--teal)!important;outline:none;box-shadow:var(--focus-ring)}
.btn{min-height:38px;display:inline-flex;align-items:center;justify-content:center;gap:7px;transition:transform .08s ease,border-color .14s ease,background-color .14s ease,color .14s ease}
.btn:active{transform:translateY(1px)}
.btn:focus-visible,.nav-item:focus-visible,a:focus-visible{outline:2px solid var(--teal-text);outline-offset:2px}
.data-table th{font-size:11.5px;letter-spacing:.015em;text-transform:none}
.data-table td{line-height:1.45}
.empty-state{min-height:132px;display:grid;place-items:center;align-content:center;gap:8px;text-align:center}
.settings-panel{max-width:860px;margin-bottom:18px}
.settings-panel>h3{font-size:16px!important;letter-spacing:-.015em}
.settings-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:16px}
.settings-section-head h3{font-size:16px;margin:0 0 4px}
.settings-section-head p{font-size:12.5px;color:var(--ink-dim);margin:0;line-height:1.55}
.distribution-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.distribution-option{border:1px solid var(--border);border-radius:10px;padding:16px;background:var(--surface-2);display:flex;flex-direction:column;gap:9px}
.distribution-option strong{font-size:14px}
.distribution-option span{font-size:12px;color:var(--ink-dim);line-height:1.5;min-height:54px}
.distribution-option .btn{align-self:flex-start}
.distribution-note{margin-top:12px;line-height:1.55}
html[data-theme="light"] .distribution-option{background:#f4f9fc!important;border-color:#cbdce5!important}
@media(max-width:720px){
  .main{padding-left:14px;padding-right:14px}
  .panel-pad{padding:16px}
  .distribution-grid{grid-template-columns:1fr}
  .distribution-option span{min-height:0}
  .settings-section-head{display:block}
  .settings-section-head .badge{display:inline-flex;margin-top:8px}
}
@media print{
  .distribution-panel{display:none!important}
}

/* ============================================================
   DRR 1.9.1 RC1 — escala tipográfica mobile confortável
   Somente telas pequenas. Desktop e impressão permanecem intactos.
   ============================================================ */
@media screen and (max-width:880px){
  :root{
    --mobile-font-body:15.5px;
    --mobile-font-small:13.5px;
    --mobile-font-caption:12.5px;
    --mobile-font-control:16px;
    --mobile-line:1.5;
  }
  body{font-size:var(--mobile-font-body);line-height:var(--mobile-line);}
  .topbar h1{font-size:24px;line-height:1.16;}
  .topbar .topbar-sub{font-size:14px;line-height:1.5;}
  .mobile-appbar strong{font-size:15.5px;}
  .mobile-appbar small{font-size:11.5px;line-height:1.35;}
  .search-box input,.search input{font-size:15.5px;}
  .search-count{font-size:12.5px;}
  .btn{font-size:14.5px;line-height:1.3;}
  .btn-sm{font-size:13.5px;}
  .kpi-label{font-size:12.5px;line-height:1.35;}
  .kpi-value{font-size:26px;}
  .list-title{font-size:15.5px;line-height:1.4;}
  .list-sub{font-size:13.5px;line-height:1.45;}
  .list-value{font-size:14.5px;}
  .badge,.chip{font-size:12px;line-height:1.25;}
  .field label{font-size:13.5px;line-height:1.4;}
  .field input,.field select,.field textarea,
  input,select,textarea{font-size:16px;line-height:1.4;}
  .field-hint{font-size:13px;line-height:1.45;}
  .autocomplete-item{font-size:14.5px;line-height:1.45;}
  .autocomplete-item .ac-sub{font-size:13px;line-height:1.45;}
  .itens-table{font-size:14px;}
  .itens-table th{font-size:12px;line-height:1.35;}
  .itens-table input{font-size:15px;}
  .itens-total-row .tl{font-size:13.5px;}
  .data-table{font-size:14px;}
  .data-table th{font-size:12.5px;line-height:1.35;}
  .data-table td{line-height:1.5;}
  .status-history-panel>summary span{font-size:12.5px;}
  .status-history-row b{font-size:14px;}
  .status-history-row small,.status-history-row time{font-size:12.5px;line-height:1.45;}
  .cliente-sinal-badge{font-size:11.5px;}
  .check-row span{font-size:13.5px;line-height:1.45;}
  .settings-section-head p{font-size:13.5px;line-height:1.5;}
  .distribution-option strong{font-size:15px;}
  .distribution-option span{font-size:13.5px;line-height:1.5;}
  .date-range span{font-size:13.5px;}
  .date-range .date-picker-field>input[type="date"]{font-size:15px;}
  .money-input-wrap>span{font-size:12.5px;}
  .money-input-wrap.compact>span{font-size:12px;}
}

/* ============================================================
   DRR 1.9.1 RC2 — proteção contra overflow em telas muito estreitas
   O aumento de tipografia da RC1 ampliou a largura intrínseca do campo
   de pesquisa. min-width:0 permite que o input encolha dentro do flex.
   ============================================================ */
@media screen and (max-width:880px){
  .search-bar input{min-width:0;}
}

/* ============================================================
   DRR 1.9.2 RC2 — acabamento de ações no mobile
   Mantém a tipografia ampliada da 1.9.1 e reorganiza barras de
   ações, detalhes e rodapés de modal para não cortar/encavalar.
   Desktop e impressão permanecem intactos.
   ============================================================ */
@media screen and (max-width:880px){
  /* Cabeçalhos com ações (Estoque, Ordens, Portal/Chamados etc.) */
  .topbar{align-items:flex-start;gap:14px;flex-wrap:wrap;}
  .topbar>div:first-child{min-width:0;max-width:100%;}
  .topbar>div+div{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px!important;
    width:100%;
    min-width:0;
  }
  .topbar>div+div>.btn,
  .topbar>div+div>a.btn{
    width:100%;
    min-width:0;
    max-width:100%;
    padding:10px 12px;
    white-space:normal;
    overflow-wrap:anywhere;
    text-align:center;
  }
  /* Quando há 3 ações, a terceira ganha uma linha inteira. */
  .topbar>div+div>:nth-child(3):last-child{grid-column:1/-1;}

  /* Ações em detalhes de OS/recibos: duas colunas reais, sem colisão. */
  .detail-actions{display:flex;align-items:stretch;gap:9px;}
  .detail-actions>.btn,
  .detail-actions>a.btn{
    flex:1 1 calc(50% - 5px);
    min-width:min(155px,100%);
    max-width:100%;
    min-height:46px;
    padding:10px 12px;
    white-space:normal;
    overflow-wrap:anywhere;
    text-align:center;
  }
  /* Controles nativos em detalhes também não podem forçar overflow. */
  .detail-actions>select{max-width:100%;min-width:0;font-size:16px!important;}

  /* Rodapés de modal com 3 ações: 2 em cima + ação final larga. */
  .modal-footer{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;}
  .modal-footer>.btn,
  .modal-footer>a.btn{width:100%;min-width:0;white-space:normal;text-align:center;}
  .modal-footer>:nth-child(3):last-child{grid-column:1/-1;}
}

@media screen and (max-width:380px){
  /* Em aparelhos realmente estreitos prioriza leitura integral. */
  .topbar>div+div{grid-template-columns:1fr;}
  .topbar>div+div>:nth-child(3):last-child{grid-column:auto;}
  .detail-actions>.btn,
  .detail-actions>a.btn{flex-basis:100%;min-width:100%;}
  .modal-footer{grid-template-columns:1fr;}
  .modal-footer>:nth-child(3):last-child{grid-column:auto;}
}


/* ============================================================
   DRR 1.9.2 RC3 — ações principais do Painel no mobile
   Mantém Nova ordem de serviço + Novo chamado lado a lado.
   ============================================================ */
.dashboard-primary-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;}
@media screen and (max-width:880px){
  .dashboard-primary-actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    width:100%;
  }
  .dashboard-primary-actions>.btn{
    width:100%;
    min-width:0;
    min-height:54px;
    padding:10px 9px;
    white-space:normal;
    line-height:1.25;
    text-align:center;
    justify-content:center;
  }
  .dashboard-primary-actions>.btn:only-child{grid-column:1/-1;}
}

/* ============================================================
   DRR 1.9.2 RC11 — Central de Ajustes por abas / papéis de usuário
   ============================================================ */
.settings-tabs{
  display:flex;
  gap:8px;
  align-items:center;
  overflow-x:auto;
  padding:2px 0 10px;
  margin:-2px 0 14px;
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
}
.settings-tab{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  padding:8px 13px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
  color:var(--ink-dim);
  font-size:13px;
  font-weight:700;
  text-decoration:none;
  white-space:nowrap;
}
.settings-tab:hover{color:var(--ink);border-color:var(--primary);}
.settings-tab.active{background:var(--primary);border-color:var(--primary);color:#fff;}
.settings-tab-page[hidden]{display:none!important;}
.settings-finance-wrap{width:100%;max-width:1180px;margin:0 auto 18px;}
.settings-finance-frame{display:block;width:100%;min-height:700px;border:0;background:transparent;overflow:hidden;}
.backup-history-card{margin:2px 0 16px;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);}
.backup-history-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:9px;}
.backup-history-head h4{font-size:14px;margin:0 0 2px;}
.backup-history-list,.backup-history-modal{display:grid;gap:7px;}
.backup-history-row{display:flex;align-items:flex-start;gap:9px;padding:8px 9px;border:1px solid var(--border);border-radius:8px;background:var(--surface);}
.backup-history-row strong{font-size:12.5px;}
.backup-history-icon{line-height:1.4;}
.backup-run-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 16px;}
.backup-admin-note{margin:12px 0;padding:10px 12px;border:1px dashed var(--border);border-radius:9px;background:var(--surface-2);}
.superadmin-callout{display:flex;flex-direction:column;gap:4px;margin-bottom:12px;padding:11px 12px;border:1px solid rgba(34,197,94,.35);border-radius:10px;background:rgba(34,197,94,.08);}
.superadmin-callout span{font-size:12.5px;color:var(--ink-dim);line-height:1.45;}
.user-role-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end;}
.user-role-row .list-title{display:flex;align-items:center;gap:7px;flex-wrap:wrap;}
.badge-blue{background:rgba(59,130,246,.12);color:#60a5fa;border-color:rgba(59,130,246,.28);}

@media screen and (max-width:880px){
  .settings-tabs{margin-left:-2px;margin-right:-2px;padding-bottom:8px;}
  .settings-tab{font-size:13.5px;min-height:42px;padding:9px 13px;}
  .settings-finance-frame{min-height:820px;}
  .backup-history-head{align-items:flex-start;}
  .user-role-actions{width:100%;justify-content:flex-start;margin-top:7px;}
  .user-role-actions>.btn{flex:1 1 130px;}
}

/* ============================================================
   DRR 1.9.2 RC12 — Ajustes instantâneos / logs inline
   ============================================================ */
.settings-finance-wrap{position:relative;}
.settings-iframe-loading{
  min-height:160px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--ink-dim);
  font-size:13px;
  border:1px dashed var(--border);
  border-radius:10px;
  background:var(--surface-2);
}
.settings-iframe-loading.is-hidden{display:none!important;}
.settings-inline-switch{
  display:flex;
  gap:6px;
  align-items:center;
  padding:5px;
  margin:10px 0 14px;
  width:max-content;
  max-width:100%;
  overflow-x:auto;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface-2);
}
.settings-inline-switch-btn{
  flex:0 0 auto;
  min-height:34px;
  padding:7px 11px;
  border:0;
  border-radius:7px;
  background:transparent;
  color:var(--ink-dim);
  font:inherit;
  font-size:12.5px;
  font-weight:700;
  cursor:pointer;
  white-space:nowrap;
}
.settings-inline-switch-btn.active{background:var(--surface);color:var(--ink);box-shadow:inset 0 0 0 1px var(--border);}
.settings-log-pane{min-width:0;}
.settings-log-filters{margin-bottom:10px;}
.settings-log-table{
  width:100%;
  max-height:440px;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:9px;
  background:var(--surface-2);
}
.settings-log-data-table{min-width:860px;margin:0;}
.settings-log-data-table thead th{position:sticky;top:0;z-index:2;background:var(--surface-2);}
.settings-log-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;}
.settings-log-retention{margin-top:12px;padding-top:10px;border-top:1px solid var(--border);}
@media screen and (max-width:880px){
  .settings-log-table{max-height:55vh;}
  .settings-inline-switch{width:100%;}
}


/* ===== RC13 · Relatórios gerenciais ===== */
.rel-dashboard-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:16px;margin-bottom:16px}.rel-dashboard-grid>.panel{margin:0}.rel-chart-card h3,.rel-secondary-grid h3{font-size:15px;margin:0 0 16px}.rel-month-bars{height:220px;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;align-items:end}.rel-month-col{height:100%;display:grid;grid-template-rows:1fr auto auto;gap:5px;text-align:center;min-width:0}.rel-month-bar-wrap{height:100%;display:flex;align-items:end;justify-content:center;background:var(--surface-2);border-radius:8px 8px 3px 3px;overflow:hidden}.rel-month-bar-wrap i{display:block;width:min(48px,70%);background:linear-gradient(180deg,var(--teal),#0f766e);border-radius:7px 7px 0 0;position:relative;min-height:0}.rel-month-bar-wrap i span{position:absolute;left:50%;bottom:100%;transform:translate(-50%,-5px);white-space:nowrap;font-size:10px;color:var(--ink-dim);opacity:0}.rel-month-col:hover i span{opacity:1}.rel-month-col>b{font-size:11px}.rel-month-col>small{font-size:10px;color:var(--ink-faint)}.rel-client-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.rel-client-metrics>div,.rel-insights>div{padding:13px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}.rel-client-metrics strong{display:block;font-size:25px;color:var(--teal-text);margin-bottom:4px}.rel-client-metrics small,.rel-insights small{color:var(--ink-faint);font-size:11px}.rel-insights{display:grid;grid-template-columns:1fr 1fr;gap:10px}.rel-insights strong{display:block;font-size:13px;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:900px){.rel-dashboard-grid{grid-template-columns:1fr}.rel-month-bars{height:190px}.rel-secondary-grid{grid-template-columns:1fr 1fr}}
@media(max-width:620px){.rel-secondary-grid{grid-template-columns:1fr}.rel-client-metrics{grid-template-columns:repeat(3,1fr)}.rel-insights{grid-template-columns:1fr 1fr}.rel-month-bars{gap:5px}.rel-month-bar-wrap i{width:64%}}
@media(max-width:420px){.rel-client-metrics{grid-template-columns:1fr}.rel-insights{grid-template-columns:1fr}}
@media print{.rel-dashboard-grid,.rel-secondary-grid{display:block!important}.rel-month-bars{display:none!important}.rel-insights{grid-template-columns:repeat(2,1fr)!important}.rel-insights>div{border:1px solid #ddd!important;background:#fff!important;color:#111!important}}


/* RC14 - acabamento da Central de Ajustes */
.settings-panel input[type="checkbox"],.settings-panel input[type="radio"]{accent-color:var(--primary)!important}
.settings-finance-wrap{max-width:none!important;margin-left:0!important;margin-right:0!important}.settings-finance-frame{max-width:100%;margin:0!important}
.settings-log-table{max-height:none!important;overflow:visible!important;border:0!important;background:transparent!important;padding:0!important}.settings-log-list{display:grid;gap:8px}.settings-log-entry{border:1px solid var(--border);background:var(--surface-2);border-radius:10px;padding:10px 12px;min-width:0}.settings-log-entry-head{display:flex;gap:10px;justify-content:space-between;align-items:center}.settings-log-entry-head strong{font-size:13px}.settings-log-entry-head span{font-size:11px;color:var(--primary);font-weight:700}.settings-log-entry-meta{display:flex;gap:8px 12px;flex-wrap:wrap;margin-top:5px;color:var(--ink-dim);font-size:11.5px}.settings-log-entry-meta b{color:var(--ink)}.settings-log-entry p{margin:7px 0 0;color:var(--ink);font-size:12.5px;line-height:1.45;overflow-wrap:anywhere}.settings-log-more{display:flex;align-items:center;gap:10px;justify-content:center;margin:12px 0}.settings-log-more span{font-size:11px;color:var(--ink-dim)}
html[data-theme="light"] .settings-tab.active{background:var(--primary)!important;border-color:var(--primary)!important;color:#fff!important}.settings-tab.active{box-shadow:0 0 0 1px color-mix(in srgb,var(--primary) 35%,transparent)}
@media(max-width:700px){.settings-panel{margin-left:0!important;margin-right:0!important;width:100%!important}.settings-finance-wrap{width:100%!important}.settings-log-entry-head{align-items:flex-start;flex-direction:column;gap:3px}.settings-log-entry-meta{font-size:12px}.settings-log-entry p{font-size:13px}.settings-log-actions{display:grid;grid-template-columns:1fr 1fr}.settings-log-actions .btn{width:100%}}

/* RC14 - relatórios gerenciais */
.rel-month-col{appearance:none;border:0;background:transparent;color:inherit;padding:0;cursor:pointer}.rel-month-col.selected .rel-month-bar-wrap{outline:1px solid color-mix(in srgb,var(--primary) 55%,transparent)}.rel-month-col>b{font-size:12px!important}.rel-month-col>small{font-size:11.5px!important;color:var(--ink-dim)!important}.rel-month-bar-wrap i span{font-size:11px!important}.rel-month-touch-detail{display:none;margin-top:10px;padding:9px 11px;border:1px solid var(--border);border-radius:8px;background:var(--surface-2);font-size:13px;font-weight:700;text-align:center}.rel-client-metrics{align-content:center}.rel-client-metrics>div{display:grid;align-content:center;min-height:92px}.rel-client-metrics small,.rel-insights small{font-size:12.5px!important;color:var(--ink-dim)!important}.rel-insights strong{font-size:14px!important;line-height:1.35;white-space:normal!important}.rel-secondary-grid>.panel{align-self:stretch;display:flex;flex-direction:column;justify-content:flex-start}.rel-secondary-grid .rel-client-metrics,.rel-secondary-grid .rel-insights{margin:auto 0}
@media(max-width:620px){.rel-month-touch-detail{display:block}.rel-month-bars{min-width:540px}.rel-chart-card:has(.rel-month-bars){overflow-x:auto}.rel-client-metrics>div{min-height:78px}.rel-insights strong{font-size:14.5px!important}.rel-insights small{font-size:13px!important}}
@media print{#folhaRelatorio.print-sheet.folha-ativa{height:auto!important;min-height:0!important;overflow:visible!important;padding-bottom:4mm!important;page-break-after:avoid!important;break-after:avoid!important}#folhaRelatorio #relatorioImpressao{height:auto!important;min-height:0!important}#folhaRelatorio .ps-footer{margin-bottom:0!important;page-break-after:avoid!important;break-after:avoid!important}#folhaRelatorio .ps-section:last-of-type{margin-bottom:5px!important}.rel-month-touch-detail{display:none!important}}

/* ===== RC14 acabamento final: relatórios e impressão ===== */
@media screen{
  .rel-secondary-grid>.panel{min-height:0!important}
  .rel-client-metrics{height:auto!important}
}
@media(max-width:620px){
  .rel-chart-card:has(.rel-month-bars){padding-bottom:12px}
  .rel-month-bars{min-width:600px!important;height:210px!important}
  .rel-month-col>b{font-size:13px!important}.rel-month-col>small{font-size:12.5px!important}
  .rel-month-touch-detail{position:sticky;left:0;font-size:14px!important}
  .rel-client-metrics{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .rel-client-metrics>div{padding:10px 6px!important;min-height:74px!important;text-align:center}
  .rel-client-metrics strong{font-size:23px!important}
  .rel-client-metrics small{font-size:12px!important;line-height:1.25}
}
@media(max-width:390px){.rel-client-metrics{grid-template-columns:1fr!important}}
@media print{
  #folhaRelatorio.print-sheet.folha-ativa{padding:8mm 9mm!important;font-size:9px!important;position:absolute!important;top:0!important;left:0!important;width:100%!important}
  #folhaRelatorio .ps-header{margin-bottom:8px!important;padding-bottom:7px!important}
  #folhaRelatorio .ps-grid{margin-bottom:10px!important;gap:6px!important}
  #folhaRelatorio .ps-block{padding:7px!important}
  #folhaRelatorio .ps-block h4{font-size:8px!important;margin-bottom:3px!important}
  #folhaRelatorio .ps-block p{font-size:14px!important;margin:0!important}
  #folhaRelatorio .ps-section{margin-bottom:8px!important;break-inside:auto!important;page-break-inside:auto!important}
  #folhaRelatorio .ps-section h4{font-size:10px!important;margin-bottom:5px!important}
  #folhaRelatorio .catbar-row{min-height:0!important;margin-bottom:3px!important;font-size:8.5px!important}
  #folhaRelatorio .rel-insights{gap:5px!important}
  #folhaRelatorio .rel-insights>div{padding:6px!important}
  #folhaRelatorio .rel-insights small{font-size:7.5px!important}
  #folhaRelatorio .rel-insights strong{font-size:9px!important}
  #folhaRelatorio .ps-table{font-size:8.3px!important;table-layout:fixed!important}
  #folhaRelatorio .ps-table th{font-size:7.7px!important;padding:3px!important}
  #folhaRelatorio .ps-table td{padding:3px!important;overflow-wrap:anywhere!important}
  #folhaRelatorio .ps-footer{font-size:7.5px!important;margin-top:5px!important;padding-top:4px!important}
  #folhaRelatorio.print-sheet.folha-ativa,#folhaRelatorio #relatorioImpressao{break-after:avoid!important;page-break-after:avoid!important}
}


/* ============================================================
   DRR 1.9.2 RC15 — acabamento para homologação FINAL
   ============================================================ */
/* A Central não possui --primary; usar explicitamente o azul DRR. */
.settings-tab.active,
html[data-theme="light"] .settings-tab.active{
  background:var(--teal)!important;
  border-color:var(--teal)!important;
  color:#fff!important;
  box-shadow:0 0 0 1px rgba(15,160,209,.28)!important;
}

/* Usuários e permissões: preservar identidade/textos no celular sem os botões esmagarem o miolo. */
@media(max-width:880px){
  .user-role-row{display:grid!important;grid-template-columns:42px minmax(0,1fr)!important;gap:10px 12px!important;align-items:start!important;}
  .user-role-row .avatar{grid-column:1;grid-row:1;}
  .user-role-row .list-main{grid-column:2;grid-row:1;min-width:0!important;width:100%!important;}
  .user-role-row .list-title,.user-role-row .list-sub{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere;}
  .user-role-row .user-role-actions{grid-column:1/-1;grid-row:2;width:100%!important;margin:0!important;display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px!important;}
  .user-role-row .user-role-actions>.btn{width:100%!important;min-width:0!important;justify-content:center;}
  .settings-finance-wrap{box-sizing:border-box!important;width:100%!important;padding-inline:0!important;overflow:hidden!important;}
  .settings-finance-frame{box-sizing:border-box!important;width:100%!important;max-width:100%!important;margin:0!important;}
}
@media(max-width:430px){
  .user-role-row .user-role-actions{grid-template-columns:1fr 1fr;}
  .user-role-row .user-role-actions>.btn:first-of-type{grid-column:1/-1;}
}

/* Relatório técnico: 6 meses sempre cabem na largura do telefone. */
@media(max-width:620px){
  .rel-chart-card:has(.rel-month-bars){overflow:visible!important;}
  .rel-month-bars{min-width:0!important;width:100%!important;height:178px!important;gap:3px!important;}
  .rel-month-col{min-width:0!important;width:auto!important;}
  .rel-month-col>b{font-size:10.5px!important;letter-spacing:-.02em;}
  .rel-month-col>small{font-size:10px!important;line-height:1.15;white-space:nowrap;}
  .rel-month-bar-wrap i{width:72%!important;}
  .rel-month-bar-wrap i span{display:none!important;}
  .rel-month-touch-detail{position:static!important;left:auto!important;width:100%!important;}
}

/* Evita uma folha fantasma ao fim de relatórios A4 isolados. */
@media print{
  #folhaRelatorio.print-sheet.folha-ativa,
  #folhaRelatorioOrdens.print-sheet.folha-ativa,
  #folhaRelatorioClientes.print-sheet.folha-ativa,
  #folhaRelatorioEstoque.print-sheet.folha-ativa,
  #folhaRelatorioChamados.print-sheet.folha-ativa{
    position:relative!important;top:auto!important;left:auto!important;
    display:block!important;width:210mm!important;max-width:210mm!important;
    min-height:0!important;height:auto!important;margin:0!important;
    break-after:avoid!important;page-break-after:avoid!important;
  }
}
/* Exportação direta do relatório técnico: usar a mesma aparência branca do A4 sem depender de @media print. */
.pdf-report-export{font-family:Arial,sans-serif!important;font-size:9px!important;line-height:1.3!important}
.pdf-report-export .ps-header{margin-bottom:8px!important;padding-bottom:7px!important}
.pdf-report-export .ps-grid{margin-bottom:10px!important;gap:6px!important}
.pdf-report-export .ps-block{padding:7px!important}.pdf-report-export .ps-block h4{font-size:8px!important;margin-bottom:3px!important}.pdf-report-export .ps-block p{font-size:14px!important;margin:0!important}
.pdf-report-export .ps-section{margin-bottom:8px!important;break-inside:auto!important}.pdf-report-export .ps-section h4{font-size:10px!important;margin-bottom:5px!important}
.pdf-report-export .catbar-row{min-height:0!important;margin-bottom:3px!important;font-size:8.5px!important}.pdf-report-export .catbar-name{color:#111!important}.pdf-report-export .catbar-track{background:#eef1f2!important}.pdf-report-export .catbar-val{color:#555!important}
.pdf-report-export .rel-insights{gap:5px!important;grid-template-columns:repeat(2,1fr)!important}.pdf-report-export .rel-insights>div{padding:6px!important;border:1px solid #ddd!important;background:#fff!important;color:#111!important}.pdf-report-export .rel-insights small{font-size:7.5px!important;color:#666!important}.pdf-report-export .rel-insights strong{font-size:9px!important;color:#111!important}
.pdf-report-export .ps-table{font-size:8.3px!important;table-layout:fixed!important}.pdf-report-export .ps-table th{font-size:7.7px!important;padding:3px!important}.pdf-report-export .ps-table td{padding:3px!important;overflow-wrap:anywhere!important}.pdf-report-export .ps-footer{font-size:7.5px!important;margin-top:5px!important;padding-top:4px!important}


/* ============================================================
   DRR 1.9.2 RC16 — acabamento de usuários / backup final
   ============================================================ */
.user-role-actions .btn{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.user-role-actions .btn svg{width:15px;height:15px;flex:0 0 auto}
.user-role-action-delete{color:var(--red)!important;border-color:color-mix(in srgb,var(--red) 38%,var(--border))!important}
@media(max-width:880px){
  .user-role-row{padding:13px!important}
  .user-role-row .user-role-actions{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(82px,1fr))!important;gap:7px!important;padding-top:10px!important;border-top:1px solid var(--border)!important}
  .user-role-row .user-role-actions>.btn{grid-column:auto!important;min-height:40px!important;padding:8px 7px!important;border:1px solid var(--border)!important;border-radius:9px!important;background:var(--surface-2)!important;color:var(--ink)!important}
  .user-role-row .user-role-actions>.btn.user-role-action-delete{color:var(--red)!important;background:color-mix(in srgb,var(--red) 7%,var(--surface-2))!important;border-color:color-mix(in srgb,var(--red) 35%,var(--border))!important}
  .user-role-row .user-role-actions>.btn span{display:inline!important;font-size:12.5px!important;font-weight:700}
}


/* ============================================================
   DRR 1.9.2 RC18 — acabamento final da Central de Ajustes
   Mantém todas as abas dentro da largura útil no desktop e
   rolagem horizontal somente no mobile.
   ============================================================ */
@media screen and (min-width:881px){
  .settings-tabs{
    flex-wrap:wrap!important;
    overflow-x:visible!important;
    max-width:100%!important;
    align-content:flex-start;
  }
  .settings-tab{max-width:100%;}
}
@media screen and (max-width:880px){
  .settings-tabs{
    flex-wrap:nowrap!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
  }
}


/* ============================================================
   DRR 1.9.2 RC19 — fechamento da Central de Ajustes
   No desktop, a navegação acompanha a mesma largura dos painéis
   administrativos (860px) e quebra em linhas de forma previsível.
   ============================================================ */
@media screen and (min-width:881px){
  .settings-tabs{
    width:min(100%,860px)!important;
    max-width:860px!important;
    flex-wrap:wrap!important;
    overflow:visible!important;
    align-items:stretch!important;
    align-content:flex-start!important;
    row-gap:8px!important;
  }
  .settings-tab{
    flex:0 0 auto!important;
    max-width:100%!important;
  }
}


/* ============================================================
   DRR 1.9.7 RC1 — tooltip flutuante do relatório técnico
   ============================================================ */
.rel-chart-card:has(.rel-month-bars){position:relative;overflow:visible}
.rel-month-hover-tip{position:absolute;z-index:30;transform:translateX(-50%);display:grid;gap:2px;min-width:170px;padding:7px 9px;border:1px solid #3a4a54;border-radius:8px;background:#0b1014;color:#dcecf4;box-shadow:0 10px 24px rgba(0,0,0,.35);pointer-events:none;text-align:left;font-size:11px;line-height:1.35}
.rel-month-hover-tip[hidden]{display:none!important}
.rel-month-hover-tip span{font-size:11px;font-weight:700;color:inherit}
.rel-month-hover-tip b{font-size:12px;color:inherit}
.rel-month-hover-tip small{font-size:11px;color:#9fb1bb}
html[data-theme="light"] .rel-month-hover-tip{background:#fff;color:#182126;border-color:#9eb1ba;box-shadow:0 10px 24px rgba(22,35,42,.16)}
html[data-theme="light"] .rel-month-hover-tip small{color:#60717b}
@media(max-width:620px){.rel-month-hover-tip{display:none!important}}
@media print{.rel-month-hover-tip{display:none!important}}
