:root {
  --mgr-primary: #dc2626;
  --mgr-primary-hover: #ef4444;
  --mgr-primary-rgb: 220, 38, 38;
  --panel-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .55);
  --panel-shadow-hover: 0 4px 10px rgba(0, 0, 0, .35), 0 20px 40px -18px rgba(0, 0, 0, .6);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { scrollbar-color: rgba(255, 255, 255, .18) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .24); }
*::-webkit-scrollbar-track { background: transparent; }

a, button { transition: color .15s var(--ease-out), background-color .15s var(--ease-out), border-color .15s var(--ease-out); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(var(--mgr-primary-rgb), .55);
  outline-offset: 2px;
}

/* ---------- Navegação (sidebar + drawer) ---------- */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  color: #a1a1aa;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.18s var(--ease-out);
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-item.active { color: #f87171; background: rgba(239, 68, 68, 0.12); }
.nav-item::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 999px;
  background: var(--mgr-primary);
  opacity: 0;
  transform: scaleY(.4);
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
}
.nav-item.active::before { opacity: 1; transform: scaleY(1); }
.nav-item .nav-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: .6rem;
  background: rgba(255, 255, 255, .04);
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out);
}
.nav-item.active .nav-item-icon { background: rgba(var(--mgr-primary-rgb), .18); color: var(--mgr-primary-hover); }

.panel-sidebar {
  background: linear-gradient(180deg, rgba(24, 24, 27, .9) 0%, rgba(9, 9, 11, 1) 55%);
}
.panel-sidebar-brand {
  background: linear-gradient(135deg, rgba(var(--mgr-primary-rgb), .16), transparent 70%);
}

/* ---------- Cards ---------- */
.stat-card {
  position: relative;
  overflow: hidden;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: var(--panel-shadow);
  transition: box-shadow .2s var(--ease-out), transform .2s var(--ease-out);
}
.stat-card:hover { box-shadow: var(--panel-shadow-hover); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120px 80px at 100% 0%, rgba(var(--stat-glow-rgb, var(--mgr-primary-rgb)), .16), transparent 70%);
  pointer-events: none;
}
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .75rem;
  background: rgba(var(--stat-glow-rgb, var(--mgr-primary-rgb)), .14);
  color: rgb(var(--stat-glow-rgb, var(--mgr-primary-rgb)));
  font-size: 1rem;
  margin-bottom: .6rem;
}

.card {
  position: relative;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--panel-shadow);
  transition: box-shadow .2s var(--ease-out), transform .2s var(--ease-out), border-color .2s var(--ease-out);
}
.card-hover:hover { box-shadow: var(--panel-shadow-hover); border-color: rgba(255, 255, 255, .14); transform: translateY(-2px); }
.card-title {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.panel-table-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 1rem;
  box-shadow: var(--panel-shadow);
  overflow: hidden;
}
.panel-table-card table thead th {
  font-size: .68rem;
  letter-spacing: .06em;
  font-weight: 800;
}
.panel-table-card table tbody tr {
  transition: background-color .15s var(--ease-out);
}

/* ---------- Formulários ---------- */
.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #a1a1aa;
  margin-bottom: 0.25rem;
}
.input {
  width: 100%;
  background: #09090b;
  border: 1px solid #3f3f46;
  border-radius: 0.75rem;
  padding: 0.625rem 1rem;
  color: #fafafa;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.input:focus {
  outline: none;
  border-color: var(--mgr-primary-hover);
  box-shadow: 0 0 0 3px rgba(var(--mgr-primary-rgb), .18);
}

/* ---------- Botões ---------- */
.btn-primary {
  background: var(--mgr-primary);
  color: #fff;
  font-weight: 700;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 8px 20px -8px rgba(var(--mgr-primary-rgb), .5);
  transition: background .18s var(--ease-out), transform .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.btn-primary:hover { background: var(--mgr-primary-hover); transform: translateY(-1px); box-shadow: 0 12px 24px -10px rgba(var(--mgr-primary-rgb), .6); }
.btn-primary:active { transform: translateY(0) scale(.98); }

.btn-secondary {
  background: #27272a;
  color: #e4e4e7;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  transition: background .18s var(--ease-out), transform .18s var(--ease-out);
}
.btn-secondary:hover { background: #3f3f46; transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(0) scale(.98); }

.btn-danger {
  background: #7f1d1d;
  color: #fecaca;
  font-weight: 700;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  transition: background .18s var(--ease-out), transform .18s var(--ease-out);
}
.btn-danger:hover { background: #991b1b; transform: translateY(-1px); }
.btn-danger:active { transform: translateY(0) scale(.98); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 0.125rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.5;
}
.badge-ok { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, .25); }
.badge-blocked { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .25); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, .25); }

/* ---------- Chat (tickets de suporte) ---------- */
.chat-box {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-msg {
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
}
.chat-operator { background: rgba(239, 68, 68, 0.12); margin-left: 2rem; }
.chat-install { background: #09090b; border: 1px solid #27272a; margin-right: 2rem; }
.chat-meta { font-size: 0.6875rem; color: #71717a; margin-bottom: 0.25rem; }

/* ---------- Header mobile + drawer ---------- */
.panel-topbar-mobile {
  background: rgba(9, 9, 11, .95);
  backdrop-filter: blur(10px);
}
.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .7rem;
  background: rgba(255, 255, 255, .06);
  transition: background-color .18s var(--ease-out);
}
.hamburger-btn:active { transform: scale(.94); }

.panel-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease-out);
}
.panel-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

.panel-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 61;
  width: min(84vw, 300px);
  background: linear-gradient(180deg, rgba(24, 24, 27, .98) 0%, rgba(9, 9, 11, .98) 60%);
  border-right: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 24px 0 60px -20px rgba(0, 0, 0, .7);
  transform: translateX(-100%);
  transition: transform .28s var(--ease-out);
  display: flex;
  flex-direction: column;
}
.panel-drawer.is-open { transform: translateX(0); }

@media (max-width: 480px) {
  .stat-card, .card { border-radius: .95rem; }
}

/* ---------- Linhas de resumo (campos editáveis via modal) ---------- */
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}
.summary-row + .summary-row { border-top: 1px solid #27272a; }
.summary-row-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #71717a;
  margin-bottom: 0.2rem;
}
.summary-row-value {
  font-weight: 700;
  font-size: 0.9rem;
  color: #e4e4e7;
}
.summary-row-hint {
  font-size: 0.75rem;
  color: #71717a;
  margin-top: 0.15rem;
}
.btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #27272a;
  color: #e4e4e7;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.65rem;
  flex-shrink: 0;
  transition: background .18s var(--ease-out), transform .18s var(--ease-out);
}
.btn-edit:hover { background: var(--mgr-primary); color: #fff; transform: translateY(-1px); }
.btn-edit:active { transform: translateY(0) scale(.96); }

/* ---------- Modais ---------- */
body.modal-lock { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease-out);
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }

.modal-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 71;
  width: min(92vw, 480px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 1.1rem;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .75);
  transform: translate(-50%, -48%) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s var(--ease-out), opacity .22s var(--ease-out);
}
.modal-panel.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}
.modal-header h3 { font-weight: 800; font-size: 1.05rem; }
.modal-header p { font-size: 0.75rem; color: #a1a1aa; margin-top: .2rem; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: .6rem;
  color: #a1a1aa;
  background: rgba(255, 255, 255, .04);
  flex-shrink: 0;
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out);
}
.modal-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

@media (max-width: 480px) {
  .modal-panel { width: 94vw; max-height: 90vh; }
}

/* ---------- Notificações (PWA / sino) ---------- */
.notif-wrap { position: relative; }
.panel-topbar-desktop {
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(10px);
}
.panel-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 0.75rem;
  border-left: 1px solid #27272a;
}
.panel-topbar-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #27272a;
  color: #d4d4d8;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.panel-topbar-user-meta { min-width: 0; max-width: 11rem; }
.panel-topbar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fafafa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-topbar-user-email {
  font-size: 0.6875rem;
  color: #71717a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #27272a;
  cursor: pointer;
}
.notif-bell-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.notif-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 800;
  line-height: 1.1rem;
  text-align: center;
  box-shadow: 0 0 0 2px #09090b;
}
.notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(24rem, calc(100vw - 1.5rem));
  min-width: 18rem;
  max-height: min(28rem, 70vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 0.875rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 100;
}
.notif-dropdown.notif-dropdown--fixed {
  position: fixed;
  top: auto;
  right: auto;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #27272a;
  background: rgba(24, 24, 27, 0.98);
}
.notif-dropdown-title {
  font-size: 0.875rem;
  font-weight: 800;
  color: #fafafa;
}
.notif-mark-all {
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
}
.notif-mark-all:hover { color: #fca5a5; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #71717a;
  font-size: 0.8125rem;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(39, 39, 42, 0.7);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s var(--ease-out);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255, 255, 255, 0.04); }
.notif-item--unread {
  background: rgba(220, 38, 38, 0.08);
  border-left: 3px solid #dc2626;
  padding-left: calc(1rem - 3px);
}
.notif-item-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  background: rgba(220, 38, 38, 0.14);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  margin-top: 0.05rem;
}
.notif-item-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.notif-item-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fafafa;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.notif-item-text {
  font-size: 0.75rem;
  color: #a1a1aa;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
}
.notif-item-time { font-size: 0.6875rem; color: #71717a; margin-top: 0.1rem; }
.notif-dropdown-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid #27272a;
  font-size: 0.6875rem;
  color: #71717a;
}
.notif-enable-push {
  color: #60a5fa;
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}
.notif-enable-push:hover { text-decoration: underline; }
.panel-topbar-mobile .notif-wrap { margin-left: auto; }
.panel-sidebar-notif { padding: 0 1rem 0.75rem; }

/* Barrinha push (toast) no topo da tela */
.notif-toast-stack {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  left: 0.75rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 28rem;
  margin-left: auto;
}
@media (min-width: 640px) {
  .notif-toast-stack { left: auto; }
}
.notif-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(24, 24, 27, 0.98), rgba(39, 39, 42, 0.98));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  color: #fafafa;
  animation: notif-toast-in 0.35s ease-out;
  backdrop-filter: blur(10px);
}
.notif-toast--success { border-color: rgba(16, 185, 129, 0.45); }
.notif-toast--test { border-color: rgba(56, 189, 248, 0.45); }
.notif-toast--info { border-color: rgba(250, 204, 21, 0.35); }
.notif-toast-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  flex-shrink: 0;
}
.notif-toast--success .notif-toast-icon { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.notif-toast--test .notif-toast-icon { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.notif-toast-body { min-width: 0; flex: 1; }
.notif-toast-title { font-size: 0.875rem; font-weight: 800; line-height: 1.3; }
.notif-toast-text { font-size: 0.75rem; color: #d4d4d8; margin-top: 0.15rem; line-height: 1.35; }
.notif-toast-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.notif-toast-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fca5a5;
  text-decoration: none;
}
.notif-toast-link:hover { color: #fff; }
.notif-toast-close {
  background: transparent;
  border: none;
  color: #a1a1aa;
  cursor: pointer;
  padding: 0.15rem;
  line-height: 1;
}
.notif-toast-close:hover { color: #fff; }
@keyframes notif-toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes notif-toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}
.notif-toast--leaving { animation: notif-toast-out 0.25s ease-in forwards; }
