/* =====================================================================
   skibidigang · diseño v5
   Tinta oscura + violeta eléctrico + cian «ping» para lo nuevo.
   Orden: tokens · base · marca · botones · campos · acceso · app · overlays · responsive
   ===================================================================== */

/* Tipografías alojadas en el propio sitio (licencia OFL): Bricolage Grotesque, Manrope y JetBrains Mono */
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 200 800; font-style: normal; font-display: swap; src: url('../assets/fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 200 800; font-style: normal; font-display: swap; src: url('../assets/fonts/manrope-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('../assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-style: normal; font-display: swap; src: url('../assets/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-style: normal; font-display: swap; src: url('../assets/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); }

/* ============ Tokens ============ */
:root {
  color-scheme: dark;
  --ink: 255, 255, 255;               /* se usa como rgba(var(--ink), .08) */
  --bg: #0a0a12;
  --bg-2: #0e0e1a;
  --panel: #12121e;
  --pop: #1a1a2a;
  --well: rgba(0, 0, 0, 0.28);
  --well-focus: rgba(0, 0, 0, 0.4);
  --scrim: rgba(6, 6, 12, 0.66);
  --text: #f4f4fa;
  --muted: #a6a6bc;
  --faint: #72728a;
  --border: rgba(var(--ink), 0.08);
  --border-strong: rgba(var(--ink), 0.16);
  --surface: rgba(var(--ink), 0.045);
  --focus: #c4b5fd;

  --accent: #8b5cf6;
  --accent-2: #e879f9;
  --accent-t: #c4b5fd;
  --grad-a: #a78bfa;
  --grad-b: #f0abfc;
  --spark: #22d3ee;
  --spark-ink: #032a33;
  --danger: #ff6b81;
  --ok: #34d399;
  --warn: #fbbf24;
  --star: #fcd34d;
  --err: #ffc2cb;
  --warn-t: #fde68a;

  --radius: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 30px 70px -36px rgba(0, 0, 0, 0.9);
  --font: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'Manrope', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme='light'] {
  color-scheme: light;
  --ink: 22, 20, 40;
  --bg: #f5f4fb;
  --bg-2: #efedf8;
  --panel: #ffffff;
  --pop: #ffffff;
  --well: #f0eef9;
  --well-focus: #ffffff;
  --scrim: rgba(22, 20, 40, 0.42);
  --text: #15132a;
  --muted: #5a5873;
  --faint: #8d8ba6;
  --focus: #6d28d9;
  --accent-t: #6d28d9;
  --grad-a: #7c3aed;
  --grad-b: #c026d3;
  --spark: #0891b2;
  --err: #b4233a;
  --warn-t: #8a5a06;
  --star: #d97706;
  --shadow: 0 1px 2px rgba(22, 20, 40, 0.06), 0 22px 48px -28px rgba(60, 40, 120, 0.3);
}

/* Alto y posición del área realmente visible (se actualiza desde ui.js cuando sale el teclado del móvil) */
:root { --vvh: 100dvh; --vvt: 0px; }

/* ============ Base ============ */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: none;
  transition: background-color 0.4s;
}

/* La interfaz no se selecciona ni se arrastra; solo los campos y el contenido del correo. */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable], .viewer-text, .modal-code { -webkit-user-select: text; user-select: text; }
img, svg, a { -webkit-user-drag: none; user-drag: none; }

h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.025em; margin: 0; }
p { margin: 0; }
code, .mono { font-family: var(--mono); }
a { color: inherit; }
::selection { background: rgba(139, 92, 246, 0.35); }

* { scrollbar-width: thin; scrollbar-color: rgba(var(--ink), 0.2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(var(--ink), 0.16); border-radius: 99px; }

.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; }

/* Fondo vivo: tres manchas que derivan despacio + rejilla muy sutil */
body::before {
  content: ''; position: fixed; inset: -10%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(620px 440px at 12% 0%, rgba(139, 92, 246, 0.26), transparent 65%),
    radial-gradient(560px 420px at 92% 8%, rgba(232, 121, 249, 0.16), transparent 65%),
    radial-gradient(640px 480px at 55% 108%, rgba(56, 189, 248, 0.1), transparent 65%);
  animation: drift 22s ease-in-out infinite alternate;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(rgba(var(--ink), 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--ink), 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000, transparent 75%);
}
:root[data-theme='light'] body::before {
  background:
    radial-gradient(620px 440px at 10% -4%, rgba(139, 92, 246, 0.16), transparent 65%),
    radial-gradient(560px 420px at 100% 0%, rgba(232, 121, 249, 0.12), transparent 65%),
    radial-gradient(640px 480px at 55% 110%, rgba(56, 189, 248, 0.1), transparent 65%);
}
@keyframes drift { to { transform: translate3d(2%, -3%, 0) scale(1.08); } }

/* ============ Superficies ============ */
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(var(--ink), 0.05);
}
/* Luz que sigue al puntero (js/fx.js fija --mx / --my) */
.spot { position: relative; isolation: isolate; }
.spot::after {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(139, 92, 246, 0.14), transparent 45%);
  opacity: 0; transition: opacity 0.4s;
}
.spot:hover::after { opacity: 1; }

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; list-style: none; margin: 0; padding: 0; }
.hint { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.hint code { color: var(--text); word-break: break-all; }
.section-title { margin: 0 0 12px 2px; color: var(--muted); font: 700 11.5px var(--font); text-transform: uppercase; letter-spacing: 0.12em; }
.grad, .brand-name em {
  background-image: linear-gradient(100deg, var(--grad-a), var(--grad-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ============ Marca ============ */
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 800; letter-spacing: -0.04em; }
.brand-name { font-size: 23px; line-height: 1; }
.brand-name em { font-style: normal; }
.brand-logo { display: block; width: 40px; height: 40px; flex: none; overflow: visible; filter: drop-shadow(0 8px 16px rgba(139, 92, 246, 0.35)); }
.brand-lg .brand-logo { width: 56px; height: 56px; }
.brand-lg .brand-name { font-size: 30px; }
.logo-dot { transform-box: fill-box; transform-origin: center; animation: ping-dot 2.8s var(--ease) infinite; }
.logo-ring { transform-box: fill-box; transform-origin: center; fill: none; stroke: var(--spark); stroke-width: 6; animation: ping-ring 2.8s ease-out infinite; }
.logo-lines { animation: speed 2.8s ease-in-out infinite; transform-box: fill-box; }
.brand:hover .logo-flap { transform: translateY(-5px); }
.logo-flap { transition: transform 0.4s var(--spring); transform-box: fill-box; }
@keyframes ping-dot { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.18); } }
@keyframes ping-ring { 0%, 60% { transform: scale(1); opacity: 0; } 62% { opacity: 0.8; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes speed { 0%, 100% { transform: translateX(0); opacity: 0.6; } 50% { transform: translateX(4px); opacity: 1; } }

/* ============ Botones ============ */
.btn {
  appearance: none; -webkit-appearance: none; position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 14px;
  font: 700 14px/1 var(--font); letter-spacing: -0.005em; color: var(--text);
  background: transparent; cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform 0.35s var(--spring), box-shadow 0.3s var(--ease), background-color 0.25s, border-color 0.25s, color 0.25s, opacity 0.25s;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, .input:focus-visible, .select-btn:focus-visible, .seg button:focus-visible,
.input-action:focus-visible, .mailbox:focus-visible, .msg:focus-visible, .tool:focus-visible, .code-chip:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.btn-sm { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-lg { height: 52px; font-size: 15px; border-radius: 16px; }
.w-full { width: 100%; }

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, #6d28d9, var(--accent) 45%, var(--accent-2));
  background-size: 180% 180%; background-position: 0% 50%;
  box-shadow: 0 12px 28px -12px rgba(139, 92, 246, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-primary::after { /* destello que cruza el botón */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  transform: translateX(-120%);
}
.btn-primary:hover:not(:disabled) { background-position: 100% 50%; transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(139, 92, 246, 1), inset 0 1px 0 rgba(255, 255, 255, 0.34); }
.btn-primary:hover:not(:disabled)::after { transform: translateX(120%); transition: transform 0.8s var(--ease); }

.btn-ghost { background: var(--surface); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: rgba(var(--ink), 0.09); border-color: var(--border-strong); transform: translateY(-1px); }

.btn-danger { background: rgba(255, 107, 129, 0.08); border-color: rgba(255, 107, 129, 0.25); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 129, 0.16); border-color: rgba(255, 107, 129, 0.45); transform: translateY(-1px); }
.btn-danger-solid { color: #fff; background: linear-gradient(120deg, #f43f5e, #fb7185 60%, #fb923c); box-shadow: 0 12px 26px -12px rgba(244, 63, 94, 0.9); }
.btn-danger-solid:hover:not(:disabled) { transform: translateY(-1px); }
.btn-danger-solid:disabled { filter: saturate(0.3); box-shadow: none; }

.btn-google { color: #1f1f1f; background: #fff; border-color: #dadce0; font-weight: 700; box-shadow: 0 10px 26px -16px rgba(0, 0, 0, 0.6); }
.btn-google:hover:not(:disabled) { background: #f7f7fb; transform: translateY(-1px); box-shadow: 0 14px 28px -14px rgba(0, 0, 0, 0.6); }
.btn-google svg { flex: none; }
:root[data-theme='light'] .btn-google { border-color: rgba(22, 20, 40, 0.16); box-shadow: 0 1px 2px rgba(22, 20, 40, 0.08); }

.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinning .ico { animation: spin 0.8s var(--ease) infinite; }

/* Botones de herramienta (icono) */
.tool {
  appearance: none; display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.tool:hover { background: rgba(var(--ink), 0.1); color: var(--text); }
.tool:active { transform: scale(0.88); }
.tool.danger:hover { background: rgba(255, 107, 129, 0.15); color: var(--danger); }
.tool[data-on='true'] { color: var(--star); }
.tool[data-on='true'] .ico svg { fill: currentColor; }
.tool[data-on='true'] .ico { animation: pop-star 0.45s var(--spring); }
.tool[data-act='text'][data-on='true'] { color: var(--accent-t); }
.tool[data-act='text'][data-on='true'] .ico svg { fill: none; }
@keyframes pop-star { 40% { transform: scale(1.35) rotate(-12deg); } }

/* ============ Campos ============ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.005em; }
.field-label small { font-weight: 500; color: var(--faint); }
.input-wrap { position: relative; display: block; }
.input {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 50px; padding: 0 14px; box-sizing: border-box;
  border-radius: 15px; border: 1px solid var(--border);
  background: var(--well); color: var(--text);
  font: 600 15px var(--font); outline: none;
  transition: border-color 0.25s, box-shadow 0.3s var(--ease), background-color 0.25s;
}
.input::placeholder { color: var(--faint); font-weight: 500; }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: rgba(167, 139, 250, 0.75); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); background: var(--well-focus); }
.input.has-ico { padding-left: 46px; }
.input.has-action { padding-right: 52px; }
.input-sm { height: 46px; font-size: 14.5px; }
.input:-webkit-autofill, .input:-webkit-autofill:hover, .input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 40px var(--panel) inset;
  box-shadow: 0 0 0 40px var(--panel) inset;
  caret-color: var(--text);
  transition: background-color 9999s;
}
.input-ico { position: absolute; left: 16px; top: 50%; translate: 0 -50%; color: var(--faint); pointer-events: none; transition: color 0.25s, transform 0.4s var(--spring); }
.input-wrap:focus-within .input-ico { color: var(--accent-t); transform: scale(1.12); }
.input-action {
  position: absolute; right: 7px; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.input-action:hover { background: rgba(var(--ink), 0.1); color: var(--text); }
.input-action:active { transform: scale(0.88); }
.input-action .ico { transition: transform 0.5s var(--spring); }
.input-action.roll:hover .ico { transform: rotate(90deg); }
.input-action.roll:active .ico { transform: rotate(270deg); }

/* Casilla */
.cbx {
  appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center;
  width: 19px; height: 19px; margin: 0; border-radius: 7px; border: 1.5px solid rgba(var(--ink), 0.3);
  background: var(--well); cursor: pointer; transition: background-color 0.2s, border-color 0.2s, transform 0.3s var(--spring);
}
.cbx:hover:not(:disabled) { border-color: var(--accent-t); }
.cbx:active:not(:disabled) { transform: scale(0.85); }
.cbx:disabled { opacity: 0.4; cursor: default; }
.cbx:checked, .cbx:indeterminate { background: linear-gradient(135deg, #7c3aed, var(--accent-2)); border-color: transparent; }
.cbx:checked::after { content: ''; width: 10px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.cbx:indeterminate::after { content: ''; width: 9px; height: 2px; border-radius: 2px; background: #fff; }
.cbx:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Control segmentado */
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 16px; background: var(--well); border: 1px solid var(--border); }
.seg-ind {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 12px;
  background: rgba(var(--ink), 0.1); box-shadow: inset 0 1px 0 rgba(var(--ink), 0.1), 0 6px 16px -8px rgba(0, 0, 0, 0.6);
  transition: transform 0.5s var(--spring);
}
:root[data-theme='light'] .seg-ind { background: #fff; box-shadow: 0 1px 3px rgba(22, 20, 40, 0.18); }
.seg[data-mode='register'] .seg-ind { transform: translateX(100%); }
.seg button {
  position: relative; z-index: 1; appearance: none; border: 0; background: transparent; cursor: pointer;
  height: 40px; border-radius: 12px; color: var(--muted); font: 700 13.5px var(--font); transition: color 0.3s;
}
.seg button[aria-selected='true'] { color: var(--text); }

/* Colapsable y medidor */
.reveal { display: grid; grid-template-rows: 0fr; opacity: 0; margin-top: -18px; transition: grid-template-rows 0.55s var(--ease), opacity 0.35s, margin 0.55s var(--ease); }
.reveal[data-open='true'] { grid-template-rows: 1fr; opacity: 1; margin-top: 0; }
.reveal-inner { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 2px; margin: -2px; }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.meter i { height: 5px; border-radius: 99px; background: rgba(var(--ink), 0.1); transition: background-color 0.35s, transform 0.4s var(--spring); transform-origin: left; }
.meter[data-level='1'] i:nth-child(-n + 1) { background: #ff6b81; }
.meter[data-level='2'] i:nth-child(-n + 2) { background: #fbbf24; }
.meter[data-level='3'] i:nth-child(-n + 3) { background: #a3e635; }
.meter[data-level='4'] i { background: var(--ok); }

.match-hint { min-height: 0; margin: -6px 0 0 2px; font-size: 12.5px; font-weight: 700; }
.match-hint:empty { display: none; }
.match-hint[data-state='ok'] { color: var(--ok); }
.match-hint[data-state='bad'] { color: var(--err); }

.form-error { padding: 11px 14px; border-radius: 13px; font-size: 13.5px; font-weight: 600; color: var(--err); background: rgba(255, 107, 129, 0.1); border: 1px solid rgba(255, 107, 129, 0.3); }
.shake { animation: shake 0.45s var(--ease); }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.note { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.note .ico { width: 16px; height: 16px; margin-top: 2px; color: var(--ok); }
.divider { display: flex; align-items: center; gap: 12px; margin: -2px 0; color: var(--faint); font-size: 12px; font-weight: 700; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============ Avatares ============ */
.avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; font: 800 13px var(--display); color: #fff; text-transform: uppercase; }
.avatar-img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar:has(.avatar-img) { overflow: hidden; }
.avatar.has-logo { background: #fff; border-radius: 12px; overflow: hidden; padding: 5px; box-sizing: border-box; box-shadow: 0 0 0 1px var(--border-strong); }
.avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.msg-avatar { width: 44px; height: 44px; font-size: 17px; margin-top: 2px; }
.avatar-xl { width: 76px; height: 76px; font-size: 30px; border: 2px solid var(--border-strong); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.6); }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; border-radius: 50%; }

/* Foto del buzón (cabecera de la bandeja) */
.mailhead-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; }
.mb-avatar-btn { appearance: none; position: relative; flex: none; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; transition: transform 0.3s var(--spring); }
.mb-avatar-btn .avatar { width: 100%; height: 100%; box-shadow: 0 0 0 2px var(--border-strong), 0 10px 22px -12px rgba(0, 0, 0, 0.7); }
.mb-avatar-btn:hover { transform: scale(1.05); }
.mb-avatar-btn:active { transform: scale(0.94); }
.mb-avatar-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.mb-avatar-badge { position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #7c3aed, var(--accent-2)); box-shadow: 0 0 0 2px var(--panel); }
.mb-avatar-badge .ico { width: 12px; height: 12px; }
.mb-avatar-btn[data-busy='true'] { pointer-events: none; }
.mb-avatar-btn[data-busy='true'] .avatar { opacity: 0.45; }
.mb-avatar-btn[data-busy='true']::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.avatar-pick { display: flex; align-items: center; gap: 16px; }
.avatar-pick-body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.avatar-pick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick-actions .btn { height: 36px; padding: 0 12px; }

/* ============ Acceso ============ */
.auth-wrap { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
.auth-shell { width: min(1120px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) 440px; align-items: center; gap: clamp(36px, 6vw, 96px); }

/* Mitad izquierda: mensaje + demo viva */
.hero { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
.hero-title { font-size: clamp(34px, 4.3vw, 56px); line-height: 1.02; font-weight: 800; letter-spacing: -0.045em; }
.hero-title .grad { display: inline-block; }
.hero-sub { max-width: 52ch; color: var(--muted); font-size: 17px; line-height: 1.6; }
/* Contador global de buzones (odómetro) */
.tally { position: relative; isolation: isolate; overflow: hidden; padding: 16px 26px 20px; border-radius: 26px; border: 1px solid rgba(139, 92, 246, 0.38); background: linear-gradient(155deg, rgba(139, 92, 246, 0.16), rgba(232, 121, 249, 0.05) 60%, var(--surface)); box-shadow: 0 30px 60px -38px rgba(139, 92, 246, 0.9); }
.tally[hidden] { display: none; }
.tally-glow { position: absolute; z-index: -1; left: -6%; bottom: -80%; width: 75%; height: 140%; background: radial-gradient(closest-side, rgba(167, 139, 250, 0.38), transparent); filter: blur(8px); opacity: 0.65; }
/* Tamaño del número: parecido al del subtítulo «buzones registrados» (22–32 px), un poco mayor.
   Antes faltaba la regla de data-size='l', --fs quedaba sin definir y el número caía al tamaño base (muy pequeño). */
.tally { --fs: clamp(28px, 3.3vw, 40px); }
.tally[data-size='m'] { --fs: clamp(26px, 3vw, 37px); }
.tally[data-size='s'] { --fs: clamp(24px, 2.7vw, 34px); }
.tally[data-size='xs'] { --fs: clamp(22px, 2.4vw, 31px); }
.tally-num { --h: 1.08em; position: relative; display: inline-block; max-width: 100%; margin-top: 0; font: 800 var(--fs) / var(--h) var(--display); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; color: var(--text); }
.odo { display: flex; align-items: flex-end; height: var(--h); }
.odo-col { display: block; height: var(--h); overflow: hidden; }
.odo-strip { display: flex; flex-direction: column; transform: translateY(calc(var(--pos, 0) * var(--h) * -1)); transition: transform 1.15s cubic-bezier(0.16, 1, 0.3, 1); will-change: transform; }
.odo-strip > span { display: block; height: var(--h); text-align: center; }
.odo-col.enter { animation: odo-enter 0.7s var(--spring) both; }
.odo-sep { align-self: flex-end; padding: 0 0.04em; color: var(--accent-t); }
.tally-label { margin: 6px 0 0; color: var(--muted); font-size: clamp(22px, 2.6vw, 32px); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.tally-chip { position: absolute; top: 2px; right: -6px; padding: 4px 11px; border-radius: 99px; color: #fff; font: 800 15px var(--font); letter-spacing: 0; background: linear-gradient(120deg, #6d28d9, var(--accent) 50%, var(--accent-2)); box-shadow: 0 10px 24px -8px rgba(139, 92, 246, 0.95); pointer-events: none; animation: tally-chip 1.6s var(--ease) both; }
.tally::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; } /* el destello va en un pseudo-elemento: así no choca con la animación de entrada del hero */
.tally.bump::after { animation: tally-ring 1.3s var(--ease); }
.tally.bump .tally-glow { animation: tally-glow 1.3s var(--ease); }
.tally.bump .tally-num { animation: tally-kick 0.6s var(--spring); }
@keyframes odo-enter { from { max-width: 0; opacity: 0; transform: translateY(40%) scale(0.6); } to { max-width: 1em; } }
@keyframes tally-chip { 0% { opacity: 0; transform: translateY(14px) scale(0.6); } 18% { opacity: 1; transform: translateY(-6px) scale(1.12); } 30% { transform: translateY(-4px) scale(1); } 100% { opacity: 0; transform: translateY(-46px) scale(0.95); } }
@keyframes tally-ring { 0% { opacity: 1; box-shadow: inset 0 0 0 2px rgba(232, 121, 249, 0.95), inset 0 0 46px rgba(167, 139, 250, 0.55); } 100% { opacity: 0; box-shadow: inset 0 0 0 2px rgba(232, 121, 249, 0), inset 0 0 46px rgba(167, 139, 250, 0); } }
@keyframes tally-glow { 0% { opacity: 1; transform: scale(1.25); } 100% { opacity: 0.65; transform: scale(1); } }
@keyframes tally-kick { 0% { transform: scale(1); } 35% { transform: scale(1.045); } 100% { transform: scale(1); } }

/* La bandeja en vivo de la pantalla de acceso está al final del archivo (.inbox) */

.auth-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--faint); }
.auth-foot a { color: var(--muted); text-underline-offset: 3px; }
.auth-foot a:hover { color: var(--text); }

/* Tarjeta de acceso */
.auth-card { position: relative; overflow: hidden; width: 100%; box-sizing: border-box; padding: 34px 30px 28px; display: flex; flex-direction: column; gap: 20px; border-radius: 30px; }
.auth-card::before { /* luz rosada clara que recorre todo el borde */
  content: ''; position: absolute; inset: 0; padding: 2px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--ang, 0deg), #e879f9, #f5d0fe 12%, rgba(240, 171, 252, 0.08) 32%, rgba(240, 171, 252, 0.08) 70%, #f0abfc 90%, #e879f9);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: spin-ang 7s linear infinite;
}
@keyframes slide-bg { to { background-position: 200% 0; } }
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-title { font-size: 28px; line-height: 1.12; font-weight: 800; letter-spacing: -0.04em; }
.auth-sub { color: var(--muted); font-size: 14.5px; }
.card-brand { display: none; align-self: center; }

/* ============ Barra superior ============ */
.topbar { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); }
.topbar-in { margin: 0 auto; max-width: 2000px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(32px, env(safe-area-inset-right)) 10px max(32px, env(safe-area-inset-left)); }
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .brand-logo { width: 38px; height: 38px; }
.user-menu-host { position: relative; }
.user-menu-host .menu { right: 0; top: calc(100% + 10px); min-width: 230px; }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 3px 12px 3px 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); }
button.user-chip { appearance: none; font: 700 13px var(--font); color: var(--text); cursor: pointer; transition: background-color 0.2s, border-color 0.2s, transform 0.3s var(--spring); }
button.user-chip:hover { background: rgba(var(--ink), 0.09); border-color: var(--border-strong); }
button.user-chip:active { transform: scale(0.97); }
button.user-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.user-chip:disabled { opacity: 0.6; cursor: wait; }
.user-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chev { width: 15px; height: 15px; color: var(--muted); transition: transform 0.35s var(--spring); }
button.user-chip[aria-expanded='true'] .user-chev { transform: rotate(180deg); }

/* Interruptor de tema
   Geometría con píxeles enteros: el aro se dibuja con box-shadow inset (no ocupa layout, así el redondeo del borde
   en pantallas 1x / 1.25x / 1.5x no descentra nada) y círculo, icono y alto comparten paridad (28 / 20 / 36). */
.theme-switch {
  --ts-w: 68px; --ts-h: 36px; --ts-edge: 4px; --ts-ring: 1.5px; --ts-ico: 20px;
  --ts-k: calc(var(--ts-h) - 2 * var(--ts-edge)); /* diámetro del círculo morado (28px) */
  --ts-ico-in: calc(var(--ts-edge) + (var(--ts-k) - var(--ts-ico)) / 2); /* margen del icono: queda centrado en el círculo (8px) */
  --ts-ring-c: var(--border-strong);
  appearance: none; -webkit-appearance: none; position: relative; flex: none; display: block;
  width: var(--ts-w); height: var(--ts-h); padding: 0; border: 0; border-radius: 99px; cursor: pointer;
  background: var(--panel); color: var(--muted);
  box-shadow: inset 0 0 0 var(--ts-ring) var(--ts-ring-c), 0 4px 14px -6px rgba(0, 0, 0, 0.5), inset 0 2.5px 0 -1px rgba(var(--ink), 0.05);
  transition: box-shadow 0.3s var(--ease), background-color 0.3s;
}
.theme-switch:hover { --ts-ring-c: rgba(167, 139, 250, 0.8); box-shadow: inset 0 0 0 var(--ts-ring) var(--ts-ring-c), 0 6px 18px -6px rgba(139, 92, 246, 0.55), inset 0 2.5px 0 -1px rgba(var(--ink), 0.05); }
.theme-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.theme-switch:active .ts-thumb { width: calc(var(--ts-k) + 6px); }
.theme-switch[aria-checked='true']:active .ts-thumb { transform: translateX(calc(var(--ts-w) - var(--ts-h) - 6px)); }
.ts-thumb { position: absolute; z-index: 0; top: var(--ts-edge); left: var(--ts-edge); width: var(--ts-k); height: var(--ts-k); border-radius: 50%; background: linear-gradient(135deg, #6d28d9, #a78bfa 60%, var(--accent-2)); box-shadow: 0 4px 12px -2px rgba(139, 92, 246, 0.75); transition: transform 0.5s var(--spring), width 0.2s; }
.ts-ico { position: absolute; z-index: 1; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: var(--ts-ico); height: var(--ts-ico); transition: color 0.3s, transform 0.6s var(--spring); pointer-events: none; }
.ts-ico svg { width: 100%; height: 100%; stroke-width: 2.1; }
.ts-sun { left: var(--ts-ico-in); }
/* La media luna pesa ~0.55px a la izquierda y ~0.85px abajo de su caja (medido); se compensa ~75% para que se vea centrada en el círculo */
.ts-moon { right: var(--ts-ico-in); translate: 0.4px calc(-50% - 0.6px); }
.theme-switch[aria-checked='true'] .ts-thumb { transform: translateX(calc(var(--ts-w) - var(--ts-h))); }
.theme-switch[aria-checked='true'] .ts-moon { color: #fff; transform: rotate(-12deg); }
.theme-switch[aria-checked='false'] .ts-sun { color: #fff; transform: rotate(90deg); }
.theme-fab { position: fixed; z-index: 30; top: max(14px, env(safe-area-inset-top, 0px)); right: max(14px, env(safe-area-inset-right, 0px)); }

/* ============ Select personalizado ============ */
.select { position: relative; }
.select-btn {
  appearance: none; -webkit-appearance: none; width: 100%; height: 50px; padding: 0 14px 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-radius: 15px; border: 1px solid var(--border); background: var(--well); color: var(--text);
  font: 600 15px var(--font); cursor: pointer; text-align: left;
  transition: border-color 0.25s, box-shadow 0.3s var(--ease);
}
.select-btn:hover:not(:disabled) { border-color: var(--border-strong); }
.select-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.select[data-open='true'] .select-btn { border-color: rgba(167, 139, 250, 0.75); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); }
.select-chev { color: var(--muted); transition: transform 0.4s var(--spring); }
.select[data-open='true'] .select-chev { transform: rotate(180deg); }
.select-menu {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none;
  max-height: 240px; overflow: auto; border-radius: 17px; border: 1px solid var(--border-strong); background: var(--pop);
  box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.85);
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(0.97); transform-origin: top;
  transition: opacity 0.2s, transform 0.4s var(--spring), visibility 0.2s;
}
.select[data-open='true'] .select-menu { opacity: 1; visibility: visible; transform: none; }
.select-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 12px; cursor: pointer; font-size: 14.5px; font-weight: 600; color: var(--text); transition: background-color 0.15s; }
.select-opt[data-hi='true'] { background: rgba(var(--ink), 0.08); }
.select-opt[aria-selected='true'] .ico { color: var(--accent-t); }

/* ============ Contadores ============ */
.counter { padding: 4px 11px; border-radius: 99px; background: rgba(139, 92, 246, 0.16); color: var(--accent-t); font: 800 12px var(--font); font-variant-numeric: tabular-nums; }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: rgba(var(--ink), 0.12); font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ============ Lista de buzones ============ */
.mailbox {
  appearance: none; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 18px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-align: left; cursor: pointer; font: inherit;
  transition: transform 0.4s var(--spring), background-color 0.25s, border-color 0.25s, box-shadow 0.35s var(--ease);
}
.mailbox:hover { background: rgba(var(--ink), 0.08); border-color: var(--border-strong); transform: translateX(4px); }
.mailbox:active { transform: scale(0.98); }
.mailbox[data-active='true'] { background: rgba(139, 92, 246, 0.14); border-color: rgba(167, 139, 250, 0.55); box-shadow: 0 10px 26px -16px rgba(139, 92, 246, 0.8); }
.mailbox[data-active='true']:hover { transform: none; }
/* Reordenar arrastrando */
#mailbox-list > li { position: relative; }
.mailbox-grip { flex: none; display: grid; place-items: center; width: 14px; margin: 0 -4px 0 -6px; color: var(--faint); opacity: 0; cursor: grab; touch-action: none; transition: opacity 0.2s, color 0.2s; }
.mailbox:hover .mailbox-grip, .mailbox:focus-visible .mailbox-grip, #mailbox-list.is-sorting .mailbox-grip { opacity: 0.9; }
.mailbox-grip:hover { color: var(--accent-t); }
@media (hover: none) { .mailbox-grip { opacity: 0.55; width: 22px; margin-right: -2px; } }
#mailbox-list > li.dragging { z-index: 20; }
#mailbox-list > li.dragging .mailbox { cursor: grabbing; transform: scale(1.03); background: var(--pop); border-color: var(--accent-t); box-shadow: 0 22px 44px -14px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--accent-t), 0 0 22px rgba(139, 92, 246, 0.45); }
#mailbox-list.is-sorting .mailbox:not(:active) { transition: none; }
#mailbox-list.is-sorting .mailbox:hover:not([data-active='true']) { transform: none; }
body.dragging-mailbox, body.dragging-mailbox * { cursor: grabbing !important; }
.mailbox-check { flex: none; margin-left: auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #7c3aed, var(--accent-2)); color: #fff; animation: pop-in 0.5s var(--spring) both; }
.mailbox-check .ico { width: 13px; height: 13px; }
.mailbox-check .ico svg { stroke-width: 2.8; }
.mailbox-addr { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.mailbox-local { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-domain { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pop-in { from { transform: scale(0); } }

/* ============ Layout de la app ============ */
.layout { margin: 0 auto; max-width: 2000px; padding: 24px max(32px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left)); }
.content { min-width: 0; }
.inbox { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: none; }
.app-foot { margin: 0 auto; max-width: 2000px; padding: 0 32px 28px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 12.5px; color: var(--faint); }
.app-foot a { color: var(--muted); text-underline-offset: 3px; }
.app-foot a:hover { color: var(--text); }

/* Cabecera del buzón */
.mailhead { position: relative; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 18px 26px; border-radius: 26px; }
.mailhead-main { flex: 1; min-width: 0; }
.addr-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.addr-copy { appearance: none; flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color 0.2s, color 0.2s, transform 0.3s var(--spring); }
.addr-copy .ico { width: 18px; height: 18px; }
.addr-copy:hover { background: rgba(var(--ink), 0.1); color: var(--text); }
.addr-copy:active { transform: scale(0.88); }
.addr-copy:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.addr-copy[data-copied='true'] { color: var(--ok); background: rgba(52, 211, 153, 0.14); }
.addr-copy[data-copied='true'] .ico svg { stroke-width: 2.6; animation: pop-in 0.4s var(--spring); }
.addr { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; font-weight: 500; color: var(--text); animation: fade 0.5s both; }
.stats { display: flex; white-space: nowrap; align-items: center; gap: 8px; margin-top: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.stats::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--spark); box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.6); animation: ping 2.4s ease-out infinite; }
.stats:empty { display: none; }
.mailhead-actions { display: flex; gap: 10px; }
/* Tuerca de ajustes: gira al pasar el cursor */
.btn-gear .ico { display: inline-grid; place-items: center; transition: transform 0.7s var(--spring), color 0.2s; }
.btn-gear:hover .ico, .btn-gear:focus-visible .ico, .btn-gear[aria-expanded='true'] .ico { transform: rotate(180deg); color: var(--accent-t); }
.mb-settings { min-width: 300px; padding: 18px; }
.mbs-title { margin: 0 0 14px; font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.mbs-label { margin-bottom: 10px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.mbs-photo { display: flex; align-items: center; gap: 16px; }
.mbs-photo .avatar { flex: none; width: 64px; height: 64px; font-size: 24px; box-shadow: 0 0 0 2px var(--border-strong); }
.mbs-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mbs-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.mbs-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.mbs-btns [hidden] { display: none; }
.btn-drawer { height: 46px; padding: 0 20px 0 16px; gap: 10px; border-radius: 15px; font-size: 14.5px; }
.btn-drawer .ico { width: 20px; height: 20px; }
.btn-drawer .count-badge { background: rgba(255, 255, 255, 0.24); color: #fff; height: 22px; min-width: 22px; font-size: 12.5px; }
.banner { padding: 13px 18px; border-radius: 16px; font-size: 14px; font-weight: 600; color: var(--err); background: rgba(255, 107, 129, 0.1); border: 1px solid rgba(255, 107, 129, 0.3); animation: rise 0.4s var(--ease); }
.banner[data-tone='info'] { color: var(--muted); background: var(--surface); border-color: var(--border); }

/* Menú desplegable */
.menu { position: absolute; z-index: 40; right: 22px; top: calc(100% - 10px); min-width: 250px; padding: 8px; border-radius: 18px; border: 1px solid var(--border-strong); background: var(--pop); box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.85); animation: pop 0.35s var(--spring) both; transform-origin: top right; }
.menu-item { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: 600 14.5px var(--font); text-align: left; cursor: pointer; transition: background-color 0.15s, transform 0.25s var(--ease); }
.menu-item .ico { color: var(--muted); transition: color 0.15s, transform 0.3s var(--spring); }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: rgba(var(--ink), 0.08); outline: none; }
.menu-item:hover:not(:disabled) .ico { color: var(--accent-t); transform: scale(1.12); }
.menu-item:disabled { opacity: 0.45; cursor: not-allowed; }
.menu-item.danger, .menu-item.danger .ico { color: var(--danger); }
.menu-item.danger:hover { background: rgba(255, 107, 129, 0.12); }
.menu-sep { height: 1px; margin: 8px 6px; background: var(--border); }

/* ============ Panel de correo ============ */
.mail-panel { --list-w: clamp(380px, 32%, 560px); display: grid; grid-template-columns: clamp(300px, var(--list-w), calc(100% - 320px)) 0 minmax(0, 1fr); height: calc(100dvh - 250px); min-height: 520px; overflow: hidden; border-radius: 26px; }
.list-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; container-type: inline-size; }
/* Divisor: la línea visible de 1 px sigue en el mismo sitio; el área de agarre es más ancha y no desplaza nada */
.panel-splitter { position: relative; z-index: 5; width: 0; cursor: col-resize; touch-action: none; outline: none; }
.panel-splitter::before { content: ''; position: absolute; inset: 0 auto 0 -1px; width: 2px; background: var(--border); transition: background 0.2s, box-shadow 0.2s; }
.panel-splitter::after { content: ''; position: absolute; inset: 0 -8px; }
.panel-splitter:hover::before, .panel-splitter:focus-visible::before, body.resizing-panel .panel-splitter::before { background: var(--accent-t); box-shadow: 0 0 0 1px var(--accent-t), 0 0 14px rgba(139, 92, 246, 0.55); }
body.resizing-panel { cursor: col-resize; -webkit-user-select: none; user-select: none; }
body.resizing-panel .viewer-frame { pointer-events: none; }
.viewer-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
.list-search { padding: 20px 20px 12px; }
.list-bar { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 14px 6px 20px; min-width: 0; border-bottom: 1px solid var(--border); }
.bar-group { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.bar-spacer { flex: 1; }
.bulk-count { font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.bar-group:not([hidden]) { animation: fade 0.3s both; }

.tabs { display: flex; flex: 0 1 auto; min-width: 0; gap: 2px; margin-left: auto; padding: 3px; border-radius: 13px; background: var(--well); border: 1px solid var(--border); }
.tabs button { appearance: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 700 12.5px var(--font); cursor: pointer; white-space: nowrap; transition: background-color 0.25s, color 0.25s; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected='true'] { background: rgba(var(--ink), 0.12); color: var(--text); }
:root[data-theme='light'] .tabs button[aria-selected='true'] { background: #fff; box-shadow: 0 1px 3px rgba(22, 20, 40, 0.15); }
@container (max-width: 400px) { .tabs button { padding: 0 8px; gap: 4px; } .list-bar { gap: 6px; padding-left: 14px; padding-right: 10px; } }
@container (max-width: 340px) { .tabs button { padding: 0 6px; } }
.tabs b { font-weight: 800; color: var(--accent-t); font-variant-numeric: tabular-nums; animation: pop-in 0.4s var(--spring); }
.tabs b:empty { display: none; }

/* Carpetas (como las etiquetas de Gmail) */
/* Barra de carpetas: se desplaza en horizontal; flechas + desvanecido en los bordes indican que hay más carpetas */
.folder-nav { display: flex; align-items: flex-start; min-width: 0; }
.folder-scroll { position: relative; flex: 1; min-width: 0; }
/* Botón de nueva carpeta: fuera de la zona desplazable, siempre a la vista */
.folder-add { appearance: none; flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin: 0 20px 12px 0; padding: 0; border-radius: 50%; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); cursor: pointer; transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.3s var(--spring); }
.folder-add .ico { width: 17px; height: 17px; }
.folder-add:hover { color: var(--text); background: rgba(var(--ink), 0.08); border-color: rgba(167, 139, 250, 0.8); }
.folder-add:active { transform: scale(0.92); }
.folder-add:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.folder-bar {
  --fade-l: 0px; --fade-r: 0px;
  display: flex; gap: 8px; padding: 0 12px 12px 20px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  scroll-padding-inline: 52px; /* al enfocar o seleccionar una carpeta no queda tapada por el desvanecido */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
}
.folder-bar::-webkit-scrollbar { display: none; }
.folder-nav[data-l='true'] .folder-bar { --fade-l: 52px; }
.folder-nav[data-r='true'] .folder-bar { --fade-r: 52px; }
.folder-bar.is-drag { cursor: grabbing; user-select: none; }
.folder-bar.is-drag .chip { pointer-events: none; }
.folder-arrow {
  appearance: none; -webkit-appearance: none; position: absolute; z-index: 2; top: 2px; display: none; place-items: center;
  width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--pop); color: var(--text);
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.65); cursor: pointer;
  opacity: 0; transform: scale(0.8); pointer-events: none;
  transition: opacity 0.2s, transform 0.3s var(--spring), border-color 0.2s, background-color 0.2s;
}
.folder-arrow .ico { width: 16px; height: 16px; }
.folder-arrow-l { left: 8px; }
.folder-arrow-l .ico { transform: rotate(90deg); }
.folder-arrow-r { right: 8px; }
.folder-arrow-r .ico { transform: rotate(-90deg); }
.folder-arrow:hover { border-color: rgba(167, 139, 250, 0.8); background: var(--pop); }
.folder-arrow:active { transform: scale(0.92); }
.folder-nav[data-l='true'] .folder-arrow-l, .folder-nav[data-r='true'] .folder-arrow-r { opacity: 1; transform: none; pointer-events: auto; }
.folder-nav[data-l='true'] .folder-arrow-l:active, .folder-nav[data-r='true'] .folder-arrow-r:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) { .folder-arrow { display: grid; } } /* en pantallas táctiles basta con deslizar */
.chip { appearance: none; flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px 0 11px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--muted); font: 700 13px var(--font); white-space: nowrap; cursor: pointer; transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.3s var(--spring); }
.chip .ico { width: 16px; height: 16px; }
.chip:hover { color: var(--text); background: rgba(var(--ink), 0.08); }
.chip:active { transform: scale(0.96); }
.chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.chip[aria-selected='true'] { color: var(--text); background: rgba(139, 92, 246, 0.18); border-color: rgba(139, 92, 246, 0.5); }
.chip[aria-selected='true'] .ico { color: var(--accent-t); }
.chip-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.chip b { font-weight: 800; color: var(--accent-t); font-variant-numeric: tabular-nums; }
.chip b:empty { display: none; }

.pick-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: min(260px, 40dvh); overflow-y: auto; }
.pick-item { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: 600 14.5px var(--font); text-align: left; cursor: pointer; transition: background-color 0.15s; }
.pick-item .ico { color: var(--muted); }
.pick-item:hover, .pick-item:focus-visible { background: rgba(var(--ink), 0.08); outline: none; }
.pick-item[aria-current='true'] { background: rgba(139, 92, 246, 0.14); }
.pick-item[aria-current='true'] .ico { color: var(--accent-t); }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-new { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.pick-new .input { flex: 1; min-width: 0; }
.pick-new + .form-error { margin-top: 10px; }

#message-list { flex: 1; min-height: 0; margin: 0; padding: 10px; list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
#message-list:empty { flex: 0; padding: 0; }
.msg { position: relative; display: flex; gap: 14px; padding: 16px 16px 16px 14px; border-radius: 18px; background: transparent; cursor: pointer; transition: background-color 0.2s, transform 0.35s var(--ease); outline: none; }
.msg:hover { background: rgba(var(--ink), 0.055); }
.msg:active { transform: scale(0.992); }
.msg:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.msg[data-open='true'] { background: rgba(139, 92, 246, 0.14); }
.msg[data-checked='true'] { background: rgba(var(--ink), 0.07); }
.msg[data-unread='true']::before { content: ''; position: absolute; left: 2px; top: 20px; bottom: 20px; width: 4px; border-radius: 99px; background: linear-gradient(180deg, var(--spark), #0ea5e9); box-shadow: 0 0 12px rgba(34, 211, 238, 0.55); }
.msg.anim { animation: msg-in 0.6s var(--spring) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes msg-in { from { opacity: 0; transform: translateX(-18px) scale(0.97); } }
.msg-lead { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 1px; }
.msg-lead .msg-check { opacity: 0.45; transition: opacity 0.2s, background-color 0.2s, border-color 0.2s, transform 0.3s var(--spring); }
.msg:hover .msg-check, .msg:focus-within .msg-check, .msg[data-checked='true'] .msg-check { opacity: 1; }
.msg-lead .star-btn { width: 28px; height: 28px; border-radius: 9px; }
.msg-lead .star-btn .ico { width: 16px; height: 16px; }
.msg-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.msg-from { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg[data-unread='true'] .msg-from { color: var(--text); font-weight: 800; }
.msg-time { flex: none; font-size: 12px; color: var(--faint); }
.msg[data-unread='true'] .msg-time { color: var(--accent-t); font-weight: 700; }
.msg-subject { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg[data-unread='true'] .msg-subject { font-weight: 800; }
.msg-intro { font-size: 13px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-actions { position: absolute; top: 10px; right: 10px; display: none; gap: 2px; padding: 3px; border-radius: 13px; background: var(--pop); border: 1px solid var(--border-strong); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.8); animation: pop 0.25s var(--spring) both; }
@media (hover: hover) { .msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; } }

/* Estado de la lista: esperando / sin resultados / cargando */
.list-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 24px; text-align: center; color: var(--muted); }
.list-empty p { font: 800 17px var(--display); color: var(--text); }
.list-empty small { font-size: 13px; }
.list-empty[data-kind='none'] .pulse-ring, .list-empty[data-kind='load'] .pulse-ring { display: none; }
.pulse-ring { position: relative; width: 16px; height: 16px; margin-bottom: 18px; border-radius: 50%; background: var(--spark); box-shadow: 0 0 20px rgba(34, 211, 238, 0.6); }
.pulse-ring::before, .pulse-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--spark); animation: ring 2.4s ease-out infinite; }
.pulse-ring::after { animation-delay: 1.2s; }
@keyframes ring { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(4.4); opacity: 0; } }
.list-empty[data-kind='load']::before { /* esqueleto de carga */
  content: ''; width: min(280px, 80%); height: 120px; margin-bottom: 14px; border-radius: 16px;
  background:
    linear-gradient(rgba(var(--ink), 0.09) 0 0) 0 0 / 100% 14px no-repeat,
    linear-gradient(rgba(var(--ink), 0.07) 0 0) 0 30px / 70% 12px no-repeat,
    linear-gradient(rgba(var(--ink), 0.05) 0 0) 0 52px / 100% 12px no-repeat,
    linear-gradient(rgba(var(--ink), 0.09) 0 0) 0 84px / 100% 14px no-repeat,
    linear-gradient(rgba(var(--ink), 0.07) 0 0) 0 106px / 55% 12px no-repeat;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 50% { opacity: 0.4; } }

.list-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 14px 24px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.list-foot span { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
kbd { display: inline-block; min-width: 20px; margin-right: 4px; padding: 1px 6px; border-radius: 7px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: rgba(var(--ink), 0.06); font: 600 11px var(--mono); color: var(--muted); text-align: center; }

/* ============ Lector ============ */
.viewer-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; color: var(--faint); font-weight: 600; }
.viewer-empty .ico { width: 54px; height: 54px; padding: 16px; box-sizing: border-box; border-radius: 22px; color: var(--accent-t); background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.25); animation: floaty2 5s ease-in-out infinite; }
.viewer-empty .ico svg { width: 22px; height: 22px; }
@keyframes floaty2 { 50% { transform: translateY(-8px) rotate(-4deg); } }
.viewer-bar { display: flex; align-items: center; gap: 4px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.viewer-head { padding: 22px 30px 18px; border-bottom: 1px solid var(--border); animation: rise 0.5s var(--ease) both; }
.viewer-subject { font-size: 22px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.25; overflow-wrap: anywhere; }
.viewer-meta { margin-top: 13px; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.viewer-meta .avatar { width: 42px; height: 42px; font-size: 16px; }
.viewer-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.viewer-who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-who strong { color: var(--text); font-weight: 800; font-size: 14px; }
.viewer-frame { display: block; flex: 1 0 auto; width: 100%; height: 320px; min-height: 240px; border: 0; background: #fff; color-scheme: light; animation: fade 0.5s both; }
.viewer-text { flex: 1; margin: 0; padding: 24px 30px; white-space: pre-wrap; overflow-wrap: anywhere; font: 500 15px/1.7 var(--font); max-width: 90ch; animation: fade 0.5s both; }
.notice-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 36px; border-bottom: 1px solid var(--border); background: rgba(251, 191, 36, 0.07); font-size: 13px; color: var(--warn-t); }
.only-narrow { display: none; }
.viewer-close { margin-left: 6px; position: relative; }
.viewer-close::before { content: ''; position: absolute; left: -7px; top: 9px; bottom: 9px; width: 1px; background: var(--border-strong); }

/* Códigos de verificación detectados */
.code-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 36px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, rgba(139, 92, 246, 0.12), rgba(232, 121, 249, 0.05)); animation: rise 0.5s var(--ease) both; }
.code-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.code-label::before { content: '✦'; color: var(--spark); font-size: 13px; letter-spacing: 0; }
.code-chip { appearance: none; display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 13px; border-radius: 12px; border: 1px solid rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.18); color: var(--text); cursor: pointer; font: inherit; transition: background-color 0.2s, transform 0.35s var(--spring), box-shadow 0.3s; }
.code-chip:hover { background: rgba(139, 92, 246, 0.3); transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(139, 92, 246, 0.9); }
.code-chip:active { transform: scale(0.95); }
.code-chip code { font-size: 17px; font-weight: 600; letter-spacing: 0.14em; }
.code-chip .ico { width: 15px; height: 15px; color: var(--accent-t); }

/* ============ Estado vacío ============ */
.empty { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 72px 24px; text-align: center; border-radius: 30px; overflow: hidden; }
.empty-ico { position: relative; display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 12px; border-radius: 28px; color: #fff; background: linear-gradient(135deg, #6d28d9, var(--accent) 50%, var(--accent-2)); box-shadow: 0 22px 40px -16px rgba(139, 92, 246, 0.9); animation: floaty2 5s ease-in-out infinite; }
.empty-ico::after { content: ''; position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--spark); border: 4px solid var(--panel); animation: ping-dot 2.4s var(--ease) infinite; }
.empty-ico .ico { width: 38px; height: 38px; }
.empty h3 { font-size: 24px; font-weight: 800; }
.empty p { max-width: 380px; margin-bottom: 12px; color: var(--muted); font-size: 15px; }

/* ============ Modales ============ */
.modal-backdrop { position: fixed; top: var(--vvt, 0px); left: 0; right: 0; height: var(--vvh, 100dvh); z-index: 60; display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; padding: 20px; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; background: var(--scrim); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade 0.25s both; }
.modal-backdrop.out { opacity: 0; transition: opacity 0.2s; }
.modal { width: min(470px, 100%); max-height: 100%; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; padding: 30px; background: var(--pop); animation: pop 0.5s var(--spring) both; }
.modal-title { font-size: 20px; font-weight: 800; }
.modal-msg { margin-top: 8px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.modal-ico { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 16px; border-radius: 16px; color: var(--danger); background: rgba(255, 107, 129, 0.12); border: 1px solid rgba(255, 107, 129, 0.3); animation: wobble 0.7s var(--ease) 0.2s both; }
.modal-ico[hidden] { display: none; }
.modal-ico .ico { width: 22px; height: 22px; }
@keyframes wobble { 20% { transform: rotate(-10deg); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
.modal-extra { display: flex; flex-direction: column; gap: 18px; }
.modal-extra:has(> :not([hidden])) { margin-top: 22px; }
.modal-code { display: inline-block; padding: 1px 8px; border-radius: 7px; background: rgba(var(--ink), 0.08); color: var(--text); font-size: 13px; user-select: all; word-break: break-all; }
.check-row { display: flex; align-items: flex-start; gap: 12px; font-size: 13.5px; line-height: 1.5; color: var(--muted); cursor: pointer; }
.check-row .cbx { margin-top: 2px; }

/* Cuenta */
.modal-account { width: min(520px, 100%); box-sizing: border-box; max-height: min(92dvh, 760px); overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 26px; }
.acc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.acc-tabs { margin-left: 0; width: 100%; box-sizing: border-box; flex: none; }
.acc-tabs button { flex: 1; justify-content: center; height: 38px; }
.acc-tabs .ico { width: 16px; height: 16px; }
.acc-sub { margin: 0; font-size: 16px; font-weight: 800; }
.acc-desc { margin-top: 6px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.acc-block { padding: 18px; border-radius: 20px; background: rgba(var(--ink), 0.04); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.acc-block > .acc-desc, .acc-block > .acc-sub { margin: 0; }
.acc-block .acc-sub + .acc-desc { margin-top: -8px; }
.acc-block-danger { background: rgba(255, 107, 129, 0.05); border-color: rgba(255, 107, 129, 0.28); }
.acc-block-danger .acc-sub { color: var(--danger); }
.acc-panel:not([hidden]) { animation: rise 0.45s var(--ease) both; }
.link-row { display: flex; align-items: center; gap: 14px; }
.link-ico { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: #fff; border: 1px solid var(--border-strong); }
.link-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.link-body strong { font-size: 14.5px; font-weight: 800; }
.link-body small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#g-btn[data-mode='unlink']:not(:disabled) { color: var(--danger); border-color: rgba(255, 107, 129, 0.35); }
#g-btn[data-mode='unlink']:not(:disabled):hover { background: rgba(255, 107, 129, 0.12); }
.form-error[hidden], .acc-desc[hidden] { display: none; }

/* ============ Avisos ============ */
#toasts { position: fixed; z-index: 70; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; max-width: min(380px, calc(100vw - 32px)); padding: 13px 16px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--pop); box-shadow: 0 22px 44px -18px rgba(0, 0, 0, 0.8); font-size: 14px; font-weight: 600; pointer-events: auto; animation: toast-in 0.6s var(--spring) both; }
.toast > .ico { width: 30px; height: 30px; padding: 6px; box-sizing: border-box; border-radius: 10px; color: var(--ok); background: rgba(52, 211, 153, 0.14); }
.toast-mail > .ico { color: var(--spark); background: rgba(34, 211, 238, 0.14); }
.toast-error { border-color: rgba(255, 107, 129, 0.4); }
.toast-error > .ico { color: var(--danger); background: rgba(255, 107, 129, 0.14); }
.toast-msg { flex: 1; }
.toast-action { appearance: none; margin-left: 4px; padding: 8px 13px; border: 0; border-radius: 10px; background: rgba(var(--ink), 0.1); color: var(--text); font: 800 13px var(--font); cursor: pointer; transition: background-color 0.2s, transform 0.3s var(--spring); }
.toast-action:hover { background: rgba(139, 92, 246, 0.3); }
.toast-action:active { transform: scale(0.94); }
.toast::after { /* barra de tiempo */
  content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; animation: timer var(--dur, 3.2s) linear both;
}
.toast.out { animation: toast-out 0.3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(0.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px) scale(0.92); } }
@keyframes timer { to { transform: scaleX(0); } }

/* ============ Panel lateral de buzones ============ */
.drawer-backdrop { position: fixed; top: var(--vvt, 0px); left: 0; right: 0; height: var(--vvh, 100dvh); z-index: 55; background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.drawer-backdrop[data-open='true'] { opacity: 1; visibility: visible; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 22px; padding: 26px 26px 22px; box-sizing: border-box; background: var(--panel); border-left: 1px solid var(--border-strong); box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.8); transform: translateX(100%); transition: transform 0.55s var(--ease); }
.drawer-backdrop[data-open='true'] .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { flex: 1; font-size: 22px; font-weight: 800; }
.drawer-create { gap: 14px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.drawer-create .hint { margin: 0; }
.drawer-list { flex: 1 0 auto; min-height: 160px; display: flex; flex-direction: column; }
.drawer-list #mailbox-list { flex: 1; padding: 2px 4px 2px 0; }

/* ============ Animaciones generales ============ */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.94); } }
.anim-rise { animation: rise 0.7s var(--ease) both; }
.anim-rise.d1 { animation-delay: 0.08s; }
.anim-rise.d2 { animation-delay: 0.16s; }
#app-view:not([hidden]) { animation: fade 0.5s both; }
#auth-view:not([hidden]) { animation: fade 0.4s both; }
/* Entrada escalonada de la pantalla de acceso */
.auth-shell > .hero > * { animation: rise 0.8s var(--ease) both; }
.auth-shell > .hero > :nth-child(2) { animation-delay: 0.08s; }
.auth-shell > .hero > :nth-child(3) { animation-delay: 0.16s; }
.auth-shell > .hero > :nth-child(4) { animation-delay: 0.24s; }
.auth-shell > .hero > :nth-child(5) { animation-delay: 0.32s; }
.auth-card { animation: card-in 0.9s var(--spring) 0.1s both; }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) scale(0.96); } }

/* ============ Adaptación ============ */
@media (max-width: 1100px) {
  .mail-panel { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 236px); min-height: 480px; }
  .panel-splitter { display: none; }
  .mail-panel[data-view='list'] .viewer-col { display: none; }
  .mail-panel[data-view='viewer'] .list-col { display: none; }
  .only-narrow { display: inline-grid; }
  .only-wide { display: none; }
}

@media (max-width: 960px) {
  .auth-wrap { padding-top: max(68px, calc(env(safe-area-inset-top) + 60px)); }
  .auth-shell { grid-template-columns: minmax(0, 460px); justify-content: center; }
  .hero { display: none; }
  .card-brand { display: inline-flex; }
  .layout { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .topbar-in { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

/* Zonas táctiles de 44 px y letra de 16 px (iOS hace zoom en campos menores) */
@media (pointer: coarse), (max-width: 820px) {
  .input, .input-sm, .select-btn { font-size: 16px; min-height: 48px; }
  .tool { width: 44px; height: 44px; }
  .btn-sm, .btn-icon { min-height: 44px; }
  .btn-icon { width: 44px; }
  .addr-copy { width: 40px; height: 40px; }
  .input-action { width: 44px; height: 44px; right: 2px; }
  .tabs button { height: 36px; }
  .cbx { width: 22px; height: 22px; }
  .menu-item { padding: 14px; }
  .seg button { height: 44px; }
}

/* Sin «hover pegajoso» en pantallas táctiles */
@media (hover: none) {
  .mailbox:hover { transform: none; }
  .btn:hover:not(:disabled), .btn-primary:hover:not(:disabled), .btn-ghost:hover:not(:disabled), .btn-google:hover:not(:disabled), .btn-danger:hover:not(:disabled) { transform: none; }
  .msg-lead .msg-check { opacity: 1; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .auth-wrap { align-items: start; padding-left: 14px; padding-right: 14px; }
  .auth-card { margin: auto 0; padding: 28px 20px 24px; gap: 16px; border-radius: 28px; }
  .auth-title { font-size: 25px; }
  .mail-panel { height: calc(100svh - 190px - env(safe-area-inset-top, 0px)); min-height: 440px; border-radius: 22px; }
  .mailhead { border-radius: 22px; flex-wrap: wrap; }
  .mailhead-id { flex: 1 1 100%; gap: 14px; }
  .mailhead-actions { flex: 1 1 100%; }
  .btn-drawer { flex: 1; padding: 0 14px; }
  .viewer-head { padding: 18px 16px 14px; }
  .viewer-subject { font-size: 21px; }
  .empty { padding: 52px 20px; border-radius: 26px; }

  /* El panel de buzones sube desde abajo como una hoja */
  .drawer {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: min(90dvh, calc(var(--vvh, 100dvh) - 8px)); gap: 16px;
    padding: 28px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    border-left: 0; border-top: 1px solid var(--border-strong); border-radius: 28px 28px 0 0;
    box-shadow: 0 -30px 80px -30px rgba(0, 0, 0, 0.85); transform: translateY(100%);
  }
  .drawer::before { content: ''; position: absolute; top: 9px; left: 50%; width: 42px; height: 5px; margin-left: -21px; border-radius: 99px; background: rgba(var(--ink), 0.22); }
  .drawer-backdrop[data-open='true'] .drawer { transform: none; }

  /* Diálogos como hoja inferior */
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; border-radius: 28px 28px 0 0; padding: 26px 20px calc(22px + env(safe-area-inset-bottom, 0px)); }
  /* Diálogos con campo de texto (crear carpeta, renombrar…): centrados y dentro del área visible, para que el teclado no los tape ni los empuje abajo */
  .modal-backdrop.is-input { place-items: center; padding: 14px max(14px, env(safe-area-inset-right)) 14px max(14px, env(safe-area-inset-left)); }
  .modal-backdrop.is-input .modal { border-radius: 24px; padding: 22px 18px 18px; }
  .modal-backdrop.is-input .modal-actions { margin-top: 18px; }
  .modal-backdrop.is-input .modal-extra:has(> :not([hidden])) { margin-top: 16px; }
  .modal-account { max-height: 94dvh; padding: 22px 18px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .acc-block { padding: 14px; }
  .avatar-pick { gap: 12px; }
  .avatar-xl { width: 64px; height: 64px; }

  /* Avisos arriba del borde inferior */
  #toasts { left: 12px; right: 12px; align-items: center; }
  .toast { max-width: 100%; }
}

@media (max-width: 520px) {
  .topbar-in { padding-top: 10px; padding-bottom: 10px; }
  .brand-name { font-size: 20px; }
  .user-name { display: none; }
  button.user-chip { padding-right: 8px; gap: 4px; }
  .layout { padding-top: 12px; padding-bottom: 12px; }
  .mailhead { padding: 14px 16px; gap: 12px; }
  .mailhead-id { gap: 12px; }
  .mb-avatar-btn { width: 46px; height: 46px; }
  .mb-avatar-btn .avatar { font-size: 18px; }
  .mb-avatar-badge { width: 20px; height: 20px; }
  .addr { font-size: 16px; }
  .mailhead-actions { gap: 6px; }
  .mailhead-actions #more-btn, .mailhead-actions #settings-btn { width: 44px; padding: 0; }
  .list-foot { display: none; }
  .list-search { padding: 16px 14px 10px; }
  .folder-bar { padding: 0 10px 10px 14px; }
  .folder-add { margin: 0 14px 10px 0; }
  .list-bar { gap: 8px; padding: 6px 12px 6px 16px; }
  .tabs { gap: 2px; }
  .tabs button { padding: 0 9px; }
  .viewer-text, .notice-bar { padding-left: 20px; padding-right: 20px; }
  .code-bar { padding: 12px 20px; }
  .viewer-bar { padding: 10px 12px; }
  .modal-actions .btn { flex: 1; }
  .app-foot { padding: 0 16px 20px; }
}

/* Móviles muy estrechos (320–360 px): barra superior y cabecera compactas para que nada se salga */
@media (max-width: 380px) {
  .topbar-in { gap: 8px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .topbar .brand { gap: 8px; min-width: 0; }
  .topbar .brand-logo { width: 34px; height: 34px; }
  .brand-name { font-size: 18px; }
  .topbar-right { gap: 6px; flex: none; }
  .layout { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .mailhead { padding: 12px 14px; }
  .addr { font-size: 15px; }
  .auth-wrap { padding-left: 10px; padding-right: 10px; }
  .auth-card { padding: 24px 16px 20px; }
  .seg button { font-size: 13px; padding: 0 6px; }
  .tabs button { padding: 0 7px; font-size: 12.5px; }
  .modal { padding-left: 16px; padding-right: 16px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .auth-wrap { align-items: start; }
  .mail-panel { height: calc(100svh - 120px); min-height: 300px; }
}

/* Movimiento reducido: sin animaciones decorativas */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .mrow { opacity: 1; grid-template-rows: 1fr; transform: none; }
}

/* Pie de la pantalla de acceso */
.auth-foot { grid-column: 1 / -1; justify-content: center; text-align: center; }

/* ====================== Admin, notificaciones y mensajes destacados ====================== */
/* Campana junto al usuario */
.notif-host { position: relative; }
.notif-btn { appearance: none; position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.3s var(--spring); }
.notif-btn:hover { background: rgba(var(--ink), 0.09); border-color: var(--border-strong); color: var(--text); }
.notif-btn:active { transform: scale(0.92); }
.notif-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.notif-btn[data-unread='true'] { color: var(--accent-t); border-color: rgba(139, 92, 246, 0.5); }
.notif-btn[data-unread='true'] .ico { animation: bell-ring 1.6s var(--ease) 0.4s 2 both; transform-origin: 50% 0; }
.notif-count { position: absolute; top: -4px; right: -4px; display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: linear-gradient(135deg, #f43f5e, #fb7185); color: #fff; font: 800 11px var(--font); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--bg); animation: pop-in 0.45s var(--spring) both; }
.notif-count[hidden] { display: none; }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-12deg); } 30% { transform: rotate(9deg); } 40% { transform: rotate(-6deg); } 50% { transform: rotate(0); } }

/* Avisos emergentes y lista: arriba a la derecha, bajo el usuario */
.notif-stack, .notif-panel { position: fixed; z-index: 66; top: calc(env(safe-area-inset-top, 0px) + 70px); right: max(32px, env(safe-area-inset-right, 0px)); width: min(390px, calc(100vw - 24px)); }
.notif-stack { display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.notif-stack[hidden] { display: none; }
.notif-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: start; padding: 14px 12px 14px 14px; border-radius: 20px; border: 1px solid rgba(139, 92, 246, 0.55); background: var(--pop); box-shadow: 0 26px 54px -18px rgba(0, 0, 0, 0.85), 0 0 0 4px rgba(139, 92, 246, 0.12); pointer-events: auto; animation: notif-in 0.6s var(--spring) both; }
.notif-card:first-child::before { content: ''; position: absolute; top: -7px; right: 38px; width: 12px; height: 12px; rotate: 45deg; border-radius: 3px 0 0 0; background: var(--pop); border-left: 1px solid rgba(139, 92, 246, 0.55); border-top: 1px solid rgba(139, 92, 246, 0.55); }
.notif-card.out { animation: notif-out 0.26s ease-in both; }
.notif-card-ico { grid-row: 1 / span 2; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: #fff; background: linear-gradient(135deg, #6d28d9, var(--accent) 50%, var(--accent-2)); box-shadow: 0 8px 18px -8px rgba(139, 92, 246, 0.9); }
.notif-card-ico svg { fill: currentColor; width: 20px; height: 20px; }
.notif-card-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.notif-card-kicker { color: var(--accent-t); font: 800 11px var(--font); letter-spacing: 0.06em; text-transform: uppercase; }
.notif-card-title { font-size: 15px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.notif-card-text { margin: 0; max-height: min(32vh, 220px); overflow-y: auto; color: var(--muted); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.notif-card-x { width: 30px; height: 30px; }
.notif-card-ok { grid-column: 2 / span 2; justify-self: end; appearance: none; margin-top: 6px; padding: 8px 14px; border: 0; border-radius: 11px; background: linear-gradient(120deg, #6d28d9, var(--accent) 55%, var(--accent-2)); color: #fff; font: 800 13px var(--font); cursor: pointer; transition: transform 0.3s var(--spring), filter 0.2s; }
.notif-card-ok:hover { filter: brightness(1.1); }
.notif-card-ok:active { transform: scale(0.94); }
@keyframes notif-in { from { opacity: 0; transform: translateY(-18px) scale(0.92); } }
@keyframes notif-out { to { opacity: 0; transform: translateX(30px) scale(0.95); } }

.notif-panel { display: flex; flex-direction: column; max-height: min(70dvh, 560px); overflow: hidden; border-radius: 22px; border: 1px solid var(--border-strong); background: var(--pop); box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.85); animation: pop 0.35s var(--spring) both; transform-origin: top right; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); font-size: 15px; }
.notif-link { appearance: none; padding: 0; border: 0; background: none; color: var(--accent-t); font: 700 12.5px var(--font); cursor: pointer; }
.notif-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.notif-link[hidden] { display: none; }
.notif-list { margin: 0; padding: 8px; list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.notif-item { position: relative; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); cursor: default; }
.notif-item[data-unread='true'] { cursor: pointer; border-color: rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.1); }
.notif-item[data-unread='true']::before { content: ''; position: absolute; top: 16px; left: -1px; width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent-2); }
.notif-item-top { display: flex; align-items: center; gap: 8px; }
.notif-from { color: var(--accent-t); font-size: 12px; font-weight: 800; }
.notif-time { flex: 1; color: var(--faint); font-size: 12px; }
.notif-del { width: 26px; height: 26px; }
.notif-title { margin: 4px 0 2px; font-size: 14.5px; font-weight: 800; overflow-wrap: anywhere; }
.notif-body { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 20px; color: var(--muted); font-size: 14px; }
.notif-empty .ico { width: 30px; height: 30px; color: var(--faint); }
.notif-empty p { margin: 0; }

/* Panel de administración */
.modal-admin { width: min(860px, 100%); max-height: min(92dvh, 820px); }
.adm-title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.adm-badge { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #6d28d9, var(--accent) 50%, var(--accent-2)); box-shadow: 0 10px 22px -10px rgba(139, 92, 246, 0.9); }
.adm-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.adm-tabs button { padding: 0 8px; }
.adm-body { display: flex; flex-direction: column; min-height: 0; }
.adm-view { display: flex; flex-direction: column; gap: 14px; animation: rise 0.4s var(--ease) both; }
.adm-form { gap: 16px; }
.adm-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.adm-search { flex: 1 1 240px; }
.adm-count { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.adm-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.adm-note .ico { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--accent-t); }
.adm-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: min(52dvh, 480px); overflow-y: auto; padding-right: 2px; }
.adm-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.adm-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.adm-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.adm-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; color: var(--muted); font-size: 12px; }
.adm-dot { color: var(--faint); }
.adm-ip { font-family: var(--mono); }
.adm-actions { display: flex; flex: none; gap: 8px; }
.adm-actions .btn { height: 36px; padding: 0 12px; }
.adm-pill { flex: none; padding: 3px 9px; border-radius: 99px; background: rgba(var(--ink), 0.08); color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.adm-pill-own { background: rgba(139, 92, 246, 0.16); color: var(--accent-t); }
.adm-pill-bad { background: rgba(255, 107, 129, 0.16); color: var(--danger); }
.adm-empty, .adm-state { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; list-style: none; }
.adm-state-error { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--danger); }
.adm-state-error p { margin: 0; }
.adm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-chips[hidden], .input-wrap[hidden] { display: none; }
.adm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 99px; background: rgba(139, 92, 246, 0.16); border: 1px solid rgba(139, 92, 246, 0.4); color: var(--accent-t); font-size: 13px; font-weight: 800; }
.adm-chip-x { appearance: none; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(var(--ink), 0.1); color: inherit; cursor: pointer; }
.adm-chip-x:hover { background: rgba(255, 107, 129, 0.25); color: var(--danger); }
.adm-chip-x svg { width: 12px; height: 12px; }
.textarea { height: auto; min-height: 120px; padding: 14px 16px; resize: vertical; line-height: 1.5; }
.adm-form .check-row { margin-top: 4px; }

@media (max-width: 820px) {
  .notif-stack, .notif-panel { right: max(16px, env(safe-area-inset-right, 0px)); }
}
@media (max-width: 640px) {
  .adm-row { flex-wrap: wrap; }
  .adm-actions { width: 100%; }
  .adm-actions .btn { flex: 1; justify-content: center; }
  .adm-tabs button .ico { display: none; }
}
@media (max-width: 520px) {
  .notif-stack, .notif-panel { right: 12px; top: calc(env(safe-area-inset-top, 0px) + 64px); }
  .notif-btn { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .notif-btn[data-unread='true'] .ico, .notif-card { animation: none; }
}

/* Avisos del sistema (Windows, Android…) desde la campana y el aviso emergente */
.notif-card-actions { grid-column: 2 / span 2; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 14px; margin-top: 6px; }
.notif-card-actions .notif-card-ok { margin-top: 0; }
.notif-card-allow { appearance: none; padding: 0; border: 0; background: none; color: var(--accent-t); font: 700 12.5px var(--font); text-align: left; cursor: pointer; }
.notif-card-allow:hover { text-decoration: underline; text-underline-offset: 3px; }
.notif-os { display: flex; align-items: center; gap: 10px; margin: 8px 8px 0; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.notif-os .ico { flex: none; width: 16px; height: 16px; color: var(--accent-t); }
.notif-os-text { flex: 1; min-width: 0; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.notif-os-btn { appearance: none; flex: none; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 99px; background: rgba(var(--ink), 0.06); color: var(--text); font: 800 12px var(--font); cursor: pointer; transition: background-color 0.2s, border-color 0.2s; }
.notif-os-btn:hover { background: rgba(139, 92, 246, 0.18); border-color: rgba(139, 92, 246, 0.5); }
.notif-os-btn:focus-visible, .notif-card-allow:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Dueño de cada buzón en la lista global */
.adm-owner { appearance: none; padding: 0; border: 0; background: none; color: var(--accent-t); font: 800 13px var(--font); cursor: pointer; }
.adm-owner:hover { text-decoration: underline; text-underline-offset: 3px; }
.adm-owner:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.adm-owner-gone { color: var(--faint); cursor: default; font-weight: 600; }
.adm-owner-gone:hover { text-decoration: none; }

/* ====================== Pantalla de acceso: presentación social ====================== */
/* ============ Pantalla de carga de la página de correos y redirección desde el acceso ============ */
.boot { position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--bg); color: var(--muted); text-align: center; padding: 24px; }
.boot-spin { width: 28px; height: 28px; border-width: 3px; border-color: rgba(var(--ink), 0.18); border-top-color: var(--accent); }
.boot-text { font-weight: 600; }
html.is-booting #auth-view { visibility: hidden; }

/* ====================== Pantalla de acceso: bandeja en vivo ====================== */
.hero { gap: 24px; }
.hero-title { font-size: clamp(36px, 4.2vw, 54px); }
.hero-sub { font-size: 16.5px; max-width: 54ch; }

body[data-page='auth'] .inbox { position: relative; isolation: isolate; width: 100%; max-width: 540px; padding: 16px 16px 8px; border-radius: 26px; animation: floaty 8s ease-in-out infinite; }
body[data-page='auth'] .inbox::before { /* borde luminoso que gira */
  content: ''; position: absolute; inset: -1px; z-index: -1; border-radius: 27px; padding: 1px;
  background: conic-gradient(from var(--ang, 0deg), rgba(139, 92, 246, 0.85), rgba(232, 121, 249, 0.1), rgba(34, 211, 238, 0.65), rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.85));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: spin-ang 8s linear infinite;
}
body[data-page='auth'] .inbox::after { /* aura detrás de la tarjeta */
  content: ''; position: absolute; inset: -16% -10%; z-index: -2; pointer-events: none; filter: blur(34px); opacity: 0.9;
  background:
    radial-gradient(42% 46% at 22% 28%, rgba(139, 92, 246, 0.34), transparent 70%),
    radial-gradient(40% 44% at 86% 82%, rgba(34, 211, 238, 0.22), transparent 70%),
    radial-gradient(34% 40% at 80% 12%, rgba(232, 121, 249, 0.2), transparent 70%);
}
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes spin-ang { to { --ang: 360deg; } }
@keyframes floaty { 50% { transform: translateY(-6px); } }

.inbox-head { display: flex; align-items: center; gap: 12px; padding: 0 2px 14px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.mb-stack { display: inline-flex; flex: none; }
.mb-stack > span { display: grid; place-items: center; width: 30px; height: 30px; margin-left: -9px; border-radius: 50%; border: 2px solid var(--panel); font: 800 12px var(--display); color: #fff; }
.mb-stack > span:first-child { margin-left: 0; }
.mb-stack .mb-more { background: var(--well); color: var(--accent-t); font-size: 15px; box-shadow: inset 0 0 0 1px var(--border-strong); }
.inbox-addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 13px var(--mono); color: var(--text); }
.live { display: inline-flex; flex: none; align-items: center; gap: 7px; padding: 5px 11px 5px 10px; border-radius: 99px; font: 800 11px var(--font); letter-spacing: 0.07em; text-transform: uppercase; color: var(--spark); background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34, 211, 238, 0.32); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.6); animation: ping 2s ease-out infinite; }
@keyframes ping { to { box-shadow: 0 0 0 10px rgba(34, 211, 238, 0); } }

.inbox-tabs { display: flex; gap: 4px; padding: 0 0 12px; }
.inbox-tabs > span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font: 700 12.5px var(--font); color: var(--muted); }
.inbox-tabs > span.on { color: var(--accent-t); background: rgba(139, 92, 246, 0.18); }
.inbox-tabs [data-icon], .inbox-tabs .ico { width: 14px; height: 14px; }
.inbox-tabs b { padding: 1px 7px; border-radius: 99px; font: 800 11px var(--mono); color: var(--accent-t); background: rgba(139, 92, 246, 0.2); }

.inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mrow { display: grid; grid-template-rows: 0fr; opacity: 0; transform: translateY(-12px) scale(0.97); transition: grid-template-rows 0.6s var(--ease), opacity 0.5s var(--ease), transform 0.6s var(--spring); }
.mrow.in { grid-template-rows: 1fr; opacity: 1; transform: none; }
.mrow.out { grid-template-rows: 0fr; opacity: 0; transform: translateY(10px) scale(0.97); transition-duration: 0.5s; }
.mrow.still { transition: none; }
.mrow-in { min-height: 0; overflow: hidden; }

.mail { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); transition: background-color 0.5s, border-color 0.5s; }
.mail.fresh { background: linear-gradient(115deg, rgba(139, 92, 246, 0.16), rgba(34, 211, 238, 0.06)); border-color: rgba(139, 92, 246, 0.42); }
.mail-logo { display: block; flex: none; width: 46px; height: 46px; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--border-strong), 0 12px 22px -12px rgba(0, 0, 0, 0.75); }
.mail-logo svg { display: block; width: 100%; height: 100%; }
.mail-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.mail-top { display: flex; align-items: baseline; gap: 8px; }
.mail-top b { font: 800 13.5px var(--font); }
.mail.fresh .mail-top b::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 7px; vertical-align: middle; border-radius: 50%; background: var(--spark); box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.6); animation: ping 2s ease-out infinite; }
.mail-top time { margin-left: auto; flex: none; font: 600 11px var(--font); color: var(--faint); white-space: nowrap; }
.mail.fresh .mail-top time { color: var(--spark); }
.mail-subj, .mail-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subj { font-size: 13px; font-weight: 700; color: var(--text); }
.mail-prev { font-size: 12px; color: var(--muted); }
.mail-code { flex: none; padding: 8px 11px; border-radius: 12px; font: 700 14px var(--mono); letter-spacing: 0.1em; white-space: nowrap; color: var(--accent-t); background: rgba(139, 92, 246, 0.14); border: 1px solid rgba(139, 92, 246, 0.38); }
.mail-act { flex: none; padding: 8px 14px; border-radius: 99px; font: 800 12px var(--font); color: #fff; white-space: nowrap; background: linear-gradient(120deg, #6d28d9, var(--accent) 50%, var(--accent-2)); box-shadow: 0 10px 20px -10px rgba(139, 92, 246, 0.95); }
.mail.fresh .mail-code, .mail.fresh .mail-act { animation: code-pop 0.7s var(--spring) 0.3s both; }
@keyframes code-pop { from { opacity: 0; transform: scale(0.6); } }

/* Tira de logos (solo móvil, dentro de la tarjeta de acceso) */
.card-logos { display: none; }
.card-logos p { margin: 0 0 10px; color: var(--faint); font: 700 11.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; }
.logo-marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.logo-track { display: flex; gap: 10px; width: max-content; animation: marquee 30s linear infinite; }
.logo-track .mail-logo { width: 36px; height: 36px; border-radius: 11px; }
@keyframes marquee { to { transform: translateX(calc(-50% - 5px)); } }
@media (max-width: 960px) { .card-logos { display: block; } }

/* Tarjeta de acceso: un poco más de presencia */
.auth-card { box-shadow: var(--shadow), inset 0 1px 0 rgba(var(--ink), 0.06), 0 0 0 1px rgba(139, 92, 246, 0.1), 0 50px 100px -56px rgba(139, 92, 246, 0.6); }
.btn-google { transition: transform 0.35s var(--spring), box-shadow 0.3s var(--ease), background-color 0.25s, border-color 0.25s; }
.btn-google:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 28px -16px rgba(0, 0, 0, 0.8); }

@media (prefers-reduced-motion: reduce) {
  body[data-page='auth'] .inbox, .logo-track { animation: none; }
}

/* Pantallas bajas: una fila menos y menos aire para que todo quepa sin hacer scroll */
@media (max-height: 860px) and (min-width: 961px) {
  .hero { gap: 18px; }
  .mrow:nth-child(n+4) { display: none; }
  .inbox-head { margin-bottom: 8px; padding-bottom: 12px; }
  .inbox-tabs { padding-bottom: 8px; }
  body[data-page='auth'] .inbox { padding-bottom: 6px; }
  .hero-title { font-size: clamp(34px, 3.8vw, 48px); }
}
