/* ============================================================
   Portal Franqueados — Design System
   Cores: #d81a39 (primária) | #ffcc00 (secundária) | branco
   ============================================================ */

:root {
  --primary:        #014b89;
  --primary-dark:   #013d70;
  --primary-light:  #d0e4f3;
  --secondary:      #ffcc00;
  --secondary-dark: #e6b800;
  --secondary-light:#fff8cc;
  --white:          #ffffff;
  --dark:           #1a1a2e;
  --dark2:          #16213e;
  --text:           #2d2d2d;
  --text-muted:     #6b7280;
  --border:         #e5e7eb;
  --bg:             #f3f4f6;
  --bg-card:        #ffffff;
  --success:        #16a34a;
  --warning:        #d97706;
  --danger:         #dc2626;
  --info:           #2563eb;
  --sidebar-bg:     #ffffff;
  --sidebar-text:   30,30,30;
  --sidebar-w:      260px;
  --header-h:       64px;
  --radius:         10px;
  --radius-lg:      16px;
  --shadow:         0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --transition:     .2s ease;
  --font:           'Inter', system-ui, sans-serif;
}

/* ══════════════════════════════════════════════════════════
   DARK MODE — paleta sofisticada, alto contraste
══════════════════════════════════════════════════════════ */
body.dark {
  /* Sobreescreve variáveis principais */
  --primary:        #3b82f6;        /* azul brilhante (era #014b89 — escuro demais no dark) */
  --primary-dark:   #2563eb;
  --primary-light:  #1e3a5f;
  --secondary:      #fbbf24;
  --secondary-dark: #f59e0b;
  --secondary-light:#3d2f06;

  --text:           #f1f5f9;
  --text-muted:     #a3b1c9;        /* mais brilhante (era #94a3b8) */
  --border:         #2a3349;        /* visível mas suave */
  --bg:             #0a0f1a;        /* mais profundo que #111827 */
  --bg-card:        #161c2c;        /* card distinto do bg */
  --white:          #1c2438;        /* fundos elevados (modal, dropdown, header) */
  --dark:           #f1f5f9;

  --sidebar-bg:     #0d1320;        /* sidebar entre bg e bg-card */
  --sidebar-text:   226,232,240;

  --success:        #22c55e;
  --warning:        #fbbf24;
  --danger:         #ef4444;
  --info:           #3b82f6;

  --shadow:         0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:      0 6px 12px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg:      0 16px 32px rgba(0,0,0,.55), 0 4px 8px rgba(0,0,0,.4);
}
body.dark { background: var(--bg); color: var(--text); }

/* Reset explícito para light mode — evita estados misturados ao alternar tema */
body:not(.dark) {
  background: #f3f4f6 !important;
  color: #2d2d2d;
}
body:not(.dark) #content,
body:not(.dark) .content {
  background: transparent;
  color: inherit;
}
body:not(.dark) .app { background: #f3f4f6; }

/* Links */
body.dark a { color: #60a5fa; }
body.dark a:hover { color: #93c5fd; }

/* Scrollbar */
body.dark ::-webkit-scrollbar-track { background: #0a0f1a; }
body.dark ::-webkit-scrollbar-thumb { background: #2a3349; border-radius: 3px; }
body.dark ::-webkit-scrollbar-thumb:hover { background: #3a4763; }

/* Cards com leve gradiente para profundidade */
body.dark .card {
  background: linear-gradient(180deg, #1a2238 0%, #161c2c 100%);
  border-color: #2a3349;
}
body.dark .stat-card,
body.dark .produto-card {
  background: linear-gradient(180deg, #1a2238 0%, #161c2c 100%);
  border-color: #2a3349;
}

/* Header */
body.dark .header {
  background: rgba(28,36,56,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #2a3349;
}

/* Sidebar — separação clara do bg */
body.dark .sidebar { border-right: 1px solid #1a2238; box-shadow: none; }
body.dark .sidebar-user { border-bottom-color: rgba(255,255,255,.06); }
body.dark .sidebar-header { border-bottom-color: rgba(255,255,255,.06); }

/* Sidebar nav item ativo — azul brilhante puro */
body.dark .sidebar-nav-item.active {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  color: #fff !important;
  box-shadow: inset 3px 0 0 rgba(255,255,255,.4), 0 4px 12px rgba(59,130,246,.25);
}
body.dark .sidebar-nav-item:hover { background: rgba(59,130,246,.10); color: #f1f5f9; }

/* Sidebar collapse btn */
body.dark .sidebar-collapse-btn { background: #1c2438; border-color: #2a3349; color: #a3b1c9; }
body.dark .sidebar-collapse-btn:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* Inputs */
body.dark .form-control,
body.dark .login-form input,
body.dark input[type=text], body.dark input[type=email],
body.dark input[type=password], body.dark input[type=number],
body.dark input[type=date], body.dark input[type=time], body.dark input[type=datetime-local],
body.dark input[type=month], body.dark textarea, body.dark select {
  background: #0f1626;
  color: var(--text);
  border-color: #2a3349;
}
body.dark .form-control:focus,
body.dark input:focus, body.dark textarea:focus, body.dark select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
  background: #131a2c;
}
body.dark .input-prefix { background: #0f1626; border-color: #2a3349; }
body.dark .input-prefix span { background: #1c2438; color: #a3b1c9; border-color: #2a3349; }

/* Tabelas — separação melhor entre linhas */
body.dark table thead tr  { background: #0f1626; }
body.dark table thead th  { color: #a3b1c9; border-color: #2a3349; }
body.dark table tbody tr  { border-top-color: #1f2740; }
body.dark table tbody tr:hover { background: rgba(59,130,246,.06); }
body.dark table td        { color: #e2e8f0; }

/* Stat icons (ícones coloridos nos KPIs) — mais saturados, bordas sutis */
body.dark .stat-icon { border: 1px solid rgba(255,255,255,.05); }
body.dark .stat-icon.green  { background: rgba(34,197,94,.15);  color: #4ade80; box-shadow: 0 0 0 1px rgba(34,197,94,.2)  inset; }
body.dark .stat-icon.blue   { background: rgba(59,130,246,.15); color: #60a5fa; box-shadow: 0 0 0 1px rgba(59,130,246,.2) inset; }
body.dark .stat-icon.yellow { background: rgba(251,191,36,.15); color: #fbbf24; box-shadow: 0 0 0 1px rgba(251,191,36,.2) inset; }
body.dark .stat-icon.purple { background: rgba(139,92,246,.15); color: #a78bfa; box-shadow: 0 0 0 1px rgba(139,92,246,.2) inset; }
body.dark .stat-icon.red    { background: rgba(239,68,68,.15);  color: #f87171; box-shadow: 0 0 0 1px rgba(239,68,68,.2)  inset; }
body.dark .stat-icon.orange { background: rgba(249,115,22,.15); color: #fb923c; box-shadow: 0 0 0 1px rgba(249,115,22,.2) inset; }

/* Stat labels e valores */
body.dark .stat-value { color: #f8fafc; }
body.dark .stat-label { color: #9ca3b5; }

/* Badges — fundos mais escuros, texto vibrante */
body.dark .badge-red     { background: rgba(239,68,68,.15);   color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
body.dark .badge-yellow  { background: rgba(251,191,36,.15);  color: #fcd34d; border: 1px solid rgba(251,191,36,.25); }
body.dark .badge-green   { background: rgba(34,197,94,.15);   color: #86efac; border: 1px solid rgba(34,197,94,.25); }
body.dark .badge-blue    { background: rgba(59,130,246,.15);  color: #93c5fd; border: 1px solid rgba(59,130,246,.25); }
body.dark .badge-purple  { background: rgba(139,92,246,.15);  color: #c4b5fd; border: 1px solid rgba(139,92,246,.25); }
body.dark .badge-gray    { background: rgba(156,163,175,.15); color: #d1d5db; border: 1px solid rgba(156,163,175,.25); }
body.dark .badge-orange  { background: rgba(249,115,22,.15);  color: #fdba74; border: 1px solid rgba(249,115,22,.25); }
body.dark .badge { opacity: 1; }

/* Notificação não lida */
/* notif-item dark overrides estão na seção de Notif panel mais abaixo */

/* Alertas — fundos escuros saturados */
body.dark .alert-warning { background: rgba(251,191,36,.10); border-color: rgba(251,191,36,.3); color: #fcd34d; }
body.dark .alert-danger  { background: rgba(239,68,68,.10);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
body.dark .alert-success { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.3);  color: #86efac; }
body.dark .alert-info    { background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.3); color: #93c5fd; }
body.dark .login-error   { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fca5a5; }

/* Editor de texto */
body.dark .editor-toolbar { background: #0f1626; border-color: #2a3349; }
body.dark .editor-toolbar button:hover { background: #1c2438; }
body.dark .editor-content { background: #0f1626; color: #e2e8f0; border-color: #2a3349; }

/* Botões — ghost no dark fica mais sutil */
body.dark .btn-ghost { background: #1c2438; color: #e2e8f0; border: 1px solid #2a3349; }
body.dark .btn-ghost:hover { background: #232c45; border-color: #3a4763; }
body.dark .btn-icon { color: #a3b1c9; }
body.dark .btn-icon:hover { background: #1c2438; color: #60a5fa; }

/* Botão secundário (amarelo) — ajustar contraste */
body.dark .btn-secondary { background: #fbbf24; color: #1c1917; }
body.dark .btn-secondary:hover { background: #f59e0b; }

/* Card header / footer */
body.dark .card-header { border-bottom-color: #2a3349; background: rgba(15,22,38,.4); }
body.dark .card-footer { border-top-color: #2a3349; background: #0f1626; }

/* Page title */
body.dark .page-title { color: #f8fafc; }
body.dark .page-title span { color: #a3b1c9; }

/* Notif badge contadores */
body.dark .notif-badge { box-shadow: 0 0 0 2px var(--bg); }

/* User dropdown */
body.dark .user-dropdown { background: #1c2438; border-color: #2a3349; box-shadow: var(--shadow-lg); }
body.dark .user-dropdown a { color: #e2e8f0; }
body.dark .user-dropdown a:hover { background: rgba(59,130,246,.10); color: #fff; }
body.dark .user-dropdown hr { border-color: #2a3349; }

/* Modais */
body.dark .modal { background: #1c2438; border: 1px solid #2a3349; }
body.dark .modal-header, body.dark .modal-footer { border-color: #2a3349; }
body.dark .modal-overlay { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }

/* Notif panel */
body.dark .notif-panel { background: #1c2438; border: 1px solid #2a3349; }

/* Rel tabs e period buttons */
body.dark .rel-tab         { background: #1c2438; color: #a3b1c9; border-color: #2a3349; }
body.dark .rel-tab:hover   { border-color: #3b82f6; color: #60a5fa; }
body.dark .rel-tab.active  { background: #3b82f6; color: #fff; border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59,130,246,.3); }
body.dark .rel-period-btn  { background: #1c2438; color: #a3b1c9; border-color: #2a3349; }
body.dark .rel-period-btn:hover { background: rgba(59,130,246,.15); color: #93c5fd; border-color: #3b82f6; }

/* Theme toggle icon */
body.dark #theme-toggle-btn { color: #fbbf24; }
body.dark #theme-toggle-btn:hover { background: rgba(251,191,36,.10); }

/* Text muted */
body.dark .text-muted, body.dark .text-m { color: #a3b1c9; }
body.dark .text-dim { color: #6b7280; }

/* Spinner */
body.dark .spinner { border-color: #2a3349; border-top-color: #3b82f6; }

/* Empty state */
body.dark .empty-state { color: #a3b1c9; }
body.dark .empty-state i { color: #4b5563; opacity: .5; }

/* Status badges de pedidos */
body.dark .pedido-status.pendente    { background: rgba(251,191,36,.15); color: #fcd34d; border: 1px solid rgba(251,191,36,.3); }
body.dark .pedido-status.em_analise  { background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }
body.dark .pedido-status.aprovado    { background: rgba(34,197,94,.15);  color: #86efac; border: 1px solid rgba(34,197,94,.3); }
body.dark .pedido-status.rejeitado   { background: rgba(239,68,68,.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
body.dark .pedido-status.em_producao { background: rgba(139,92,246,.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3); }
body.dark .pedido-status.enviado     { background: rgba(14,165,233,.15); color: #7dd3fc; border: 1px solid rgba(14,165,233,.3); }
body.dark .pedido-status.entregue    { background: rgba(34,197,94,.15);  color: #86efac; border: 1px solid rgba(34,197,94,.3); }
body.dark .pedido-status.cancelado   { background: rgba(156,163,175,.15);color: #d1d5db; border: 1px solid rgba(156,163,175,.3); }
body.dark .pedido-status.rascunho    { background: rgba(156,163,175,.10);color: #9ca3af; border: 1px solid rgba(156,163,175,.2); }

/* Header avatars / breadcrumb */
body.dark .header-breadcrumb { color: #f1f5f9; }
body.dark .header-breadcrumb .sep,
body.dark .header-breadcrumb .bc-sub { color: #a3b1c9; }
body.dark .user-menu-toggle { color: #e2e8f0; }
body.dark .user-menu-toggle:hover { background: rgba(255,255,255,.04); }
body.dark .user-name-sm { color: #e2e8f0; }

/* Loader inicial */
body.dark #page-loader { background: #0a0f1a; }
body.dark #page-loader i { color: #3b82f6; }

/* Aud sidebar (sidebar lateral de auditorias) */
body.dark .aud-sidebar { background: #1c2438; border-color: #2a3349; }
body.dark .gestao-sidebar > div { background: #1c2438 !important; border-color: #2a3349 !important; }

/* Inputs em rel-tab filtros (datas com background customizado) */
body.dark input[type=date],
body.dark input[type=datetime-local] { color-scheme: dark; }

/* Filter bar */
body.dark .filter-bar { background: #161c2c; border-color: #2a3349; }

/* Tabs em geral */
body.dark .tab-content { background: var(--bg-card); }
body.dark .tabs { border-bottom-color: #2a3349; }
body.dark .tab-btn { color: #a3b1c9; }
body.dark .tab-btn:hover { color: #f1f5f9; }
body.dark .tab-btn.active { color: #60a5fa; border-bottom-color: #3b82f6; }

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; overflow-x: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══════════════════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--primary, #2563eb) 55%, transparent) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--primary, #2563eb) 35%, transparent) 0%, transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}
.login-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(15,23,42,.35) 100%);
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  color: var(--white);
  box-shadow: 0 4px 15px rgba(216,26,57,.4);
}
.login-logo-icon:has(img), .login-logo-icon.has-logo {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  width: auto;
  height: auto;
  padding: .5rem;
}
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.login-logo p  { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }
.login-email-badge { background: var(--bg2); border-radius: 999px; padding: .45rem 1rem; margin-bottom: 1.25rem; font-size: .85rem; color: var(--text-m); text-align: center; }
.login-email-text { font-weight: 500; }
.login-first-msg { font-size: .875rem; color: var(--primary); font-weight: 500; margin-bottom: 1rem; text-align: center; }
.btn-link-login { display: block; width: 100%; text-align: center; margin-top: .75rem; font-size: .85rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: .25rem; }
.btn-link-login:hover { color: var(--primary); }
.login-form .form-group { margin-bottom: 1.25rem; }
.login-form label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .375rem; text-transform: uppercase; letter-spacing: .05em; }
.login-form label i { margin-right: .25rem; }
.login-form input {
  width: 100%; padding: .75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: .9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.input-eye { position: relative; }
.input-eye input { padding-right: 2.75rem; }
.btn-eye {
  position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .875rem; padding: .25rem;
  transition: color var(--transition);
}
.btn-eye:hover { color: var(--primary); }
.login-error {
  background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
  padding: .75rem 1rem; border-radius: var(--radius); font-size: .875rem;
  margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
}
.login-footer { text-align: center; color: var(--text-muted); font-size: .75rem; margin-top: 1.5rem; }

/* ══════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
:root { --sidebar-collapsed-w: 68px; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: rgba(var(--sidebar-text), 1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(0,0,0,.06);
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(var(--sidebar-text),.1);
  min-height: var(--header-h);
  overflow: hidden;
}
.sidebar-logo { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; overflow: hidden; }
.sidebar-logo.logo-img { gap: 0; justify-content: center; }

/* Logo image */
.sidebar-logo-full {
  max-height: 40px; max-width: 140px;
  object-fit: contain; display: block;
  flex-shrink: 1; min-width: 0;
}
/* Quando logo-img: ocultar ícone e título no estado expandido */
.sidebar-logo.logo-img .sidebar-logo-icon { display: none; }
.sidebar-logo.logo-img .sidebar-title     { display: none; }
.sidebar-logo-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  transition: transform .2s;
}
.sidebar-logo-icon:hover { transform: scale(1.08); }
.sidebar-title {
  font-weight: 700; font-size: 1rem; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden;
  transition: opacity .2s, width .3s cubic-bezier(.4,0,.2,1);
}
.sidebar-close { display: none; color: rgba(var(--sidebar-text),.6); padding: .25rem; flex-shrink: 0; }
.sidebar-close:hover { color: rgba(var(--sidebar-text),1); }

/* Botão colapso desktop */
.sidebar-collapse-btn {
  position: fixed;
  top: 20px;
  left: calc(var(--sidebar-w) - 14px);
  width: 28px; height: 28px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 101;
  transition: left .3s cubic-bezier(.4,0,.2,1), background .15s, transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  color: var(--text-muted);
  font-size: .65rem;
}
.sidebar-collapse-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.app.sidebar-collapsed .sidebar-collapse-btn { left: calc(var(--sidebar-collapsed-w) - 14px); transform: rotate(180deg); }

.sidebar-user {
  display: flex; align-items: center; gap: .875rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(var(--sidebar-text),.08);
  overflow: hidden;
  min-width: 0;
}
.user-avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .875rem;
  transition: transform .2s;
}
.user-avatar:hover { transform: scale(1.05); }
.user-info { overflow: hidden; min-width: 0; transition: opacity .2s, width .3s cubic-bezier(.4,0,.2,1); white-space: nowrap; }
.user-name { font-weight: 600; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .75rem; color: rgba(var(--sidebar-text),.5); }

.sidebar-nav { flex: 1; padding: .75rem 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-section {
  padding: .5rem 1.25rem .25rem;
  font-size: .65rem; font-weight: 700;
  color: rgba(var(--sidebar-text),.35);
  text-transform: uppercase; letter-spacing: .08em;
  white-space: nowrap;
  transition: opacity .2s;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .625rem 1.25rem;
  color: rgba(var(--sidebar-text),.7);
  font-size: .875rem; font-weight: 500;
  width: 100%;
  border-radius: 0;
  transition: background .15s, color .15s, padding .3s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
  text-align: left;
  position: relative;
  white-space: nowrap;
}
.sidebar-nav-item i { width: 20px; text-align: center; font-size: .95rem; flex-shrink: 0; }
.sidebar-nav-item span { overflow: hidden; transition: opacity .2s, width .3s cubic-bezier(.4,0,.2,1); }
.sidebar-nav-item:hover { background: rgba(var(--sidebar-text),.08); color: rgba(var(--sidebar-text),1); }
.sidebar-nav-item.active {
  background: var(--primary);
  color: var(--white) !important;
  box-shadow: inset 3px 0 0 rgba(255,255,255,.4);
}
.sidebar-nav-item .badge-nav {
  margin-left: auto; flex-shrink: 0;
  background: var(--secondary); color: var(--dark);
  font-size: .65rem; font-weight: 700;
  padding: .15rem .4rem; border-radius: 99px;
  transition: opacity .2s;
}

/* Tooltip quando recolhido */
.app.sidebar-collapsed .sidebar-nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) + 8px);
  top: 50%; transform: translateY(-50%) scale(.9);
  background: #1e293b; color: #fff;
  padding: .3rem .7rem; border-radius: 6px;
  font-size: .78rem; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 200;
}
.app.sidebar-collapsed .sidebar-nav-item:hover::after {
  opacity: 1; transform: translateY(-50%) scale(1);
}

.sidebar-bottom {
  padding: .75rem 0;
  border-top: 1px solid rgba(var(--sidebar-text),.08);
}

/* ── Estado recolhido (desktop) ─────────────────────── */
.app.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
.app.sidebar-collapsed .sidebar-title { opacity: 0; width: 0; }
/* Seções: sem espaço quando colapsado */
.app.sidebar-collapsed .sidebar-section {
  opacity: 0; pointer-events: none;
  height: 0; padding: 0; margin: 0; overflow: hidden;
}
.app.sidebar-collapsed .user-info { opacity: 0; width: 0; overflow: hidden; }
.app.sidebar-collapsed .sidebar-nav-item { padding: .625rem; justify-content: center; gap: 0; }
.app.sidebar-collapsed .sidebar-nav-item span { opacity: 0; width: 0; overflow: hidden; }
.app.sidebar-collapsed .sidebar-nav-item .badge-nav { display: none !important; }
.app.sidebar-collapsed .sidebar-user { justify-content: center; padding: 1rem .75rem; }
.app.sidebar-collapsed .main-wrapper { margin-left: var(--sidebar-collapsed-w); }
/* Colapsado: header some — área limpa sem logo */
.app.sidebar-collapsed .sidebar-header {
  height: 0; min-height: 0;
  padding: 0; overflow: hidden;
  border-bottom: none;
}

/* Main wrapper */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
  transition: margin-left var(--transition);
  min-width: 0;
  overflow-x: hidden;
}

/* Header */
.header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.btn-menu {
  display: none; /* shown on mobile */
  width: 36px; height: 36px;
  border-radius: 8px;
  align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: background var(--transition), color var(--transition);
}
.btn-menu:hover { background: var(--bg); color: var(--text); }
.header-breadcrumb { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9375rem; }
.header-breadcrumb .sep { color: var(--text-muted); }
.header-breadcrumb .bc-sub { color: var(--text-muted); font-weight: 400; }

.header-right { display: flex; align-items: center; gap: .5rem; }
.btn-icon {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1rem;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--primary); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--primary); color: var(--white);
  font-size: .6rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 99px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

/* ── Notif panel — design moderno ──────────────────────── */
.header-notif { position: relative; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + .75rem);
  width: 380px; max-width: calc(100vw - 2rem);
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 16px 48px -4px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.06);
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 200;
  animation: notifSlide .2s cubic-bezier(.4,0,.2,1);
}
@keyframes notifSlide {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
/* Seta apontando para o sino */
.notif-panel::before {
  content: '';
  position: absolute;
  top: -6px; right: 14px;
  width: 12px; height: 12px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}
.notif-panel-header strong {
  font-size: 1rem; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; gap: .5rem;
}
.notif-panel-header strong::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.link-btn {
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary);
  background: none; border: none;
  cursor: pointer;
  padding: .35rem .65rem;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.link-btn:hover {
  background: var(--primary-light);
  text-decoration: none;
}
body.dark .link-btn { color: #60a5fa; }
body.dark .link-btn:hover { background: rgba(59,130,246,.12); color: #93c5fd; }

.notif-list { max-height: 440px; overflow-y: auto; padding: .35rem; }
.notif-list::-webkit-scrollbar { width: 4px; }

.notif-item {
  display: flex; gap: .85rem;
  padding: .85rem;
  border-radius: 10px;
  margin-bottom: .15rem;
  cursor: pointer;
  position: relative;
  transition: background .15s ease, transform .1s ease;
}
.notif-item:hover {
  background: var(--bg);
  transform: translateX(2px);
}
body.dark .notif-item:hover { background: rgba(255,255,255,.04); }

/* Dot de não-lida no canto direito */
.notif-item.unread::after {
  content: '';
  position: absolute;
  top: 50%; right: .85rem;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.notif-item.unread .notif-content strong { font-weight: 700; }

/* Sem fundo rosa esquisito — apenas borda esquerda sutil quando não lida */
body.dark .notif-item.unread { background: rgba(59,130,246,.05); border-left: none; }
.notif-item.unread { background: linear-gradient(90deg, rgba(59,130,246,.05) 0%, transparent 50%); border-left: none; }

.notif-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
  position: relative;
}

/* Ícones com fundo gradiente sutil + cor saturada + borda sutil */
.notif-icon.comunicado { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,.3); }
.notif-icon.pedido     { background: linear-gradient(135deg, #0891b2, #0ea5e9); color: #fff; box-shadow: 0 2px 6px rgba(8,145,178,.3); }
.notif-icon.sistema    { background: linear-gradient(135deg, #6b7280, #9ca3af); color: #fff; }
.notif-icon.sucesso    { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; box-shadow: 0 2px 6px rgba(22,163,74,.3); }
.notif-icon.aviso      { background: linear-gradient(135deg, #d97706, #f59e0b); color: #fff; box-shadow: 0 2px 6px rgba(217,119,6,.3); }
.notif-icon.erro       { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,.3); }
.notif-icon.info       { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; }
.notif-icon.pesquisa   { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; box-shadow: 0 2px 6px rgba(124,58,237,.3); }
.notif-icon.nps        { background: linear-gradient(135deg, #ca8a04, #facc15); color: #fff; box-shadow: 0 2px 6px rgba(202,138,4,.3); }
.notif-icon.suporte    { background: linear-gradient(135deg, #db2777, #ec4899); color: #fff; box-shadow: 0 2px 6px rgba(219,39,119,.3); }
.notif-icon.corretiva  { background: linear-gradient(135deg, #dc2626, #f97316); color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,.3); }

.notif-content {
  flex: 1; min-width: 0;
  padding-right: 1rem; /* deixa espaço para o dot */
}
.notif-content strong {
  font-size: .8625rem;
  font-weight: 600;
  display: block;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: .15rem;
}
.notif-content p {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 .3rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}
.notif-content time {
  font-size: .7rem;
  color: var(--text-muted);
  opacity: .75;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.notif-content time::before {
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}

.notif-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}
.notif-empty i {
  font-size: 2.5rem;
  display: block;
  margin: 0 auto 1rem;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), rgba(59,130,246,.05));
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  opacity: .7;
}
.notif-empty p {
  font-size: .85rem;
  font-weight: 500;
  margin: 0;
}

.notif-panel-footer {
  padding: .65rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
body.dark .notif-panel-footer { background: rgba(15,22,38,.4); }
.notif-panel-footer a {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--primary);
  padding: .5rem 1rem;
  border-radius: 8px;
  display: inline-block;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.notif-panel-footer a:hover {
  background: var(--primary-light);
  text-decoration: none;
}
body.dark .notif-panel-footer a { color: #60a5fa; }
body.dark .notif-panel-footer a:hover { background: rgba(59,130,246,.12); color: #93c5fd; }

/* Sobrescritas dark mode */
body.dark .notif-panel { background: #1c2438; border-color: #2a3349; }
body.dark .notif-panel::before { background: #1c2438; border-color: #2a3349; }
body.dark .notif-panel-header { background: #1c2438; border-bottom-color: #2a3349; }

/* User dropdown */
.header-user { position: relative; }
.user-menu-toggle {
  display: flex; align-items: center; gap: .5rem;
  padding: .375rem .75rem;
  border-radius: 8px;
  transition: background var(--transition);
  color: var(--text);
}
.user-menu-toggle:hover { background: var(--bg); }
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
}
.user-name-sm { font-size: .875rem; font-weight: 500; }
.user-menu-toggle .fa-chevron-down { font-size: .75rem; color: var(--text-muted); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + .5rem);
  min-width: 180px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: fadeDown .15s ease;
}
.user-dropdown a {
  display: flex; align-items: center; gap: .625rem;
  padding: .75rem 1rem;
  font-size: .875rem; color: var(--text);
  transition: background var(--transition);
}
.user-dropdown a:hover { background: var(--bg); text-decoration: none; }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); }

/* Content */
.content { flex: 1; padding: 1.75rem; min-width: 0; }
.content-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 50vh; gap: 1rem; color: var(--text-muted); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }

/* Sidebar overlay (mobile) */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }

/* ══════════════════════════════════════════════════════════
   COMPONENTS
══════════════════════════════════════════════════════════ */

/* Page header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap; gap: 1rem;
}
.page-title { font-size: 1.375rem; font-weight: 700; color: var(--text); }
.page-title span { color: var(--text-muted); font-weight: 400; font-size: 1rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: .9375rem; font-weight: 600; }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 1rem;
  min-width: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-icon.red    { background: var(--primary-light); color: var(--primary); }
.stat-icon.yellow { background: var(--secondary-light); color: #b45309; }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.blue   { background: #dbeafe; color: var(--info); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.stat-card > div:not(.stat-icon) { min-width: 0; }
.stat-change { font-size: .75rem; margin-top: .5rem; display: flex; align-items: center; gap: .25rem; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .625rem 1.25rem;
  border-radius: 8px;
  font-size: .875rem; font-weight: 600;
  transition: all var(--transition);
  cursor: pointer; border: none; outline: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-sm { padding: .4rem .875rem; font-size: .8125rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: .9375rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon-only { padding: .625rem; }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(216,26,57,.3); }

.btn-secondary { background: var(--secondary); color: var(--dark); }
.btn-secondary:hover { background: var(--secondary-dark); transform: translateY(-1px); }

.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }

.btn-ghost { background: var(--bg); color: var(--text); }
.btn-ghost:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #15803d; }

.btn-info { background: var(--info); color: var(--white); }
.btn-info:hover { background: #1d4ed8; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: .375rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.form-group label .req { color: var(--primary); }
.form-control {
  padding: .625rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control:disabled { background: var(--bg); color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: .75rem; color: var(--text-muted); }
.form-error { font-size: .75rem; color: var(--danger); }
.input-prefix { display:flex;align-items:center;border:1.5px solid var(--border);border-radius:8px;overflow:hidden;background:#fff; }
.input-prefix span { padding:.625rem .75rem;background:var(--bg);color:var(--text-muted);font-size:.875rem;border-right:1.5px solid var(--border);white-space:nowrap; }
.input-prefix .form-control { border:none;border-radius:0;box-shadow:none;flex:1; }
.input-prefix:focus-within { border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-light); }
select.form-control { cursor: pointer; }

/* Search bar */
.search-bar {
  display: flex; align-items: center; gap: .75rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .5rem .875rem;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); }
.search-bar i { color: var(--text-muted); }
.search-bar input { border: none; outline: none; background: none; font-size: .9rem; flex: 1; color: var(--text); }
.search-bar input::placeholder { color: #9ca3af; }

/* Filter bar */
.filter-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-bar .search-bar { flex: 1; min-width: 200px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: #fafafa; }
tbody td { padding: .875rem 1rem; font-size: .875rem; vertical-align: middle; }
.table-actions { display: flex; gap: .375rem; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .25rem .625rem;
  border-radius: 99px;
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-red     { background: #fee2e2; color: #dc2626; }
.badge-yellow  { background: #fef9c3; color: #92400e; }
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-purple  { background: #ede9fe; color: #6d28d9; }
.badge-gray    { background: #f3f4f6; color: #4b5563; }
.badge-orange  { background: #ffedd5; color: #c2410c; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: .375rem; justify-content: center; padding: 1rem 0; }
.pagination button {
  width: 34px; height: 34px;
  border-radius: 8px;
  font-size: .8125rem; font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.pagination button:hover { background: var(--bg); color: var(--text); }
.pagination button.active { background: var(--primary); color: var(--white); font-weight: 700; }
.pagination button:disabled { opacity: .4; cursor: default; }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; display: block; margin-bottom: 1rem; opacity: .3; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.empty-state p { font-size: .875rem; }

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 580px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,.2);
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }
.modal-sm { max-width: 420px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1.0625rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .9rem;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .625rem;
  flex-shrink: 0;
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .625rem;
  z-index: 1000; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: #1e293b;
  color: var(--white);
  box-shadow: var(--shadow-lg);
  min-width: 280px; max-width: 380px;
  pointer-events: all;
  animation: toastIn .3s ease;
  transition: opacity .3s ease, transform .3s ease;
}
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error   { border-left: 4px solid var(--danger); }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-info    { border-left: 4px solid var(--info); }
.toast-icon { font-size: 1rem; margin-top: .1rem; }
.toast-icon.success { color: #4ade80; }
.toast-icon.error   { color: #f87171; }
.toast-icon.warning { color: #fbbf24; }
.toast-icon.info    { color: #60a5fa; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: .875rem; margin-bottom: .125rem; }
.toast-msg   { font-size: .8rem; opacity: .85; }
.toast-close { color: rgba(255,255,255,.5); font-size: .75rem; cursor: pointer; margin-top: .15rem; transition: color var(--transition); }
.toast-close:hover { color: var(--white); }
.toast.hiding { opacity: 0; transform: translateX(100%); }

/* ══════════════════════════════════════════════════════════
   COMUNICADOS
══════════════════════════════════════════════════════════ */
.comunicados-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.comunicado-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.comunicado-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.comunicado-card.destaque { border-top: 3px solid var(--primary); }
.comunicado-card.nao-lido { border-left: 3px solid var(--secondary); }
.comunicado-img { height: 160px; overflow: hidden; }
.comunicado-img img { width: 100%; height: 100%; object-fit: cover; }
.comunicado-img-placeholder { height: 160px; background: linear-gradient(135deg, var(--primary-light), var(--secondary-light)); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: var(--primary); opacity: .5; }
.comunicado-body { padding: 1.25rem; }
.comunicado-meta { display: flex; align-items: center; gap: .5rem; margin-bottom: .625rem; flex-wrap: wrap; }
.comunicado-cat { display: inline-block; padding: .2rem .5rem; border-radius: 4px; font-size: .7rem; font-weight: 700; }
.comunicado-prioridade-alta   { background: #fee2e2; color: #dc2626; }
.comunicado-prioridade-media  { background: #fef9c3; color: #92400e; }
.comunicado-prioridade-normal { background: #f3f4f6; color: #4b5563; }
.comunicado-card h3 { font-size: .9375rem; font-weight: 700; line-height: 1.4; margin-bottom: .5rem; }
.comunicado-card p  { font-size: .8125rem; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.comunicado-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; padding-top: .875rem; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-muted); }
.com-card-actions { display: flex; gap: .25rem; margin-left: auto; }
.com-card-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-muted); cursor: pointer; font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.com-card-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.com-card-btn.danger:hover { background: var(--danger, #dc2626); color: #fff; border-color: var(--danger, #dc2626); }
.lido-tag { display: flex; align-items: center; gap: .25rem; color: var(--success); font-size: .75rem; font-weight: 600; }
.nao-lido-tag { display: flex; align-items: center; gap: .25rem; color: var(--text-muted); font-size: .75rem; }

/* Comunicado view */
.comunicado-view { max-width: 800px; }
.comunicado-view-header { margin-bottom: 1.5rem; }
.comunicado-view-img { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; max-height: 400px; }
.comunicado-view-img img { width: 100%; height: 100%; object-fit: cover; }
.comunicado-view-content { font-size: .9375rem; line-height: 1.8; }
.comunicado-view-content h1,.comunicado-view-content h2,.comunicado-view-content h3 { margin: 1.25rem 0 .625rem; }
.comunicado-view-content p { margin-bottom: 1rem; }
.comunicado-view-content ul,.comunicado-view-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.comunicado-view-content li { margin-bottom: .375rem; }

/* Visualizações sidebar */
.views-list { display: flex; flex-direction: column; gap: .5rem; }
.view-item { display: flex; align-items: center; gap: .75rem; padding: .625rem; background: var(--bg); border-radius: 8px; }
.view-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.view-info strong { font-size: .8125rem; display: block; }
.view-info span { font-size: .7rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   PEDIDOS
══════════════════════════════════════════════════════════ */
.pedido-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; padding: .3rem .75rem; border-radius: 99px; }
.pedido-status.pendente    { background: #fef9c3; color: #92400e; }
.pedido-status.em_analise  { background: #dbeafe; color: #1e40af; }
.pedido-status.aprovado    { background: #d1fae5; color: #065f46; }
.pedido-status.rejeitado   { background: #fee2e2; color: #991b1b; }
.pedido-status.em_producao { background: #ede9fe; color: #5b21b6; }
.pedido-status.enviado     { background: #e0f2fe; color: #075985; }
.pedido-status.entregue    { background: #dcfce7; color: #14532d; }
.pedido-status.cancelado   { background: #f3f4f6; color: #4b5563; }
.pedido-status.rascunho    { background: #f8f8f8; color: #9ca3af; }

.pedido-timeline { position: relative; padding-left: 2rem; }
.pedido-timeline::before { content: ''; position: absolute; left: .6875rem; top: .5rem; bottom: .5rem; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-dot { position: absolute; left: -2rem; top: .2rem; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid var(--white); box-shadow: 0 0 0 2px var(--primary); }
.timeline-item:last-child .timeline-dot { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-date { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.timeline-text { font-size: .875rem; font-weight: 600; }
.timeline-obs  { font-size: .8125rem; color: var(--text-muted); }

/* Cart */
.cart-item { display: flex; align-items: center; gap: .875rem; padding: .875rem 0; border-bottom: 1px solid var(--border); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; font-size: .9rem; }
.cart-item-detail { font-size: .75rem; color: var(--text-muted); }
.cart-qty { display: flex; align-items: center; gap: .375rem; }
.qty-btn { width: 28px; height: 28px; border-radius: 6px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; transition: background var(--transition); color: var(--text); }
.qty-btn:hover { background: var(--primary); color: var(--white); }
.qty-input { width: 48px; text-align: center; border: 1.5px solid var(--border); border-radius: 6px; padding: .25rem; font-size: .875rem; }
.cart-price { font-weight: 700; font-size: .9375rem; white-space: nowrap; color: var(--primary); }
.cart-remove { color: var(--text-muted); font-size: .875rem; transition: color var(--transition); }
.cart-remove:hover { color: var(--danger); }

/* ══════════════════════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════════════════════ */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.dashboard-grid > * { min-width: 0; }
.dashboard-grid .full { grid-column: 1 / -1; }
.list-item { display: flex; align-items: center; justify-content: space-between; padding: .875rem 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item-main { display: flex; flex-direction: column; gap: .125rem; }
.list-item-title { font-weight: 600; font-size: .9rem; }
.list-item-sub   { font-size: .75rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   RELATÓRIOS
══════════════════════════════════════════════════════════ */
.chart-bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.chart-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: 99px; transition: width .6s ease; }
.chart-bar-fill.yellow { background: linear-gradient(90deg, var(--secondary), var(--secondary-dark)); }
.chart-bar-fill.green  { background: linear-gradient(90deg, var(--success), #166534); }

/* ══════════════════════════════════════════════════════════
   RICH TEXT / EDITOR
══════════════════════════════════════════════════════════ */
.editor-toolbar {
  display: flex; gap: .25rem; flex-wrap: wrap;
  padding: .5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}
.editor-toolbar button {
  width: 30px; height: 30px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.editor-toolbar button:hover { background: var(--white); color: var(--primary); }
.editor-toolbar button.active { background: var(--primary); color: var(--white); }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: .25rem .1rem; align-self: stretch; }
.editor-content {
  min-height: 200px;
  padding: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 0 0 8px 8px;
  outline: none;
  font-size: .9rem;
  line-height: 1.7;
}
.editor-content:focus { border-color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   DESTINATÁRIOS COMUNICADOS
══════════════════════════════════════════════════════════ */
.dest-tags { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.dest-tag {
  display: inline-flex; align-items: center; gap: .375rem;
  background: var(--primary-light); color: var(--primary);
  padding: .3rem .75rem; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.dest-tag button { width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .6rem; background: none; color: var(--primary); transition: background var(--transition); }
.dest-tag button:hover { background: var(--primary); color: var(--white); }

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab-btn {
  padding: .75rem 1.25rem;
  font-size: .875rem; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════ */
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.fw-bold  { font-weight: 700; }
.fw-600   { font-weight: 600; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: .5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; gap: .75rem; align-items: flex-start; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Produto card */
.produto-card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; transition: transform var(--transition), box-shadow var(--transition); cursor: pointer; }
.produto-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.produto-img { height: 140px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 2.5rem; }
.produto-img img { width: 100%; height: 100%; object-fit: cover; }
.produto-body { padding: 1rem; }
.produto-name { font-weight: 700; font-size: .9375rem; margin-bottom: .25rem; }
.produto-cat  { font-size: .75rem; color: var(--text-muted); margin-bottom: .5rem; }
.produto-price { font-size: 1.125rem; font-weight: 800; color: var(--primary); }
.produto-unit  { font-size: .75rem; color: var(--text-muted); }
.produto-footer { padding: .875rem 1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; }

/* Avatar initials color by type */
.avatar-admin     { background: var(--primary); }
.avatar-consultor { background: var(--info); }
.avatar-franqueado{ background: var(--success); }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes fadeDown  { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform: translateY(0); } }
@keyframes modalIn   { from { opacity:0; transform: scale(.95) translateY(10px); } to { opacity:1; transform: scale(1) translateY(0); } }
@keyframes toastIn   { from { opacity:0; transform: translateX(100%); } to { opacity:1; transform: translateX(0); } }
@keyframes pulse     { 0%,100%{opacity:1} 50%{opacity:.5} }
.loading-skeleton { animation: pulse 1.5s ease infinite; background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; border-radius: 4px; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

/* Large desktop (≥1400px): 4-col stats when many cards present */
@media (min-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Medium-large desktop (1281–1399px): 3-col stats */
@media (max-width: 1399px) and (min-width: 1281px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Medium desktop / laptop (≤1280px): 2-col stats, 2-col dashboard */
@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Compact desktop / large tablet (≤1024px) */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* Mobile / small tablet (≤768px) — sidebar collapses to overlay */
@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay.visible { display: block; }
  .sidebar-collapse-btn { display: none; }
  .app.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  .app.sidebar-collapsed .main-wrapper { margin-left: 0; }
  .main-wrapper { margin-left: 0; overflow-x: hidden; }
  .btn-menu { display: flex; }
  .user-name-sm { display: none; }
  .content { padding: 1rem; min-width: 0; overflow-x: hidden; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .comunicados-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .search-bar,
  .filter-bar select,
  .filter-bar .form-control { width: 100% !important; min-width: 0 !important; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-title { word-break: break-word; overflow-wrap: break-word; min-width: 0; }
  .notif-panel { right: -4rem; width: min(320px, 90vw); }
  .modal { margin: .5rem; width: calc(100vw - 1rem); max-width: calc(100vw - 1rem); }
  .tabs { gap: 0; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab-btn { padding: .625rem .875rem; font-size: .8125rem; white-space: nowrap; }
  .responsive-grid { grid-template-columns: 1fr !important; }
  .hide-mobile { display: none !important; }
  .card-body { padding: 1rem; }
  .card-header { padding: .875rem 1rem; gap: .5rem; }
  .card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
  /* Auditoria detail mobile */
  .aud-info-strip { display: flex; gap: 1rem; flex-wrap: wrap; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: .875rem 1rem; margin-bottom: 1rem; }
  .aud-mobile-only { display: block; margin-top: 1rem; }
  .aud-sidebar { display: none; }

  /* IA de Gestão mobile */
  .gestao-wrap { height: calc(100vh - 80px) !important; min-height: 0; }
  .gestao-sidebar { display: none !important; }
}

/* Auditoria detail — desktop only */
.aud-info-strip { display: none; }
.aud-mobile-only { display: none; }
.aud-sidebar { display: block; min-width: 0; }

/* Small mobile (≤480px) */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .table-wrap table { font-size: .8rem; }
  thead th, tbody td { padding: .5rem .625rem; }
  .modal { max-width: 100%; }
  .toast-container { left: .75rem; right: .75rem; bottom: .75rem; }
  .toast { min-width: auto; width: 100%; }
  .page-title { font-size: 1.2rem; }
  .btn { padding: .5rem .875rem; font-size: .8125rem; }
  .btn-sm { padding: .35rem .65rem; font-size: .75rem; }
}

/* ── Logistics Calendar ──────────────────────────────────────── */
.page-header .tabs { border-bottom: none; margin-bottom: 0; }
.page-header .tab-btn { padding: .375rem .875rem; font-size: .875rem; }

.log-stats-bar {
  display: flex; gap: 1rem; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.5rem; margin-bottom: 1.5rem;
}
.log-stat { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.log-stat-val { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.log-stat-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: .25rem; }

.cal-grid-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; margin-bottom: 4px;
}
.cal-day-name {
  text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted);
  padding: .5rem 0; text-transform: uppercase; letter-spacing: .06em;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-day {
  min-height: 88px; border: 1px solid var(--border); border-radius: 8px;
  padding: .375rem .4rem; cursor: pointer; position: relative;
  transition: border-color .15s, background .15s;
}
.cal-day:hover { border-color: var(--primary); background: var(--bg); }
.cal-day:hover .cal-add-hint { opacity: 1; }
.cal-day-empty { min-height: 88px; background: var(--bg); border-radius: 8px; opacity: .3; }
.cal-day-num {
  font-size: .78rem; font-weight: 700; color: var(--text);
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  margin-bottom: .2rem;
}
.cal-today-num {
  background: var(--primary); color: #fff; border-radius: 50%;
}
.cal-today { background: color-mix(in srgb, var(--primary) 5%, transparent); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.cal-past .cal-day-num { color: var(--muted); }
.cal-past { opacity: .75; }
.cal-entries { display: flex; flex-direction: column; gap: 2px; }
.cal-entry {
  font-size: .62rem; font-weight: 600;
  padding: .15rem .35rem; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.4;
}
.cal-more { font-size: .6rem; color: var(--muted); padding: 0 .35rem; }
.cal-add-hint {
  position: absolute; bottom: .3rem; right: .3rem;
  font-size: .65rem; color: var(--primary); opacity: 0; transition: opacity .15s;
}

/* ── Arquivos ────────────────────────────────────────────────── */
.arq-section-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: .75rem;
}
.arq-bc-link {
  cursor: pointer; color: var(--primary); font-size: .8rem;
  display: inline-flex; align-items: center; gap: .25rem;
  transition: opacity .15s;
}
.arq-bc-link:hover { opacity: .75; }
.arq-bc-sep { color: var(--text-muted); font-size: .8rem; margin: 0 .1rem; }

/* ── Comunicados Blocker ─────────────────────────────────────── */
#com-blocker {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.70);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
#com-blocker-box {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%; max-width: 700px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 72px rgba(0,0,0,.4);
}
#com-blocker-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #1e3a5f, #1e293b);
  display: flex; align-items: center; gap: .875rem;
  flex-shrink: 0;
}
#com-blocker-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(251,191,36,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; color: #fbbf24;
  flex-shrink: 0;
}
#com-blocker-title {
  font-weight: 700; font-size: 1rem; color: #f1f5f9;
}
#com-blocker-sub {
  font-size: .76rem; color: #94a3b8; margin-top: .15rem;
}
#com-blocker-progress {
  margin-left: auto;
  background: rgba(255,255,255,.14);
  color: #f1f5f9;
  font-size: .78rem; font-weight: 600;
  padding: .35rem .9rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
#com-blocker-body {
  flex: 1; overflow-y: auto;
  padding: 1.5rem;
}
#com-blocker-footer {
  padding: .875rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card);
  gap: 1rem;
  flex-shrink: 0;
}
#com-blocker-hint {
  font-size: .78rem; color: var(--text-muted);
  display: flex; align-items: center; gap: .4rem;
}
#com-blocker-btn {
  background: var(--primary); color: #fff;
  border: none; border-radius: 10px;
  padding: .625rem 1.5rem;
  font-size: .875rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: .5rem;
  transition: background .15s, opacity .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
#com-blocker-btn:disabled {
  opacity: .4; cursor: not-allowed;
}
#com-blocker-btn:not(:disabled):hover {
  background: var(--primary-dark, #013d70);
}
@media (max-width: 600px) {
  #com-blocker-box { max-height: 100vh; border-radius: 0; }
  #com-blocker-header { padding: 1rem; }
  #com-blocker-body { padding: 1rem; }
  #com-blocker-footer { padding: .75rem 1rem; }
  #com-blocker-hint { display: none; }
}

/* ── Relatórios ─────────────────────────────────────────── */
.rel-tab {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s, box-shadow .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.rel-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.rel-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(1,75,137,.25);
}

.rel-period-btn {
  padding: .38rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.rel-period-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

/* ══════════════════════════════════════════════════════════
   UX POLISH — skeletons, microinteractions, animations
══════════════════════════════════════════════════════════ */

/* ── Skeletons ─────────────────────────────────────────── */
.skel {
  display: block;
  background: linear-gradient(90deg, var(--border) 0%, rgba(255,255,255,.08) 50%, var(--border) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
body.dark .skel {
  background: linear-gradient(90deg, #1a2238 0%, #232c45 50%, #1a2238 100%);
  background-size: 200% 100%;
}
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-text   { height: 12px; margin: .35rem 0; border-radius: 4px; }
.skel-text.lg { height: 18px; }
.skel-text.sm { height: 9px; }
.skel-circle { border-radius: 50%; }
.skel-card { height: 120px; border-radius: var(--radius-lg); }
.skel-row {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
}
.skel-row:first-child { border-top: none; }
.skel-stack > * + * { margin-top: .35rem; }
.skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* ── Microinteractions ─────────────────────────────────── */

/* Cards: hover lift sutil */
.card, .stat-card, .produto-card {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover, .produto-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
body.dark .card:hover { border-color: rgba(59,130,246,.3); }
body.dark .stat-card:hover { border-color: rgba(59,130,246,.4); }

/* Buttons: scale ao clicar */
.btn { transition: transform .08s ease, background .15s, box-shadow .15s, color .15s, border-color .15s; }
.btn:active:not(:disabled) { transform: scale(.96); }

/* Botões pequenos: lift sutil no hover */
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }

/* Inputs: focus mais notável */
.form-control:focus, input:focus, textarea:focus, select:focus {
  transform: translateY(-1px);
  transition: transform .12s ease, border-color .15s, box-shadow .15s;
}

/* Sidebar items: slide sutil no hover */
.sidebar-nav-item { transition: background .15s, color .15s, padding .3s cubic-bezier(.4,0,.2,1), border-color .15s; }
.sidebar-nav-item:not(.active):hover {
  padding-left: 1.6rem;
}

/* Table rows: highlight ao hover */
table tbody tr { transition: background .12s ease; }

/* Badges com pulse ao aparecer */
.badge-nav, .notif-badge {
  animation: badge-pop .25s ease;
}
@keyframes badge-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Page transitions ──────────────────────────────────── */
.content > * {
  animation: page-fade-in .25s ease;
}
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Empty states melhorados ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.empty-state .empty-illustration {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), rgba(59,130,246,.05));
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .25rem;
  position: relative;
}
.empty-state .empty-illustration::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px dashed var(--border);
  animation: empty-spin 20s linear infinite;
}
.empty-state .empty-illustration i {
  font-size: 2.25rem;
  color: var(--primary);
  opacity: .6;
}
.empty-state h3 {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  margin-bottom: .15rem;
}
.empty-state p {
  font-size: .85rem; color: var(--text-muted);
  max-width: 380px; line-height: 1.5;
}
.empty-state .btn { margin-top: .75rem; }
@keyframes empty-spin {
  to { transform: rotate(360deg); }
}
body.dark .empty-state .empty-illustration {
  background: linear-gradient(135deg, rgba(59,130,246,.18), rgba(59,130,246,.02));
}

/* ── Toast progress bar ────────────────────────────────── */
.toast { position: relative; overflow: hidden; }
.toast-progress {
  position: absolute;
  bottom: 0; left: 0; height: 2px;
  background: currentColor;
  opacity: .25;
  transform-origin: left;
  animation: toast-progress linear forwards;
}
@keyframes toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.toast .toast-icon.success { color: var(--success); }
.toast .toast-icon.error   { color: var(--danger); }
.toast .toast-icon.warning { color: var(--warning); }
.toast .toast-icon.info    { color: var(--info); }
.toast.hiding {
  animation: toast-out .25s ease forwards;
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(120%); }
}
.toast-action {
  background: rgba(255,255,255,.1);
  border: 1px solid currentColor;
  color: inherit;
  padding: .25rem .6rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: .5rem;
  transition: background .15s;
}
.toast-action:hover { background: rgba(255,255,255,.18); }

/* ── Command palette (Ctrl+K) ──────────────────────────── */
#cmd-palette {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: cmd-fade .15s ease;
}
#cmd-palette.open { display: flex; }
@keyframes cmd-fade { from { opacity: 0; } to { opacity: 1; } }

#cmd-box {
  width: 100%; max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cmd-pop .2s cubic-bezier(.4,0,.2,1);
}
@keyframes cmd-pop {
  from { transform: scale(.96) translateY(-10px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

#cmd-input-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
#cmd-input-row i { color: var(--text-muted); font-size: 1rem; }
#cmd-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
#cmd-input::placeholder { color: var(--text-muted); }
.cmd-hint {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .68rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: .15rem .4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
}

#cmd-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: .5rem;
}
.cmd-section-title {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .75rem .75rem .3rem;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: .9rem;
  transition: background .1s;
}
.cmd-item i { width: 18px; text-align: center; color: var(--text-muted); }
.cmd-item:hover, .cmd-item.active {
  background: var(--primary-light);
  color: var(--primary);
}
body.dark .cmd-item.active, body.dark .cmd-item:hover {
  background: rgba(59,130,246,.15);
  color: #93c5fd;
}
.cmd-item.active i, .cmd-item:hover i { color: inherit; }
.cmd-item-sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-left: auto;
}
.cmd-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: .85rem;
}

#cmd-footer {
  display: flex;
  gap: 1rem;
  padding: .55rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: .7rem;
  color: var(--text-muted);
}

/* ── Keyboard shortcut modal ───────────────────────────── */
#kbd-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: none;
  align-items: center; justify-content: center;
  padding: 1rem;
  animation: cmd-fade .15s ease;
}
#kbd-modal.open { display: flex; }
#kbd-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: cmd-pop .2s cubic-bezier(.4,0,.2,1);
}
#kbd-box header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
#kbd-box header h3 { font-size: 1rem; font-weight: 700; }
.kbd-group { padding: .75rem 1.25rem 1rem; }
.kbd-group h4 {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.kbd-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem 0;
  font-size: .875rem;
}
kbd {
  display: inline-block;
  padding: .15rem .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: ui-monospace, monospace;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
}
body.dark kbd { background: #0f1626; border-color: #2a3349; box-shadow: 0 1px 0 #1a2238; }
.kbd-row .kbds { display: inline-flex; gap: .25rem; }

/* ── Onboarding spotlight ──────────────────────────────── */
#ob-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 9998;
  display: none;
  animation: cmd-fade .25s ease;
}
#ob-overlay.open { display: block; }
#ob-card {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  width: 340px;
  z-index: 9999;
  animation: cmd-pop .25s cubic-bezier(.4,0,.2,1);
}
#ob-card .ob-step {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  margin-bottom: .35rem;
}
#ob-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .35rem; }
#ob-card p  { font-size: .85rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 1rem; }
#ob-card .ob-actions {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
}
#ob-card .ob-dots { display: flex; gap: .25rem; }
#ob-card .ob-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border);
}
#ob-card .ob-dots span.active { background: var(--primary); width: 18px; border-radius: 99px; }

/* Spotlight ring around target element */
.ob-spotlight {
  position: relative !important;
  z-index: 9999 !important;
  box-shadow: 0 0 0 4px var(--primary), 0 0 0 9999px rgba(0,0,0,.6) !important;
  border-radius: 8px !important;
  transition: box-shadow .3s ease;
}

/* ── Links em chats (mensagens auto-linkificadas) ──────── */
.msg-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(59,130,246,.4);
  word-break: break-all;
  transition: text-decoration-color .15s, color .15s;
}
.msg-link:hover {
  color: var(--primary-dark);
  text-decoration-color: currentColor;
}
body.dark .msg-link {
  color: #60a5fa;
  text-decoration-color: rgba(96,165,250,.4);
}
body.dark .msg-link:hover {
  color: #93c5fd;
}
/* Quando o balão do chat tem fundo colorido (mensagens do próprio usuário no Suporte),
   o link precisa ser claro */
[style*="background:var(--primary)"] .msg-link,
[style*="background: var(--primary)"] .msg-link {
  color: #fff !important;
  text-decoration-color: rgba(255,255,255,.5);
}
[style*="background:var(--primary)"] .msg-link:hover,
[style*="background: var(--primary)"] .msg-link:hover {
  text-decoration-color: #fff;
}
