/* ================= Oficina Digital — estilos generales ================= */

:root {
  /* Paleta: neutros cálidos con tinte violeta + acento índigo */
  --bg: #f1f1f6;
  --surface: #ffffff;
  --surface-2: #f4f4f8;
  --surface-3: #ececf3;
  --border: #e4e4ec;
  --border-strong: #d2d3de;
  --text: #1a1b25;
  --text-2: #41434f;
  --muted: #71737f;
  --accent: #5457e0;
  --accent-hover: #4649c9;
  --accent-soft: #ededfd;
  --accent-softer: #f6f6fe;
  --accent-ink: #3f42b8;
  --ring: rgba(84, 87, 224, .22);
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #5457e0 55%, #7a5af8 100%);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --warn: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(23, 23, 46, .05);
  --shadow: 0 1px 2px rgba(23, 23, 46, .04), 0 2px 8px rgba(23, 23, 46, .05);
  --shadow-md: 0 4px 14px rgba(23, 23, 46, .08), 0 1px 3px rgba(23, 23, 46, .05);
  --shadow-lg: 0 10px 28px rgba(23, 23, 46, .11), 0 2px 8px rgba(23, 23, 46, .06);
  --shadow-xl: 0 24px 64px rgba(23, 23, 46, .2), 0 6px 18px rgba(23, 23, 46, .1);
  --shadow-accent: 0 1px 2px rgba(70, 73, 201, .3), 0 5px 14px rgba(84, 87, 224, .3);
  --t-fast: .14s;
  --t-med: .2s;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv05" 1, "cv11" 1, "ss01" 1;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

/* ================= Estructura ================= */

.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Barra superior de navegación */
.topnav {
  height: 60px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  height: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
}
.brand-logo svg { width: 19px; height: 19px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }

.topnav-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}
.topnav-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 14px 5px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background .15s, color .15s;
}
.topnav-nav a svg { width: 19px; height: 19px; }
.topnav-nav a:hover { background: var(--surface-2); color: var(--text); }
.topnav-nav a.active { background: var(--accent-soft); color: var(--accent); }

.nav-badge {
  position: absolute;
  top: 0;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}

.topnav-right { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.topnav-avatar {
  width: 34px; height: 34px;
  font-size: 12.5px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s, transform .12s;
}
.topnav-avatar:hover { border-color: var(--accent-soft); transform: scale(1.04); }

/* Cabecera contextual del módulo (ligera, integrada en el contenido) */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.main-inner { display: contents; }

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px 0;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-actions { display: flex; gap: 8px; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 24px 24px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ================= Componentes comunes ================= */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.search-box {
  position: relative;
  display: flex; align-items: center;
}
.search-box svg {
  position: absolute; left: 10px;
  width: 15px; height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  width: 260px;
  padding: 8px 12px 8px 33px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.global-search-wrap {
  position: relative;
  flex-shrink: 0;
}
.global-search-box input {
  width: 220px;
  transition: width .2s, border-color .15s, box-shadow .15s;
}
.global-search-box input:focus {
  width: 320px;
}
.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 420px;
  max-width: calc(100vw - 28px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 160;
  padding: 6px;
}
.global-search-results[hidden] { display: none !important; }
.gs-loading, .gs-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.gs-group { margin-bottom: 4px; }
.gs-group:last-child { margin-bottom: 0; }
.gs-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.gs-group-head svg { width: 13px; height: 13px; }
.gs-item {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: left;
  transition: background .12s;
}
.gs-item:hover, .gs-item.hl { background: var(--surface-2); }
.gs-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.gs-icon svg { width: 15px; height: 15px; }
.gs-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.gs-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.gs-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gs-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gs-snippet {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .global-search-box input { width: 150px; }
  .global-search-box input:focus { width: 200px; }
  .global-search-results { width: 340px; }
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-weight: 500; }
.checkbox-field input { width: 16px; height: 16px; accent-color: var(--accent); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.badge {
  display: inline-flex; align-items: center;
  min-width: 19px; height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  justify-content: center;
}

.pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.prio-baja { background: #f1f5f9; color: #475569; }
.prio-media { background: #fef3c7; color: #b45309; }
.prio-alta { background: #fee2e2; color: #b91c1c; }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.empty-state {
  height: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}
.empty-state svg { width: 40px; height: 40px; opacity: .45; }
.empty-state .title { font-weight: 600; color: var(--text); }

.loading { padding: 40px; text-align: center; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ================= Dashboard ================= */

.dash-header { margin-bottom: 22px; }
.dash-header h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.dash-header p { color: var(--muted); margin-top: 3px; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-value { font-size: 23px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.dash-panel h3 {
  font-size: 14px; font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.dash-panel h3 a { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.dash-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--surface-2);
  cursor: pointer;
  transition: background .12s;
  min-width: 0;
}
.dash-item:last-child { border-bottom: none; border-radius: 0 0 var(--radius) var(--radius); }
.dash-item:hover { background: var(--surface-2); }
.dash-item .grow { flex: 1; min-width: 0; }
.dash-item .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-item .t2 { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-item .meta { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* ================= Correo ================= */

.mail-layout {
  display: grid;
  grid-template-columns: var(--mf-w, 200px) 6px 380px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  height: calc(100vh - 148px);
  overflow: hidden;
}

.mail-splitter {
  cursor: col-resize;
  background: transparent;
  transition: background .15s;
}
.mail-splitter:hover, .mail-splitter.dragging { background: var(--accent-soft); }

.mail-folders {
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  overflow-y: auto;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
}
#mail-folders { flex: 1; min-height: 0; overflow-y: auto; }
#mail-quota { padding: 10px 6px 0; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
#mail-quota:empty { display: none; }
.quota-label { margin-bottom: 5px; }
.quota-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.quota-fill { height: 100%; border-radius: 3px; background: var(--accent); }
.quota-bar.warn .quota-fill { background: var(--danger); }
.mail-folder {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  transition: background .12s, color .12s;
}
.mail-folder svg { width: 16px; height: 16px; flex-shrink: 0; }
.mail-folder > span:not(.badge) {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-folder .badge { flex-shrink: 0; }
.mail-folder:hover { background: var(--surface-2); color: var(--text); }
.mail-folder.active { background: var(--accent-soft); color: var(--accent); }
.mail-folder .badge { margin-left: auto; }

.mail-list { border-right: 1px solid var(--border); overflow-y: auto; }
.mail-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  position: sticky; top: 0;
  z-index: 4;
}
.mail-density {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.mail-density button {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.mail-density button.active { background: var(--accent); color: #fff; }
.mail-per-page select {
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  outline: none;
}
.mail-per-page select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mail-list-tools { display: flex; align-items: center; gap: 6px; }
.mail-list-tools .icon-btn { width: 28px; height: 28px; }
.mail-list-tools .icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.mail-list-tools .icon-btn.spinning svg { animation: mail-spin .8s linear infinite; }
@keyframes mail-spin { to { transform: rotate(360deg); } }
.folder-add-btn {
  width: calc(100% - 16px);
  margin: 10px 8px;
  justify-content: center;
}

.mail-item {
  display: flex; gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--surface-2);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.mail-item:hover { background: var(--surface-2); }
.mail-item.selected { background: var(--accent-soft); }
.mail-item.unread .mi-subject { font-weight: 700; }
.mail-item.unread .mi-sender { font-weight: 700; color: var(--text); }
.mail-item.unread::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.mi-main { flex: 1; min-width: 0; }
.mi-top { display: flex; align-items: baseline; gap: 8px; }
.mi-sender { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-date { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.mi-subject { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mi-snippet { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mi-star { color: #d1d5db; flex-shrink: 0; align-self: center; }
.mi-star svg { width: 16px; height: 16px; display: block; }
.mi-star:hover { color: #f59e0b; }
.mi-star.starred { color: #f59e0b; }

.density-compact .mail-item { padding: 7px 10px; }
.density-compact .mail-item .avatar { width: 30px; height: 30px; font-size: 11px; }
.density-compact .mi-sender { font-size: 12px; }
.density-compact .mi-subject { font-size: 12px; }
.density-compact .mi-snippet { font-size: 11.5px; }
.density-compact .mi-date { font-size: 11px; }
.density-compact .thread-child { padding-left: 10px; }

.mail-view { overflow-y: auto; display: flex; flex-direction: column; }
.mv-header { padding: 20px 24px 14px; border-bottom: 1px solid var(--border); }
.mv-subject { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 10px; }
.mv-meta { display: flex; align-items: center; gap: 12px; }
.mv-meta .who { flex: 1; min-width: 0; }
.mv-meta .from { font-weight: 600; font-size: 13px; }
.mv-meta .to { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-meta .date { font-size: 12.5px; color: var(--muted); }
.mv-actions { display: flex; gap: 6px; padding: 10px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mv-body {
  padding: 22px 24px;
  white-space: normal;
  line-height: 1.6;
  font-size: 14px;
  flex: 1;
}
.mv-body.rich { white-space: normal; }

/* ================= Contactos ================= */

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.contact-card {
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.contact-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.cc-top { display: flex; align-items: center; gap: 13px; }
.cc-top .avatar { width: 46px; height: 46px; font-size: 15px; }
.cc-name { font-weight: 700; font-size: 15px; }
.cc-role { font-size: 12.5px; color: var(--muted); }
.cc-info { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.cc-info span { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-info svg { width: 14px; height: 14px; flex-shrink: 0; }
.cc-notes {
  font-size: 12.5px; color: var(--muted);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.cc-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: auto; }

/* ================= Tareas ================= */

.tasks-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
  height: calc(100vh - 148px);
}
.tasks-lists { padding: 12px; overflow-y: auto; }
.tasks-lists h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 10px 10px; }
.task-list-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text);
  transition: background .12s;
  text-align: left;
}
.task-list-item:hover { background: var(--surface-2); }
.task-list-item.active { background: var(--accent-soft); color: var(--accent); }
.task-list-item .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-list-item .count { font-size: 12px; color: var(--muted); }
.task-list-item .icon-btn { width: 24px; height: 24px; opacity: 0; }
.task-list-item:hover .icon-btn { opacity: 1; }
.task-list-item .icon-btn svg { width: 13px; height: 13px; }
.tl-add { margin-top: 8px; width: 100%; }

.tasks-main { padding: 18px 20px; overflow-y: auto; }
.tasks-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tasks-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.filters { display: flex; gap: 4px; margin-left: auto; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; }
.filters button {
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.filters button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.task-add { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.task-add input[type="text"] {
  flex: 1; min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
}
.task-add input[type="date"], .task-add select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
}
.task-add input:focus, .task-add select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 7px;
  background: var(--surface);
  transition: border-color .12s;
}
.task-row:hover { border-color: var(--border-strong); }
.task-row.done .tr-title { text-decoration: line-through; color: var(--muted); }
.task-check {
  width: 20px; height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
  transition: background .12s, border-color .12s;
}
.task-check svg { width: 13px; height: 13px; opacity: 0; }
.task-row.done .task-check { background: var(--ok); border-color: var(--ok); }
.task-row.done .task-check svg { opacity: 1; }
.tr-main { flex: 1; min-width: 0; }
.tr-title { font-weight: 600; }
.tr-notes { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-due {
  font-size: 12px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  flex-shrink: 0;
}
.tr-due.overdue { background: var(--danger-soft); color: var(--danger); }
.tr-due.today { background: #fff7ed; color: var(--warn); }

/* ================= Kanban ================= */

.kanban-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  height: calc(100vh - 148px);
  padding-bottom: 8px;
}
.kanban-col {
  width: 285px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.kanban-col-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 10px;
}
.kanban-col-name { font-weight: 700; font-size: 13.5px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-col-header .count { font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.kanban-col-header .icon-btn { width: 26px; height: 26px; opacity: 0; }
.kanban-col:hover .kanban-col-header .icon-btn { opacity: 1; }
.kanban-col-header .icon-btn svg { width: 13px; height: 13px; }

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-cards.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: var(--radius-sm); }

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: border-color .12s, box-shadow .12s;
}
.kanban-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.kanban-card.dragging { opacity: .45; }
.kc-title { font-weight: 600; margin-bottom: 4px; }
.kc-desc { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kc-labels { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.kc-label {
  font-size: 11px; font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.kc-footer { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.kc-due { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.kc-due svg { width: 12px; height: 12px; }
.kc-due.overdue { color: var(--danger); font-weight: 600; }
.kc-footer .pill { margin-left: auto; }

.kanban-add {
  margin: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  transition: background .12s, color .12s;
}
.kanban-add:hover { background: var(--border); color: var(--text); }

.kanban-new-col {
  width: 285px;
  flex-shrink: 0;
  padding: 13px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  transition: border-color .15s, color .15s;
}
.kanban-new-col:hover { border-color: var(--accent); color: var(--accent); }

/* ================= Calendario ================= */

.cal-layout { display: grid; grid-template-columns: 1fr 290px; gap: 16px; align-items: start; }

.cal-main { padding: 16px 18px; }
.cal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-header h2 { font-size: 17px; font-weight: 700; min-width: 170px; }
.cal-weekdays, .cal-grid-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekdays div {
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted);
  text-align: center;
  padding: 4px 0 8px;
}
.cal-cell {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 6px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  overflow: hidden;
  background: var(--surface);
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other-month { opacity: .42; }
.cal-cell.today { border-color: var(--accent); border-width: 2px; }
.cal-day-num { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.cal-cell.today .cal-day-num {
  color: #fff;
  background: var(--accent);
  width: 21px; height: 21px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11.5px;
}
.cal-chip {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  border-radius: 4px;
  padding: 1.5px 6px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-more { font-size: 10.5px; color: var(--muted); font-weight: 600; }

.cal-agenda { padding: 16px 18px; }
.cal-agenda h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.agenda-item {
  display: flex; gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--surface-2);
  cursor: pointer;
}
.agenda-item:last-child { border-bottom: none; }
.agenda-item .bar { width: 4px; border-radius: 4px; flex-shrink: 0; }
.agenda-item .t1 { font-weight: 600; font-size: 13px; }
.agenda-item .t2 { font-size: 12px; color: var(--muted); }

/* ================= Modal y toast ================= */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, .45);
  display: grid; place-items: center;
  z-index: 100;
  animation: fadeIn .15s ease;
  padding: 20px;
}
.modal {
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .18s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15.5px; font-weight: 700; }
.modal-body { padding: 18px 20px 6px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 16px;
}
.modal-footer .spacer { flex: 1; }

/* Overlay de arrastrar y soltar adjuntos (compose) */
.modal { position: relative; }
.drop-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(84, 87, 224, .10);
  border: 2px dashed var(--accent);
  border-radius: inherit;
  pointer-events: none;
}
/* La regla display:grid de arriba pisaba el atributo hidden: el aviso se veía siempre */
.drop-overlay[hidden] { display: none; }
.drop-overlay-msg {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--accent);
  font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg);
}
.drop-overlay-msg svg { width: 18px; height: 18px; }

#toast-root {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
}
.toast {
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideUp .18s ease;
}

@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } }

/* ================= Responsive ================= */

@media (max-width: 1100px) {
  .mail-layout { grid-template-columns: var(--mf-w, 180px) 6px 300px 1fr; }
  .cal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .brand-name { display: none; }
  .topnav-nav a span { display: none; }
  .topnav-nav a { padding: 9px 13px; }
  .topnav-inner { gap: 14px; padding: 0 14px; }
  .mail-layout { grid-template-columns: 1fr; height: auto; }
  .mail-splitter { display: none; }
  .mail-folders, .mail-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 260px; }
  .tasks-layout { grid-template-columns: 1fr; height: auto; }
  .search-box input { width: 150px; }
  .topbar { flex-wrap: wrap; }
}

/* ================= Componentes v2 ================= */

/* Modal grande */
.modal-lg { width: 760px; }
.hidden { display: none !important; }

/* Menú emergente */
.menu-pop {
  position: fixed;
  z-index: 150;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  animation: slideUp .12s ease;
}
.menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  transition: background .12s;
}
.menu-item svg { width: 14px; height: 14px; color: var(--muted); }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }

/* Avatares extra */
.avatar-xs { width: 24px; height: 24px; font-size: 9px; }
.avatar-lg { width: 64px; height: 64px; font-size: 21px; }

/* ---------- Editor de texto enriquecido ---------- */
.rte {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rte-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.rte-btn {
  min-width: 28px; height: 28px;
  padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  transition: background .12s, color .12s;
}
.rte-btn svg { width: 15px; height: 15px; }
.rte-btn:hover { background: var(--border); color: var(--text); }
.rte-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 5px; }
.rte-area {
  min-height: 170px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px 14px;
  outline: none;
  font-size: 14px;
  line-height: 1.55;
}
.rte-compact .rte-area { min-height: 80px; max-height: 180px; font-size: 13.5px; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rte-area img { max-width: 100%; height: auto; border-radius: 6px; }

/* Contenido enriquecido renderizado */
.rich p { margin: 0 0 8px; }
.rich p:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 6px 0 10px; padding-left: 24px; }
.rich blockquote {
  margin: 8px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #374151;
}
.rich a { color: var(--accent); text-decoration: underline; }
.rich .quote-head { font-size: 12.5px; color: var(--muted); margin-top: 14px; }

/* ---------- Campo de chips (Para/CC/CCO) ---------- */
.chips-field { position: relative; }
.chips-input {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.chips-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips-input input {
  flex: 1; min-width: 140px;
  border: none; outline: none;
  padding: 5px 4px;
  background: transparent;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 5px 3px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.chip-x { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: inherit; }
.chip-x svg { width: 10px; height: 10px; }
.chip-x:hover { background: rgba(79, 70, 229, .18); }
.chips-dd {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.chips-dd-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 5px;
  text-align: left;
  transition: background .12s;
}
.chips-dd-item:hover, .chips-dd-item.hl { background: var(--surface-2); }
.cd-name { font-weight: 600; font-size: 13px; }
.cd-email { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ---------- Redacción de correo ---------- */
.compose-fields { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: visible; }
.compose-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--surface-2);
}
.compose-row:last-child { border-bottom: none; }
.compose-row .chips-input { border: none; box-shadow: none; padding: 2px 0; min-height: 34px; }
.compose-row .chips-input:focus-within { box-shadow: none; }
.compose-label { width: 52px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.compose-grow { flex: 1; min-width: 0; }
.compose-subject { flex: 1; border: none; outline: none; padding: 9px 0; font-size: 14px; background: transparent; }
.compose-cc-toggle { font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 6px; border-radius: 5px; flex-shrink: 0; }
.compose-cc-toggle:hover { background: var(--surface-2); color: var(--accent); }
.compose-footer-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.compose-prio { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.compose-prio svg { width: 15px; height: 15px; }
.compose-prio select {
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
}
.autosave-note { font-size: 12px; color: var(--muted); }

/* ---------- Adjuntos ---------- */
.att-area { margin-top: 12px; }
.att-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.att-hint { font-size: 12px; color: var(--muted); }
.att-list { display: flex; flex-direction: column; gap: 6px; }
.att-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.att-icon {
  width: 34px; height: 34px;
  border-radius: 7px;
  display: grid; place-items: center;
  position: relative;
  flex-shrink: 0;
  background: #e2e8f0; color: #475569;
}
.att-icon svg { width: 16px; height: 16px; }
.att-icon em {
  position: absolute; bottom: -1px; right: -3px;
  font-size: 7.5px; font-style: normal; font-weight: 800;
  background: inherit;
  padding: 0 3px;
  border-radius: 3px;
}
.att-pdf { background: #fee2e2; color: #b91c1c; }
.att-img { background: #e0f2fe; color: #0369a1; }
.att-zip { background: #fef3c7; color: #b45309; }
.att-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-size { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.mv-attachments { padding: 10px 24px; border-bottom: 1px solid var(--border); }
.mv-att-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.mv-att-toggle:hover { color: var(--text); border-color: var(--accent); }
.mv-att-toggle svg { width: 14px; height: 14px; }
.mv-att-chevron { display: inline-grid; place-items: center; transition: transform .18s; }
.mv-att-chevron svg { width: 13px; height: 13px; }
.mv-att-toggle.open .mv-att-chevron { transform: rotate(180deg); }
.mv-attachments .att-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 260px; overflow-y: auto; }
.mv-attachments .att-list[hidden] { display: none; }
.mv-att-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
a.mv-att-toggle { text-decoration: none; }
.att-thumb {
  width: 34px; height: 34px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: zoom-in;
}
.img-preview-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 23, 42, .82);
  display: grid; place-items: center;
  cursor: zoom-out;
  padding: 24px;
}
.img-preview-overlay img {
  max-width: 92vw; max-height: 92vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  background: #fff;
}

/* ---------- Lista de correo: selección y prioridad ---------- */
.msg-check { width: 16px; height: 16px; accent-color: var(--accent); align-self: center; flex-shrink: 0; cursor: pointer; }
.msg-flag { display: inline-grid; place-items: center; margin-right: 4px; vertical-align: -2px; }
.msg-flag svg { width: 13px; height: 13px; }
.msg-flag.alta { color: var(--danger); }
.msg-flag.baja { color: #94a3b8; }
.mi-clip { display: inline-grid; place-items: center; margin-right: 4px; vertical-align: -2px; color: var(--muted); }
.mi-clip svg { width: 12px; height: 12px; }
.bulk-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  position: sticky; top: 0;
  z-index: 5;
}
.bulk-bar .btn { font-size: 12px; }
.bulk-bar .icon-btn { margin-left: auto; }

/* ---------- Contactos ---------- */
.contacts-head { display: flex; align-items: center; margin-bottom: 12px; }
.contacts-count { font-size: 13px; color: var(--muted); font-weight: 600; }
.contact-card { cursor: pointer; }
.cc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.cc-tag {
  font-size: 11px; font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.cd-header { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.cd-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.cd-sub { color: var(--muted); font-size: 13.5px; }
.cd-info { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.cd-row { display: flex; align-items: center; gap: 11px; font-size: 13.5px; }
.cd-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.cd-ic svg { width: 15px; height: 15px; }
.cd-notes { margin-top: 16px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.cd-notes h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 5px; }
.cd-notes p { font-size: 13.5px; white-space: pre-wrap; }

/* ---------- Tareas ---------- */
.tl-icon { display: inline-grid; place-items: center; flex-shrink: 0; }
.tl-icon svg { width: 15px; height: 15px; }
.task-add input[type="time"] {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
}
.task-row.dragging { opacity: .45; }
.task-row.reorderable, #task-rows.reorderable .task-row { cursor: grab; }
.tr-sub { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.tr-sub svg { width: 13px; height: 13px; }
.tr-progress {
  width: 46px; height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
}
.tr-progress span { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .2s; }
.tr-progress.big { width: 130px; height: 7px; }
.tr-list { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sub-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.sub-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.sub-progress:empty { display: none; }
.sub-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
  border-radius: 5px;
}
.sub-row:hover { background: var(--surface); }
.sub-row.done .sub-title { text-decoration: line-through; color: var(--muted); }
.sub-check { width: 18px; height: 18px; border-radius: 5px; }
.sub-check svg { width: 11px; height: 11px; }
.sub-row.done .sub-check { background: var(--ok); border-color: var(--ok); }
.sub-row.done .sub-check svg { opacity: 1; }
.sub-title { flex: 1; font-size: 13.5px; }
.sub-empty { font-size: 12.5px; color: var(--muted); padding: 6px 2px; }
.sub-add { display: flex; gap: 8px; margin-top: 8px; }
.sub-add input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
}
.sub-add input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sub-del { width: 24px; height: 24px; }
.sub-del svg { width: 12px; height: 12px; }

/* ---------- Kanban ---------- */
.kc-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.kc-badge svg { width: 12.5px; height: 12.5px; }
.kc-badge.done { color: var(--ok); }
.col-menu-btn { opacity: 0; }
.kanban-col:hover .col-menu-btn { opacity: 1; }
.comments-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.comment-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.comment-row:last-of-type { border-bottom: none; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 9px; font-size: 12px; align-items: baseline; }
.comment-head span { color: var(--muted); }
.comment-body { font-size: 13.5px; margin-top: 2px; white-space: pre-wrap; }
.comment-add { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.comment-add input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
}
.comment-add input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.attachments-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface-2); min-height: 42px; }
.attachment-row { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.attachment-row:last-of-type { border-bottom: none; }
.attachment-row .att-icon { color: var(--muted); display: inline-grid; place-items: center; }
.attachment-row .att-icon svg { width: 15px; height: 15px; }
.attachment-row .att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--accent); text-decoration: none; }
.attachment-row .att-name:hover { text-decoration: underline; }
.attachment-row .att-size { font-size: 11.5px; color: var(--muted); }
.attachment-add { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.attachment-add .drop-hint { font-size: 12px; color: var(--muted); }

.sieve-section { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 700; margin: 20px 0 10px; }
.sieve-section:first-of-type { margin-top: 0; }
.sieve-filters-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.sieve-filter-row { display: grid; grid-template-columns: 1.2fr 90px 1fr 130px 1fr 32px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.sieve-filter-row:last-of-type { border-bottom: none; }
.sieve-filter-row input, .sieve-filter-row select { padding: 6px 8px; font-size: 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.sieve-filter-row input:disabled { background: var(--surface-2); opacity: .6; }

/* ---------- Calendario: vistas ---------- */
.cal-side { display: flex; flex-direction: column; gap: 16px; }
.cal-cell.drag-over { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); }
.cal-chip[draggable="true"] { cursor: grab; }
.cal-chip-recur svg { width: 9px; height: 9px; vertical-align: -1px; margin-right: 2px; }
.recur-interval { display: flex; align-items: center; gap: 8px; }
.recur-interval input { flex: 0 0 70px; }
.recur-interval em { font-style: normal; color: var(--muted); font-size: 13px; }
.recurrence-note {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); margin: 2px 0 0;
}
.recurrence-note svg { width: 13px; height: 13px; flex: none; }
.ics-summary { font-size: 14px; }
.ics-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.ics-line { display: flex; align-items: center; gap: 7px; color: var(--muted); margin-bottom: 4px; }
.ics-line svg { width: 14px; height: 14px; flex: none; }
.ics-desc { margin-top: 8px; color: var(--muted); font-size: 13px; white-space: pre-wrap; }

.week-head { display: grid; grid-template-columns: 52px repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.week-day-head { padding: 6px 4px; text-align: center; border-left: 1px solid var(--surface-2); }
.week-day-head .wd-name { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.week-day-head .wd-num {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  font-size: 14px; font-weight: 700;
  margin: 2px auto;
}
.week-day-head.today .wd-num { background: var(--accent); color: #fff; border-radius: 50%; }
.week-allday { min-height: 6px; padding: 0 3px 4px; }
.week-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  max-height: calc(100vh - 380px);
  min-height: 420px;
  overflow-y: auto;
}
.week-gutter { border-right: 1px solid var(--border); }
.week-hour {
  height: var(--hour-px);
  font-size: 10.5px;
  color: var(--muted);
  text-align: right;
  padding-right: 7px;
  transform: translateY(-6px);
}
.week-hour:first-child { transform: translateY(0); }
.week-col {
  position: relative;
  height: calc(14 * var(--hour-px));
  border-left: 1px solid var(--surface-2);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-px) - 1px), var(--surface-2) calc(var(--hour-px) - 1px), var(--surface-2) var(--hour-px));
  cursor: pointer;
}
.week-col.today { background-color: #f5f7ff; }
.week-event {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  line-height: 1.25;
  padding: 3px 6px;
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.week-event strong { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-event span { opacity: .9; font-size: 10px; }

/* Mini calendario */
.mini-cal { padding: 14px 16px; }
.mini-title { font-size: 13.5px; font-weight: 700; margin-bottom: 10px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-wd { font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; padding: 2px 0; }
.mini-day {
  position: relative;
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 11.5px;
  border-radius: 6px;
  color: var(--text);
  transition: background .12s;
}
.mini-day:hover { background: var(--surface-2); }
.mini-day.other { color: var(--border-strong); }
.mini-day.today { background: var(--accent); color: #fff; font-weight: 700; }
.mini-dot { position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .75; }

/* ---------- Dashboard: gráfica ---------- */
.chart-panel { margin-bottom: 14px; }
.chart {
  display: flex; align-items: flex-end; gap: 10px;
  height: 150px;
  padding: 18px 22px 14px;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.chart-val { font-size: 11.5px; font-weight: 700; color: var(--muted); min-height: 14px; }
.chart-bar {
  width: 100%;
  max-width: 46px;
  background: linear-gradient(180deg, var(--accent), #818cf8);
  border-radius: 6px 6px 3px 3px;
  transition: height .3s ease;
}
.chart-col:hover .chart-bar { filter: brightness(1.08); }
.chart-day { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* ---------- Responsive v2 ---------- */
@media (max-width: 1100px) {
  .week-grid { max-height: 480px; }
}
@media (max-width: 860px) {
  .modal-lg { width: 100%; }
  .cal-side { flex-direction: column; }
}

/* ================= Componentes v3 (multi-usuario) ================= */

/* ---------- Pantalla de login ---------- */
.login-screen {
  position: fixed; inset: 0;
  z-index: 300;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f6f7f9 55%, #ecfeff 100%);
  padding: 20px;
}
.login-card {
  width: 380px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 26px;
  animation: slideUp .2s ease;
}
.login-card h1 { font-size: 20px; font-weight: 700; text-align: center; margin-top: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 4px 0 20px; }
.login-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 600;
  margin: -6px 0 10px;
}
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.login-demo {
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ---------- Menú de usuario en la barra superior ---------- */
.menu-head {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.menu-head .avatar { width: 34px; height: 34px; font-size: 12px; }
.user-menu-info { min-width: 0; }
.user-menu-info .t1 { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-info .t2 { font-size: 12px; color: var(--muted); }
.menu-foot {
  padding: 8px 12px 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Selector de cuenta de correo ---------- */
.account-select {
  width: 100%;
  margin-bottom: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  font-size: 12.5px;
  font-weight: 600;
}
.account-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.compose-from { font-size: 13px; color: var(--muted); padding: 6px 0; }

/* ---------- Perfil ---------- */
.account-list { display: flex; flex-direction: column; gap: 6px; }
.account-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.account-row .t1 { font-weight: 600; font-size: 13px; }
.account-row .t2 { font-size: 12px; color: var(--muted); }
.account-info { flex: 1; min-width: 0; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field-hint-inline { font-size: 11.5px; color: var(--muted); font-weight: 400; font-style: normal; }
.temp-password {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  user-select: all;
}

/* ---------- Administración ---------- */
.admin-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
}
.admin-tabs button {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.admin-tabs button.active { background: var(--accent); color: #fff; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.admin-table td { padding: 11px 14px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .t1 { font-weight: 600; }
.admin-table .t2 { font-size: 12px; color: var(--muted); }
.admin-user { display: flex; align-items: center; gap: 11px; }
.admin-user .avatar { width: 32px; height: 32px; font-size: 11px; }
.admin-accounts { font-size: 12.5px; color: var(--muted); }
.admin-star { color: #f59e0b; }
.admin-actions { white-space: nowrap; text-align: right; }
.prio-ok { background: #d1fae5; color: #065f46; }
.admin-group { margin-bottom: 14px; padding: 6px 0; }
.admin-group-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.admin-group-head .t1 { font-weight: 700; }
.admin-group-head .t2 { font-size: 12px; color: var(--muted); }
.admin-account-row { margin: 6px 16px; }

/* ================= Webmail real (v4) ================= */

.mail-more {
  width: calc(100% - 20px);
  margin: 10px;
  justify-content: center;
}

/* ================= Webmail real: mejoras v5 ================= */

/* Iconos de respondido / reenviado en la lista */
.mi-flag-icon { display: inline-grid; place-items: center; margin-right: 4px; vertical-align: -2px; }
.mi-flag-icon svg { width: 12.5px; height: 12.5px; }
.mi-flag-icon.ans { color: #2563eb; }
.mi-flag-icon.fwd { color: #7c3aed; }

/* Drag & drop de mensajes a carpetas */
.mail-item.dragging { opacity: .45; }
.mail-item { cursor: grab; }
.mail-folder.drag-over {
  background: var(--accent-soft);
  color: var(--accent);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* Imágenes inline en el cuerpo del mensaje */
.mv-body img { max-width: 100%; height: auto; }

/* ---------- Hilos de conversación ---------- */
.mail-thread { border-bottom: 1px solid var(--surface-2); }
.thread-root { border-bottom: none; }
.thread-children { background: #fafbfc; }
.thread-children[hidden] { display: none; }
.thread-child { padding-left: 14px; border-bottom: 1px solid var(--surface-2); }
.thread-child:last-child { border-bottom: none; }
.thread-chevron {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  color: var(--muted);
  vertical-align: -4px;
  transition: transform .18s;
}
.thread-chevron svg { width: 13px; height: 13px; }
.mail-thread.expanded .thread-chevron { transform: rotate(180deg); }
.thread-count {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}
.thread-unread {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 4px;
}

/* ---------- Firma en compose ---------- */
.compose-signature {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
  background: var(--surface-2);
}
.compose-sig-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sig-preview {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.email-signature {
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}


/* ================= Rediseño visual (capa final, prevalece por cascada) ================= */

html { color-scheme: light; }

/* Selección de texto con acento */
::selection { background: rgba(84, 87, 224, .22); color: inherit; }

/* Scrollbar fina y discreta */
* { scrollbar-width: thin; scrollbar-color: rgba(23, 23, 46, .25) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(23, 23, 46, .17);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(23, 23, 46, .32); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* Foco visible accesible (los campos de texto ya llevan su propio anillo) */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible,
[contenteditable]:focus-visible, .chips-input:focus-visible, .rte:focus-visible { outline: none; }

/* ---------- Anillos de foco unificados ---------- */
.search-box input:focus,
.field input:focus, .field textarea:focus, .field select:focus,
.mail-per-page select:focus, .task-add input:focus, .task-add select:focus,
.sub-add input:focus, .comment-add input:focus, .account-select:focus,
.sieve-filter-row input:focus, .sieve-filter-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--ring);
}
.rte:focus-within, .chips-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--ring); }

/* ---------- Barra superior: cristal esmerilado ---------- */
.topnav {
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(1.7) blur(16px);
  backdrop-filter: saturate(1.7) blur(16px);
  border-bottom: 1px solid rgba(228, 228, 236, .9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset;
  position: relative;
  z-index: 50;
}
.brand-logo {
  background: var(--accent-grad);
  box-shadow: 0 2px 6px rgba(84, 87, 224, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-name { letter-spacing: -.02em; color: var(--text); }
.topnav-nav a { border-radius: 10px; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.topnav-nav a:hover { background: var(--surface-3); }
.topnav-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px rgba(84, 87, 224, .12);
}
.nav-badge {
  background: var(--accent-grad);
  box-shadow: 0 1px 3px rgba(84, 87, 224, .4);
  border-color: rgba(255, 255, 255, .95);
}
.topnav-avatar { box-shadow: 0 1px 3px rgba(23, 23, 46, .18); }
.topnav-avatar:hover { border-color: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Buscador global ---------- */
.search-box input {
  background: var(--surface-2);
  border-color: transparent;
  border-radius: 9px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), width .22s var(--ease);
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:hover { background: var(--surface-3); }
.search-box input:focus { background: var(--surface); }
.global-search-results {
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  border-color: var(--border);
  padding: 7px;
}
.gs-item { border-radius: 8px; }
.gs-item:hover, .gs-item.hl { background: var(--accent-softer); }
.gs-item.hl .gs-icon, .gs-item:hover .gs-icon { color: var(--accent); }

/* ---------- Botones ---------- */
.btn {
  border-radius: 9px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.btn:active { transform: translateY(.5px); }
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-accent);
  text-shadow: 0 1px 1px rgba(30, 27, 90, .18);
}
.btn-primary:hover { background: var(--accent-grad); filter: brightness(1.07); box-shadow: 0 2px 4px rgba(70, 73, 201, .3), 0 8px 20px rgba(84, 87, 224, .34); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--surface-2); border-color: #c3c4d1; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .18); }
.btn[disabled], .btn:disabled { opacity: .55; pointer-events: none; }

.icon-btn { border-radius: 8px; transition: background var(--t-fast), color var(--t-fast); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Campos ---------- */
.field > span { color: var(--text-2); }
.field input, .field textarea, .field select {
  border-color: var(--border-strong);
  border-radius: 9px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: #c3c4d1; }

/* ---------- Avatares ---------- */
.avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 1px 2px rgba(23, 23, 46, .15); font-weight: 650; }

/* ---------- Tarjetas y dashboard ---------- */
.card { border-color: var(--border); }
.stat-card { transition: border-color var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.stat-card:hover { border-color: rgba(84, 87, 224, .4); box-shadow: var(--shadow-md); }
.dash-panel h3 { letter-spacing: -.005em; }
.dash-item:hover { background: var(--accent-softer); }
.chart-bar { background: linear-gradient(180deg, #7a5af8, var(--accent)); box-shadow: 0 2px 6px rgba(84, 87, 224, .25); }

/* ---------- Correo: estructura ---------- */
.mail-layout { box-shadow: var(--shadow); border-color: var(--border); }
.mail-folders { background: #f7f7fb; }
.mail-folder { border-radius: 8px; }
.mail-folder:hover { background: var(--surface-3); }
.mail-folder.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(84, 87, 224, .1);
}
.mail-folder .badge { background: var(--accent-grad); box-shadow: 0 1px 3px rgba(84, 87, 224, .35); }
.mail-list-header { background: #fafafc; }
.mail-density { border-color: var(--border-strong); }
.mail-density button.active { background: var(--accent-grad); box-shadow: 0 1px 3px rgba(84, 87, 224, .35); }

/* ---------- Correo: lista de mensajes ---------- */
.mail-item { transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.mail-item:hover { background: var(--surface-2); }
.mail-item.unread { background: var(--accent-softer); }
.mail-item.unread:hover { background: var(--accent-soft); }
.mail-item.unread::before {
  background: var(--accent-grad);
  width: 3px;
  border-radius: 0 3px 3px 0;
  top: 6px; bottom: 6px;
}
.mail-item.unread .mi-sender { color: var(--text); font-weight: 700; letter-spacing: -.005em; }
.mail-item.unread .mi-date { color: var(--accent); font-weight: 650; }
.mail-item.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.mail-item.selected .mi-sender { color: var(--accent-ink); }
.mail-item.selected.unread::before { display: none; }
.mi-sender { letter-spacing: -.005em; }
.mi-star { color: var(--border-strong); transition: color var(--t-fast), transform var(--t-fast); }
.mi-star:hover { color: #f59e0b; transform: scale(1.15); }
.mi-star.starred { color: #f59e0b; }
.thread-children { background: #f7f7fb; box-shadow: inset 0 1px 0 var(--border); }
.thread-count { background: var(--surface-3); }
.thread-unread { background: var(--accent-grad); box-shadow: 0 1px 2px rgba(84, 87, 224, .35); }
.bulk-bar { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Correo: vista de mensaje ---------- */
.mv-header { padding: 22px 28px 16px; background: linear-gradient(180deg, var(--accent-softer) 0%, var(--surface) 100%); }
.mv-subject { font-size: 19px; letter-spacing: -.015em; }
.mv-meta .from { font-size: 13.5px; }
.mv-actions { padding: 10px 28px; background: var(--surface); }
.mv-attachments { padding: 10px 28px; }
.mv-body { padding: 24px 28px; color: #2a2c38; }
.mv-att-toggle { border-radius: 999px; }
.mv-att-toggle:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.att-item { background: var(--surface); box-shadow: var(--shadow-sm); }
.att-item:hover { border-color: var(--border-strong); }

/* ---------- Redacción ---------- */
.compose-fields { border-radius: 10px; box-shadow: var(--shadow-sm); }
.chip {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid rgba(84, 87, 224, .16);
  padding: 3px 6px 3px 11px;
}
.chip-x:hover { background: rgba(84, 87, 224, .2); }
.chips-dd { border-radius: 10px; box-shadow: var(--shadow-lg); }
.chips-dd-item:hover, .chips-dd-item.hl { background: var(--accent-softer); }

/* ---------- Modales ---------- */
.modal-backdrop {
  background: rgba(19, 19, 36, .46);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.modal {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(228, 228, 236, .8);
}
.modal-header { padding: 18px 22px 14px; }
.modal-header h3 { font-size: 16px; letter-spacing: -.01em; }
.modal-body { padding: 20px 22px 8px; }
.modal-footer { padding: 14px 22px 18px; }

/* ---------- Menús emergentes y toast ---------- */
.menu-pop { border-radius: 11px; box-shadow: var(--shadow-xl); padding: 6px; }
.menu-item { border-radius: 7px; }
.menu-item:hover { background: var(--accent-softer); }
.toast { background: #1a1b25; box-shadow: var(--shadow-xl); }

/* ---------- Contactos ---------- */
.contact-card { transition: border-color var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.contact-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.cc-tag { background: var(--accent-softer); color: var(--accent-ink); border-color: rgba(84, 87, 224, .14); }
.cd-ic { border-radius: 9px; }

/* ---------- Tareas ---------- */
.task-list-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.filters { background: var(--surface-3); }
.filters button.active { box-shadow: var(--shadow-sm); }
.task-row { border-radius: 10px; transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast) var(--ease); }
.task-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.task-check { border-radius: 7px; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast); }
.task-row:hover .task-check { border-color: var(--accent); }
.tr-progress { background: var(--surface-3); }

/* ---------- Kanban ---------- */
.kanban-col { background: var(--surface-2); border-color: var(--border); }
.kanban-col-header .count { background: var(--surface); box-shadow: var(--shadow-sm); border-color: transparent; font-weight: 650; }
.kanban-card { border-radius: 10px; transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast) var(--ease); }
.kanban-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-add:hover { background: var(--surface-3); color: var(--text); }
.kanban-new-col { transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast); }
.kanban-new-col:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }
.kc-label { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Calendario ---------- */
.cal-cell { border-radius: 9px; transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast); }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 3px 10px rgba(84, 87, 224, .14);
}
.cal-cell.today .cal-day-num { background: var(--accent-grad); box-shadow: 0 1px 3px rgba(84, 87, 224, .4); }
.cal-chip { border-radius: 6px; box-shadow: var(--shadow-sm); }
.cal-chip:hover { filter: brightness(1.08); }
.agenda-item:hover { background: var(--accent-softer); border-radius: 8px; }
.week-col.today { background-color: var(--accent-softer); }
.week-event { border-radius: 7px; box-shadow: var(--shadow); }
.week-day-head.today .wd-num { background: var(--accent-grad); box-shadow: 0 1px 3px rgba(84, 87, 224, .4); }
.mini-day.today { background: var(--accent-grad); box-shadow: 0 1px 3px rgba(84, 87, 224, .4); }
.mini-day:hover { background: var(--surface-3); }

/* ---------- Administración ---------- */
.admin-tabs { border-radius: 10px; box-shadow: var(--shadow-sm); }
.admin-tabs button.active { background: var(--accent-grad); box-shadow: 0 1px 3px rgba(84, 87, 224, .35); }
.admin-table th { background: var(--surface-2); }
.admin-table tbody tr:hover td, .admin-table tr:hover td { background: var(--accent-softer); }
.account-row { transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.account-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

/* ---------- Login ---------- */
.login-screen {
  background:
    radial-gradient(rgba(84, 87, 224, .06) 1px, transparent 1.5px),
    radial-gradient(1100px 620px at 12% -8%, rgba(99, 102, 241, .2), transparent 60%),
    radial-gradient(900px 560px at 108% 112%, rgba(122, 90, 248, .16), transparent 55%),
    linear-gradient(155deg, #f5f5fb 0%, #eceef8 48%, #f3f0fc 100%);
  background-size: 24px 24px, auto, auto, auto;
}
.login-card {
  border-radius: 20px;
  padding: 40px 36px 30px;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(228, 228, 236, .9);
}
.login-card h1 { font-size: 21px; letter-spacing: -.02em; }
.login-card .brand-logo { width: 46px; height: 46px; border-radius: 14px; }
.login-card .brand-logo svg { width: 26px; height: 26px; }
.login-card .btn-block { padding: 11px; font-size: 14px; border-radius: 10px; }
.login-demo { background: var(--accent-softer); color: var(--muted); border: 1px solid rgba(84, 87, 224, .12); }

/* ---------- Editor enriquecido ---------- */
.rte { border-radius: 10px; }
.rte-toolbar { background: var(--surface-2); }
.rte-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Selector de color por muestras ---------- */
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 2px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0; transition: transform var(--t-fast, .15s) var(--ease, ease), box-shadow var(--t-fast, .15s) var(--ease, ease);
}
.swatch:hover { transform: scale(1.12); }
.swatch.sel { outline: 2px solid var(--accent, #5457e0); outline-offset: 2px; }

/* ================= Atajos de teclado ================= */

/* Cursor de teclado en la lista de correo (navegación con j/k y flechas) */
.mail-item.kbd-focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

/* Modal de ayuda de atajos */
.kbd-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 4px; }
.kbd-group:first-child { margin-top: 0; }
.kbd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--surface-2);
  font-size: 13px;
}
.kbd-row:last-child { border-bottom: none; }
.kbd-keys { display: inline-flex; gap: 4px; flex-shrink: 0; }
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  color: var(--text-2);
}

/* ================= Modo oscuro ================= */

html[data-theme="dark"] { color-scheme: dark; }

[data-theme="dark"] {
  /* Fondos casi negros azulados; superficies elevadas más claras que el fondo */
  --bg: #0d0f17;
  --surface: #161926;
  --surface-2: #1d2130;
  --surface-3: #262a3c;
  --border: #2a2e42;
  --border-strong: #3c415a;
  --text: #e8eaf3;
  --text-2: #c4c8d8;
  --muted: #8e93a9;
  --accent: #7c7ff2;
  --accent-hover: #9294ff;
  --accent-soft: rgba(124, 127, 242, .17);
  --accent-softer: rgba(124, 127, 242, .09);
  --accent-ink: #b5b7ff;
  --ring: rgba(124, 127, 242, .3);
  --accent-grad: linear-gradient(135deg, #818cf8 0%, #6d70f0 55%, #9a7bff 100%);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .13);
  --ok: #34d399;
  --warn: #fbbf24;
  /* Sombras más sutiles (en oscuro apenas elevan; importan más los bordes) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .22);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .32), 0 1px 3px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, .55), 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-accent: 0 1px 2px rgba(0, 0, 0, .35), 0 5px 14px rgba(109, 112, 240, .28);
}

/* Selección y scrollbar adaptadas */
[data-theme="dark"] ::selection { background: rgba(124, 127, 242, .38); }
[data-theme="dark"] * { scrollbar-color: rgba(232, 234, 243, .22) transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(232, 234, 243, .15); border: 3px solid transparent; background-clip: padding-box; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(232, 234, 243, .3); border: 3px solid transparent; background-clip: padding-box; }

/* Barra superior: cristal esmerilado en oscuro */
[data-theme="dark"] .topnav {
  background: rgba(22, 25, 38, .78);
  border-bottom-color: var(--border);
  box-shadow: none;
}
[data-theme="dark"] .nav-badge { border-color: var(--surface); }
[data-theme="dark"] .topnav-avatar { box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }

/* Correo: paneles con fondos que no usaban variables */
[data-theme="dark"] .mail-folders { background: var(--surface-2); }
[data-theme="dark"] .mail-list-header { background: var(--surface-2); }
[data-theme="dark"] .thread-children { background: var(--surface-2); }

/* Cuerpo del mensaje: el lienzo se mantiene CLARO también en oscuro (como Gmail),
   porque el HTML del correo trae sus propios colores. Solo se oscurece la UI alrededor. */
[data-theme="dark"] .mv-body {
  background: #ffffff;
  color: #1a1b25;
  border-top: 1px solid var(--border);
}
[data-theme="dark"] .mv-header { background: linear-gradient(180deg, var(--accent-softer) 0%, var(--surface) 100%); }

/* Botones y campos */
[data-theme="dark"] .btn-ghost:hover { border-color: var(--border-strong); }
[data-theme="dark"] .btn-danger:hover { background: rgba(248, 113, 113, .22); box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .25); }
[data-theme="dark"] .field input:hover, [data-theme="dark"] .field textarea:hover, [data-theme="dark"] .field select:hover { border-color: var(--border-strong); }

/* Modales y menús */
[data-theme="dark"] .modal { border-color: var(--border); }
[data-theme="dark"] .modal-backdrop { background: rgba(4, 5, 10, .55); }
[data-theme="dark"] .toast { background: #e8eaf3; color: #1a1b25; }

/* Píldoras de prioridad y colores fijos de estado */
[data-theme="dark"] .prio-baja { background: rgba(148, 163, 184, .16); color: #b7bdcc; }
[data-theme="dark"] .prio-media { background: rgba(251, 191, 36, .15); color: #fcd34d; }
[data-theme="dark"] .prio-alta { background: rgba(248, 113, 113, .15); color: #fca5a5; }
[data-theme="dark"] .prio-ok { background: rgba(52, 211, 153, .15); color: #6ee7b7; }
[data-theme="dark"] .tr-due.today { background: rgba(251, 191, 36, .13); }
[data-theme="dark"] .mi-flag-icon.ans { color: #7ea2f8; }
[data-theme="dark"] .mi-flag-icon.fwd { color: #b39af8; }
[data-theme="dark"] .msg-flag.baja { color: #5b6478; }

/* Iconos de adjuntos */
[data-theme="dark"] .att-icon { background: var(--surface-3); color: var(--text-2); }
[data-theme="dark"] .att-pdf { background: rgba(248, 113, 113, .16); color: #fca5a5; }
[data-theme="dark"] .att-img { background: rgba(56, 189, 248, .14); color: #7dd3fc; }
[data-theme="dark"] .att-zip { background: rgba(251, 191, 36, .14); color: #fcd34d; }

/* Login en oscuro */
[data-theme="dark"] .login-screen {
  background:
    radial-gradient(rgba(124, 127, 242, .07) 1px, transparent 1.5px),
    radial-gradient(1100px 620px at 12% -8%, rgba(109, 112, 240, .16), transparent 60%),
    radial-gradient(900px 560px at 108% 112%, rgba(154, 123, 255, .12), transparent 55%),
    linear-gradient(155deg, #0d0f17 0%, #11142a 48%, #12101f 100%);
  background-size: 24px 24px, auto, auto, auto;
}
[data-theme="dark"] .login-card { border-color: var(--border); }
[data-theme="dark"] .login-demo { background: var(--accent-softer); border-color: var(--border); }

/* ---------- Indicadores de carga ---------- */
.spinner {
  width: 22px; height: 22px; margin: 0 auto;
  border: 2.5px solid var(--surface-3); border-top-color: var(--accent);
  border-radius: 50%; animation: od-spin .7s linear infinite;
}
@keyframes od-spin { to { transform: rotate(360deg); } }
.loading { display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; }
.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
  min-height: 12px;
}
@keyframes skel-shimmer { to { background-position: -200% 0; } }
.skel-row { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.skel-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }

/* ---------- Cuerpo del mensaje en iframe sandbox (v6) ---------- */
.mv-body-wrap { padding: 10px 16px 22px; }
.mv-body-frame {
  display: block; width: 100%; min-height: 120px; border: 0;
  background: #fff; border-radius: 10px;
}
[data-theme="dark"] .mv-body-frame { box-shadow: 0 0 0 1px var(--border); }

/* ---------- Toast con acción (Deshacer) (v6) ---------- */
.toast { display: flex; align-items: center; gap: 12px; }
.toast-action {
  border: none; background: none; cursor: pointer;
  color: #a5b4fc; font-weight: 600; font-size: 13px; padding: 2px 4px;
  border-radius: 6px; flex-shrink: 0;
}
.toast-action:hover { text-decoration: underline; }

/* ---------- Correo en móvil: lista a pantalla completa y mensaje superpuesto (v6) ---------- */
.mv-back { display: none; }
@media (max-width: 900px) {
  .mail-folders { max-height: none; padding: 6px 8px; }
  #mail-folders { display: flex; flex-direction: row; overflow-x: auto; gap: 4px; }
  #mail-folders .mail-folder { flex: 0 0 auto; width: auto; }
  #mail-folders .folder-add-btn { flex: 0 0 auto; }
  #mail-quota { display: none; }
  .mail-list { max-height: none; }
  .mail-view { display: none; }
  .mail-layout.show-view .mail-view {
    display: flex; position: fixed; inset: 0; z-index: 70;
    background: var(--surface); overflow-y: auto;
  }
  .mv-back {
    display: inline-flex; flex-shrink: 0; margin-right: 4px;
  }
  .mv-header { display: flex; align-items: flex-start; flex-wrap: wrap; }
}

/* ---------- Equipos y compartición (v7) ---------- */
.board-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.board-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 500;
}
.board-tab:hover { border-color: var(--border-strong); }
.board-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.board-tab .dot { width: 9px; height: 9px; border-radius: 50%; }
.board-tab-manage { color: var(--muted); }
.board-tab-manage svg { width: 13px; height: 13px; }

.team-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; margin-bottom: 8px;
  font-size: 14px; color: var(--text); text-align: left;
}
.team-row:hover { border-color: var(--accent); background: var(--accent-softer); }
.team-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.team-row .team-name { font-weight: 600; }
.team-row .team-meta { color: var(--muted); font-size: 12.5px; margin-left: auto; }

.team-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.team-member-row:last-child { border-bottom: none; }
.team-member-row .tm-name { font-weight: 500; }
.team-member-row .tm-email { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.team-member-row .tm-role { font-size: 12.5px; padding: 4px 6px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

.tl-team { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.cal-chip-team svg { width: 10px; height: 10px; vertical-align: -1px; margin-right: 3px; opacity: .85; }

/* Evento público de otra persona: solo lectura */
.cal-chip-ro { opacity: .82; cursor: pointer; outline: 1px dashed rgba(255,255,255,.55); outline-offset: -1px; }

/* ---------- Gestión de equipo: asignaciones, avisos y disponibilidad (v8) ---------- */
.topnav-bell { position: relative; width: 36px; height: 36px; }
.topnav-bell svg { width: 18px; height: 18px; }
.topnav-bell .nav-badge { position: absolute; top: 2px; right: 0; }
.menu-pop .menu-item span { white-space: normal; max-width: 320px; text-align: left; }

.kc-assignee { margin-left: auto; }
.task-row .avatar-xs { flex-shrink: 0; }

#cal-busy-toggle.active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.week-busy {
  position: absolute; left: 2px; right: 2px; z-index: 0;
  background: repeating-linear-gradient(45deg, rgba(100,116,139,.14) 0 6px, rgba(100,116,139,.26) 6px 12px);
  border: 1px dashed rgba(100,116,139,.45); border-radius: 5px;
  pointer-events: none; overflow: hidden;
}
.week-busy span { font-size: 10px; color: var(--muted); padding: 1px 4px; display: inline-block; }
.week-event { z-index: 1; }

/* ================= Capa móvil (mobile.css) ================= */
/* Elementos creados por mobile.js; solo se muestran en pantallas estrechas */
.mnav, .mfab, .msearch-btn, .msearch-close, .mtb-more, .msheet-scrim { display: none; }

/* ================= Alta automática: guía de la primera descarga ================= */
.onboard { margin: 14px 24px 0; }
.onboard[hidden] { display: none; }
.onboard-inner {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--accent-softer);
  border: 1px solid rgba(84, 87, 224, .28);
  animation: slideUp .2s ease;
}
.onboard-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
}
.onboard-icon svg { width: 19px; height: 19px; }
.onboard.done .onboard-icon { background: var(--ok); }
.onboard-text { flex: 1; min-width: 0; }
.onboard-title { font-weight: 700; font-size: 14px; }
.onboard-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.onboard-bar { height: 5px; border-radius: 3px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.onboard-bar span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s var(--ease); }
.onboard-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
[data-theme="dark"] .onboard-inner { border-color: rgba(124, 127, 242, .35); }

/* Primera sincronización / historial parcial de una carpeta */
.mail-syncing svg { animation: spin 1.6s linear infinite; opacity: .6; }
@keyframes spin { to { transform: rotate(360deg); } }
.mail-partial { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 12px; font-size: 12.5px; color: var(--muted); }
.mail-partial svg { width: 14px; height: 14px; }

/* ================= Responder: mensaje citado plegado ================= */
.compose-quote { margin-top: 8px; }
.compose-quote-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
}
.compose-quote-toggle svg { width: 13px; height: 13px; transition: transform .18s; }
.compose-quote-toggle.open svg { transform: rotate(180deg); }
.compose-quote-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.compose-quote-body {
  margin-top: 8px; padding: 10px 14px; max-height: 260px; overflow-y: auto;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.5; color: var(--text-2); outline: none;
}
.compose-quote-body:focus { border-color: var(--accent); }
.compose-quote-body blockquote { border-left: 3px solid var(--border-strong); margin: 8px 0; padding: 4px 12px; }
.compose-quote-body .quote-head { font-size: 12.5px; color: var(--muted); }

/* ================= Invitación de calendario en el mensaje ================= */
.mv-invite {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 12px 24px 0; padding: 14px 16px;
  border: 1px solid rgba(84, 87, 224, .28); border-radius: var(--radius);
  background: var(--accent-softer);
}
.mv-invite-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: var(--accent); color: #fff; display: grid; place-items: center;
}
.mv-invite-icon svg { width: 20px; height: 20px; }
.mv-invite-body { flex: 1; min-width: 0; }
.mv-invite-title { font-weight: 700; font-size: 14.5px; }
.mv-invite-line { font-size: 13px; color: var(--text-2); margin-top: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.mv-invite-line svg { width: 14px; height: 14px; color: var(--muted); }
.mv-invite-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mv-invite-done { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ok); font-size: 13.5px; }
.mv-invite-done svg { width: 16px; height: 16px; }
[data-theme="dark"] .mv-invite { border-color: rgba(124, 127, 242, .35); }

/* Contenedor por navegación (ver router()): transparente para el layout */
.route-view { display: contents; }

/* Aviso de imágenes remotas bloqueadas en la lectura de correo */
.mv-remote-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 10px;padding:8px 12px;border:1px solid var(--border,#e2e5ec);border-radius:8px;background:var(--surface-2,#f6f7fa);font-size:13px;color:var(--text-2,#5a5e6b)}
.mv-remote-bar span{flex:1 1 260px}
.mv-remote-bar[hidden]{display:none}

/* ---- Lectura de correo: más espacio para el cuerpo ---- */
@media (min-width: 1281px) { .mail-layout { grid-template-columns: var(--mf-w, 200px) 6px 340px 1fr; } }
@media (min-width: 901px) {
  .mail-layout { transition: grid-template-columns .18s ease; }
  .mail-layout.reading-wide { grid-template-columns: 0 0 0 1fr; }
}
.mail-layout.reading-wide > .mail-folders,
.mail-layout.reading-wide > .mail-splitter,
.mail-layout.reading-wide > .mail-list { visibility: hidden; overflow: hidden; border: 0; min-width: 0; padding: 0; }
.mv-header { padding: 14px 24px 10px; }
.mv-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 8px 24px; gap: 5px; }
.mv-actions::-webkit-scrollbar { display: none; }
.mv-actions .btn { flex: 0 0 auto; white-space: nowrap; }
.mv-actions .mv-wide-btn { margin-left: auto; }
.mv-actions .mv-wide-btn.active, .mail-layout.reading-wide .mv-wide-btn { color: var(--accent); background: var(--accent-soft); }
/* Ajuste de la barra al espacio REAL (Mail.fitActions): se quitan textos por
   prioridad y, si aun así no cabe, pasa a dos líneas. Nunca se corta un botón. */
.mv-actions .btn.nolbl .lbl { display: none; }
.mv-actions.wrap { flex-wrap: wrap; overflow-x: visible; }
@media (max-width: 900px) { .mv-wide-btn { display: none !important; } }

/* ---- Cabecera de la lista: seleccionar todos + filtro no leídos ---- */
.mail-check-all { display: inline-flex; align-items: center; padding: 0 4px 0 2px; cursor: pointer; }
.mail-check-all input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.mail-filter-unread { border: 1px solid var(--border); background: var(--surface); color: var(--text-2, var(--text)); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.mail-filter-unread:hover { background: var(--surface-2); }
.mail-filter-unread.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }

/* Los globos de contador (Correo, campana, barra móvil) se ocultan con el
   atributo hidden cuando el valor es 0; `display: grid` de .nav-badge lo
   anulaba y aparecía un globo con "0". */
.nav-badge[hidden] { display: none !important; }

.mail-list-header { gap: 8px; justify-content: flex-start; }
.mail-list-header .mail-list-tools { margin-left: auto; }
.mail-list-header .mail-per-page select { padding-left: 8px; padding-right: 22px; }
.mail-list-header { padding: 8px 10px; gap: 6px; } .mail-list-header .mail-list-tools { gap: 4px; }
.mail-list { container-type: inline-size; } @container (max-width: 335px) { .mail-list-header .mail-per-page { display: none; } }

/* El panel de lectura es un flex en columna: con overflow-x en la barra de
   acciones, esta podía encogerse y un cuerpo largo la aplastaba en altura
   (botones cortados). Cabecera, barra, avisos y adjuntos no se encogen. */
.mail-view > .mv-header, .mail-view > .mv-actions, .mail-view > .mv-remote-bar,
.mail-view > .mv-attachments, .mail-view > .mv-invite { flex-shrink: 0; }
