/* ═══════════════════════════════════════════════════════════════════════
   ArcFinance — Design System Premium v6.0
   Arcoll Digital · 2026
   ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─────────────────────────────────────────────────────────────────────
   DESIGN TOKENS
   ───────────────────────────────────────────────────────────────────── */
:root {
  /* Cores dinâmicas (sobrescritas via PHP) */
  --primary:        #6366f1;
  --primary-dk:     #4338ca;
  --primary-lt:     #eef2ff;
  --primary-rgb:    99, 102, 241;

  /* Status */
  --success:        #10b981; --success-lt: #d1fae5; --success-dk: #065f46;
  --danger:         #ef4444; --danger-lt:  #fee2e2; --danger-dk:  #991b1b;
  --warning:        #f59e0b; --warning-lt: #fef3c7; --warning-dk: #92400e;
  --info:           #06b6d4; --info-lt:    #e0f2fe; --info-dk:    #075985;

  /* Sidebar */
  --sidebar-w:      260px;
  --sidebar-bg:     #0f172a;
  --sidebar-bg2:    #1e293b;
  --sidebar-txt:    rgba(148,163,184,1);
  --sidebar-hover:  rgba(255,255,255,.06);
  --sidebar-active: rgba(99,102,241,.18);
  --sidebar-border: rgba(255,255,255,.06);

  /* Layout */
  --topbar-h: 62px;

  /* Superfícies */
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --surface-3:    #f1f5f9;
  --border-clr:   #e2e8f0;
  --border-light: #f1f5f9;
  --body-bg:      #f1f5f9;

  /* Texto */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-disabled:  #cbd5e1;

  /* Raios */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 4px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,.09), 0 1px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.16), 0 8px 24px rgba(0,0,0,.08);
  --shadow-primary: 0 4px 18px rgba(99,102,241,.35);

  /* Transições */
  --t-fast: .12s cubic-bezier(.4,0,.2,1);
  --t:      .2s  cubic-bezier(.4,0,.2,1);
  --t-slow: .35s cubic-bezier(.4,0,.2,1);

  /* Tipografia */
  --font-base: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;
}

/* ─────────────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box }
html { scroll-behavior: smooth; height: 100%; -webkit-text-size-adjust: 100% }
body {
  font-family: var(--font-base);
  font-size: .9375rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--body-bg);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; transition: color var(--t-fast) }
a:hover { color: var(--primary-dk) }
img { max-width: 100% }
::selection { background: rgba(99,102,241,.18); color: var(--primary-dk) }

/* ─────────────────────────────────────────────────────────────────────
   SIDEBAR
   ───────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1030;
  overflow: hidden;
  transition: transform var(--t-slow);
  border-right: 1px solid var(--sidebar-border);
}
@media(max-width:991.98px) {
  .sidebar { transform: translateX(-100%) }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl) }
}

/* ── SIDEBAR: topo fixo ─────────────────────────────────────────── */
.sb-top {
  display: flex; align-items: center; gap: .7rem;
  padding: 1rem .9rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  min-height: 64px;
  position: sticky; top: 0; z-index: 10;
}
.sb-brand-link {
  display: flex; align-items: center; gap: .7rem;
  flex: 1; min-width: 0; text-decoration: none;
}
.sb-logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: #fff;
  flex-shrink: 0; box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
.sb-logo-img { max-height: 34px; max-width: 120px; object-fit: contain; flex-shrink: 0; }
.sb-brand-wrap { flex: 1; min-width: 0; }
.sb-brand-name { font-weight: 800; font-size: .92rem; color: #fff; line-height: 1.1; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-brand-desc { font-size: .63rem; color: rgba(148,163,184,.7); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── SIDEBAR: área de scroll (menus) — sem barra de rolagem ────── */
.sb-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: .5rem;
  scrollbar-width: none; /* Firefox */
}
.sb-nav::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.sb-section { font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(100,116,139,.65); padding: 1.1rem .5rem .35rem; }

.sb-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .52rem .75rem;
  color: var(--sidebar-txt);
  border-radius: var(--radius-sm);
  margin: 1px 0;
  font-size: .855rem; font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  position: relative;
}
.sb-link i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0 }
.sb-link:hover { background: var(--sidebar-hover); color: #fff; transform: translateX(2px) }
.sb-link.active { background: var(--sidebar-active); color: #a5b4fc; font-weight: 600 }
.sb-link .sb-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; border-radius: var(--radius-full); padding: .1rem .42rem; line-height: 1.4 }

.sb-group { margin-bottom: 1px }
.sb-group-btn {
  display: flex; align-items: center; gap: .65rem; width: 100%;
  padding: .52rem .75rem; border-radius: var(--radius-sm);
  color: var(--sidebar-txt); background: none; border: none;
  font-size: .855rem; font-weight: 500; cursor: pointer;
  font-family: var(--font-base);
  transition: background var(--t-fast), color var(--t-fast);
}
.sb-group-btn i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0 }
.sb-group-btn .sb-arrow { margin-left: auto; font-size: .7rem; transition: transform var(--t) }
.sb-group-btn:hover { background: var(--sidebar-hover); color: #fff }
.sb-group.open .sb-arrow { transform: rotate(180deg) }
.sb-group.open .sb-group-btn { color: #c7d2fe }

.sb-submenu { overflow: hidden; transition: max-height var(--t-slow) }
.sb-sub-link {
  display: flex; align-items: center; gap: .5rem;
  padding: .42rem .75rem .42rem 2.35rem;
  color: rgba(148,163,184,.75); border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  margin: 1px 0;
}
.sb-sub-link::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .4; flex-shrink: 0; margin-left: -1rem }
.sb-sub-link:hover { background: var(--sidebar-hover); color: #fff }
.sb-sub-link.active { color: #a5b4fc; font-weight: 600 }
.sb-sub-link.active::before { opacity: 1 }

/* ── SIDEBAR: rodapé fixo com 4 ícones ─────────────────────────── */
.sb-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: .6rem .5rem;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-around;
}
.sb-foot-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius);
  color: rgba(148,163,184,.75); text-decoration: none;
  font-size: 1.15rem; transition: all var(--t-fast);
  position: relative;
}
.sb-foot-btn:hover { background: var(--sidebar-hover); color: #fff; }
.sb-foot-btn.active { background: var(--sidebar-active); color: #a5b4fc; }
.sb-foot-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: #fff; border-radius: 50%;
  width: 15px; height: 15px; font-size: .58rem;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Overlay mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 1029;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block }

/* ─────────────────────────────────────────────────────────────────────
   TOPBAR
   ───────────────────────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--t-slow) }
@media(max-width:991.98px) { .main-content { margin-left: 0 } }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-clr);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; gap: 1rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-xs);
}
.sb-toggle { background: none; border: none; font-size: 1.4rem; color: var(--text-secondary); cursor: pointer; padding: .3rem; border-radius: var(--radius-sm); transition: background var(--t-fast) }
.sb-toggle:hover { background: var(--surface-3); color: var(--text-primary) }
.topbar-title { font-size: .9rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.01em }

.topbar-search { max-width: 380px; width: 100% }
.topbar-search .form-control { border-radius: 20px 0 0 20px; border-right: none; font-size: .85rem; background: var(--surface-2) }
.topbar-search .btn-search { border-radius: 0 20px 20px 0; background: var(--primary); color: #fff; border: 1px solid var(--primary); padding: .375rem .75rem }
.topbar-search .btn-search:hover { opacity: .88 }

.cart-btn { position: relative }
.cart-badge { position: absolute; top: -6px; right: -6px; background: var(--primary); color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: .65rem; display: flex; align-items: center; justify-content: center; font-weight: 700 }

/* ─────────────────────────────────────────────────────────────────────
   PAGE CONTENT
   ───────────────────────────────────────────────────────────────────── */
.page-content { flex: 1; padding: 1.75rem 1.5rem }
@media(max-width:575.98px) { .page-content { padding: 1.25rem 1rem } }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
  padding-bottom: 1rem; border-bottom: 1px solid var(--border-clr);
}
.page-title { font-size: 1.15rem; font-weight: 800; color: var(--text-primary); margin: 0; letter-spacing: -.02em }

/* ─────────────────────────────────────────────────────────────────────
   CARDS
   ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border-clr); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: .9rem 1.25rem; background: var(--surface-2);
  border-bottom: 1px solid var(--border-clr);
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: .875rem;
}
.card-body { padding: 1.25rem }
.card-footer { padding: .85rem 1.25rem; background: var(--surface-2); border-top: 1px solid var(--border-clr) }

/* Stat cards */
.stat-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border-clr); box-shadow: var(--shadow);
  padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
  transition: transform var(--t), box-shadow var(--t);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md) }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.stat-value { font-size: 1.55rem; font-weight: 800; color: var(--text-primary); line-height: 1; letter-spacing: -.03em }
.stat-label { font-size: .76rem; color: var(--text-muted); font-weight: 500; margin-bottom: .15rem }
.stat-delta { font-size: .72rem; font-weight: 600 }
.stat-delta.up { color: var(--success) }
.stat-delta.dn { color: var(--danger) }
.stat-card-green { background: linear-gradient(135deg, #16a34a, #15803d) !important; border-color: transparent !important; color: #fff }
.stat-card-red   { background: linear-gradient(135deg, #dc2626, #b91c1c) !important; border-color: transparent !important; color: #fff }
.stat-card-blue  { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; border-color: transparent !important; color: #fff }
.stat-card-green .stat-value, .stat-card-red .stat-value, .stat-card-blue .stat-value,
.stat-card-green .stat-label, .stat-card-red .stat-label, .stat-card-blue .stat-label { color: rgba(255,255,255,.95) !important }

/* ─────────────────────────────────────────────────────────────────────
   TABELAS
   ───────────────────────────────────────────────────────────────────── */
.table { margin: 0; font-size: .875rem }
.table thead th {
  background: var(--surface-2); font-weight: 700; font-size: .76rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  padding: .7rem 1rem; border-bottom: 1px solid var(--border-clr);
  white-space: nowrap;
}
.table tbody td { padding: .8rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--border-light); color: var(--text-secondary) }
.table tbody tr:last-child td { border-bottom: none }
.table-hover tbody tr:hover td { background: var(--surface-2) }
.text-money { font-family: var(--font-mono); font-weight: 700; color: var(--text-primary) }
.fw-500 { font-weight: 500 }
.fw-600 { font-weight: 600 }
.fw-700 { font-weight: 700 }
.fw-800 { font-weight: 800 }

/* ─────────────────────────────────────────────────────────────────────
   BOTÕES
   ───────────────────────────────────────────────────────────────────── */
.btn { border-radius: var(--radius); font-weight: 600; font-size: .855rem; padding: .45rem .95rem; transition: all var(--t-fast); font-family: var(--font-base); display: inline-flex; align-items: center; gap: .35rem }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(var(--primary-rgb),.3) }
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); color: #fff; box-shadow: 0 4px 14px rgba(var(--primary-rgb),.4); transform: translateY(-1px) }
.btn-primary:active { transform: translateY(0) }
.btn-outline-primary { border-color: var(--border-clr); color: var(--primary) }
.btn-outline-primary:hover { background: var(--primary-lt); border-color: var(--primary); color: var(--primary) }
.btn-xs { font-size: .75rem; padding: .25rem .55rem; border-radius: var(--radius-sm) }
.btn-sm { font-size: .82rem; padding: .35rem .75rem }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius) }

/* ─────────────────────────────────────────────────────────────────────
   FORMULÁRIOS
   ───────────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1.5px solid var(--border-clr); border-radius: var(--radius);
  padding: .5rem .85rem; font-size: .875rem; font-family: var(--font-base);
  color: var(--text-primary); background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  line-height: 1.5;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12); outline: none;
}
.form-control::placeholder { color: var(--text-muted) }
.form-control:disabled, .form-select:disabled { background: var(--surface-3); opacity: .7 }
.form-label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem; display: block }
.form-label.required::after { content: ' *'; color: var(--danger) }
.form-text { font-size: .76rem; color: var(--text-muted); margin-top: .25rem }
.form-control-sm, .form-select-sm { padding: .3rem .7rem; font-size: .82rem; border-radius: var(--radius-sm) }
.input-group-text { background: var(--surface-2); border-color: var(--border-clr); color: var(--text-secondary); font-size: .875rem }

/* Switches */
.form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-top: .15em }
.form-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary) }

/* ─────────────────────────────────────────────────────────────────────
   BADGES
   ───────────────────────────────────────────────────────────────────── */
.badge {
  font-size: .72rem; font-weight: 700; padding: .28em .7em;
  border-radius: var(--radius-sm); letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: .25rem;
}
.bg-success-subtle { background: var(--success-lt) !important; color: var(--success-dk) !important }
.bg-danger-subtle  { background: var(--danger-lt)  !important; color: var(--danger-dk)  !important }
.bg-warning-subtle { background: var(--warning-lt) !important; color: var(--warning-dk) !important }
.bg-primary-subtle { background: var(--primary-lt) !important; color: var(--primary-dk) !important }
.bg-info-subtle    { background: var(--info-lt)    !important; color: var(--info-dk)    !important }
.bg-secondary-subtle { background: var(--surface-3) !important; color: var(--text-secondary) !important }

/* ─────────────────────────────────────────────────────────────────────
   ALERTS
   ───────────────────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius); border: none; font-size: .875rem; padding: .85rem 1.1rem; font-weight: 500 }
.alert-success { background: var(--success-lt); color: var(--success-dk); border-left: 4px solid var(--success) }
.alert-danger  { background: var(--danger-lt);  color: var(--danger-dk);  border-left: 4px solid var(--danger) }
.alert-warning { background: var(--warning-lt); color: var(--warning-dk); border-left: 4px solid var(--warning) }
.alert-info    { background: var(--info-lt);    color: var(--info-dk);    border-left: 4px solid var(--info) }
.alert-dismissible .btn-close { padding: .9rem }

/* ─────────────────────────────────────────────────────────────────────
   MODAIS
   ───────────────────────────────────────────────────────────────────── */
.modal-content { border: none; border-radius: var(--radius-xl); box-shadow: var(--shadow-xl) }
.modal-header { border-bottom: 1px solid var(--border-clr); padding: 1.1rem 1.4rem; background: var(--surface-2); border-radius: var(--radius-xl) var(--radius-xl) 0 0 }
.modal-title { font-weight: 700; font-size: .975rem; letter-spacing: -.01em }
.modal-body { padding: 1.4rem }
.modal-footer { border-top: 1px solid var(--border-clr); padding: .85rem 1.4rem; background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); gap: .5rem }
#sidebar { z-index: 1030 !important }
.sidebar-overlay { z-index: 1029 !important }
.modal-backdrop { z-index: 1050 !important }
.modal { z-index: 1055 !important }

/* ─────────────────────────────────────────────────────────────────────
   DROPDOWNS
   ───────────────────────────────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border-clr); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: .35rem; font-size: .875rem;
  animation: dropIn .15s ease both;
}
@keyframes dropIn { from { opacity:0; transform:translateY(-8px) scale(.97) } to { opacity:1; transform:translateY(0) scale(1) } }
.dropdown-item {
  border-radius: var(--radius-sm); padding: .45rem .75rem; font-size: .855rem;
  color: var(--text-secondary); font-weight: 500;
  display: flex; align-items: center; gap: .5rem;
  transition: background var(--t-fast), color var(--t-fast);
}
.dropdown-item:hover { background: var(--primary-lt); color: var(--primary) }
.dropdown-item.text-danger:hover { background: var(--danger-lt); color: var(--danger-dk) }
.dropdown-divider { border-color: var(--border-clr); margin: .3rem 0 }

/* ─────────────────────────────────────────────────────────────────────
   PAGINAÇÃO
   ───────────────────────────────────────────────────────────────────── */
.pagination { gap: .25rem; margin: 0 }
.page-link {
  border-radius: var(--radius-sm) !important; border: 1px solid var(--border-clr);
  color: var(--text-secondary); font-size: .8rem; font-weight: 600;
  padding: .35rem .65rem; transition: all var(--t-fast); min-width: 34px; text-align: center;
}
.page-link:hover { background: var(--primary-lt); border-color: #c7d2fe; color: var(--primary) }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-primary) }
.page-item.disabled .page-link { opacity: .45 }

/* ─────────────────────────────────────────────────────────────────────
   AVATAR
   ───────────────────────────────────────────────────────────────────── */
.avatar { width:40px; height:40px; border-radius:50%; object-fit:cover; background:var(--primary-lt); display:flex; align-items:center; justify-content:center; font-weight:700; color:var(--primary); font-size:.875rem; flex-shrink:0; border:2px solid rgba(99,102,241,.15) }
.avatar-sm { width:30px; height:30px; font-size:.75rem }
.avatar-lg { width:54px; height:54px; font-size:1rem }

/* ─────────────────────────────────────────────────────────────────────
   PERMISSÕES — Grupos de Permissão
   ───────────────────────────────────────────────────────────────────── */
.perm-group-card {
  background: var(--surface); border: 1.5px solid var(--border-clr);
  border-radius: var(--radius-lg); padding: 1.35rem;
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
  display: flex; flex-direction: column;
}
.perm-group-card:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 40%, white); transform: translateY(-2px) }
.perm-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--primary-lt); color: var(--primary-dk);
  border-radius: var(--radius-sm); padding: .22rem .58rem;
  font-size: .7rem; font-weight: 700; margin: .15rem;
}
.perm-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem }
.perm-check-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .48rem .75rem; border: 1.5px solid var(--border-clr);
  border-radius: var(--radius); cursor: pointer;
  transition: all var(--t-fast); font-size: .83rem; font-weight: 500;
  color: var(--text-secondary);
}
.perm-check-item:hover { border-color: var(--primary); background: var(--primary-lt); color: var(--primary) }
.perm-check-item:has(input:checked) { border-color: var(--primary); background: var(--primary-lt); color: var(--primary-dk); font-weight: 600 }
.perm-check-item input { margin: 0; cursor: pointer; accent-color: var(--primary) }
.perm-section-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: .6rem; display: flex; align-items: center; gap: .5rem }
.perm-section-label::after { content: ''; flex: 1; height: 1px; background: var(--border-clr) }

/* ─────────────────────────────────────────────────────────────────────
   PORTAL DO CLIENTE
   ───────────────────────────────────────────────────────────────────── */
.portal-navbar {
  background: rgba(255,255,255,.95); border-bottom: 1px solid var(--border-clr);
  padding: .75rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 12px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.portal-brand {
  font-weight: 800; font-size: 1.05rem; color: var(--primary);
  text-decoration: none; display: flex; align-items: center; gap: .5rem; letter-spacing: -.02em;
}
.portal-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border-clr); box-shadow: var(--shadow);
  padding: 1.5rem; margin-bottom: 1rem;
  transition: box-shadow var(--t), transform var(--t);
}
.portal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px) }

/* Portal hero card */
.portal-hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dk) 100%);
  border-radius: var(--radius-lg); color: #fff; padding: 1.75rem;
  margin-bottom: 1.5rem; position: relative; overflow: hidden;
  border: none; box-shadow: var(--shadow-primary);
}
.portal-hero-card::before { content: ''; position: absolute; top: -40%; right: -10%; width: 300px; height: 300px; background: rgba(255,255,255,.06); border-radius: 50% }
.portal-hero-card::after  { content: ''; position: absolute; bottom: -50%; left: -5%; width: 200px; height: 200px; background: rgba(255,255,255,.04); border-radius: 50% }

/* Portal stat card */
.portal-stat-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border-clr); box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: transform var(--t), box-shadow var(--t);
}
.portal-stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md) }
.portal-stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0 }
.portal-stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1 }
.portal-stat-label { font-size: .76rem; color: var(--text-muted); font-weight: 500 }

/* Portal section card */
.portal-section-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border-clr); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.25rem }
.portal-section-header { padding: .9rem 1.25rem; border-bottom: 1px solid var(--border-clr); display: flex; align-items: center; justify-content: space-between }
.portal-section-title { font-weight: 700; font-size: .9rem; color: var(--text-primary); margin: 0; display: flex; align-items: center; gap: .5rem }

/* Portal quick action buttons */
.portal-quick-btn {
  display: flex; align-items: center; gap: .65rem;
  padding: .85rem 1rem; border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-clr); background: var(--surface);
  color: var(--text-secondary); font-weight: 600; font-size: .855rem;
  text-decoration: none; transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
}
.portal-quick-btn:hover { border-color: var(--primary); background: var(--primary-lt); color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow) }
.portal-quick-btn i { font-size: 1.2rem; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center }
.portal-quick-btn:hover i { background: rgba(99,102,241,.12) }

/* Portal Security page */
.security-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border-clr); box-shadow: var(--shadow); overflow: hidden }
.security-card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-clr); background: var(--surface-2); display: flex; align-items: center; gap: .6rem }
.security-card-body { padding: 1.5rem }
.security-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .85rem; border-radius: var(--radius-full); font-size: .75rem; font-weight: 700 }
.security-badge.good { background: var(--success-lt); color: var(--success-dk) }
.security-badge.warn { background: var(--warning-lt); color: var(--warning-dk) }

/* ─────────────────────────────────────────────────────────────────────
   LOJA / E-COMMERCE (layout admin)
   ───────────────────────────────────────────────────────────────────── */
.product-card { background: var(--surface); border: 1px solid var(--border-clr); border-radius: var(--radius-lg); overflow: hidden; transition: transform var(--t), box-shadow var(--t) }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg) }
.product-card img { width: 100%; height: 200px; object-fit: cover; background: var(--surface-3) }
.product-price { font-size: 1.3rem; font-weight: 800; color: var(--primary); letter-spacing: -.02em; font-family: var(--font-mono) }
.product-price.promo { color: var(--success) }
.product-price-old { text-decoration: line-through; color: var(--text-muted); font-size: .875rem; font-family: var(--font-mono) }

/* ─────────────────────────────────────────────────────────────────────
   KANBAN (Ordens de Serviço)
   ───────────────────────────────────────────────────────────────────── */
.kanban-col { min-width: 280px; background: var(--surface-2); border: 1px solid var(--border-clr); border-radius: var(--radius-lg); padding: .75rem; flex: 1 }
.kanban-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .85rem; color: var(--text-muted) }
.kanban-card { background: var(--surface); border: 1px solid var(--border-clr); border-radius: var(--radius); padding: .85rem; margin-bottom: .5rem; cursor: grab; box-shadow: var(--shadow-xs); transition: box-shadow var(--t), transform var(--t) }
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px) }

/* ─────────────────────────────────────────────────────────────────────
   TIMELINE
   ───────────────────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 2.1rem }
.timeline::before { content: ''; position: absolute; left: .7rem; top: 0; bottom: 0; width: 2px; background: linear-gradient(to bottom, var(--primary-lt), var(--border-clr)) }
.timeline-item { position: relative; margin-bottom: 1.35rem }
.timeline-dot { position: absolute; left: -1.8rem; top: .3rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--primary); box-shadow: 0 0 0 3px var(--primary-lt); transition: transform var(--t) }
.timeline-item:hover .timeline-dot { transform: scale(1.2) }
.timeline-dot.success { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-lt) }
.timeline-dot.warning { border-color: var(--warning); box-shadow: 0 0 0 3px var(--warning-lt) }
.timeline-dot.danger  { border-color: var(--danger);  box-shadow: 0 0 0 3px var(--danger-lt) }

/* ─────────────────────────────────────────────────────────────────────
   CHARTS
   ───────────────────────────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px }

/* ─────────────────────────────────────────────────────────────────────
   PIX
   ───────────────────────────────────────────────────────────────────── */
.pix-box { border: 2px dashed #86efac; background: #f0fdf4; border-radius: var(--radius-lg); padding: 1.5rem; text-align: center }
.pix-key-display { background: var(--surface); border: 1px solid var(--border-clr); border-radius: var(--radius); padding: .75rem 1rem; font-family: var(--font-mono); font-size: .875rem; word-break: break-all; margin: 1rem 0; user-select: all }

/* ─────────────────────────────────────────────────────────────────────
   SECTION TITLE
   ───────────────────────────────────────────────────────────────────── */
.section-title-admin { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: .9rem; display: flex; align-items: center; gap: .5rem }
.section-title-admin::after { content: ''; flex: 1; height: 1px; background: var(--border-clr) }

/* ─────────────────────────────────────────────────────────────────────
   EMPTY STATE / LOADING
   ───────────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted) }
.empty-state i { font-size: 3rem; opacity: .25; display: block; margin-bottom: 1rem }
.empty-state p { font-size: .9rem }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.85); display: none; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(4px); flex-direction: column; gap: 1rem }
.loading-overlay.active { display: flex }

/* ─────────────────────────────────────────────────────────────────────
   TOASTS
   ───────────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem }
.toast { border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: .875rem; min-width: 280px; border: none }

/* ─────────────────────────────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────────────────────────────── */
.login-wrapper { display: flex; min-height: 100vh; width: 100% }
.login-left {
  flex: 1; background: linear-gradient(145deg, #1e1b4b 0%, #312e81 50%, #1e293b 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 2rem; color: #fff; position: relative; overflow: hidden;
}
.login-left::before { content: ''; position: absolute; top: -100px; right: -100px; width: 400px; height: 400px; background: radial-gradient(circle, rgba(99,102,241,.2) 0%, transparent 70%) }
.login-left::after  { content: ''; position: absolute; bottom: -80px; left: -80px;  width: 300px; height: 300px; background: radial-gradient(circle, rgba(16,185,129,.15) 0%, transparent 70%) }
.login-right { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--body-bg); min-width: 400px; max-width: 460px; flex-shrink: 0 }
.login-card { width: 100%; background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border-clr); padding: 2.25rem 2rem; box-shadow: var(--shadow-xl) }
@media(max-width:767.98px) { .login-left { display: none } .login-right { max-width: 100%; min-width: 0 } }

/* ─────────────────────────────────────────────────────────────────────
   DOCUMENTO / PRINT
   ───────────────────────────────────────────────────────────────────── */
.doc-wrap { max-width: 800px; margin: 0 auto; background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden }
.doc-header { padding: 2rem; background: #fff; border-bottom: 2px solid #e2e8f0 }
.doc-header-logo { max-height: 64px; max-width: 180px; object-fit: contain }
.doc-title { font-size: 1.1rem; font-weight: 800; color: var(--primary) }
.doc-number { text-align: right }
.doc-section { margin-bottom: 16px }
.doc-section-title { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--primary); border-bottom: 1px solid #e2e8f0; padding-bottom: 5px; margin-bottom: 10px }
.doc-label { font-size: .75rem; font-weight: 600; color: #64748b; display: block }
.sig-area { display: flex; justify-content: space-between; margin-top: 40px; gap: 40px }
.sig-line { flex: 1; border-top: 1.5px solid #e2e8f0; padding-top: 8px; font-size: .75rem; color: #64748b; text-align: center }
.company-name { font-weight: 800; font-size: 1.1rem; color: #0f172a }

/* ─────────────────────────────────────────────────────────────────────
   ITENS DE FORMULÁRIO (notas, orçamentos)
   ───────────────────────────────────────────────────────────────────── */
.items-table .item-qty   { font-family: var(--font-mono); font-size: .82rem }
.items-table .item-price { font-family: var(--font-mono); font-size: .82rem }
.items-table .item-disc  { font-family: var(--font-mono); font-size: .82rem }
.btn-remove-item { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: .2rem .4rem; border-radius: var(--radius-sm); transition: color var(--t-fast), background var(--t-fast) }
.btn-remove-item:hover { color: var(--danger); background: var(--danger-lt) }

/* ─────────────────────────────────────────────────────────────────────
   NAV LEGADO (retrocompat)
   ───────────────────────────────────────────────────────────────────── */
.nav-section { font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(100,116,139,.8); padding: 1rem .9rem .3rem; display: block }
.nav-item { display: flex; align-items: center; gap: .65rem; padding: .48rem .85rem; color: var(--sidebar-txt); border-radius: var(--radius-sm); margin: 1px .5rem; font-size: .855rem; font-weight: 500; text-decoration: none; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast); position: relative; cursor: pointer }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; transform: translateX(2px) }
.nav-item.active { background: var(--sidebar-active); color: #a5b4fc; font-weight: 600 }

/* ─────────────────────────────────────────────────────────────────────
   WIDGET IA FLUTUANTE
   ───────────────────────────────────────────────────────────────────── */
#ai-float-btn { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; border: none; box-shadow: 0 4px 20px rgba(99,102,241,.45); cursor: pointer; z-index: 1060; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; transition: transform .2s, box-shadow .2s }
#ai-float-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(99,102,241,.55) }
#ai-float-btn .ai-pulse { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(99,102,241,.4); animation: ai-pulse 2s infinite }
@keyframes ai-pulse { 0%{transform:scale(1);opacity:1} 70%{transform:scale(1.3);opacity:0} 100%{transform:scale(1.3);opacity:0} }
#ai-float-panel { position: fixed; bottom: 6.5rem; right: 1.5rem; width: 360px; max-width: calc(100vw - 2rem); background: var(--surface); border: 1px solid var(--border-clr); border-radius: 1rem; box-shadow: 0 12px 48px rgba(0,0,0,.2); z-index: 1059; display: none; flex-direction: column; overflow: hidden }
#ai-float-panel.open { display: flex }
.ai-panel-header { background: linear-gradient(135deg,#6366f1,#818cf8); color: #fff; padding: .75rem 1rem; display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .9rem }
.ai-panel-header .ai-status { font-size: .75rem; opacity: .8; font-weight: 400; margin-left: auto }
.ai-panel-body { flex: 1; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; max-height: 340px; overflow-y: auto }
.ai-msg { padding: .55rem .75rem; border-radius: .65rem; font-size: .825rem; line-height: 1.5; max-width: 88% }
.ai-msg-user { background: #6366f1; color: #fff; align-self: flex-end; border-bottom-right-radius: .2rem }
.ai-msg-ai   { background: var(--surface-2); color: var(--text-primary); align-self: flex-start; border-bottom-left-radius: .2rem }
.ai-typing   { display: flex; gap: 4px; align-items: center; padding: .4rem .6rem }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: ai-dot 1.2s infinite }
.ai-typing span:nth-child(2) { animation-delay: .2s }
.ai-typing span:nth-child(3) { animation-delay: .4s }
@keyframes ai-dot { 0%,80%,100%{transform:scale(.6);opacity:.4} 40%{transform:scale(1);opacity:1} }
.ai-panel-footer { padding: .5rem .75rem; border-top: 1px solid var(--border-clr); display: flex; gap: .4rem }
.ai-panel-footer input { flex: 1; border: 1px solid var(--border-clr); border-radius: .5rem; padding: .4rem .65rem; font-size: .825rem; background: var(--surface-2); color: var(--text-primary); outline: none }
.ai-panel-footer input:focus { border-color: #6366f1 }
.ai-panel-footer button { background: #6366f1; color: #fff; border: none; border-radius: .5rem; padding: .4rem .75rem; font-size: .8rem; cursor: pointer }

/* ─────────────────────────────────────────────────────────────────────
   UTILITÁRIOS
   ───────────────────────────────────────────────────────────────────── */
.hover-lift { transition: transform var(--t), box-shadow var(--t) }
.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-md) }
.cursor-pointer { cursor: pointer }
.text-mono { font-family: var(--font-mono) }
.text-money { font-family: var(--font-mono); font-weight: 700 }
.text-muted-sm { font-size: .79rem; color: var(--text-muted) }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: .5rem }
.status-badge { display: inline-flex; align-items: center; padding: .25em .75em; border-radius: var(--radius-full); font-size: .7rem; font-weight: 700; letter-spacing: .02em }
.gap-xs { gap: .3rem !important }
.rounded-xl { border-radius: var(--radius-xl) !important }

/* Gradiente stat cards */
.stat-card-orange { background: linear-gradient(135deg, #f97316, #ea580c) !important; border-color: transparent !important; color: #fff }
.stat-card-purple { background: linear-gradient(135deg, #9333ea, #7c3aed) !important; border-color: transparent !important; color: #fff }
.stat-card-orange .stat-value, .stat-card-purple .stat-value,
.stat-card-orange .stat-label, .stat-card-purple .stat-label { color: rgba(255,255,255,.95) !important }

/* ─────────────────────────────────────────────────────────────────────
   ANIMAÇÕES GLOBAIS
   ───────────────────────────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(16px) } to { opacity:1; transform:translateY(0) } }
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }
@keyframes scaleIn { from { opacity:0; transform:scale(.93) } to { opacity:1; transform:scale(1) } }
.anim-fade-up { animation: fadeUp .4s ease both }
.anim-fade-in { animation: fadeIn .3s ease both }

/* ─────────────────────────────────────────────────────────────────────
   PRINT
   ───────────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .ai-float-btn, #ai-float-panel, .btn, .alert { display: none !important }
  .main-content { margin: 0 !important }
  body { background: #fff !important }
  .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important }
}
