/* ══════════════════════════════════════════════════════════════
   BZPMail — app-email estilo Materio (implementação original local)
   Layout de 3 colunas: sidebar | lista | leitura, como no exemplo
   app-email do Materio. Todo o código é autoral; nenhuma linha foi
   copiada do template PRO.
   ══════════════════════════════════════════════════════════════ */

/* ── Ripple effect for buttons (Materio signature) ── */
.materio-btn-primary, .materio-btn-outline, .materio-icon-btn, .email-folder, .m-mail {
  position: relative; overflow: hidden;
}
.materio-btn-primary::after, .materio-btn-outline::after, .materio-icon-btn::after,
.email-folder::after, .m-mail::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
    rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s;
}
.materio-btn-primary:active::after, .materio-btn-outline:active::after,
.materio-icon-btn:active::after, .email-folder:active::after, .m-mail:active::after {
  opacity: 1; transition: opacity 0s;
}

/* ── Thread indicator (like "4 Earlier Messages") ── */
.thread-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; margin-bottom: 12px;
  background: var(--materio-primary-light);
  border: 1px solid var(--materio-primary-border);
  border-radius: 8px;
  font-size: 0.82rem; font-weight: 500;
  color: var(--materio-primary);
  cursor: pointer;
  transition: background 0.15s;
}
.thread-indicator:hover { background: rgba(145, 85, 253, 0.18); }
.thread-indicator i { font-size: 0.75rem; }

/* ── Context menu (right-click on email items) ── */
.email-context-menu {
  position: fixed; z-index: 2000;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(58, 53, 65, 0.18);
  padding: 6px 0;
  min-width: 200px;
  animation: ctxIn 0.12s ease-out;
  display: none;
}
.email-context-menu.visible { display: block; }
@keyframes ctxIn { from { opacity: 0; transform: scale(0.95) translateY(-4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.email-context-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 16px; border: none; background: none;
  color: var(--materio-text); font-size: 0.84rem; cursor: pointer;
  text-align: left; transition: background 0.1s;
}
.email-context-menu button:hover { background: var(--materio-hover); }
.email-context-menu button i { width: 18px; text-align: center; font-size: 0.8rem; color: var(--materio-text-secondary); }
.email-context-menu button.danger { color: var(--materio-danger); }
.email-context-menu button.danger i { color: var(--materio-danger); }
.email-context-menu .ctx-divider { height: 1px; background: var(--materio-divider); margin: 4px 0; }

/* ── Floating compose panel (Materio app-email style) ── */
.compose-float {
  position: fixed; bottom: 0; right: 24px;
  width: 50vw; min-width: 520px; max-height: 85vh;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(58, 53, 65, 0.18);
  z-index: 1070;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
body.dark-mode .compose-float { box-shadow: 0 -4px 24px rgba(0,0,0,0.45); }
.compose-float.open { transform: translateY(0); }
/* Header */
.compose-float .cf-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--materio-bg);
  border-bottom: 1px solid var(--materio-divider);
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}
.cf-header-title {
  font-weight: 600; font-size: 0.95rem;
  color: var(--materio-text);
}
.cf-header-actions {
  display: flex; align-items: center; gap: 4px;
}
.cf-header-btn {
  width: 28px; height: 28px; border: none; background: none;
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--materio-text-secondary); font-size: 0.82rem;
  transition: background 0.12s, color 0.12s;
}
.cf-header-btn:hover { background: var(--materio-hover); color: var(--materio-text); }
/* Body */
.compose-float .cf-body {
  flex: 1; overflow-y: auto; padding: 0;
  display: flex; flex-direction: column;
}
/* Field rows */
.cf-field-row {
  display: flex; align-items: center; gap: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--materio-divider);
}
.cf-field-label {
  font-size: 0.85rem; color: var(--materio-muted);
  min-width: 42px; flex-shrink: 0;
  font-weight: 500;
}
.cf-field-input {
  flex: 1; border: none; outline: none;
  background: transparent; color: var(--materio-text);
  font-size: 0.88rem; font-family: inherit;
  padding: 2px 0;
}
.cf-field-input::placeholder { color: var(--materio-muted); }
.cf-ccbcc-toggle {
  border: none; background: none; cursor: pointer;
  font-size: 0.78rem; color: var(--materio-primary);
  font-weight: 500; white-space: nowrap;
  padding: 4px 8px; border-radius: 4px;
  transition: background 0.12s;
}
.cf-ccbcc-toggle:hover { background: var(--materio-primary-light); }
.cf-ccbcc-fields { border-bottom: 1px solid var(--materio-divider); }
.cf-ccbcc-fields .cf-field-row:last-child { border-bottom: none; }
/* Format bar */
.cf-format-bar {
  display: flex; align-items: center; gap: 2px;
  padding: 6px 18px;
  border-bottom: 1px solid var(--materio-divider);
}
.cf-format-btn {
  width: 30px; height: 30px; border: none; background: none;
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--materio-text-secondary); font-size: 0.82rem;
  transition: background 0.12s, color 0.12s;
}
.cf-format-btn:hover { background: var(--materio-hover); color: var(--materio-text); }
/* Editor */
.cf-editor-wrap { flex: 1; padding: 0 18px; min-height: 0; }
.cf-editor-wrap .compose-editor {
  min-height: 140px; max-height: 38vh;
  border: none; border-radius: 0;
  padding: 12px 0; outline: none;
  font-size: 0.88rem; line-height: 1.45;
  background: transparent; color: var(--materio-text);
}
.cf-editor-wrap .compose-editor div,
.cf-editor-wrap .compose-editor p {
  margin: 0; padding: 0;
}
.cf-editor-wrap .compose-editor:focus { box-shadow: none; border-color: transparent; }
/* Attachments */
.cf-attachments { padding: 4px 18px 8px; }
/* Footer */
.compose-float .cf-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--materio-divider);
  flex-shrink: 0;
}
.cf-footer-left, .cf-footer-right {
  display: flex; align-items: center; gap: 8px;
}
.cf-send-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border: none; border-radius: 8px;
  background: var(--materio-primary); color: #fff;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(145,85,253,0.3);
}
.cf-send-btn:hover { background: var(--materio-primary-dark); box-shadow: 0 4px 12px rgba(145,85,253,0.4); }
.cf-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.cf-footer-icon-btn {
  width: 32px; height: 32px; border: none; background: none;
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--materio-text-secondary); font-size: 0.88rem;
  transition: background 0.12s, color 0.12s;
}
.cf-footer-icon-btn:hover { background: var(--materio-hover); color: var(--materio-text); }
.cf-footer-icon-btn.danger:hover { color: var(--materio-danger); background: rgba(255,76,81,0.08); }
.cf-account-select {
  border: 1px solid var(--materio-divider); border-radius: 6px;
  padding: 5px 8px; font-size: 0.78rem;
  background: var(--materio-bg); color: var(--materio-text-secondary);
  outline: none; cursor: pointer; max-width: 160px;
}
.cf-account-select:focus { border-color: var(--materio-primary); }

/* ── Compose em tela cheia: mesmo layout/formatação do popup (cf-*), porém estático ── */
.compose-float.compose-fullpage {
  position: static; transform: none;
  width: 100%; max-width: 880px; max-height: none;
  border-bottom: 1px solid var(--materio-card-border);
  border-radius: 12px;
  margin: 0 auto;
  transition: none;
}
.compose-float.compose-fullpage .cf-header { border-radius: 12px 12px 0 0; }
.compose-float.compose-fullpage .cf-body { overflow: visible; }
.compose-float.compose-fullpage .cf-editor-wrap .compose-editor {
  min-height: 340px; max-height: none;
}
.compose-float.compose-fullpage select.cf-field-input { cursor: pointer; }
.compose-float.compose-fullpage .cf-footer { border-radius: 0 0 12px 12px; }
@media (max-width: 992px) {
  .compose-float.compose-fullpage { width: 100%; right: auto; min-width: 0; }
}
@media (max-width: 600px) {
  .compose-float.compose-fullpage { width: 100%; height: auto; max-height: none; border-radius: 12px; }
  .compose-float.compose-fullpage .cf-header { border-radius: 12px 12px 0 0; }
}

/* ── Compose minimize bar (when float is collapsed) ── */
.compose-minimize {
  position: fixed; bottom: 0; right: 24px;
  background: var(--materio-primary);
  color: #fff; border-radius: 10px 10px 0 0;
  padding: 10px 20px; cursor: pointer;
  font-weight: 600; font-size: 0.85rem;
  box-shadow: 0 -2px 12px rgba(145, 85, 253, 0.3);
  z-index: 1070;
  display: none;
  animation: slideUp 0.2s ease-out;
}
.compose-minimize.visible { display: flex; align-items: center; gap: 8px; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.compose-minimize:hover { background: var(--materio-primary-dark); }

/* ── Keyboard navigation focus indicator ── */
.m-mail.keyboard-focus {
  background: var(--materio-primary-light) !important;
  border-left-color: var(--materio-primary) !important;
  box-shadow: inset 0 0 0 2px var(--materio-primary-light);
}

/* ── Email list item enhanced hover (Materio style) ── */
.m-mail {
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, border-left-color 0.2s;
}
.m-mail:hover {
  background: var(--materio-hover);
  box-shadow: 0 1px 4px rgba(58, 53, 65, 0.06);
}
.m-mail:active {
  transform: scale(0.995);
}

/* ── Sidebar section separators (Materio style) ── */
.email-sidebar .sidebar-section {
  border-top: 1px solid var(--materio-divider);
  margin-top: 12px;
  padding-top: 8px;
}
.email-sidebar .sidebar-section .email-side-title {
  padding-top: 8px;
}

/* ── Email item unread indicator bar (Materio uses left border) ── */
.m-mail.unread {
  border-left: 3px solid var(--materio-primary);
  background: rgba(145, 85, 253, 0.04);
}
body.dark-mode .m-mail.unread {
  background: rgba(145, 85, 253, 0.08);
}
.m-mail:not(.unread) {
  border-left: 3px solid transparent;
}

/* ── Enhanced sender card (read panel) ── */
.sender-card {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border: 1px solid var(--materio-divider); border-radius: 10px;
  background: var(--materio-bg); margin-bottom: 16px;
  transition: box-shadow 0.15s;
}
.sender-card:hover {
  box-shadow: 0 2px 8px rgba(58, 53, 65, 0.06);
}

/* ── Improved reply section in read panel ── */
.reply-section {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px; margin-top: 16px;
  border: 1px solid var(--materio-divider); border-radius: 10px;
  background: var(--materio-bg);
}
.reply-section .reply-input {
  flex: 1; background: var(--materio-card); border: 1px solid var(--materio-divider);
  border-radius: 8px; padding: 10px 14px; font-size: 0.88rem;
  color: var(--materio-text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reply-section .reply-input:focus {
  border-color: var(--materio-primary);
  box-shadow: 0 0 0 3px var(--materio-primary-light);
}

/* ── Enhanced attachment cards (Materio style with hover effect) ── */
.attach-card {
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.attach-card:hover {
  border-color: var(--materio-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(145, 85, 253, 0.12);
}

/* ── Enhanced compose editor toolbar (Materio style) ── */
.format-bar {
  padding: 6px 0;
  border-top: 1px solid var(--materio-divider);
  margin-top: 8px;
}
.format-bar .materio-icon-btn {
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.format-bar .materio-icon-btn:hover {
  background: var(--materio-primary-light);
  color: var(--materio-primary);
}

/* ── Email list empty state with illustration (Materio style) ── */
.m-empty {
  text-align: center; padding: 56px 20px; color: var(--materio-text-secondary);
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.m-empty i { font-size: 2rem; color: var(--materio-muted); margin-bottom: 12px; display: block; opacity: 0.6; }
.m-empty h5 { color: var(--materio-text); margin-bottom: 6px; font-weight: 600; }
.m-empty p { font-size: 0.85rem; margin-bottom: 16px; line-height: 1.5; }

/* ── Smooth page transition ── */
.materio-page {
  animation: pageIn 0.25s ease-out;
}
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

.email-app {
  display: flex;
  gap: 20px;
  padding: 20px;
  min-height: 100vh;
  max-width: 1720px;
  margin: 0 auto;
  align-items: flex-start;
  flex-wrap: nowrap;
}

/* ── Topbar (conta/config sempre no canto superior direito) ── */
.email-topbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-radius: var(--materio-radius-lg);
  box-shadow: var(--materio-shadow-sm);
  padding: 10px 16px;
  max-width: 1720px;
  margin: 20px auto 0;
}
.email-topbar .brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--materio-text);
  font-weight: 700; font-size: 0.98rem;
}
.email-topbar .brand .brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--materio-primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 3px 8px rgba(145, 85, 253, 0.35);
}
.email-topbar .hamburger { display: none; }
.email-topbar .spacer { flex: 1; }

/* ── Sidebar ─────────────────────────────── */
.email-sidebar {
  width: 258px;
  flex-shrink: 0;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-radius: var(--materio-radius-lg);
  box-shadow: var(--materio-shadow-sm);
  padding: 18px 12px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.email-sidebar .compose-wrap { padding: 0 8px 14px; }
.email-side-title {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--materio-muted);
  padding: 14px 12px 6px;
}
.email-folder {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--materio-text-secondary); font-size: 0.9rem;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background 0.12s, color 0.12s;
}
.email-folder i { width: 20px; text-align: center; font-size: 0.85rem; }
.email-folder:hover { background: var(--materio-hover); color: var(--materio-text); }
.email-folder.active { background: var(--materio-primary-light); color: var(--materio-primary); font-weight: 600; }
.email-folder .folder-count {
  margin-left: auto; font-size: 0.72rem; font-weight: 600;
  background: var(--materio-primary); color: #fff;
  border-radius: 20px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.email-folder.active .folder-count { background: var(--materio-primary); }
.email-label-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 8px; font-size: 0.87rem;
  color: var(--materio-text-secondary); cursor: pointer;
  background: none; border: none; width: 100%; text-align: left;
}
.email-label-row:hover { background: var(--materio-hover); color: var(--materio-text); }
.email-label-row.active { background: var(--materio-primary-light); color: var(--materio-primary); font-weight: 600; }

/* grupos de conta/pasta real */
.acc-group { margin-top: 4px; }
.acc-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; font-size: 0.82rem;
  color: var(--materio-text-secondary); cursor: pointer; font-weight: 500;
  background: none; border: none; width: 100%; text-align: left;
}
.acc-head:hover { background: var(--materio-hover); }
.acc-head .chev { margin-left: auto; font-size: 0.65rem; transition: transform 0.15s; }
.acc-head.open .chev { transform: rotate(180deg); }
.acc-head .acc-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-folder {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 34px; border-radius: 8px; font-size: 0.83rem;
  color: var(--materio-text-secondary); cursor: pointer;
}
.sub-folder:hover { background: var(--materio-hover); }
.sub-folder.active { background: var(--materio-primary-light); color: var(--materio-primary); font-weight: 600; }
.sub-folder .folder-count { margin-left: auto; font-size: 0.7rem; font-weight: 600; }

/* ── Lista ───────────────────────────────── */
.email-list-card {
  width: 400px; flex-shrink: 0;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-radius: var(--materio-radius-lg);
  box-shadow: var(--materio-shadow-sm);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px);
  min-height: 400px;
  overflow: hidden;
}
.email-search-bar {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--materio-divider);
}
.email-search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--materio-bg);
  border: 1px solid transparent;
  border-radius: 8px; padding: 0 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.email-search-box:focus-within {
  background: var(--materio-card);
  border-color: var(--materio-primary);
  box-shadow: 0 0 0 3px var(--materio-primary-light);
}
.email-search-box i { color: var(--materio-muted); font-size: 0.82rem; }
.email-search-box input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--materio-text); padding: 9px 0; font-size: 0.87rem; font-family: inherit;
}
.email-search-box input::placeholder { color: var(--materio-muted); }
.email-search-adv {
  margin-top: 10px; background: var(--materio-bg);
  border: 1px solid var(--materio-divider); border-radius: 10px; padding: 12px;
}
.email-search-adv .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }

.email-list-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--materio-divider);
}
.email-list-toolbar .sep { width: 1px; height: 20px; background: var(--materio-divider); margin: 0 6px; }
.email-list-toolbar .page-info { margin-left: auto; font-size: 0.76rem; color: var(--materio-muted); white-space: nowrap; }

#mail-list { flex: 1; overflow-y: auto; min-height: 200px; }

/* Linha de e-mail estilo Materio */
.m-mail {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 14px 13px 12px;
  border-bottom: 1px solid var(--materio-divider);
  border-left: 3px solid transparent;
  cursor: pointer; transition: background 0.1s;
  position: relative;
}
.m-mail:hover { background: var(--materio-hover); }
.m-mail.selected { background: var(--materio-primary-light); }
.m-mail.active { background: var(--materio-primary-light); border-left-color: var(--materio-primary); }
.m-mail.unread { border-left-color: var(--materio-primary); background: rgba(145, 85, 253, 0.04); }
body.dark-mode .m-mail.unread { background: rgba(145, 85, 253, 0.08); }
.m-mail .m-check { margin-top: 3px; }
.m-mail .m-check input { width: 15px; height: 15px; accent-color: var(--materio-primary); cursor: pointer; }
.m-mail .m-main { flex: 1; min-width: 0; }
.m-mail .m-top { display: flex; align-items: center; gap: 8px; }
.m-mail .m-from { font-size: 0.86rem; color: var(--materio-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.m-mail.unread .m-from { font-weight: 700; }
.m-mail .m-time { font-size: 0.72rem; color: var(--materio-muted); white-space: nowrap; }
.m-mail.unread .m-time { color: var(--materio-primary); font-weight: 600; }
.m-mail .m-subject { font-size: 0.83rem; color: var(--materio-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.m-mail.unread .m-subject { font-weight: 600; }
.m-mail .m-snippet { font-size: 0.79rem; color: var(--materio-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-mail .m-flags { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.m-mail .m-flags:empty { display: none; margin: 0; }
.m-mail .m-star { background: none; border: none; cursor: pointer; color: var(--materio-muted); font-size: 0.78rem; padding: 0; margin-left: 2px; flex-shrink: 0; }
.m-mail .m-star:hover { color: var(--materio-warning); }
.m-mail .m-star.active { color: var(--materio-warning); }
.m-mail .m-clip { color: var(--materio-muted); font-size: 0.72rem; }
.m-mail .m-acct-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.m-mail .m-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--materio-primary); display: inline-block; flex-shrink: 0; }

.m-loading { text-align: center; padding: 56px 20px; color: var(--materio-muted); }
.m-loading .spinner-materio {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--materio-divider); border-top-color: var(--materio-primary);
  animation: mspin 0.8s linear infinite; margin: 0 auto 14px;
}
@keyframes mspin { to { transform: rotate(360deg); } }

/* ── Card genérico de conteúdo (Configurações etc.): fluxo normal,
   nunca vira painel off-canvas ── */
.email-content-card {
  flex: 1; min-width: 0;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-radius: var(--materio-radius-lg);
  box-shadow: var(--materio-shadow-sm);
  overflow: hidden;
}

/* ── Leitura ─────────────────────────────── */
.email-view-card {
  flex: 1; min-width: 0;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-radius: var(--materio-radius-lg);
  box-shadow: var(--materio-shadow-sm);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px);
  min-height: 400px;
  overflow: hidden;
  position: relative;
}
/* Transição de entrada do conteúdo (como no original) */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.email-view-scroll.view-enter { animation: viewIn 0.22s ease-out; }
.email-view-card .only-overlay { display: none; }
.email-view-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 10px 16px; border-bottom: 1px solid var(--materio-divider);
  flex-wrap: wrap;
  background: var(--materio-card);
  position: sticky; top: 0; z-index: 5;
  flex-shrink: 0;
}
.email-view-toolbar .sep { width: 1px; height: 20px; background: var(--materio-divider); margin: 0 6px; }
/* Translation popup near toolbar button */
.translation-popup {
  position: fixed; z-index: 1000;
  background: var(--materio-card);
  border: 1px solid var(--materio-card-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(58,53,65,0.18);
  padding: 14px 16px;
  min-width: 300px; max-width: 420px;
  animation: popIn 0.18s ease-out;
}
body.dark-mode .translation-popup { box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
@keyframes popIn { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.email-view-scroll { flex: 1; overflow-y: auto; padding: 22px 26px; }
.email-view-subject { font-size: 1.25rem; font-weight: 600; margin: 0 0 4px; color: var(--materio-text); line-height: 1.35; }
.email-view-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.sender-card .s-info { flex: 1; min-width: 0; }
.sender-card .s-name { font-weight: 600; font-size: 0.92rem; }
.sender-card .s-addr { font-size: 0.8rem; color: var(--materio-text-secondary); }
.sender-card .s-meta { font-size: 0.78rem; color: var(--materio-muted); margin-top: 4px; }
.sender-card .s-date { font-size: 0.78rem; color: var(--materio-muted); white-space: nowrap; }
.email-html-body { font-size: 0.92rem; line-height: 1.7; color: var(--materio-text); overflow-wrap: anywhere; }
/* Corpo do e-mail isolado em iframe: o CSS da mensagem nunca quebra o app */
.mail-frame {
  width: 100%; min-height: 160px;
  border: 1px solid var(--materio-divider); border-radius: 10px;
  background: #fff; display: block;
}
.email-html-body img { max-width: 100%; height: auto; border-radius: 8px; }
.email-html-body pre { background: var(--materio-bg); padding: 14px; border-radius: 8px; overflow-x: auto; border: 1px solid var(--materio-divider); }
.email-html-body blockquote { border-left: 3px solid var(--materio-primary); padding-left: 12px; color: var(--materio-text-secondary); margin: 12px 0; }
.attach-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.attach-card {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--materio-divider); border-radius: 10px;
  padding: 10px 12px; font-size: 0.82rem; text-decoration: none;
  color: var(--materio-text); background: var(--materio-bg);
  max-width: 260px; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.attach-card:hover {
  border-color: var(--materio-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(145, 85, 253, 0.12);
}
.attach-card .a-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: var(--materio-primary-light); color: var(--materio-primary);
  display: flex; align-items: center; justify-content: center;
}
.attach-card small { color: var(--materio-muted); display: block; }
.view-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--materio-muted); padding: 40px; text-align: center;
}
.view-placeholder i { font-size: 2.4rem; margin-bottom: 12px; opacity: 0.5; }

/* Resposta rápida */
.quick-reply {
  display: flex; gap: 10px; align-items: center;
  border-top: 1px solid var(--materio-divider); padding: 12px 18px;
  background: var(--materio-card);
}

/* Cabeçalhos de redigir: título à esquerda, ações sempre à direita */
.materio-modal .modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.materio-modal .modal-header .modal-title { margin: 0; flex: 1; min-width: 0; }
.materio-card-header > div:last-child { margin-left: auto; }

/* Compose fields — bordered-box style matching Materio template (overrides site.css underline) */
.compose-field { display: flex; flex-direction: column; gap: 6px; padding: 0 0 2px; margin-bottom: 14px; border-bottom: none !important; }
.compose-field .materio-label { font-size: 0.82rem; font-weight: 500; color: var(--materio-text-secondary); margin-bottom: 2px; }
.compose-field .materio-input,
.compose-field .materio-select {
  width: 100%;
  border: 1px solid var(--materio-card-border);
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--materio-bg);
  color: var(--materio-text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compose-field .materio-input:focus,
.compose-field .materio-select:focus {
  border-color: var(--materio-primary);
  box-shadow: 0 0 0 3px var(--materio-primary-light);
  background: var(--materio-card);
}
.compose-field .materio-input::placeholder { color: var(--materio-muted); }
/* Override site.css generic input reset inside compose-fields */
.compose-field input:not(.materio-input),
.compose-field select:not(.materio-select) {
  flex: 1; background: none; border: none; outline: none;
  color: var(--materio-text); font-size: 0.9rem; font-family: inherit;
}
.materio-modal .modal-footer.compose-foot {
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.materio-modal .modal-footer.compose-foot .cf-group {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.materio-modal .modal-footer.compose-foot .materio-btn-primary,
.materio-modal .modal-footer.compose-foot .materio-btn-outline {
  min-height: 38px;
}
.compose-editor {
  min-height: 220px; max-height: 46vh; overflow-y: auto;
  border: 1px solid var(--materio-divider); border-radius: 8px;
  padding: 12px 14px; outline: none; font-size: 0.9rem; line-height: 1.45;
  background: var(--materio-card); color: var(--materio-text);
}
.compose-editor div,
.compose-editor p {
  margin: 0; padding: 0;
}
.compose-editor:empty::before { content: attr(data-placeholder); color: var(--materio-muted); }
.compose-editor:focus { border-color: var(--materio-primary); }
.format-bar { display: flex; gap: 2px; align-items: center; padding: 6px 0; }
.chip-attach {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--materio-bg); border: 1px solid var(--materio-divider);
  border-radius: 20px; padding: 5px 8px 5px 12px; font-size: 0.78rem; margin: 0 6px 6px 0;
}
.chip-attach button { border: none; background: none; color: var(--materio-danger); cursor: pointer; }

/* Busca avançada toggle */
.adv-toggle { font-size: 0.78rem; }

/* Densidade compacta da lista */
#mail-list.density-compact .m-mail { padding: 7px 14px 7px 12px; }
#mail-list.density-compact .m-snippet { display: none; }
#mail-list.density-compact .m-flags { margin-top: 2px; }

/* ── Responsivo ──────────────────────────── */
@media (max-width: 1400px) {
  .email-list-card { width: 360px; }
}
@media (max-width: 1280px) {
  /* Só o painel de leitura do Index (#email-view) vira overlay deslizante;
     outras páginas que usam .email-view-card (ex.: ViewMail) seguem normais */
  #email-view.email-view-card {
    position: fixed; top: 20px; right: 20px; bottom: 20px; z-index: 1060;
    width: min(720px, calc(100vw - 40px));
    flex: none;
    max-height: none;
    transform: translateX(calc(100% + 40px));
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--materio-shadow);
  }
  #email-view.email-view-card.mobile-open { transform: none; }
  .email-view-card .only-overlay { display: none; }
  #email-view.email-view-card .only-overlay { display: inline-flex; }
  .view-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1055;
    animation: backdropIn 0.2s ease-out;
  }
  @keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
  .email-list-card { flex: 1; min-width: 0; }
  .compose-float { width: 60vw; right: 12px; }
}
@media (max-width: 992px) {
  .email-app { padding: 12px; gap: 12px; }
  .email-topbar { margin: 12px 12px 0; }
  .email-topbar .hamburger { display: inline-flex; }
  .email-topbar .brand span { display: none; }
  .email-sidebar {
    position: fixed; left: 12px; top: 12px; bottom: 12px; z-index: 1050;
    transform: translateX(-110%); transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: none;
  }
  .email-sidebar.open { transform: none; box-shadow: var(--materio-shadow); }
  .email-list-card { flex-basis: 100%; width: 100%; max-height: calc(100vh - 140px); }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1040;
    animation: backdropIn 0.2s ease-out;
  }
  .compose-float { width: 90vw; right: 5vw; min-width: 0; }
}
@media (max-width: 600px) {
  .compose-float { width: 100vw; height: 100vh; max-height: 100vh; right: 0; bottom: 0; border-radius: 0; }
  .compose-float .cf-header { border-radius: 0; }
  .compose-float .cf-editor-wrap { flex: 1; }
  .compose-float .compose-editor { min-height: 200px; }
}

/* ── Translation Modal (shared, dynamically created) ────────────── */
#sharedTranslationModal .modal-content {
  border: 1px solid var(--materio-card-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(58, 53, 65, 0.18);
}
body.dark-mode #sharedTranslationModal .modal-content {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
#sharedTranslationModal .modal-header {
  background: var(--materio-bg);
  border-bottom: 1px solid var(--materio-divider);
  padding: 16px 20px;
  border-radius: 12px 12px 0 0;
}
#sharedTranslationModal .modal-body {
  padding: 20px;
  background: var(--materio-card);
}
#sharedTranslationResult {
  background: var(--materio-bg);
  border: 1px solid var(--materio-divider);
  border-radius: 12px;
  overflow: hidden;
}
#sharedTranslationText {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--materio-text);
}
#sharedTranslationText p {
  margin-bottom: 12px;
}
#sharedTranslationText p:last-child {
  margin-bottom: 0;
}
@media (max-width: 600px) {
  #sharedTranslationModal .modal-dialog {
    margin: 8px;
    max-width: calc(100% - 16px);
  }
  #sharedTranslationModal .modal-body {
    padding: 16px;
  }
  #sharedTranslationResult {
    font-size: 0.85rem;
  }
}
