.hidden { display: none !important; }


.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.tiny {
  font-size: 12px;
  color: var(--text-muted);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}



.btn:hover {
  background: rgba(255, 255, 255, 0.15);
}









.btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn.danger:hover {
  background: var(--accent-danger);
  color: #fff;
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge.ok {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.err {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Chat & Support */
.support-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.support-list .list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.support-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.2s;
}

.support-item:hover, .support-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
}

.support-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.chat-bubble.me {
  background: var(--accent-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.chat-bubble.other {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-color);
}

.menu-count {
  background: var(--accent-danger, #ef4444);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: auto;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}


/* SUPPORT & CHAT CODEX PERFECT STYLING */
.support-grid {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 18px;
  height: calc(100vh - 120px);
}

.support-list {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow: hidden;
}

.support-list .list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 10px;
}

.support-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.support-item:hover, .support-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.45);
}

.support-item strong {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.support-thread {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow: hidden;
}

.support-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 16px;
}

.support-msg {
  display: flex;
  margin-bottom: 4px;
}

.support-msg.admin {
  justify-content: flex-end;
}

.support-msg > div {
  max-width: 82%;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: #1e293b;
  color: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  line-height: 1.5;
}

.support-msg.admin > div {
  background: #2563eb;
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.5);
}

.email-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #0f172a;
  padding: 18px;
  margin-bottom: 14px;
  color: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.email-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.email-subject {
  font-size: 16px;
  font-weight: 700;
  color: #60a5fa;
}

.email-meta {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email-body {
  font-size: 14px;
  line-height: 1.6;
  color: #f1f5f9;
  margin-top: 12px;
  word-break: break-word;
}

.email-raw {
  margin-top: 14px;
  font-size: 11px;
  color: #64748b;
}

.email-raw summary {
  cursor: pointer;
  color: #3b82f6;
  font-weight: 600;
}

.email-raw pre {
  background: #020617;
  padding: 12px;
  border-radius: 8px;
  margin-top: 8px;
  overflow-x: auto;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.05);
}



/* FORÇAR BARRA DE ROLAGEM VISÍVEL EM SUPORTE E CHAT CODEX */
.support-messages, #supportMessages, #codexSupportMessages, .support-thread, #supportThread, #codexSupportThread {
  overflow-y: scroll !important;
  scrollbar-width: auto !important;
  scrollbar-color: #3b82f6 #0f172a !important;
}

.support-messages::-webkit-scrollbar, #supportMessages::-webkit-scrollbar, #codexSupportMessages::-webkit-scrollbar {
  width: 10px !important;
  display: block !important;
}

.support-messages::-webkit-scrollbar-track, #supportMessages::-webkit-scrollbar-track, #codexSupportMessages::-webkit-scrollbar-track {
  background: #0f172a !important;
  border-radius: 6px;
}

.support-messages::-webkit-scrollbar-thumb, #supportMessages::-webkit-scrollbar-thumb, #codexSupportMessages::-webkit-scrollbar-thumb {
  background: #3b82f6 !important;
  border-radius: 6px;
  border: 2px solid #0f172a;
}

.support-messages::-webkit-scrollbar-thumb:hover, #supportMessages::-webkit-scrollbar-thumb:hover, #codexSupportMessages::-webkit-scrollbar-thumb:hover {
  background: #2563eb !important;
}

/* EMAIL READER CLIENT STYLE */
.email-card {
  border: 1px solid #334155 !important;
  border-radius: 12px !important;
  background: #0f172a !important;
  padding: 20px !important;
  margin-bottom: 16px !important;
  color: #f8fafc !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4) !important;
}

.email-subject {
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #60a5fa !important;
  margin-bottom: 8px !important;
}

.email-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
}



/* RESPONSIVIDADE COMPLETA PARA DISPOSITIVOS MÓVEIS E TABLETS */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 16px !important;
  }

  .mobile-header-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
  }

  .menu {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
  }

  .menu.mobile-open {
    display: flex !important;
  }

  .support-grid {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }

  .support-list {
    max-height: 300px;
  }

  .main-content {
    padding: 16px !important;
  }

  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  table {
    min-width: 600px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
  }
}

@media (min-width: 901px) {
  .mobile-header-bar {
    display: none !important;
  }
  .menu {
    display: flex !important;
  }
}


/* ESTRUTURA RESPONSIVA E UX DE SISTEMA AVANÇADO */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .btn, button {
    min-height: 42px;
  }

  .email-card {
    padding: 14px !important;
  }

  .gmail-card {
    padding: 14px !important;
  }
}

/* ========================================================== */
/* FTHYRK SUPERADMIN - RESPONSIVIDADE E CORREÇÃO DE OVERLAY   */
/* ========================================================== */
@media (max-width: 1024px) {
  aside.sidebar, .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 9999 !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 4px 0 25px rgba(0,0,0,0.5);
  }

  aside.sidebar.mobile-open, .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  main, .main-content, #main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 16px !important;
  }
}

/* Garantir ajuste em desktops sem sobreposição */
main, .main-content {
  box-sizing: border-box;
  overflow-x: hidden;
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: #4f46e5;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
  line-height: 1.3;
}

.btn:hover {
  background: #4338ca;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: #4f46e5;
  color: #ffffff !important;
}

.btn.primary:hover {
  background: #4338ca;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc !important;
}

.btn.ghost:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn.ok, .btn.success {
  background: #16a34a;
  color: #ffffff !important;
}

.btn.ok:hover, .btn.success:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.btn.danger {
  background: #dc2626;
  color: #ffffff !important;
  border: none;
}

.btn.danger:hover {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}


/* ========================================================= */
/* FIX: SUPPORT CHAT TEXTAREA AUTO-EXPAND & GMAIL VIEW GRID  */
/* ========================================================= */

#gmailView:not(.hidden) {
  display: block !important;
  width: 100% !important;
  height: calc(100vh - 120px) !important;
}

#supportView:not(.hidden) {
  display: block !important;
  width: 100% !important;
}

.support-reply {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 14px !important;
  background: var(--bg-card, #1e293b) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 0 0 12px 12px !important;
  margin-top: auto !important;
  flex-shrink: 0 !important;
}

.support-reply textarea {
  width: 100% !important;
  min-height: 90px !important;
  max-height: 380px !important;
  padding: 14px 16px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 10px !important;
  color: #f8fafc !important;
  font-family: inherit !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
  resize: vertical !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.support-reply textarea:focus {
  border-color: #38bdf8 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}
