/* ============================================================== */
/* OFICINA360 PRO - SISTEMA DE DESIGN & INTERFACE INTUITIVA       */
/* ============================================================== */

:root {
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --white: #ffffff;
  --navy: #0f2b3f;
  --navy-light: #164260;
  --navy-dark: #091b28;
  --accent: #f97316;
  --accent-light: #ffedd5;
  --green: #16a34a;
  --green-light: #dcfce7;
  --blue: #0284c7;
  --blue-light: #e0f2fe;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --orange: #ea580c;
  --orange-light: #ffedd5;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 30px -4px rgba(15, 23, 42, 0.1), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, strong, b {
  font-family: 'Manrope', 'DM Sans', sans-serif;
  color: var(--ink);
  line-height: 1.25;
}

p {
  margin: 0;
}

/* ============================================================== */
/* ESTRUTURA DO APLICATIVO (APP SHELL) E RESPONSIVIDADE           */
/* ============================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Barra Lateral (Sidebar) */
.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  flex-shrink: 0;
  transition: transform 0.25s ease, width 0.25s ease;
  z-index: 100;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font: 800 20px 'Manrope';
  box-shadow: 0 4px 12px rgba(15, 43, 63, 0.25);
  flex-shrink: 0;
}

.brand strong {
  font: 800 16px 'Manrope';
  color: var(--navy);
  display: block;
  letter-spacing: -0.5px;
}

.brand strong span {
  color: var(--accent);
}

.brand small {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
  font-weight: 500;
}

.workspace {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 20px;
}

.workspace-icon {
  background: #fde68a;
  color: #92400e;
  font-weight: 800;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 11px;
  flex-shrink: 0;
}

.workspace b {
  font-size: 12px;
  display: block;
  color: var(--ink);
}

.workspace small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.workspace > span {
  margin-left: auto;
  color: #94a3b8;
  font-size: 12px;
}

/* Navegação da Sidebar */
.nav-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted-light);
  font-weight: 800;
  padding: 8px 12px 6px;
  display: block;
  text-transform: uppercase;
}

.nav-label.secondary {
  margin-top: 20px;
}

.nav-item {
  height: 42px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin: 3px 0;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item i {
  font-style: normal;
  font-size: 17px;
  width: 20px;
  text-align: center;
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav-item:hover {
  background: #f1f5f9;
  color: var(--navy);
}

.nav-item:hover i {
  color: var(--navy);
}

.nav-item.active {
  background: var(--blue-light);
  color: #0369a1;
  font-weight: 700;
}

.nav-item.active i {
  color: var(--blue);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  background: var(--blue);
  border-radius: 0 4px 4px 0;
}

/* Badges de navegação */
.badge-nav {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  line-height: 1.2;
}

.badge-nav.danger { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }
.badge-nav.warning { background: var(--amber-light); color: var(--amber); border: 1px solid #fde68a; }
.badge-nav.orange { background: var(--orange-light); color: var(--orange); border: 1px solid #fed7aa; }

/* Rodapé da Sidebar */
.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
}

.profile {
  border-top: 1px solid var(--line);
  padding: 14px 6px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile b {
  font-size: 12px;
  display: block;
}

.profile small {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.avatar, .mini-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 12px 'Manrope';
  flex-shrink: 0;
}

.avatar-blue, .mini-avatar { background: #e0f2fe; color: #0284c7; font-weight: 800; }
.avatar-orange { background: #ffedd5; color: #ea580c; }
.avatar-green { background: #dcfce7; color: #16a34a; }
.avatar-purple { background: #ede9fe; color: #7c3aed; }

/* Overlay Mobile para Sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 95;
}

/* Conteúdo Principal */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Barra Superior (Topbar) */
.topbar {
  height: 66px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-mobile-menu {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 18px;
  color: var(--ink);
  cursor: pointer;
}

.btn-mobile-menu:hover {
  background: #f1f5f9;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
}

.breadcrumb span {
  padding: 0 8px;
  color: var(--line-strong);
}

.breadcrumb strong {
  color: var(--ink);
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-help-topbar {
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-help-topbar:hover {
  background: #f1f5f9;
  border-color: var(--line-strong);
  color: var(--navy);
}

.user-short b {
  font-size: 12px;
  display: block;
}

.user-short small {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
}

/* Área de Conteúdo da Página */
.page-content {
  padding: 30px 36px 60px;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

/* Cabeçalho da Página */
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.eyebrow {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.2px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.page-heading h1 {
  font-size: 26px;
  letter-spacing: -0.8px;
  color: var(--navy);
  margin: 0;
  font-weight: 800;
}

.page-heading p {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

.heading-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================== */
/* GUIAS AUTOEXPLICATIVOS & BANNERS DIDÁTICOS                      */
/* Para facilitar a operação de quem tem pouca intimidade técnica */
/* ============================================================== */

.guide-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f9ed 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.guide-icon {
  width: 36px;
  height: 36px;
  background: #22c55e;
  color: #fff;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(34, 197, 94, 0.25);
}

.guide-body {
  flex: 1;
}

.guide-title {
  font-size: 14px;
  font-weight: 800;
  color: #166534;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-body p {
  font-size: 12px;
  color: #15803d;
  line-height: 1.45;
  margin-bottom: 10px;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.guide-step-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(187, 247, 208, 0.8);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  color: #166534;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.step-num {
  background: #16a34a;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Stepper do Ciclo de Vida da OS (Passo a Passo Visual) */
.os-lifecycle-stepper {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin: 14px 0 20px;
  overflow-x: auto;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.lifecycle-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-light);
  white-space: nowrap;
}

.lifecycle-step .step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid #cbd5e1;
}

.lifecycle-step.completed {
  color: #16a34a;
}
.lifecycle-step.completed .step-circle {
  background: #dcfce7;
  color: #16a34a;
  border-color: #86efac;
}

.lifecycle-step.current {
  color: #0369a1;
}
.lifecycle-step.current .step-circle {
  background: #0284c7;
  color: #fff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.lifecycle-arrow {
  color: #cbd5e1;
  font-size: 14px;
  padding: 0 4px;
}

/* ============================================================== */
/* BOTÕES MODERNOS E CLAROS                                       */
/* ============================================================== */

.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font: 700 13px 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 43, 63, 0.2);
}
.btn-primary:hover {
  background: var(--navy-light);
  box-shadow: 0 6px 16px rgba(15, 43, 63, 0.3);
}

.btn-outline {
  background: #ffffff !important;
  color: var(--navy) !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700;
}
.btn-outline:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: var(--navy-dark) !important;
}

.btn-ghost {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink-secondary);
}
.btn-ghost:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.btn-success {
  background: #16a34a !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}
.btn-success:hover {
  background: #15803d !important;
}

.btn-warning {
  background: #f59e0b !important;
  color: #fff !important;
  border: none !important;
}
.btn-warning:hover {
  background: #d97706 !important;
}

.btn-danger {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1px solid #fca5a5 !important;
}
.btn-danger:hover {
  background: #fecaca !important;
}

.btn-danger-dark {
  background: #dc2626 !important;
  color: #fff !important;
  border: none !important;
}
.btn-danger-dark:hover {
  background: #b91c1c !important;
}

.btn-sm {
  padding: 7px 11px !important;
  font-size: 12px !important;
}

/* ============================================================== */
/* CARDS DE MÉTRICAS & PAINÉIS                                    */
/* ============================================================== */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card, .panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card {
  padding: 18px 20px;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
}

.metric-icon.green, .trend.green { color: var(--green); background: var(--green-light); }
.metric-icon.orange, .trend.orange { color: var(--amber); background: var(--amber-light); }
.metric-icon.blue, .trend.blue { color: var(--blue); background: var(--blue-light); }
.metric-icon.purple, .trend.purple { color: var(--purple); background: var(--purple-light); }

.metric-card > strong {
  font-size: 24px;
  color: var(--ink);
  display: block;
  letter-spacing: -0.5px;
}

.trend {
  display: inline-block;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 8px;
}

/* Painéis (Panels) */
.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  min-height: 68px;
  box-sizing: border-box;
}

.panel-head h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}

.panel-head p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

/* Alerta de itens no estoque mínimo */
.stock-alert-panel {
  margin-top: 20px;
  margin-bottom: 20px;
}
.stock-alert-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}
.stock-alert-summary strong { font-size: 20px; }
.stock-alert-summary.has-alerts { background: var(--red-light); color: var(--red); }
.stock-alert-summary.is-ok { background: var(--green-light); color: var(--green); }
.stock-alert-summary strong { color: inherit; }
.stock-alert-list { padding: 0 22px; }
.stock-alert-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}
.stock-alert-item:last-child { border-bottom: 0; }
.stock-alert-item-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stock-alert-item-main > div { min-width: 0; }
.stock-alert-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 15px;
}
.stock-alert-icon.critical { background: var(--red-light); color: var(--red); }
.stock-alert-icon.warning { background: var(--amber-light); color: var(--amber); }
.stock-alert-item b, .stock-alert-item small { display: block; }
.stock-alert-item b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-alert-item small, .stock-alert-footer { color: var(--muted); font-size: 11px; }
.stock-alert-values { text-align: right; white-space: nowrap; }
.stock-current { display: block; font-weight: 800; font-size: 13px; }
.stock-current.critical, .stock-alert-status.critical { color: var(--red); }
.stock-current.warning, .stock-alert-status.warning { color: var(--amber); }
.stock-alert-status { min-width: 128px; font-size: 11px; font-weight: 800; text-align: right; }
.stock-alert-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  background: #f8fafc;
}
.stock-alert-empty { padding: 24px; }
@media (max-width: 680px) {
  .stock-alert-item {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }
  .stock-alert-values { text-align: right; }
  .stock-alert-status {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: left;
  }
}

/* ============================================================== */
/* TABELAS MODERNAS E BUSCA EM TEMPO REAL                         */
/* ============================================================== */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th {
  text-align: left;
  color: #64748b;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--ink-secondary);
  font-size: 13px;
  vertical-align: middle;
}

tr:hover td {
  background: #fafcff;
}

td b {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

td small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

/* Toolbar e Barra de Busca Rápida */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  flex: 1;
  max-width: 440px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.search span {
  font-size: 16px;
  color: var(--muted);
}

.search input {
  border: 0;
  outline: 0;
  font: 13px 'DM Sans', sans-serif;
  width: 100%;
  color: var(--ink);
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--muted-light);
  cursor: pointer;
  padding: 4px;
  display: none;
  font-size: 14px;
}
.search-clear-btn:hover {
  color: var(--ink);
}

.search-count-badge {
  background: #e2e8f0;
  color: #475569;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Pills e Badges de Status */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.success { color: #166534; background: #dcfce7; }
.pill.warning { color: #b45309; background: #fef3c7; }
.pill.info { color: #0369a1; background: #e0f2fe; }
.pill.purple { color: #6d28d9; background: #ede9fe; }
.pill.teal { color: #0f766e; background: #ccfbf1; }
.pill.danger { color: #991b1b; background: #fee2e2; }
.pill.secondary { color: #475569; background: #f1f5f9; }

/* Callouts de Alerta */
.callout {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  color: #92400e;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.callout > span {
  font-size: 20px;
  flex-shrink: 0;
}

.callout.erro {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.callout.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.callout.info {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

/* ============================================================== */
/* BOTÃO FLUTUANTE DE AJUDA & CENTRAL DE DÚVIDAS                   */
/* ============================================================== */

.floating-help-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: linear-gradient(135deg, var(--navy) 0%, #1e4d6d 100%);
  color: #fff;
  border: 1px solid #33668a;
  border-radius: 30px;
  padding: 11px 18px;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(15, 43, 63, 0.35);
  z-index: 80;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-help-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(2, 132, 199, 0.4);
  background: linear-gradient(135deg, #164260 0%, #0284c7 100%);
}

/* Modal e Diálogos */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog.modal-lg {
  max-width: 860px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-head h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.btn-close:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.modal-body {
  padding: 24px;
}

/* Formulários */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 22px;
}

.form-grid label, .modal-card label {
  font-size: 12px;
  color: var(--ink-secondary);
  font-weight: 700;
}

.form-grid input, .form-grid select, .form-grid textarea, .modal-card select, .modal-card input {
  display: block;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 6px;
  outline: none;
  color: var(--ink);
  font: 13px 'DM Sans', sans-serif;
  transition: all 0.15s ease;
  background: #fff;
}

.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Toast Notificações */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font: 700 13px 'DM Sans', sans-serif;
  box-shadow: 0 10px 30px rgba(15, 43, 63, 0.35);
  transform: translateY(16px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.toast-success { background: #15803d; }
.toast.toast-error { background: #b91c1c; }

/* ============================================================== */
/* RESPONSIVIDADE (MOBILE & TABLETS)                              */
/* ============================================================== */

@media (max-width: 1024px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-content {
    padding: 24px 20px;
  }
  .topbar {
    padding: 0 20px;
  }
}

@media (max-width: 768px) {
  .btn-mobile-menu {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-overlay.mobile-open {
    display: block;
  }
  .user-short {
    display: none;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .page-heading h1 {
    font-size: 22px;
  }
  .floating-help-btn span.label {
    display: none;
  }
  .floating-help-btn {
    padding: 12px;
    border-radius: 50%;
  }
}

[hidden] {
  display: none !important;
}

/* ============================================================== */
/* ESTILOS ESPECÍFICOS DOS MÓDULOS DE OFICINA & FINANCEIRO        */
/* ============================================================== */

.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.actions form { margin: 0; }
.check-line { display: flex !important; align-items: center; gap: 10px; }
.check-line input { width: auto !important; margin: 0 !important; }

/* Banners de Alerta Operacionais e Financeiros */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.alert-banner.danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.alert-banner.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}
.alert-icon { font-size: 24px; flex-shrink: 0; }
.alert-text { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
.alert-text strong { font-size: 14px; font-weight: 800; color: inherit; }

/* Indicadores de Tempo / Prazos de Entrega */
.badge-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}
.badge-time.today {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid #fde68a;
}
.badge-time.expired {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #fca5a5;
}

/* Linhas Destacadas */
.row-highlight-today { background: #fffdf5 !important; }
.row-highlight-late { background: #fff5f5 !important; }
.row-returned { background: #fafafa !important; opacity: 0.75; }
.text-strikethrough { text-decoration: line-through; color: var(--muted); }

/* Tags de Especialidade e Tipo de Item */
.service-tag {
  display: inline-block;
  padding: 3px 8px;
  background: #f1f5f9;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
}
.tag-tipo {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 4px;
  text-transform: uppercase;
}
.tag-tipo.servico { background: #e0f2fe; color: #0369a1; }
.tag-tipo.peca { background: #fef3c7; color: #b45309; }
.tag-tipo.produto { background: #dcfce7; color: #15803d; }
.tag-tipo.fabricado { background: #f3e8ff; color: #7e22ce; }
.tag-tipo.material { background: #ffedd5; color: #c2410c; }

/* Haver e Valores */
.badge-haver {
  display: inline-block;
  padding: 3px 9px;
  background: #dcfce7;
  color: #166534;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
}
.color-debt { color: #dc2626 !important; font-weight: 800; }
.color-ok { color: #16a34a !important; font-weight: 800; }

/* Prioridades */
.pill-priority {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.pill-priority.baixa { background: #f1f5f9; color: #64748b; }
.pill-priority.normal { background: #e0f2fe; color: #0284c7; }
.pill-priority.alta { background: #ffedd5; color: #ea580c; }
.pill-priority.urgente { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }

/* Abas Pills */
.tab-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-pill {
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.15s;
}
.tab-pill:hover { background: #e2e8f0; }
.tab-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* Card Hero Detalhe da OS */
.os-hero-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  box-shadow: var(--shadow);
}
.os-hero-main { display: flex; align-items: center; gap: 16px; }
.os-code-badge {
  background: var(--navy);
  color: #fff;
  font-family: 'Manrope', sans-serif;
  font-weight: 900;
  font-size: 18px;
  padding: 9px 16px;
  border-radius: 10px;
}
.os-subtitle { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.os-hero-meta { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.os-hero-meta small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}

/* Faixa de Equilíbrio Financeiro da OS */
.financial-balance-strip {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 16px;
  padding: 16px 22px;
  flex-wrap: wrap;
  gap: 18px;
}
.balance-cell { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.balance-cell small { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.balance-cell strong { font-size: 22px; font-family: 'Manrope', sans-serif; font-weight: 800; }
.balance-cell.divider-left { border-left: 1px solid #cbd5e1; }
.balance-cell.highlight-cell { background: #fff; padding: 10px 16px; border-radius: 10px; border: 1px solid #94a3b8; }
.micro-text { font-size: 11px; color: var(--muted); }
.balance-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* Filtros Rápidos */
.quick-filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.btn-filter {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  color: #475569;
  transition: all 0.15s;
}
.btn-filter:hover { background: #f1f5f9; }
.btn-filter.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ============================================================== */
/* GRIDS DE CONTEÚDO, FINANCEIRO, ESPECIALIDADES & ACESSO RÁPIDO  */
/* ============================================================== */

/* Grid de duas colunas do dashboard */
.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.content-grid > .panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.content-grid > .panel > .mini-list,
.content-grid > .panel > .service-type-grid,
.content-grid > .panel > .quick-grid {
  flex: 1;
}

@media (max-width: 1050px) {
  .content-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Link de texto elegante */
.text-link {
  color: var(--orange);
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}
.text-link:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* Cards de Alerta Financeiro (Dashboard) */
.financial-alert-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 20px 0;
}

@media (max-width: 1250px) and (min-width: 1051px) {
  .financial-alert-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .financial-alert-cards {
    grid-template-columns: 1fr !important;
  }
}

.fin-card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.fin-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.fin-card strong {
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 800;
  font-family: 'Manrope', sans-serif;
  margin: 4px 0 2px;
  display: block;
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-card small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-card.danger-card {
  background: #fff8f8;
  border-color: #fecaca;
}
.fin-card.danger-card strong { color: var(--red); }

.fin-card.warning-card {
  background: #fffdf5;
  border-color: #fde68a;
}
.fin-card.warning-card strong { color: var(--amber); }

.fin-card.info-card {
  background: #f0f9ff;
  border-color: #bae6fd;
}
.fin-card.info-card strong { color: var(--blue); }

.fin-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.fin-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 7px;
  border-radius: 10px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.red-dot { background: var(--red); box-shadow: 0 0 6px rgba(220, 38, 38, 0.4); }
.yellow-dot { background: var(--amber); box-shadow: 0 0 6px rgba(217, 119, 6, 0.4); }
.blue-dot { background: var(--blue); box-shadow: 0 0 6px rgba(2, 132, 199, 0.4); }

/* Mini-listas financeiras */
.mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px 20px;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.15s ease;
}

.mini-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.mini-item b {
  font-size: 13px;
  display: block;
  color: var(--ink);
}

.mini-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.text-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.text-right b {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 13px;
}

.empty-state-mini {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}

.badge-status-date {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-status-date.red { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }
.badge-status-date.yellow { background: var(--amber-light); color: var(--amber); border: 1px solid #fde68a; }
.badge-status-date.blue { background: var(--blue-light); color: var(--blue); border: 1px solid #bae6fd; }
.badge-status-date.gray { background: #f1f5f9; color: var(--muted); }
.badge-status-date.success { background: var(--green-light); color: var(--green); border: 1px solid #bbf7d0; }

/* Grid de Especialidades no Dashboard */
.service-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px 20px 20px;
  align-content: start;
}

.service-type-badge-card {
  padding: 13px 15px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.service-type-badge-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background: #ffffff;
}

.st-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--ink);
}

.st-bullet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.service-type-badge-card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

/* Grid de Acesso Rápido */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 20px 20px;
  align-content: start;
}

@media (max-width: 480px) {
  .quick-grid {
    grid-template-columns: 1fr !important;
  }
}

.quick-grid a {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.quick-grid a:hover {
  border-color: var(--blue);
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.quick-grid b {
  font-size: 13px;
  font-weight: 800;
  display: block;
  color: var(--navy);
}

.quick-grid small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.quick-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
  flex-shrink: 0;
}

.blue-bg { background: var(--blue-light); color: var(--blue); }
.orange-bg { background: var(--orange-light); color: var(--orange); }
.green-bg { background: var(--green-light); color: var(--green); }
.purple-bg { background: var(--purple-light); color: var(--purple); }

/* ============================================================== */
/* CATÁLOGO DE PRODUTOS, PEÇAS, FABRICADOS & SERVIÇOS             */
/* ============================================================== */

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .catalog-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .catalog-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 480px) {
  .catalog-grid {
    grid-template-columns: 1fr !important;
  }
}

.catalog-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex !important;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  cursor: pointer;
  text-decoration: none;
}

.catalog-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue);
}

.catalog-card h2 {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 2px 0;
  color: var(--navy);
  letter-spacing: -0.3px;
}

.catalog-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}

.catalog-symbol {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
  font-weight: 800;
  transition: transform 0.15s ease;
}

.catalog-card:hover .catalog-symbol {
  transform: scale(1.08);
}

.catalog-card.orange-border { border-top: 3px solid var(--orange); }
.catalog-card.orange-border .catalog-symbol { background: var(--orange-light); color: var(--orange); }

.catalog-card.blue-border { border-top: 3px solid var(--blue); }
.catalog-card.blue-border .catalog-symbol { background: var(--blue-light); color: var(--blue); }

.catalog-card.green-border { border-top: 3px solid var(--green); }
.catalog-card.green-border .catalog-symbol { background: var(--green-light); color: var(--green); }

.catalog-card.purple-border { border-top: 3px solid var(--purple); }
.catalog-card.purple-border .catalog-symbol { background: var(--purple-light); color: var(--purple); }

/* Comentários da OS */
.comment-card {
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 10px;
}

/* Ajustes específicos para o bloco financeiro e cards de catálogo ativos */
#bloco-financeiro {
  grid-template-columns: 1fr 1fr !important;
}
@media (max-width: 950px) {
  #bloco-financeiro {
    grid-template-columns: 1fr !important;
  }
}

.catalog-card.active-card {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.3), var(--shadow) !important;
  background: #f8fafc;
}

/* Responsividade Avançada de Modais e Formulários em Qualquer Tamanho de Tela */
.modal-dialog.modal-lg {
  max-width: 860px !important;
}
.modal-dialog {
  display: flex;
  flex-direction: column;
}
.modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(88vh - 70px);
}
@media (max-width: 680px) {
  .modal {
    padding: 10px;
  }
  .modal-dialog {
    max-width: 100% !important;
    border-radius: 12px;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-head {
    padding: 14px 16px;
  }
  .modal-dialog .form-grid, .modal-body.form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 0 !important;
  }
}

/* ============================================================== */
/* INTERRUPTORES TOGGLE & CONFIGURAÇÕES RESPONSIVAS               */
/* ============================================================== */
.setting-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
@media (max-width: 580px) {
  .setting-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch i {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 28px;
}
.switch i:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.switch input:checked + i {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.switch input:checked + i:before {
  transform: translateX(22px);
}
.switch input:focus + i {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.venda-add-item {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 18px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.venda-qtd {
  width: 120px;
}
.venda-resumo {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 24px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.venda-resumo > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}
.venda-resumo strong {
  color: var(--navy);
  font-size: 16px;
}
.venda-resumo .venda-total strong {
  color: var(--green);
  font-size: 22px;
}
.venda-panel .table-wrap input {
  padding: 6px 8px;
  font-size: 13px;
}
@media (max-width: 720px) {
  .venda-add-item,
  .venda-resumo {
    align-items: stretch;
    flex-direction: column;
  }
  .venda-qtd {
    width: auto;
  }
}

.os-diagnostico-text {
  padding: 0 22px 20px;
  color: var(--ink-secondary);
  white-space: normal;
  line-height: 1.7;
}

.os-print-sheet,
.venda-print-sheet,
.commission-print-sheet {
  display: none !important;
}

/* Módulo de comissões e acertos */
.acertos-filter-panel { margin-bottom: 20px; }
.acertos-filter-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 22px;
}
.acertos-filter-form label { min-width: 150px; flex: 1; }
.acertos-filter-form button { height: 42px; }
.acertos-presets { display: flex; gap: 6px; align-items: center; }
.commission-identity {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--navy);
  border-radius: var(--radius);
  color: #fff;
  box-shadow: var(--shadow);
}
.commission-identity div { display: flex; flex-direction: column; gap: 3px; }
.commission-identity span { color: #bfdbfe; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.commission-identity strong { color: #fff; font-size: 15px; }
.commission-identity small { color: #cbd5e1; }
.commission-summary-grid { margin-bottom: 20px; }
.commission-details-panel, .commission-history-panel { margin-bottom: 20px; }
.commission-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.acertos-empty { margin-top: 20px; padding: 32px; }
@media (max-width: 900px) {
  .commission-identity { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .acertos-filter-form { align-items: stretch; flex-direction: column; }
  .acertos-filter-form label { min-width: 0; }
  .acertos-presets { justify-content: stretch; }
  .acertos-presets .btn { flex: 1; }
  .commission-identity { grid-template-columns: 1fr; }
  .commission-action-bar { align-items: stretch; flex-direction: column; }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  html, body {
    background: #fff !important;
    color: #111827 !important;
  }

  body * {
    visibility: hidden !important;
  }

  /* Retira o layout da aplicação do fluxo de impressão. Visibility:hidden
     não basta: elementos invisíveis continuam ocupando páginas. */
  body > .sidebar-overlay,
  .app-shell > .sidebar,
  .app-shell > .main-content > .topbar,
  .page-content > *:not(.os-print-sheet):not(.venda-print-sheet):not(.commission-print-sheet) {
    display: none !important;
  }

  .app-shell,
  .app-shell > .main-content,
  .page-content {
    display: block !important;
    width: auto !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .os-print-sheet,
  .os-print-sheet *,
  .venda-print-sheet,
  .venda-print-sheet *,
  .commission-print-sheet,
  .commission-print-sheet * {
    visibility: visible !important;
  }

  .os-print-sheet,
  .venda-print-sheet,
  .commission-print-sheet {
    display: block !important;
    position: static !important;
    inset: auto !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font: 10pt/1.4 Arial, sans-serif;
    color: #111827;
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .os-print-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #0f2b3f;
  }

  .os-print-header h1 {
    margin: 0 0 4px;
    color: #0f2b3f;
    font-size: 19pt;
  }

  .os-print-header p {
    margin: 2px 0;
    color: #475569;
    font-size: 8.5pt;
  }

  .os-print-title {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    color: #0f2b3f;
    text-align: right;
  }

  .os-print-title strong {
    font-size: 11pt;
    letter-spacing: .5px;
  }

  .os-print-title span {
    font-size: 16pt;
    font-weight: 800;
  }

  .os-print-title small {
    color: #64748b;
  }

  .os-paid-stamp {
    display: flex;
    flex: 0 0 112px;
    width: 112px;
    height: 112px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1px;
    align-self: center;
    margin: 0 8px 0 4px;
    border: 3px solid #15803d;
    border-radius: 50%;
    outline: 1px dashed #15803d;
    outline-offset: -8px;
    color: #15803d;
    transform: rotate(-12deg);
    opacity: .9;
    position: relative;
  }

  .os-paid-stamp::before,
  .os-paid-stamp::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-top: 1px solid #15803d;
    border-bottom: 1px solid #15803d;
    border-radius: 50%;
  }

  .os-paid-stamp::after {
    inset: -7px;
    border: 0;
    border-top: 2px solid #15803d;
    border-bottom: 2px solid #15803d;
    transform: rotate(45deg);
  }

  .os-paid-stamp strong {
    font-size: 20pt;
    line-height: 1;
    letter-spacing: 1.5px;
    font-family: Georgia, 'Times New Roman', serif;
  }

  .os-paid-stamp span {
    font-size: 6.5pt;
    font-weight: 800;
    letter-spacing: 1.2px;
  }

  .os-paid-stamp .os-paid-stamp-stars {
    font-size: 8pt;
    letter-spacing: 5px;
    line-height: 1;
  }

  .os-print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px 16px;
    padding: 14px 0;
    border-bottom: 1px solid #cbd5e1;
  }

  .os-print-grid div {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .os-print-grid b {
    color: #64748b;
    font-size: 8pt;
    text-transform: uppercase;
  }

  .os-print-section {
    margin-top: 16px;
  }

  .os-print-section h2 {
    margin: 0 0 7px;
    padding-bottom: 4px;
    border-bottom: 1px solid #cbd5e1;
    color: #0f2b3f;
    font-size: 11pt;
  }

  .os-print-description {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    white-space: normal;
  }

  .os-print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
  }

  .os-print-table th,
  .os-print-table td {
    padding: 6px 7px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
  }

  .os-print-table th {
    background: #f1f5f9 !important;
    color: #334155;
    font-size: 7.5pt;
    text-transform: uppercase;
  }

  .os-print-table th:nth-last-child(-n+2),
  .os-print-table td:nth-last-child(-n+2) {
    text-align: right;
  }

  .os-print-muted {
    color: #64748b;
    font-style: italic;
  }

  .os-print-totals {
    display: flex;
    justify-content: flex-end;
    gap: 24px;
    margin-top: 14px;
    padding-top: 9px;
    border-top: 1px solid #94a3b8;
  }

  .os-print-totals div {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .os-print-totals span {
    color: #64748b;
    font-size: 8pt;
  }

  .os-print-total b {
    color: #0f2b3f;
    font-size: 13pt;
  }

  .os-print-signatures {
    display: flex;
    justify-content: space-between;
    gap: 70px;
    margin-top: 58px;
  }

  .os-print-signatures div {
    width: 42%;
    padding-top: 7px;
    border-top: 1px solid #334155;
    color: #475569;
    font-size: 8.5pt;
    text-align: center;
  }
}


/* ========================================================================== */
/* CAMADA VISUAL VIVA — POLIMENTO, PROFUNDIDADE E MICROINTERAÇÕES             */
/* ========================================================================== */
:root {
  --bg: #f4f7fb;
  --bg-card: rgba(255, 255, 255, 0.92);
  --line: #e5eaf1;
  --line-strong: #d2dbe7;
  --navy: #102f46;
  --navy-light: #1d5977;
  --accent: #f47b20;
  --blue: #087db7;
  --shadow-sm: 0 2px 8px rgba(16, 47, 70, .055);
  --shadow: 0 10px 28px rgba(16, 47, 70, .08), 0 2px 8px rgba(16, 47, 70, .035);
  --shadow-lg: 0 22px 55px rgba(16, 47, 70, .13), 0 6px 18px rgba(16, 47, 70, .06);
  --radius-sm: 8px;
  --radius: 13px;
  --radius-lg: 18px;
  --ease-smooth: cubic-bezier(.22, 1, .36, 1);
}

html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(circle at 76% -10%, rgba(8, 125, 183, .075), transparent 29rem),
    radial-gradient(circle at 5% 35%, rgba(244, 123, 32, .045), transparent 24rem),
    var(--bg);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background-image: linear-gradient(rgba(16,47,70,.022) 1px, transparent 1px), linear-gradient(90deg, rgba(16,47,70,.022) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  z-index: -1;
}

.sidebar {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(18px);
  border-right-color: rgba(210,219,231,.8);
  box-shadow: 8px 0 30px rgba(16,47,70,.035);
}
.brand { padding-bottom: 26px; }
.brand-mark {
  background: linear-gradient(135deg, #102f46, #0a82b9 72%, #36b7d4);
  box-shadow: 0 8px 20px rgba(8,125,183,.25);
  animation: brandFloat 5s ease-in-out infinite;
}
@keyframes brandFloat { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-2px) rotate(2deg); } }

.nav-item {
  border: 1px solid transparent;
  transition: color .22s var(--ease-smooth), background .22s var(--ease-smooth), transform .22s var(--ease-smooth), border-color .22s var(--ease-smooth);
}
.nav-item:hover { transform: translateX(3px); border-color: rgba(8,125,183,.10); background: rgba(224,242,254,.6); }
.nav-item.active {
  background: linear-gradient(100deg, rgba(224,242,254,.95), rgba(239,248,252,.55));
  border-color: rgba(8,125,183,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 4px 12px rgba(8,125,183,.06);
}
.nav-item.active::before { box-shadow: 0 0 12px rgba(8,125,183,.48); }
.nav-item i { transition: transform .22s var(--ease-smooth), color .22s var(--ease-smooth); }
.nav-item:hover i, .nav-item.active i { transform: scale(1.12); }

.main-content { min-width: 0; }
.topbar {
  background: rgba(255,255,255,.76);
  backdrop-filter: blur(16px);
  border-bottom-color: rgba(210,219,231,.72);
  box-shadow: 0 3px 18px rgba(16,47,70,.035);
}
.page-content { animation: pageIn .55s var(--ease-smooth) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-heading h1 { letter-spacing: -.045em; }
.eyebrow { color: var(--blue); letter-spacing: .13em; }

.panel, .metric-card, .catalog-card, .callout, .alert-banner, .guide-banner {
  border-color: rgba(210,219,231,.8);
  box-shadow: var(--shadow-sm);
  transition: border-color .25s var(--ease-smooth), box-shadow .25s var(--ease-smooth), transform .25s var(--ease-smooth);
}
.panel:hover, .metric-card:hover, .catalog-card:hover { border-color: rgba(8,125,183,.24); box-shadow: var(--shadow); }
.panel-head { border-bottom-color: rgba(229,234,241,.85); }

.metric-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(248,251,253,.87));
}
.metric-card::after {
  content: '';
  position: absolute;
  width: 110px;
  height: 110px;
  right: -38px;
  top: -45px;
  border-radius: 50%;
  background: rgba(8,125,183,.05);
  transition: transform .45s var(--ease-smooth);
}
.metric-card:hover::after { transform: scale(1.45); }
.metric-icon { transition: transform .3s var(--ease-smooth), box-shadow .3s var(--ease-smooth); }
.metric-card:hover .metric-icon { transform: rotate(-6deg) scale(1.08); box-shadow: 0 8px 18px rgba(8,125,183,.14); }

.btn {
  border-radius: 10px;
  transition: transform .2s var(--ease-smooth), box-shadow .2s var(--ease-smooth), background .2s var(--ease-smooth), border-color .2s var(--ease-smooth);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, #f47b20, #e85c16);
  box-shadow: 0 7px 16px rgba(244,123,32,.2);
}
.btn-primary:hover { box-shadow: 0 11px 22px rgba(244,123,32,.27); }
.btn-outline:hover, .btn-ghost:hover { box-shadow: 0 7px 16px rgba(8,125,183,.1); }

.search, input, select, textarea {
  transition: border-color .2s var(--ease-smooth), box-shadow .2s var(--ease-smooth), background .2s var(--ease-smooth), transform .2s var(--ease-smooth);
}
.search:focus-within, input:focus, select:focus, textarea:focus {
  border-color: rgba(8,125,183,.72) !important;
  box-shadow: 0 0 0 4px rgba(8,125,183,.11), 0 4px 12px rgba(16,47,70,.05) !important;
  outline: none;
}
.search:focus-within { background: #fff; }

.table-wrap { border-radius: var(--radius); box-shadow: 0 3px 14px rgba(16,47,70,.045); }
table tbody tr { transition: background .18s ease, transform .18s var(--ease-smooth), box-shadow .18s ease; }
table tbody tr:hover { background: rgba(224,242,254,.34) !important; box-shadow: inset 3px 0 0 var(--blue); }
table tbody tr:hover td:first-child { padding-left: 17px; }
table td, table th { transition: padding .18s var(--ease-smooth); }

.quick-grid a { border-radius: 13px; background: linear-gradient(145deg, #fff, #f9fbfd); }
.quick-grid a:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 14px 28px rgba(16,47,70,.1); }
.quick-icon { transition: transform .3s var(--ease-smooth), box-shadow .3s var(--ease-smooth); }
.quick-grid a:hover .quick-icon { transform: rotate(-7deg) scale(1.1); box-shadow: 0 8px 16px rgba(16,47,70,.1); }

.stock-alert-item, .mini-item, .guide-step-card, .comment-card { transition: transform .22s var(--ease-smooth), box-shadow .22s ease, border-color .22s ease; }
.stock-alert-item:hover, .mini-item:hover { transform: translateX(4px); box-shadow: 0 8px 18px rgba(16,47,70,.07); }

.modal { background: rgba(8, 25, 40, .53); backdrop-filter: blur(5px); animation: fadeIn .2s ease both; }
.modal-dialog { animation: modalIn .38s var(--ease-smooth) both; box-shadow: 0 28px 80px rgba(8,25,40,.25); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.975); } to { opacity: 1; transform: translateY(0) scale(1); } }

.toast { box-shadow: 0 16px 36px rgba(16,47,70,.18); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.35); }
.badge-nav { animation: badgePulse 2.8s ease-in-out infinite; }
@keyframes badgePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); } 50% { box-shadow: 0 0 0 4px rgba(220,38,38,.08); } }

/* Entrada progressiva ativada pelo JavaScript */
.js .reveal-on-scroll { opacity: 0; transform: translateY(14px); }
.js .reveal-on-scroll.is-visible { opacity: 1; transform: translateY(0); transition: opacity .55s ease, transform .55s var(--ease-smooth); }
.js .stagger-item { opacity: 0; transform: translateY(8px); animation: staggerIn .48s var(--ease-smooth) forwards; animation-delay: var(--stagger-delay, 0ms); }
@keyframes staggerIn { to { opacity: 1; transform: translateY(0); } }

.ripple-effect { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.42); transform: scale(0); animation: ripple .6s ease-out; }
@keyframes ripple { to { transform: scale(3.2); opacity: 0; } }

@media (max-width: 768px) {
  .page-heading { gap: 16px; }
  .page-heading h1 { font-size: clamp(24px, 7vw, 34px); }
  .panel, .metric-card { border-radius: 14px; }
  .topbar { padding-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}


/* Correção de viewport para modais extensos, como Entrada / Fabricação de Estoque */
.modal {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(12px, 3.5vh, 32px) 20px;
}
.modal-dialog {
  min-height: 0;
  max-height: min(90vh, 760px);
  max-height: min(90dvh, 760px);
  margin: auto;
}
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.modal-body.form-grid {
  min-height: 0;
  align-content: start;
}
#modal-form-estoque .modal-dialog {
  max-height: min(90vh, 620px);
  max-height: min(90dvh, 620px);
}
#modal-form-estoque .modal-body {
  padding-bottom: 20px;
}
@media (max-width: 680px) {
  .modal {
    align-items: flex-start;
    padding: 10px;
  }
  .modal-dialog,
  #modal-form-estoque .modal-dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    margin: auto 0;
  }
}


/* Modais sempre flutuantes na viewport, inclusive sobre páginas longas */
.page-content {
  animation: pageFadeIn .45s ease both;
  transform: none !important;
}
@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
}
.modal-dialog {
  position: relative;
  margin: auto;
}


/* Saudação dinâmica da Visão Geral */
.dashboard-welcome {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: min(100%, 650px);
  padding: 18px 24px 18px 18px;
  border: 1px solid rgba(8,125,183,.14);
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 15%, rgba(91,207,219,.22), transparent 10rem),
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(237,248,252,.82));
  box-shadow: 0 12px 30px rgba(16,47,70,.08), inset 0 1px 0 rgba(255,255,255,.9);
}
.dashboard-welcome::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  right: -92px;
  bottom: -112px;
  border: 1px solid rgba(8,125,183,.11);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(8,125,183,.035), 0 0 0 44px rgba(8,125,183,.025);
}
.welcome-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  color: #fff;
  font-size: 27px;
  border-radius: 19px;
  background: linear-gradient(145deg, #0d3852, #087db7 68%, #43c5d3);
  box-shadow: 0 12px 22px rgba(8,125,183,.25), inset 0 1px 0 rgba(255,255,255,.3);
  transform: rotate(-4deg);
  animation: welcomeOrb 5s ease-in-out infinite;
}
.welcome-orb::before,
.welcome-orb::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 50%;
}
.welcome-orb::before { inset: 8px; }
.welcome-orb::after { inset: 15px; border-color: rgba(255,255,255,.2); }
@keyframes welcomeOrb { 0%,100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(3deg) translateY(-3px); } }
.welcome-orb span { position: relative; z-index: 1; text-shadow: 0 2px 10px rgba(255,255,255,.35); }
.welcome-copy { position: relative; z-index: 1; min-width: 0; }
.welcome-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .105em;
  text-transform: uppercase;
}
.welcome-topline time { color: var(--muted); letter-spacing: .02em; text-transform: none; font-weight: 700; }
.welcome-divider { color: rgba(8,125,183,.35); }
.welcome-live-dot,
.welcome-status span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1fbd78;
  box-shadow: 0 0 0 4px rgba(31,189,120,.12);
}
.dashboard-welcome h1 {
  margin: 6px 0 5px;
  font-size: clamp(24px, 3vw, 31px);
  line-height: 1.1;
  letter-spacing: -.055em;
}
.welcome-greeting {
  background: linear-gradient(110deg, #087db7, #13a0ae 70%, #f47b20);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-spark { color: var(--accent); font-size: .68em; vertical-align: top; margin-left: 2px; }
.dashboard-welcome p { margin: 0; color: var(--muted); font-size: 12px; }
.dashboard-welcome p b { color: var(--ink-secondary); }
.welcome-meta { display: flex; align-items: center; gap: 12px; margin-top: 11px; }
.welcome-clock,
.welcome-status { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); font-size: 11px; font-weight: 800; }
.welcome-clock { padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.72); border: 1px solid rgba(8,125,183,.1); }
.welcome-clock > span { color: var(--blue); font-size: 14px; line-height: 1; }
.welcome-status { color: var(--muted); font-weight: 700; }
.welcome-status span { width: 6px; height: 6px; box-shadow: none; }
@media (max-width: 720px) {
  .dashboard-welcome { width: 100%; min-width: 0; padding: 16px; gap: 13px; }
  .welcome-orb { width: 48px; height: 48px; flex-basis: 48px; border-radius: 15px; font-size: 21px; }
  .welcome-topline { flex-wrap: wrap; row-gap: 4px; }
  .dashboard-welcome h1 { font-size: 24px; }
  .dashboard-welcome p { font-size: 11px; }
}


/* ========================================================================== */
/* VISÃO GERAL — COMPOSIÇÃO PRINCIPAL DA TELA INICIAL                        */
/* ========================================================================== */
.page-content > .alert-banner { margin-top: 4px; }
#bloco-servicos,
#bloco-estoque,
#bloco-tetos-clientes,
.page-dashboard > .content-grid {
  position: relative;
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 30px rgba(16,47,70,.065), inset 0 1px 0 rgba(255,255,255,.9);
}
#bloco-servicos,
#bloco-estoque,
#bloco-tetos-clientes {
  overflow: hidden;
}
#bloco-servicos { border-top: 4px solid var(--blue); }
#bloco-estoque { border-top: 4px solid var(--amber); }
#bloco-tetos-clientes { border-top: 4px solid var(--red); }
.page-dashboard > .content-grid { border-top: 4px solid var(--purple); }

#bloco-servicos .panel-head,
#bloco-estoque .panel-head,
#bloco-tetos-clientes .panel-head,
.page-dashboard > .content-grid .panel-head {
  padding: 20px 24px;
  min-height: 82px;
  background: linear-gradient(110deg, rgba(248,251,253,.98), rgba(255,255,255,.72));
}
#bloco-servicos .panel-head h2,
#bloco-estoque .panel-head h2,
#bloco-tetos-clientes .panel-head h2,
.page-dashboard > .content-grid .panel-head h2 {
  font-size: 17px;
  letter-spacing: -.035em;
}
#bloco-servicos .panel-head p,
#bloco-estoque .panel-head p,
#bloco-tetos-clientes .panel-head p,
.page-dashboard > .content-grid .panel-head p { margin-top: 5px; }

/* Operação: toolbar mais clara e tabs com hierarquia visual */
#bloco-servicos .panel-head > div:last-child {
  padding: 7px;
  border: 1px solid rgba(210,219,231,.75);
  border-radius: 14px;
  background: rgba(255,255,255,.74);
  box-shadow: 0 4px 12px rgba(16,47,70,.035);
}
#bloco-servicos .search { height: 36px !important; box-shadow: none; background: #fbfdff; }
#bloco-servicos .tab-pills { gap: 4px; }
#bloco-servicos .tab-pill {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 7px 11px;
  font-size: 11px;
  white-space: nowrap;
}
#bloco-servicos .tab-pill:hover { background: #eef7fb; color: var(--blue); }
#bloco-servicos .tab-pill.active {
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-color: transparent;
  box-shadow: 0 5px 12px rgba(8,125,183,.2);
}
#bloco-servicos .tab-pill.danger-pill:not(.active) { color: var(--red); background: var(--red-light); }
#bloco-servicos .table-wrap,
#bloco-tetos-clientes .table-wrap {
  margin: 16px 20px 20px;
  border: 1px solid rgba(229,234,241,.9);
  background: #fff;
}
#bloco-servicos th,
#bloco-tetos-clientes th {
  color: #6b8190;
  letter-spacing: .08em;
  background: linear-gradient(180deg, #f8fbfd, #f2f7fa);
  padding-top: 13px;
  padding-bottom: 13px;
}
#bloco-servicos td, #bloco-tetos-clientes td { padding-top: 16px; padding-bottom: 16px; }
#bloco-servicos .tab-content > .empty-state,
#bloco-tetos-clientes > .empty-state { margin: 18px 20px 20px; border-radius: 15px; background: linear-gradient(145deg, #fbfdff, #f5f9fb); }

/* Estoque: transformar a lista em cartões de leitura rápida */
#bloco-estoque .stock-alert-list { padding: 12px 20px 14px; }
#bloco-estoque .stock-alert-item {
  margin: 8px 0;
  padding: 14px 16px;
  border: 1px solid #edf1f5;
  border-radius: 14px;
  background: linear-gradient(105deg, #fff, #fbfdfe);
  box-shadow: 0 3px 10px rgba(16,47,70,.035);
}
#bloco-estoque .stock-alert-item:last-child { border-bottom: 1px solid #edf1f5; }
#bloco-estoque .stock-alert-item:hover { border-color: rgba(217,119,6,.25); background: #fffdfa; }
#bloco-estoque .stock-alert-icon { width: 34px; height: 34px; border-radius: 11px; }
#bloco-estoque .stock-current { font-size: 14px; }
#bloco-estoque .stock-alert-status { padding: 5px 9px; border-radius: 999px; background: #fff7ed; }
#bloco-estoque .stock-alert-status.critical { background: var(--red-light); }
#bloco-estoque .stock-alert-footer { margin-top: 2px; padding: 14px 22px; background: linear-gradient(90deg, #fffaf1, #fff); }
#bloco-estoque .stock-alert-summary { border: 1px solid rgba(217,119,6,.12); border-radius: 999px; padding-inline: 14px; }

/* Tetos: alerta importante com aparência de painel de atenção */
#bloco-tetos-clientes .stock-alert-summary { border-radius: 999px; border: 1px solid rgba(220,38,38,.12); padding-inline: 14px; }
#bloco-tetos-clientes .table-wrap { box-shadow: 0 4px 14px rgba(220,38,38,.045); }
#bloco-tetos-clientes tbody tr { background: linear-gradient(90deg, #fff7f7, #fff); }
#bloco-tetos-clientes tbody tr:hover { background: #fff0f0 !important; }
#bloco-tetos-clientes td:first-child { border-left: 4px solid #ef4444; }
#bloco-tetos-clientes .pill.danger { box-shadow: 0 3px 8px rgba(220,38,38,.1); }

/* Acesso rápido: bloco de ações com acabamento próprio */
.page-dashboard > .content-grid { padding: 0; overflow: hidden; }
.page-dashboard > .content-grid > .panel { border: 0; box-shadow: none; background: transparent; }
.page-dashboard > .content-grid .quick-grid { padding: 18px 24px 24px; gap: 14px; }
.page-dashboard > .content-grid .quick-grid a {
  min-height: 68px;
  border-color: #e7edf2;
  background: linear-gradient(135deg, #fff, #f8fbfd);
}
.page-dashboard > .content-grid .quick-grid a::after {
  content: '›';
  margin-left: auto;
  color: #b4c2cc;
  font-size: 22px;
  font-weight: 400;
  transition: transform .25s var(--ease-smooth), color .25s ease;
}
.page-dashboard > .content-grid .quick-grid a:hover::after { color: var(--blue); transform: translateX(4px); }

/* Alerta operacional mais integrado ao cabeçalho */
.page-content > .alert-banner.danger {
  border: 1px solid rgba(220,38,38,.16);
  border-left: 4px solid var(--red);
  background: linear-gradient(100deg, #fff6f6, #fffafa);
  box-shadow: 0 8px 20px rgba(220,38,38,.06);
}

@media (max-width: 900px) {
  #bloco-servicos .panel-head > div:last-child { width: 100%; }
  #bloco-servicos .panel-head > div:last-child .search { max-width: none !important; width: 100%; }
  #bloco-servicos .tab-pills { justify-content: space-between; }
  #bloco-servicos .tab-pill { flex: 1; }
}
@media (max-width: 680px) {
  #bloco-servicos .panel-head,
  #bloco-estoque .panel-head,
  #bloco-tetos-clientes .panel-head,
  .page-dashboard > .content-grid .panel-head { padding: 17px 16px; }
  #bloco-servicos .table-wrap, #bloco-tetos-clientes .table-wrap { margin-inline: 12px; }
  #bloco-estoque .stock-alert-list { padding-inline: 12px; }
  #bloco-estoque .stock-alert-item { grid-template-columns: 1fr auto; }
  #bloco-estoque .stock-alert-status { grid-column: 1 / -1; justify-self: start; }
  .page-dashboard > .content-grid .quick-grid { padding: 14px 16px 18px; }
}


/* Integração Ticketz — configurações de mensagens */
.ticketz-config-panel {
  margin-top: 20px;
  overflow: hidden;
  border-top: 4px solid #16a085;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.ticketz-config-panel .panel-head {
  padding: 20px 24px;
  background: linear-gradient(110deg, #f2fbf8, #fff);
}
.ticketz-config-panel .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.ticketz-title-icon {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #087f68, #24b68e);
  font-size: 13px;
}
.ticketz-config-body { padding: 22px 24px 24px; }
.ticketz-intro {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid #ccefe5;
  border-radius: 13px;
  background: #f2fcf8;
  color: #145c4e;
}
.ticketz-api-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  color: #087f68;
  background: #d8f6ec;
  font-size: 20px;
}
.ticketz-intro b { display: block; color: #0c5a4b; font-size: 13px; }
.ticketz-intro p { margin-top: 3px; color: #42776c; font-size: 12px; line-height: 1.45; }
.ticketz-form { margin-top: 18px; }
.ticketz-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdfe;
}
.ticketz-setting-row b { display: block; color: var(--navy); font-size: 13px; }
.ticketz-setting-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.ticketz-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.ticketz-fields label { display: flex; flex-direction: column; gap: 6px; }
.ticketz-fields label > span { color: var(--navy); font-size: 12px; font-weight: 800; }
.ticketz-fields label > span b { color: var(--red); }
.ticketz-fields input { width: 100%; }
.ticketz-fields input[readonly] { color: var(--muted); background: #f8fafc; font-size: 11px; }
.ticketz-fields small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.ticketz-remove-token { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; color: var(--red); font-size: 11px; font-weight: 700; }
.ticketz-remove-token input { accent-color: var(--red); }
.ticketz-security-note {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 11px;
  background: #f8fafc;
  color: var(--muted);
}
.ticketz-security-note > span { font-size: 17px; }
.ticketz-security-note b { display: block; color: var(--ink-secondary); font-size: 11px; }
.ticketz-security-note small { display: block; margin-top: 2px; font-size: 10px; line-height: 1.4; }
.ticketz-security-note strong { color: var(--navy); }
.ticketz-form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
@media (max-width: 720px) {
  .ticketz-config-body { padding: 16px; }
  .ticketz-fields { grid-template-columns: 1fr; }
  .ticketz-config-panel .panel-head { padding: 17px 16px; }
}

/* ============================================================== */
/* TEMA ESCURO E ALTERNADOR                                       */
/* ============================================================== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-secondary);
  font: 700 12px 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.theme-toggle:hover { background: var(--line); border-color: var(--line-strong); color: var(--ink); }
.theme-toggle-icon { font-size: 16px; line-height: 1; }

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e5edf5;
  --ink-secondary: #c1cfdd;
  --muted: #93a6b8;
  --muted-light: #71869a;
  --line: #263849;
  --line-strong: #385066;
  --bg: #0d1822;
  --bg-card: #142431;
  --white: #142431;
  --navy: #d9e7f2;
  --navy-light: #78b9dc;
  --navy-dark: #07111a;
  --accent-light: #4b2b14;
  --green-light: #123b2a;
  --blue-light: #123b56;
  --purple-light: #302052;
  --orange-light: #452713;
  --amber-light: #473714;
  --red-light: #481d24;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.18);
  --shadow: 0 4px 16px -2px rgba(0,0,0,.28), 0 2px 6px -1px rgba(0,0,0,.2);
  --shadow-lg: 0 12px 30px -4px rgba(0,0,0,.4), 0 4px 12px -2px rgba(0,0,0,.25);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .sidebar,
[data-theme="dark"] .topbar,
[data-theme="dark"] .panel,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .fin-card,
[data-theme="dark"] .catalog-card,
[data-theme="dark"] .modal-dialog,
[data-theme="dark"] .os-lifecycle-stepper,
[data-theme="dark"] .ticketz-setting-row { background: var(--bg-card); }
[data-theme="dark"] .workspace,
[data-theme="dark"] .btn-help-topbar,
[data-theme="dark"] .btn-mobile-menu,
[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .search,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .ticketz-security-note { background: #101e2a; color: var(--ink); }
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #71869a; }
[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .btn-help-topbar:hover,
[data-theme="dark"] .btn-mobile-menu:hover,
[data-theme="dark"] .theme-toggle:hover { background: #1b3040; }
[data-theme="dark"] .nav-item.active { color: #7ac7f1; }
[data-theme="dark"] .page-heading h1,
[data-theme="dark"] .brand strong,
[data-theme="dark"] .breadcrumb strong,
[data-theme="dark"] .ticketz-setting-row b { color: var(--ink); }
[data-theme="dark"] table th { background: #182c3b; color: var(--ink-secondary); }
[data-theme="dark"] table td { border-color: var(--line); }
[data-theme="dark"] table tr:hover td { background: #172b39; }
[data-theme="dark"] .guide-banner { background: linear-gradient(135deg, #123526 0%, #163b2d 100%); border-color: #245c42; }
[data-theme="dark"] .guide-step-card { background: rgba(20, 45, 36, .86); border-color: #2b6749; color: #b9e8ca; }
[data-theme="dark"] .modal { background: rgba(3, 10, 16, .72); }
[data-theme="dark"] .topbar { box-shadow: 0 1px 3px rgba(0,0,0,.22); }
[data-theme="dark"] .ticketz-intro { background: #102f2b; border-color: #245e55; color: #b4e0d7; }
[data-theme="dark"] .ticketz-security-note { border-color: var(--line); }
[data-theme="dark"] .row-highlight-late td { background: #3a2025; }
[data-theme="dark"] .row-highlight-today td { background: #3b321b; }
[data-theme="dark"] .row-returned td { background: #213041; }

@media (max-width: 768px) {
  .theme-toggle { padding: 7px 9px; min-width: 34px; }
  .theme-toggle-label { display: none; }
  .top-actions { gap: 7px; }
}

/* Correções de contraste para componentes legados e estilos inline. */
[data-theme="dark"] .nav-item.active {
  background: #1d5c7d !important;
  color: #effaff !important;
  box-shadow: inset 0 0 0 1px rgba(137, 211, 244, .24);
}
[data-theme="dark"] .nav-item.active i { color: #d6f3ff !important; }
[data-theme="dark"] .nav-item:hover { color: #f0f8ff !important; }
[data-theme="dark"] .nav-item:hover i { color: #9edcff !important; }
[data-theme="dark"] .nav-label { color: #8faabd !important; }

[data-theme="dark"] .panel-head,
[data-theme="dark"] .stock-alert-item { border-color: #294052; }
[data-theme="dark"] .stock-alert-footer,
[data-theme="dark"] .mini-item,
[data-theme="dark"] .service-type-badge-card,
[data-theme="dark"] .quick-grid a,
[data-theme="dark"] .empty-state-mini,
[data-theme="dark"] .venda-add-item-container {
  background: #172a38 !important;
  border-color: #30485a !important;
}
[data-theme="dark"] .mini-item:hover,
[data-theme="dark"] .service-type-badge-card:hover,
[data-theme="dark"] .quick-grid a:hover { background: #203b4d !important; }
[data-theme="dark"] .panel-head h2,
[data-theme="dark"] .quick-grid b,
[data-theme="dark"] .catalog-card h2,
[data-theme="dark"] .text-link:hover { color: #e9f5fc !important; }
[data-theme="dark"] .panel-head p,
[data-theme="dark"] .metric-top,
[data-theme="dark"] .fin-card small,
[data-theme="dark"] .mini-item small,
[data-theme="dark"] .service-type-badge-card p,
[data-theme="dark"] .quick-grid small { color: #a8bac9 !important; }

[data-theme="dark"] th { background: #1b3040 !important; color: #c8d7e3 !important; }
[data-theme="dark"] td { color: #c4d2dd !important; border-color: #294052 !important; }
[data-theme="dark"] td b { color: #edf6fb !important; }
[data-theme="dark"] td small { color: #9db1c1 !important; }
[data-theme="dark"] tr:hover td { background: #1c3545 !important; }
[data-theme="dark"] .search-count-badge { background: #294052 !important; color: #d8e6ef !important; }

[data-theme="dark"] .pill.success,
[data-theme="dark"] .badge-status-date.success { color: #9ae6b4 !important; background: #164b35 !important; }
[data-theme="dark"] .pill.warning,
[data-theme="dark"] .badge-status-date.yellow { color: #fbd38d !important; background: #4a3918 !important; }
[data-theme="dark"] .pill.info,
[data-theme="dark"] .badge-status-date.blue { color: #9fddfa !important; background: #164766 !important; }
[data-theme="dark"] .pill.purple { color: #d5bcff !important; background: #3b2862 !important; }
[data-theme="dark"] .pill.teal { color: #8de4d9 !important; background: #164b48 !important; }
[data-theme="dark"] .pill.danger,
[data-theme="dark"] .badge-status-date.red { color: #ffb4bb !important; background: #54232b !important; }
[data-theme="dark"] .pill.secondary,
[data-theme="dark"] .badge-status-date.gray { color: #c4d2dd !important; background: #293c4b !important; }

[data-theme="dark"] .callout { background: #473915 !important; border-color: #806523 !important; color: #ffe3a1 !important; }
[data-theme="dark"] .callout.erro { background: #4d2028 !important; border-color: #843844 !important; color: #ffc2c8 !important; }
[data-theme="dark"] .callout.success { background: #154b35 !important; border-color: #277451 !important; color: #a6edbb !important; }
[data-theme="dark"] .callout.info { background: #143e59 !important; border-color: #246689 !important; color: #b1e3ff !important; }

[data-theme="dark"] .fin-card.danger-card { background: #3e2028 !important; border-color: #753642 !important; }
[data-theme="dark"] .fin-card.warning-card { background: #403417 !important; border-color: #766127 !important; }
[data-theme="dark"] .fin-card.info-card { background: #153b54 !important; border-color: #286383 !important; }
[data-theme="dark"] .fin-count { background: rgba(255,255,255,.12) !important; color: #dceaf2; }
[data-theme="dark"] .stock-alert-summary.has-alerts { background: #54232b !important; color: #ffb4bb !important; }
[data-theme="dark"] .stock-alert-summary.is-ok { background: #164b35 !important; color: #9ae6b4 !important; }

/* Alguns módulos ainda possuem estilos inline; estes ajustes preservam o contraste. */
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#fafbfc"],
[data-theme="dark"] [style*="background: #fafbfc"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"] {
  background: #172a38 !important;
}
[data-theme="dark"] [style*="color:#374151"],
[data-theme="dark"] [style*="color: #374151"],
[data-theme="dark"] [style*="color:#475569"],
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color: #64748b"] {
  color: #c4d2dd !important;
}
[data-theme="dark"] [style*="color:var(--navy)"],
[data-theme="dark"] [style*="color: var(--navy)"] { color: #e9f5fc !important; }
[data-theme="dark"] [style*="border-bottom:1px solid #fafbfc"],
[data-theme="dark"] [style*="border-bottom: 1px solid #fafbfc"] { border-bottom-color: #294052 !important; }
[data-theme="dark"] [style*="background:#fff1f2"],
[data-theme="dark"] [style*="background: #fff1f2"] { background: #4d2028 !important; }

[data-theme="dark"] .btn-outline { background: #172a38 !important; color: #dcecf5 !important; border-color: #527087 !important; }
[data-theme="dark"] .btn-outline:hover { background: #234457 !important; color: #fff !important; }
[data-theme="dark"] .btn-ghost { background: #172a38 !important; color: #d3e2eb !important; }
[data-theme="dark"] .btn-ghost:hover { background: #234457 !important; color: #fff !important; }
[data-theme="dark"] .floating-help-btn { color: #fff !important; }

/* Visão geral: o dashboard possui uma composição visual própria. */
[data-theme="dark"] .dashboard-welcome {
  background: radial-gradient(circle at 92% 15%, rgba(47, 156, 187, .22), transparent 10rem),
    linear-gradient(135deg, #172f40, #102431 82%) !important;
  border-color: #2d6078 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(164, 222, 242, .12) !important;
}
[data-theme="dark"] .dashboard-welcome h1 { color: #f0f8fc !important; }
[data-theme="dark"] .dashboard-welcome p { color: #b6c9d5 !important; }
[data-theme="dark"] .dashboard-welcome p b { color: #e6f4fa !important; }
[data-theme="dark"] .welcome-topline { color: #8edcff !important; }
[data-theme="dark"] .welcome-topline time,
[data-theme="dark"] .welcome-status { color: #a9bfcc !important; }
[data-theme="dark"] .welcome-clock { background: rgba(24, 61, 79, .9) !important; border-color: #38758e !important; color: #e1f5fc !important; }

[data-theme="dark"] #bloco-servicos,
[data-theme="dark"] #bloco-estoque,
[data-theme="dark"] #bloco-tetos-clientes,
[data-theme="dark"] .page-dashboard > .content-grid {
  background: #132532 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(160, 211, 230, .08) !important;
}
[data-theme="dark"] #bloco-servicos .panel-head,
[data-theme="dark"] #bloco-estoque .panel-head,
[data-theme="dark"] #bloco-tetos-clientes .panel-head,
[data-theme="dark"] .page-dashboard > .content-grid .panel-head {
  background: linear-gradient(110deg, #1a3444, #142a38) !important;
  border-bottom-color: #2b4556 !important;
}
[data-theme="dark"] #bloco-servicos .panel-head h2,
[data-theme="dark"] #bloco-estoque .panel-head h2,
[data-theme="dark"] #bloco-tetos-clientes .panel-head h2,
[data-theme="dark"] .page-dashboard > .content-grid .panel-head h2 { color: #edf7fb !important; }
[data-theme="dark"] #bloco-servicos .panel-head p,
[data-theme="dark"] #bloco-estoque .panel-head p,
[data-theme="dark"] #bloco-tetos-clientes .panel-head p,
[data-theme="dark"] .page-dashboard > .content-grid .panel-head p { color: #a9bfcc !important; }

[data-theme="dark"] #bloco-servicos .panel-head > div:last-child {
  background: rgba(18, 40, 53, .95) !important;
  border-color: #315165 !important;
}
[data-theme="dark"] #bloco-servicos .search { background: #0f202c !important; border-color: #38566a !important; }
[data-theme="dark"] #bloco-servicos .tab-pill { color: #a9bfcc !important; }
[data-theme="dark"] #bloco-servicos .tab-pill:hover { background: #1f455a !important; color: #bfeaff !important; }
[data-theme="dark"] #bloco-servicos .tab-pill.active { color: #fff !important; background: linear-gradient(135deg, #1d5c7d, #087db7) !important; }
[data-theme="dark"] #bloco-servicos .tab-pill.danger-pill:not(.active) { color: #ffb4bb !important; background: #54232b !important; }

[data-theme="dark"] #bloco-servicos .table-wrap,
[data-theme="dark"] #bloco-tetos-clientes .table-wrap {
  background: #0f202c !important;
  border-color: #2b4556 !important;
}
[data-theme="dark"] #bloco-servicos th,
[data-theme="dark"] #bloco-tetos-clientes th {
  color: #c9dce7 !important;
  background: linear-gradient(180deg, #1e3849, #192f3e) !important;
  border-bottom-color: #385467 !important;
}
[data-theme="dark"] #bloco-servicos td,
[data-theme="dark"] #bloco-tetos-clientes td { color: #d0dfe8 !important; }
[data-theme="dark"] #bloco-servicos .tab-content > .empty-state,
[data-theme="dark"] #bloco-tetos-clientes > .empty-state {
  background: linear-gradient(145deg, #172e3e, #122632) !important;
  border-color: #315165 !important;
  color: #d4e3eb !important;
}
[data-theme="dark"] .empty-state h3 { color: #edf7fb !important; }
[data-theme="dark"] .empty-state p { color: #a9bfcc !important; }

[data-theme="dark"] #bloco-estoque .stock-alert-item {
  background: linear-gradient(105deg, #182f3e, #142a37) !important;
  border-color: #304b5d !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .18) !important;
}
[data-theme="dark"] #bloco-estoque .stock-alert-item:hover { background: #203d4e !important; }
[data-theme="dark"] #bloco-estoque .stock-alert-footer { background: linear-gradient(90deg, #26351f, #182c35) !important; }
[data-theme="dark"] #bloco-estoque .stock-alert-status { background: #4a3918 !important; color: #fbd38d !important; }
[data-theme="dark"] #bloco-estoque .stock-alert-status.critical { background: #54232b !important; color: #ffb4bb !important; }

[data-theme="dark"] .page-dashboard > .content-grid > .panel { background: transparent !important; }
[data-theme="dark"] .page-dashboard > .content-grid .quick-grid a {
  background: linear-gradient(135deg, #1a3444, #142a38) !important;
  border-color: #315165 !important;
  color: #e6f3f8 !important;
}
[data-theme="dark"] .page-dashboard > .content-grid .quick-grid a:hover { background: #21475b !important; }
[data-theme="dark"] .page-dashboard > .content-grid .quick-grid a::after { color: #8fb2c2 !important; }

[data-theme="dark"] .page-content > .alert-banner.danger {
  background: linear-gradient(100deg, #4b222a, #351e29) !important;
  border-color: #82404b !important;
  color: #ffd1d5 !important;
}

/* Revisão global das telas e componentes reutilizados. */
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]) {
  background: #101f2b !important;
  color: #e6f2f7 !important;
  border-color: #3a5668 !important;
}
[data-theme="dark"] select option { background: #142a38; color: #e6f2f7; }
[data-theme="dark"] label { color: #c4d5df; }
[data-theme="dark"] label > span,
[data-theme="dark"] .venda-add-item label,
[data-theme="dark"] .venda-add-item-container label { color: #d4e4eb !important; }

[data-theme="dark"] .venda-add-item-container,
[data-theme="dark"] .venda-add-item,
[data-theme="dark"] .venda-panel,
[data-theme="dark"] .venda-resumo,
[data-theme="dark"] .comment-card,
[data-theme="dark"] .os-diagnostico-panel,
[data-theme="dark"] .financial-balance-strip,
[data-theme="dark"] .haver-box-form,
[data-theme="dark"] .haver-box-head {
  background: #172c3a !important;
  border-color: #355265 !important;
  color: #d5e4eb !important;
}
[data-theme="dark"] .venda-add-item-container > div:first-child label,
[data-theme="dark"] .venda-resumo > div,
[data-theme="dark"] .venda-resumo span,
[data-theme="dark"] .os-diagnostico-text { color: #b8ccd8 !important; }
[data-theme="dark"] .venda-resumo strong,
[data-theme="dark"] .balance-cell strong { color: #edf8fc !important; }
[data-theme="dark"] .venda-resumo .venda-total strong { color: #8fe5b4 !important; }
[data-theme="dark"] #venda-item-preview {
  background: #203b4b !important;
  color: #e4f3f8 !important;
  border: 1px solid #477188;
}
[data-theme="dark"] #venda-item-preview-estoque { background: #29495a !important; color: #dff4fb !important; }

[data-theme="dark"] .os-hero-card,
[data-theme="dark"] .os-lifecycle-stepper,
[data-theme="dark"] .os-diagnostico-panel {
  background: #142a38 !important;
  border-color: #355265 !important;
}
[data-theme="dark"] .os-hero-card h1,
[data-theme="dark"] .os-hero-card h2,
[data-theme="dark"] .os-hero-card h3,
[data-theme="dark"] .os-diagnostico-panel h3 { color: #edf8fc !important; }
[data-theme="dark"] .os-hero-meta small,
[data-theme="dark"] .os-subtitle,
[data-theme="dark"] .os-diagnostico-text { color: #acc2cf !important; }
[data-theme="dark"] .lifecycle-step { color: #9bb1bf !important; }
[data-theme="dark"] .lifecycle-step.current { color: #a9e2fb !important; }
[data-theme="dark"] .lifecycle-step .step-circle { background: #263d4c !important; color: #c5d7e0 !important; border-color: #496375 !important; }
[data-theme="dark"] .lifecycle-step.completed .step-circle { background: #164b35 !important; color: #9ae6b4 !important; border-color: #32805c !important; }

[data-theme="dark"] .service-tag,
[data-theme="dark"] .badge-category {
  background: #203b4b !important;
  color: #d9edf5 !important;
  border-color: #477188 !important;
}
[data-theme="dark"] .badge-time { background: #293f4e !important; color: #d5e6ee !important; border-color: #496374 !important; }
[data-theme="dark"] .badge-time.today { background: #4a3918 !important; color: #fbd38d !important; border-color: #806a2a !important; }
[data-theme="dark"] .badge-time.expired { background: #54232b !important; color: #ffb4bb !important; border-color: #843844 !important; }
[data-theme="dark"] .badge-haver { background: #164b35 !important; color: #a6edbb !important; }
[data-theme="dark"] .muted { color: #9db3c0 !important; }
[data-theme="dark"] .code { color: #e8f5fa !important; }
[data-theme="dark"] .code-danger { color: #ff9ea8 !important; }

[data-theme="dark"] .tab-pill,
[data-theme="dark"] .btn-filter { background: #243b4a !important; color: #cfe0e8 !important; border-color: #3e596a !important; }
[data-theme="dark"] .tab-pill:hover,
[data-theme="dark"] .btn-filter:hover { background: #31566b !important; color: #fff !important; }
[data-theme="dark"] .tab-pill.active,
[data-theme="dark"] .btn-filter.active { background: #1d5c7d !important; color: #fff !important; border-color: #5aa4c8 !important; }
[data-theme="dark"] .btn-filter.warning { color: #fbd38d !important; }
[data-theme="dark"] .btn-filter.danger { color: #ffb4bb !important; }

[data-theme="dark"] .catalog-card,
[data-theme="dark"] .catalog-card.active-card,
[data-theme="dark"] .service-type-badge-card {
  background: linear-gradient(135deg, #1a3444, #142a38) !important;
  border-color: #38586b !important;
  color: #e5f2f7 !important;
}
[data-theme="dark"] .catalog-card h2,
[data-theme="dark"] .service-type-badge-card .st-header,
[data-theme="dark"] .st-header { color: #edf8fc !important; }
[data-theme="dark"] .catalog-card p,
[data-theme="dark"] .service-type-badge-card p { color: #b1c5d0 !important; }
[data-theme="dark"] .catalog-card:hover,
[data-theme="dark"] .service-type-badge-card:hover { background: #21475b !important; }
[data-theme="dark"] .catalog-symbol { filter: saturate(1.15) brightness(1.12); }

[data-theme="dark"] .comment-card { background: #1a3342 !important; border-color: #38586b !important; }
[data-theme="dark"] .comment-card strong { color: #eaf6fa !important; }
[data-theme="dark"] .comment-card p,
[data-theme="dark"] .comment-card div { color: #c3d5de !important; }
[data-theme="dark"] .modal-head { background: #1a3444 !important; border-bottom-color: #355265 !important; }
[data-theme="dark"] .modal-head h3 { color: #edf8fc !important; }
[data-theme="dark"] .modal-body { background: #142a38 !important; color: #d3e3ea !important; }
[data-theme="dark"] .modal-dialog { border: 1px solid #38586b; }
[data-theme="dark"] .btn-close:hover { background: #29495b !important; color: #fff !important; }

[data-theme="dark"] .tag-tipo.servico { background: #164766 !important; color: #a9e2fb !important; }
[data-theme="dark"] .tag-tipo.peca { background: #4a3918 !important; color: #fbd38d !important; }
[data-theme="dark"] .tag-tipo.produto { background: #164b35 !important; color: #a6edbb !important; }
[data-theme="dark"] .tag-tipo.fabricado { background: #3b2862 !important; color: #d5bcff !important; }
[data-theme="dark"] .tag-tipo.material { background: #4a2b17 !important; color: #ffbd91 !important; }

/* Ajustes finais de componentes que usam --navy como fundo no tema claro. */
[data-theme="dark"] .commission-identity {
  background: linear-gradient(135deg, #17384b, #102936) !important;
  color: #edf8fc !important;
  border: 1px solid #37647a;
}
[data-theme="dark"] .commission-identity span { color: #a9e2fb !important; }
[data-theme="dark"] .commission-identity strong { color: #f2fbfe !important; }
[data-theme="dark"] .commission-identity small { color: #bfd2dc !important; }
[data-theme="dark"] .commission-action-bar { background: #172c3a !important; color: #b8ccd8 !important; border-top-color: #355265 !important; }

[data-theme="dark"] .ticketz-config-panel .panel-head {
  background: linear-gradient(110deg, #1a3444, #142a38) !important;
  border-bottom-color: #355265 !important;
}
[data-theme="dark"] .ticketz-config-panel .panel-head h2,
[data-theme="dark"] .ticketz-setting-row b,
[data-theme="dark"] .ticketz-fields label > span { color: #edf8fc !important; }
[data-theme="dark"] .ticketz-title-icon { background: #164766 !important; color: #a9e2fb !important; }
[data-theme="dark"] .ticketz-intro b { color: #c5f1e5 !important; }
[data-theme="dark"] .ticketz-intro p { color: #a9d6cc !important; }
[data-theme="dark"] .ticketz-api-mark { background: #164b48 !important; color: #8de4d9 !important; }
[data-theme="dark"] .ticketz-setting-row { background: #172f3e !important; border-color: #38586b !important; }
[data-theme="dark"] .ticketz-setting-row small,
[data-theme="dark"] .ticketz-fields small { color: #a8bfcb !important; }
[data-theme="dark"] .ticketz-fields input[readonly] { background: #0f202c !important; color: #b8ccd8 !important; }
[data-theme="dark"] .ticketz-security-note { background: #172c3a !important; color: #b8ccd8 !important; }
[data-theme="dark"] .ticketz-security-note b,
[data-theme="dark"] .ticketz-security-note strong { color: #e4f2f7 !important; }

[data-theme="dark"] .os-code-badge {
  background: linear-gradient(135deg, #1d5c7d, #087db7) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .28);
}
[data-theme="dark"] .financial-balance-strip { background: #172c3a !important; }
[data-theme="dark"] .balance-cell small { color: #a9bfcc !important; }
[data-theme="dark"] .balance-cell.highlight-cell {
  background: #203b4b !important;
  border-color: #527087 !important;
}
[data-theme="dark"] .balance-cell.divider-left { border-left-color: #456276 !important; }
[data-theme="dark"] .balance-cell.highlight-cell strong { color: #f1fbfe !important; }

[data-theme="dark"] .commission-history-panel .panel-head,
[data-theme="dark"] #bloco-comentarios .panel-head {
  background: #1a3444 !important;
  border-bottom-color: #355265 !important;
}
[data-theme="dark"] .commission-history-panel .panel-head h2,
[data-theme="dark"] #bloco-comentarios .panel-head h2 { color: #edf8fc !important; }
[data-theme="dark"] .commission-history-panel .panel-head p,
[data-theme="dark"] #bloco-comentarios .panel-head p { color: #a9bfcc !important; }

[data-theme="dark"] .avatar-blue,
[data-theme="dark"] .mini-avatar {
  background: #164766 !important;
  color: #b5e8ff !important;
  border: 1px solid #397b9d;
}
[data-theme="dark"] .avatar-orange { background: #4a2b17 !important; color: #ffc08f !important; }
[data-theme="dark"] .avatar-green { background: #164b35 !important; color: #a6edbb !important; }
[data-theme="dark"] .avatar-purple { background: #3b2862 !important; color: #d5bcff !important; }


/* Configuração de mensagens automáticas */
.messages-config-panel { margin-top: 20px; }
.messages-config-body { padding: 18px 22px 22px; }
.message-template-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.message-template-row:last-of-type { border-bottom: 0; }
.message-template-title { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; }
.message-template-title > div { display:flex; flex-direction:column; gap:3px; }
.message-template-title b { color:var(--ink); font-size:14px; }
.message-template-title small, .message-template-title em { color:var(--muted); font-size:11px; font-style:normal; }
.message-template-title em { color:var(--blue); font-weight:700; }
.message-template-row textarea { display:block; width:100%; min-height:58px; resize:vertical; margin-top:10px; border:1px solid var(--line-strong); border-radius:8px; padding:10px 12px; color:var(--ink); background:var(--bg-card); font:13px 'DM Sans',sans-serif; }
.message-variables { display:block; margin-top:6px; color:var(--muted); font-size:11px; }
.message-variables code { color:var(--blue); font-size:11px; }
.messages-config-actions { display:flex; justify-content:flex-end; padding-top:18px; }
@media (max-width:680px) { .messages-config-body { padding:14px 16px 18px; } .message-template-title { gap:10px; } .messages-config-actions .btn { width:100%; } }
[data-theme="dark"] .message-template-row { border-bottom-color:#355265; }
[data-theme="dark"] .message-template-title b { color:#edf8fc !important; }
[data-theme="dark"] .message-template-title small { color:#aac0cc !important; }
[data-theme="dark"] .message-template-title em { color:#9edcf7 !important; }
[data-theme="dark"] .message-template-row textarea { background:#101f2b !important; color:#e6f2f7 !important; border-color:#3a5668 !important; }
[data-theme="dark"] .message-variables { color:#a8bfcb !important; }
[data-theme="dark"] .message-variables code { color:#9edcf7 !important; }


/* Acabamento visual do card Configuração de mensagens */
.messages-config-panel { overflow:hidden; }
.messages-config-panel > .panel-head { padding:22px 24px; background:linear-gradient(110deg, var(--navy), #164766); }
.messages-config-panel > .panel-head h2 { color:#fff; letter-spacing:-.02em; }
.messages-config-panel > .panel-head p { color:#c8e0eb; }
.messages-config-body { padding:22px 24px 24px; background:var(--bg-card); }
.messages-config-intro { display:flex; align-items:center; gap:13px; margin-bottom:20px; padding:14px 16px; border:1px solid #cfe3ed; border-radius:10px; background:linear-gradient(100deg,#eff8fc,#f7fbfd); }
.messages-config-intro-icon { display:grid; place-items:center; width:38px; height:38px; flex:0 0 38px; border-radius:10px; background:#d8eff9; color:#087db7; font-size:19px; }
.messages-config-intro div { display:flex; flex-direction:column; gap:3px; }
.messages-config-intro b { color:var(--navy); font-size:13px; }
.messages-config-intro small { color:var(--muted); font-size:11px; line-height:1.45; }
.message-template-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.message-template-row { min-width:0; margin:0; padding:17px; border:1px solid #dbe7ed; border-radius:12px; background:#fbfdfe; box-shadow:0 3px 12px rgba(20,55,73,.05); transition:border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.message-template-row:hover { border-color:#9dc9dc; box-shadow:0 8px 20px rgba(20,55,73,.09); transform:translateY(-1px); }
.message-template-title { min-height:54px; align-items:flex-start; gap:12px; }
.message-template-heading { display:flex; align-items:flex-start; gap:10px; min-width:0; }
.message-template-heading > div { min-width:0; }
.message-template-icon { display:grid; place-items:center; width:28px; height:28px; flex:0 0 28px; border-radius:8px; background:#e3f3f9; color:#087db7; font-size:14px; }
.message-template-title b { display:block; color:#17384b; font-size:13px; line-height:1.3; }
.message-template-title small { display:block; margin-top:4px; line-height:1.35; }
.message-template-title em { display:inline-block; margin-top:6px; padding:3px 7px; border-radius:999px; background:#edf7fb; color:#16739b; font-size:10px; }
.message-template-toggle { display:flex; align-items:center; gap:7px; flex:0 0 auto; color:#718794; font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.message-template-toggle .switch { width:42px; height:24px; }
.message-template-toggle .switch i:before { width:18px; height:18px; bottom:3px; }
.message-template-toggle .switch input:checked + i:before { transform:translateX(18px); }
.message-template-row textarea { min-height:104px; margin-top:14px; line-height:1.55; border-color:#cbdde5; background:#fff; box-shadow:inset 0 1px 2px rgba(15,45,60,.04); }
.message-template-row textarea:focus { border-color:#1994c5; box-shadow:0 0 0 3px rgba(25,148,197,.13); }
.message-variables { min-height:30px; line-height:1.45; }
.message-variables code { display:inline; padding:2px 5px; border-radius:4px; background:#edf7fb; }
.messages-config-actions { margin-top:18px; padding-top:18px; border-top:1px solid var(--line); }
[data-theme="dark"] .messages-config-panel > .panel-head { background:linear-gradient(110deg,#17384b,#102936) !important; border-bottom-color:#37647a !important; }
[data-theme="dark"] .messages-config-panel > .panel-head h2 { color:#f4fbfe !important; }
[data-theme="dark"] .messages-config-panel > .panel-head p { color:#b9d2de !important; }
[data-theme="dark"] .messages-config-body { background:#142a38 !important; }
[data-theme="dark"] .messages-config-intro { background:linear-gradient(100deg,#173b4b,#183242) !important; border-color:#3b6375 !important; }
[data-theme="dark"] .messages-config-intro-icon { background:#164766 !important; color:#a9e2fb !important; }
[data-theme="dark"] .messages-config-intro b { color:#edf8fc !important; }
[data-theme="dark"] .messages-config-intro small { color:#b4cbd5 !important; }
[data-theme="dark"] .message-template-row { background:#172f3e !important; border-color:#38586b !important; box-shadow:0 4px 14px rgba(0,0,0,.14); }
[data-theme="dark"] .message-template-row:hover { border-color:#5c8da4 !important; background:#1a3748 !important; }
[data-theme="dark"] .message-template-icon { background:#164766 !important; color:#a9e2fb !important; }
[data-theme="dark"] .message-template-title b { color:#edf8fc !important; }
[data-theme="dark"] .message-template-title small { color:#aac0cc !important; }
[data-theme="dark"] .message-template-title em { background:#203f50 !important; color:#a9e2fb !important; }
[data-theme="dark"] .message-template-toggle { color:#a8bfcb !important; }
[data-theme="dark"] .message-template-row textarea { background:#101f2b !important; color:#e6f2f7 !important; border-color:#3a5668 !important; }
[data-theme="dark"] .message-variables code { background:#203f50 !important; color:#a9e2fb !important; }
[data-theme="dark"] .messages-config-actions { border-top-color:#355265 !important; }
@media (max-width:900px) { .message-template-grid { grid-template-columns:1fr; } }
@media (max-width:560px) { .messages-config-body { padding:16px; } .messages-config-intro { align-items:flex-start; } .message-template-row { padding:14px; } .message-template-title { flex-direction:column; } .message-template-toggle { align-self:flex-end; margin-top:-4px; } .message-template-row textarea { min-height:126px; } }


/* Refinamentos globais de experiência em smartphones */
body.menu-mobile-aberto { overflow: hidden; }

@media (max-width: 768px) {
  html { scroll-padding-top: 76px; }
  body { overflow-x: hidden; }
  .app-shell { min-height: 100vh; min-height: 100dvh; }

  .sidebar {
    width: min(86vw, 340px);
    max-width: calc(100vw - 36px);
    padding: calc(16px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .brand { padding-bottom: 16px; }
  #btn-close-sidebar { display: grid !important; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; }
  .nav-label.secondary { margin-top: 12px; }
  .nav-item { min-height: 48px; height: auto; padding-block: 10px; }

  .topbar {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    gap: 7px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  }
  .topbar-left { min-width: 0; flex: 1 1 100%; gap: 10px; }
  .btn-mobile-menu { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; padding: 0; }
  .breadcrumb { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
  .top-actions {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
    justify-content: space-between;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .top-actions::-webkit-scrollbar { display: none; }
  .theme-toggle { width: 42px; min-width: 42px; min-height: 42px; padding: 0; flex: 0 0 42px; }
  .theme-toggle-label { display: none; }
  .top-actions .btn, .top-actions .btn-help-topbar { min-height: 42px; }
  .top-actions .mini-avatar { width: 36px; height: 36px; flex: 0 0 36px; }

  .page-content { padding: 18px 14px calc(86px + env(safe-area-inset-bottom)); }
  .page-heading { align-items: flex-start; gap: 12px; margin-bottom: 18px; }
  .page-heading h1 { font-size: clamp(21px, 6vw, 28px); line-height: 1.2; }
  .page-heading p { font-size: 13px; line-height: 1.45; }
  .heading-actions { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); gap: 8px; }
  .heading-actions .btn { width: 100%; min-height: 44px; white-space: normal; line-height: 1.25; }
  .panel, .metric-card, .callout, .guide-banner { min-width: 0; }
  .panel-head { gap: 12px; padding: 16px; }
  .panel-head h2 { font-size: 16px; line-height: 1.3; }
  .panel-head p { line-height: 1.45; }

  .form-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; padding: 14px !important; }
  .form-grid > *, .form-grid label { min-width: 0; }
  .form-grid label { line-height: 1.4; }
  .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .form-grid select,
  .form-grid textarea,
  .search input {
    min-height: 44px;
    font-size: 16px !important;
  }
  .form-grid textarea { min-height: 100px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; flex: 0 0 20px; }

  .table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .table-wrap table { min-width: 640px; }
  .table-wrap th, .table-wrap td { padding: 10px 12px; }
  .actions { flex-wrap: wrap; gap: 6px; }
  .actions .btn, .actions button { min-height: 40px; white-space: normal; }

  .modal { padding: calc(8px + env(safe-area-inset-top)) 10px calc(8px + env(safe-area-inset-bottom)); }
  .modal-dialog, #modal-form-estoque .modal-dialog { width: 100%; max-width: 100% !important; max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .modal-head { flex: 0 0 auto; }
  .modal-body { max-height: calc(100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .floating-help-btn { right: 14px !important; bottom: calc(14px + env(safe-area-inset-bottom)) !important; }
  .toast { left: 12px !important; right: 12px !important; width: auto; bottom: calc(14px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .page-content { padding-inline: 10px; }
  .topbar { padding-inline: 10px; }
  .top-actions { gap: 5px; }
  .top-actions .btn-help-topbar { width: 42px; min-width: 42px; padding: 0; justify-content: center; font-size: 0; }
  .top-actions .btn-help-topbar span { font-size: 16px; }
  .top-actions .btn-primary { padding-inline: 10px; font-size: 12px; }
  .table-wrap table { min-width: 600px; }
  .guide-banner { gap: 10px; padding: 13px; }
  .guide-icon { width: 30px; height: 30px; flex: 0 0 30px; font-size: 16px; }
}

@media (hover: none) and (pointer: coarse) {
  .btn:hover, .nav-item:hover, .quick-grid a:hover, .catalog-card:hover,
  .stock-alert-item:hover, .mini-item:hover { transform: none; }
  .btn, .nav-item, .theme-toggle, .btn-help-topbar { touch-action: manipulation; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark { animation: none !important; }
}


@media (max-width: 768px) {
  .btn { min-height: 44px; line-height: 1.2; white-space: normal; }
  .btn-sm { min-height: 42px; }
  .page-content input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
  .page-content select,
  .page-content textarea {
    min-height: 44px;
    font-size: 16px !important;
  }
  .page-content textarea { min-height: 100px; }
  .login-card input:not([type="hidden"]) { min-height: 48px; font-size: 16px !important; }
}

@media (max-width: 480px) {
  html body.login-body {
    min-height: 100vh;
    min-height: 100dvh;
    align-items: flex-start;
    padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
  }
  .login-body .login-card { max-width: 440px; margin-block: auto; padding: 24px 18px; border-radius: 20px; }
}


/* Cards de valores do Financeiro: leitura equilibrada no celular */
@media (max-width: 768px) {
  .page-financeiro .financial-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
  }
  .page-financeiro .financial-summary-grid .metric-card {
    min-width: 0;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 9px;
    padding: 13px 12px;
    border-radius: 14px;
  }
  .page-financeiro .financial-summary-grid .metric-top {
    min-width: 0;
    align-items: flex-start;
    gap: 7px;
    margin-bottom: 0;
    font-size: 11px;
    line-height: 1.35;
  }
  .page-financeiro .financial-summary-grid .metric-top > span {
    min-width: 0;
    flex: 1 1 auto;
  }
  .page-financeiro .financial-summary-grid .metric-icon {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    border-radius: 8px;
    font-size: 14px;
  }
  .page-financeiro .financial-summary-grid .metric-card > strong {
    min-width: 0;
    font-size: clamp(14px, 4.1vw, 18px);
    line-height: 1.15;
    letter-spacing: -.045em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .page-financeiro .financial-summary-grid .metric-card > small.trend {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-top: 0;
    padding: 4px 7px;
    font-size: 10px;
    line-height: 1.35;
    white-space: normal;
  }
}

@media (max-width: 340px) {
  .page-financeiro .financial-summary-grid { grid-template-columns: minmax(0, 1fr); }
  .page-financeiro .financial-summary-grid .metric-card { min-height: 118px; padding: 14px; }
  .page-financeiro .financial-summary-grid .metric-card > strong { font-size: 18px; }
}
