@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Paleta de marca real de Grupo GESE (tomada de grupogese.com.mx) */
  --primary: #002185;
  --accent: #0a277e;
  --grad: linear-gradient(135deg, #002185, #0a277e);

  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f7f8fb;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #94a3b8;
  --border: #e5e9f1;
  --border-soft: #edf0f6;
  --hover: #eef1f8;

  --sidebar-bg: #050e2e;
  --sidebar-text: #aab6d6;
  --sidebar-text-dim: #74809f;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(255,255,255,.12);

  --primary-soft: #e8ecfb;
  --primary-soft-border: #d2daf4;
  --success: #059669;
  --danger: #e11d48;
  --warning: #f59e0b;

  --unread-bg: #f3f5fc;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 10px 30px -10px rgba(15, 23, 42, .18), 0 2px 6px rgba(15,23,42,.06);
  --shadow-lg: 0 30px 70px -20px rgba(15, 23, 42, .4);
}

:root[data-theme="dark"] {
  --bg: #090d1c;
  --panel: #11172e;
  --panel-2: #151c38;
  --text: #e8ecf8;
  --muted: #aab3cf;
  --muted-2: #6c7699;
  --border: #222b4d;
  --border-soft: #1c2545;
  --hover: #19213f;

  --sidebar-bg: #060916;

  --primary-soft: #1b1f3d;
  --primary-soft-border: #2a2f57;
  --unread-bg: #141a35;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--primary-soft-border); }
button, input, textarea, select { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -4px; }
.page-card h2 .icon { margin-right: 4px; }
.icon-sm { width: 15px; height: 15px; }

/* ---------- Topbar ---------- */
.topbar {
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 800;
  box-shadow: 0 6px 16px -6px var(--primary);
}
.brand-mark-logo { height: 30px; width: auto; max-width: 110px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px 6px; }
.topbar-search { flex: 1; max-width: 480px; position: relative; }
.topbar-search input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px 9px 38px;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.topbar-search input:focus { outline: none; border-color: var(--primary); background: var(--panel); box-shadow: 0 0 0 4px var(--primary-soft); }
.topbar-search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: transparent; border: none; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn--danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 5px; border-radius: 999px; }
.user-chip:hover { background: var(--hover); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11.5px; font-weight: 700; flex-shrink: 0;
  letter-spacing: .02em;
}
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.avatar.sm { width: 21px; height: 21px; font-size: 9.5px; }
.user-chip .user-email { font-size: 13px; color: var(--text); font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.layout { display: flex; height: calc(100vh - 60px); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 18px 14px 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.compose-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--grad);
  color: #fff; font-weight: 700; font-size: 15px;
  border: none; border-radius: 13px; height: 46px;
  cursor: pointer; margin-bottom: 18px; box-shadow: 0 10px 24px -10px var(--primary);
  transition: transform .15s ease, filter .15s ease;
}
.compose-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.compose-btn:active { transform: translateY(0) scale(.98); }
.compose-icon-wrap { display: flex; }

/* ---------- Grupos de cuenta (estilo Outlook, colapsables, nativos <details>) ---------- */
.accounts-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; margin: 0 -14px; padding: 0 14px; }
.account-group { border-radius: var(--radius-sm); }
.account-group + .account-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.07); }
.account-header {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  cursor: pointer; list-style: none; user-select: none;
  transition: background .13s ease;
}
.account-header::-webkit-details-marker { display: none; }
.account-header:hover { background: var(--sidebar-hover); }
.account-name {
  font-size: 12.5px; font-weight: 700; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1;
  letter-spacing: -.01em;
}
.account-unread {
  font-size: 10.5px; font-weight: 800; color: #fff;
  background: var(--primary); border-radius: 999px;
  padding: 1.5px 6.5px; flex-shrink: 0;
}
.account-remove {
  display: none; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  color: var(--sidebar-text-dim);
}
.account-remove:hover { background: rgba(225,29,72,.2); color: #fca5a5; }
.account-header:hover .account-remove { display: flex; }
.account-header:hover .chevron { display: none; }
.chevron { color: var(--sidebar-text-dim); transition: transform .18s ease; flex-shrink: 0; }
.account-group[open] .chevron { transform: rotate(180deg); }

.nav-group { display: flex; flex-direction: column; gap: 1px; padding: 4px 0 8px 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .13s ease, color .13s ease;
}
.nav-item.active { background: var(--sidebar-active); box-shadow: inset 3px 0 0 var(--accent); }
.nav-icon {
  width: 27px; height: 27px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--sidebar-text-dim); background: transparent;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.nav-icon .icon { width: 15px; height: 15px; }
.nav-item:hover { color: #fff; }
.nav-item:hover .nav-icon { color: #fff; }
.nav-item.active { color: #fff; font-weight: 700; }
.nav-item.active .nav-icon {
  background: var(--grad); color: #fff;
  box-shadow: 0 2px 10px -2px var(--primary);
}

.add-account-link {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 7px 10px 7px 6px; border-radius: var(--radius-sm);
  color: var(--sidebar-text-dim); font-size: 12.5px; font-weight: 600;
  border: 1px dashed rgba(255,255,255,.16);
}
.add-account-link .nav-icon { background: transparent; }
.add-account-link:hover { color: #fff; border-color: rgba(255,255,255,.32); text-decoration: none; }
.add-account-link:hover .nav-icon { background: var(--sidebar-hover); color: #fff; }

.sidebar-footer { margin-top: 12px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.sidebar-footer a { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text-dim); font-size: 12px; padding: 7px 11px; border-radius: var(--radius-sm); }
.sidebar-footer a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }

/* ---------- Mail shell (list + preview) ---------- */
.mail-shell { flex: 1; display: flex; min-width: 0; }
.msg-pane { width: 400px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--panel); min-width: 0; }
.msg-pane-header { padding: 18px 20px 6px; display: flex; align-items: baseline; justify-content: space-between; }
.msg-pane-header h2 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.msg-pane-header .total { font-size: 12.5px; color: var(--muted-2); font-weight: 600; }

.list-search { position: relative; margin: 8px 20px 10px; display: flex; align-items: center; }
.list-search .icon { position: absolute; left: 12px; color: var(--muted-2); pointer-events: none; }
.list-search input { width: 100%; padding-left: 36px; padding-right: 32px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding-top: 9px; padding-bottom: 9px; font-size: 13.5px; color: var(--text); }
.list-search input:focus { outline: none; border-color: var(--primary); background: var(--panel); }
.list-search .clear-btn { position: absolute; right: 8px; border: 0; background: none; color: var(--muted-2); display: flex; cursor: pointer; padding: 4px; border-radius: 6px; }
.list-search .clear-btn:hover { background: var(--border); color: var(--text); }

.seg { display: inline-flex; background: var(--hover); padding: 3px; border-radius: var(--radius-sm); gap: 2px; margin: 0 20px 10px; }
.seg a { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.seg a.is-active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

.msg-scroll { flex: 1; overflow-y: auto; padding: 0 10px 16px; }
.day-label { padding: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }

.msg-row {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 12px; cursor: pointer;
  border-radius: var(--radius); border: 1px solid transparent;
  margin-bottom: 2px;
  transition: background .12s ease;
}
.msg-row:hover { background: var(--hover); }
.msg-row.active { background: color-mix(in srgb, var(--primary) 9%, var(--panel)); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.msg-row.unread { background: var(--unread-bg); }
.msg-row.unread.active { background: color-mix(in srgb, var(--primary) 9%, var(--panel)); }

.msg-row .avatar { margin-top: 1px; }
.msg-row-body { min-width: 0; flex: 1; }
.msg-row-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.msg-from { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row:not(.unread) .msg-from { font-weight: 500; color: var(--muted); }
.msg-date { margin-left: auto; font-size: 12px; color: var(--muted-2); flex-shrink: 0; }
.msg-subject { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 5px; }
.msg-row.unread .msg-subject { color: var(--text); font-weight: 700; }
.msg-meta-row { display: flex; align-items: center; gap: 8px; color: var(--muted-2); min-height: 16px; }
.unread-dot { position: absolute; right: 14px; top: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pager a { color: var(--text); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.pager a:hover { color: var(--primary); }
.pager .disabled { opacity: .35; pointer-events: none; }

/* ---------- Preview pane (lector) ---------- */
.preview-pane { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg); padding: 18px 22px 22px; }
.preview-empty {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted-2); gap: 10px; padding: 40px;
}
.preview-empty .icon { width: 46px; height: 46px; opacity: .4; }
.preview-empty p { font-size: 13.5px; margin: 0; }

.preview-content { max-width: 820px; margin: 0 auto; }
.preview-head {
  background: var(--panel); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 16px 16px 0 0; padding: 10px 24px 16px; box-shadow: var(--shadow-sm);
}
.preview-bar { display: flex; align-items: center; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.preview-bar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.preview-subject { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 14px 0 14px; line-height: 1.25; }
.preview-meta { display: flex; align-items: center; gap: 12px; }
.preview-meta-text { flex: 1; min-width: 0; }
.preview-meta-name { font-size: 14px; }
.preview-meta-name b { font-weight: 700; }
.preview-meta-to { font-size: 12.5px; color: var(--muted-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-meta-date { font-size: 12.5px; color: var(--muted-2); white-space: nowrap; flex-shrink: 0; }

.preview-body-card {
  background: #fff; border: 1px solid var(--border); border-top: 1px solid var(--border);
  border-radius: 0 0 16px 16px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.preview-body { font-size: 14.5px; line-height: 1.65; color: #1f2937; white-space: pre-wrap; padding: 22px 26px; }
.preview-body iframe { width: 100%; border: none; min-height: 420px; background: #fff; display: block; }

.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.notice { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 14px; border-radius: 10px; background: color-mix(in srgb, var(--warning) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.preview-bar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; flex-shrink: 0; }

.attachments { margin-top: 0; }
.attach-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 13px 5px 10px; font-size: 12.5px; font-weight: 500;
  color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.attachment-chip small { color: var(--muted-2); }
.attachment-chip:hover { border-color: var(--primary); text-decoration: none; }
.attachment-chip .icon { color: var(--muted); width: 14px; height: 14px; }

.preview-actions { display: none; } /* las acciones viven ahora en .preview-bar */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  cursor: pointer; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn .icon { width: 15px; height: 15px; }
.btn:hover { background: var(--hover); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.secondary { background: var(--panel); color: var(--text); }
.btn:not(.secondary):not(.danger) {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--primary) 70%, transparent);
}
.btn:not(.secondary):not(.danger):hover { filter: brightness(1.08); background: var(--grad); }
.btn.danger { color: var(--danger); background: var(--panel); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }

/* ---------- Login (hero dividido, igual a panel.alanquezada) ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  color: #fff; padding: 8vh 7vw; display: flex; flex-direction: column; justify-content: center; gap: 22px;
  background: radial-gradient(900px 500px at 10% 0%, rgba(255,255,255,.2), transparent 60%), var(--grad);
}
.login-hero .login-logo { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.2); backdrop-filter: blur(6px); }
.login-hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.1; letter-spacing: -.03em; margin: 0; }
.login-hero p { font-size: 17px; opacity: .9; max-width: 460px; margin: 0; }
.login-hero ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 12px; font-weight: 600; }
.login-hero ul li { display: flex; gap: 10px; align-items: center; }
.login-hero--logo { align-items: center; justify-content: center; }
.login-hero-logo { max-width: 320px; width: 70%; filter: drop-shadow(0 10px 30px rgba(0,0,0,.25)); background: #fff; padding: 28px 36px; border-radius: 20px; }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.login-box { width: min(380px, 100%); }
.login-box h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 2px; font-weight: 800; }
.login-box .sub { font-size: 13.5px; color: var(--muted); margin: 0 0 20px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: var(--panel); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.field textarea { resize: vertical; font-family: inherit; line-height: 1.5; }

.error { background: color-mix(in srgb, var(--danger) 10%, var(--panel)); color: var(--danger); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.ok { background: color-mix(in srgb, var(--success) 10%, var(--panel)); color: var(--success); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--success) 30%, transparent); }

/* ---------- Páginas de contenido (compose, firma, plantillas) ---------- */
.content-page { flex: 1; overflow-y: auto; padding: 32px 40px 60px; }
.page-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 34px 40px 36px; box-shadow: var(--shadow-md); width: 100%; max-width: 1100px; margin: 0 auto; height: fit-content; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .field-row { grid-template-columns: 1fr; } }
.page-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.page-card h2 { margin: 0; font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.page-card h2 .icon-wrap {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px var(--primary);
}
.from-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px 5px 6px; margin: 14px 0 20px;
}
.from-chip strong { color: var(--text); font-weight: 700; }

.empty { color: var(--muted-2); padding: 60px 20px; text-align: center; font-size: 13.5px; }

/* ---------- Adjuntos: zona de carga (compose) ---------- */
.attach-zone {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 24px 20px; text-align: center; cursor: pointer; position: relative;
  color: var(--muted); font-size: 13.5px; transition: border-color .15s ease, background .15s ease;
  margin-bottom: 4px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--panel-2);
}
.attach-zone:hover, .attach-zone.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.attach-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.attach-zone .zone-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--panel); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--primary); margin-bottom: 4px;
}
.attach-zone .zone-icon .icon { width: 20px; height: 20px; }
.attach-zone strong { color: var(--primary); font-weight: 700; }
.attach-zone .zone-hint { font-size: 12px; color: var(--muted-2); }

.attach-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.attach-item {
  display: inline-flex; align-items: center; gap: 9px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 10px 9px 13px; font-size: 13px; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.attach-item .file-icon {
  width: 26px; height: 26px; border-radius: 7px; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.attach-item .file-icon .icon { width: 14px; height: 14px; }
.attach-item .remove-file { cursor: pointer; color: var(--muted-2); display: flex; border-radius: 5px; padding: 3px; margin-left: 2px; }
.attach-item .remove-file:hover { background: var(--border); color: var(--danger); }

/* ---------- Adjuntos recibidos: thumbnails + lightbox ---------- */
.attach-thumb { width: 96px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.attach-thumb-img {
  width: 96px; height: 96px; border-radius: var(--radius-sm); object-fit: cover;
  border: 1px solid var(--border); background: var(--panel-2); transition: transform .15s ease, box-shadow .15s ease;
}
.attach-thumb:hover .attach-thumb-img { transform: scale(1.03); box-shadow: var(--shadow-md); }
.attach-thumb-name { font-size: 11px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(8,12,30,.72); z-index: 50; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.lightbox-overlay img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox-close {
  position: absolute; top: 20px; right: 24px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.22); }

/* ---------- Editor de texto enriquecido ---------- */
.editor-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 6px;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--panel-2);
}
.editor-toolbar button {
  width: 30px; height: 30px; border: none; background: transparent; border-radius: 6px;
  color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.editor-toolbar button:hover { background: var(--border); color: var(--text); }
.editor-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.editor-area {
  border: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 12px 14px; font-size: 14px; line-height: 1.6; color: var(--text); background: var(--panel);
  overflow-y: auto; max-height: 420px;
}
.editor-area:focus { outline: none; border-color: var(--primary); }
.editor-area blockquote { margin: 8px 0; border-left: 3px solid var(--border); padding-left: 12px; color: var(--muted); }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 14px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.template-picker select {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px;
  font-size: 13px; background: var(--panel); color: var(--text); cursor: pointer;
}

.sig-logo-preview { display: flex; align-items: center; gap: 16px; }
.sig-logo-preview img { max-width: 220px; max-height: 110px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: #fff; }

.template-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.template-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--border-soft);
}
.template-name { font-size: 13.5px; font-weight: 700; }
.template-subject { font-size: 12px; color: var(--muted); margin-top: 2px; }
.template-row form { margin: 0; }

/* ---------- Mover a carpeta / marcar importante ---------- */
.move-dropdown { position: relative; display: inline-block; }
.move-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; display: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px; max-height: 260px; overflow-y: auto;
}
.move-menu.open { display: block; }
.move-menu a {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.move-menu a:hover { background: var(--hover); text-decoration: none; }
.flag-btn.is-flagged { color: var(--warning); }
.flag-btn.is-flagged svg { fill: var(--warning); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sidebar { width: 224px; }
  .msg-pane { width: 340px; }
}
@media (max-width: 860px) {
  .msg-pane { width: 100%; }
  .preview-pane { display: none; }
  .mail-shell.has-preview .msg-pane { display: none; }
  .mail-shell.has-preview .preview-pane { display: block; }
  .topbar-search { display: none; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
