:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #0b1120;
  --bg-hover: #334155;
  --bg-active: #2563eb;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);
  
  --border-color: #334155;
  --border-light: #1e293b;

  --status-green: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 32px rgba(0,0,0,0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* -------------------------------------------------------------
   BARRA LATERAL (SIDEBAR)
------------------------------------------------------------- */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 20px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo-img {
  height: 38px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.3));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.brand-domain {
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 600;
}

/* Seletor de Contas */
.account-picker-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-picker-box label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.account-select {
  width: 100%;
  padding: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.account-select:hover {
  border-color: var(--accent-primary);
}

/* Botão Escrever */
.btn-compose {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-compose:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

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

/* Seções de Navegação */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-item .badge {
  margin-left: auto;
  background-color: var(--accent-primary);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.storage-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.storage-bar {
  width: 100%;
  height: 6px;
  background-color: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}

.storage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #10b981);
  border-radius: 3px;
}

/* -------------------------------------------------------------
   CONTEÚDO PRINCIPAL (MAIN CONTENT)
------------------------------------------------------------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-dark);
  overflow: hidden;
}

/* Top Header */
.top-header {
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-sidebar);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  width: 380px;
  transition: border-color 0.2s;
}

.search-box:focus-within {
  border-color: var(--accent-primary);
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
}

.search-box i {
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--status-green);
  font-weight: 600;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  background-color: var(--status-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--status-green);
}

/* Painel Dividido (Email List | Email Detail) */
.workspace-panel {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Lista de E-mails */
.email-list-panel {
  width: 420px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background-color: var(--bg-dark);
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.email-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.email-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s;
  position: relative;
}

.email-item:hover {
  background-color: var(--bg-card);
}

.email-item.unread {
  background-color: rgba(99, 102, 241, 0.05);
  border-left: 3px solid var(--accent-primary);
}

.email-item.active {
  background-color: var(--bg-hover);
}

.email-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sender-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.email-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.email-subject {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.star-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.star-btn.starred {
  color: #f59e0b;
}

/* Visualizador de Detalhes de E-mail */
.email-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  overflow-y: auto;
}

.email-detail-panel.empty-state {
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.large-icon {
  width: 64px;
  height: 64px;
  stroke-width: 1.5;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.mail-header-bar {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mail-subject-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mail-metadata {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sender-avatar-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 1.1rem;
}

.sender-info-text h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.sender-info-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mail-actions {
  display: flex;
  gap: 10px;
}

.mail-body-container {
  padding: 32px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-dark);
  margin: 20px 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  min-height: 250px;
}

.attachments-section {
  padding: 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: fit-content;
  font-size: 0.85rem;
  color: var(--accent-primary);
  text-decoration: none;
}

/* -------------------------------------------------------------
   MODAIS E FORMULÁRIOS
------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s;
}

.modal-backdrop.hidden {
  display: none;
  opacity: 0;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 540px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-lg {
  width: 780px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 80vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--accent-primary);
}

.email-input-group {
  display: flex;
  align-items: center;
}

.email-input-group input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-suffix {
  padding: 10px 14px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-left: none;
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.textarea {
  resize: vertical;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

.btn-primary {
  padding: 10px 20px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  padding: 10px 20px;
  background: var(--bg-dark);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

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

/* -------------------------------------------------------------
   DNS & TABELAS
------------------------------------------------------------- */
.dns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.dns-card {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dns-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dns-type {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-primary);
}

.badge-valid {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--status-green);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-missing {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.dns-code {
  background-color: #050811;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.8rem;
  color: #38bdf8;
  word-break: break-all;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.data-table th, .data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}
