/* =====================================================================
   gestion-webmail · sistema visual
   Hereda el lenguaje de portocarreroweb (familia .gd-page de
   soluciones-gestion-digital.css): tokens --ink/--accent/--green/--line,
   tipografía Geist + Geist Mono, microetiquetas mono, tarjetas con borde.
   Aquí adaptado a un shell de aplicación: sidebar + lista + lector.
   Fuentes AUTO-ALOJADAS (sin CDN externo).
   ===================================================================== */

/* ═══ FUENTES (variables, auto-alojadas) ═════════════════════════════ */
@font-face {
  font-family: 'Geist';
  src: url('../fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 400 500;
  font-display: swap;
  font-style: normal;
}

/* ═══ TOKENS (1:1 con la familia .gd-page) ═══════════════════════════ */
:root {
  --bg:    #FAFAFA;
  --bg-2:  #F4F4F4;
  --bg-3:  #EBEBEB;
  --ink:   #0A0A0A;
  --ink-2: #525252;
  --ink-3: #A1A1A1;
  --ink-4: #D4D4D4;
  --line:  #E5E5E5;
  --line-2:#EDEDED;
  --accent:#0066FF;
  --accent-soft: rgba(0, 102, 255, 0.08);
  --green: #00B866;
  --amber: #F59E0B;
  --red:   #F43F5E;

  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  --mono: 'Geist Mono', 'SF Mono', ui-monospace, monospace;

  --sidebar-w: 264px;
  --list-w: 400px;
  --radius: 14px;
  --radius-sm: 9px;
}

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

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--ink); color: var(--bg); }

a { color: inherit; text-decoration: none; }

.mono {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ═══ SHELL: sidebar | lista | lector ════════════════════════════════ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────────────────── */
.side {
  background: var(--ink);
  color: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  gap: 26px;
  overflow-y: auto;
}
.side__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px;
}
.side__logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: grid; place-items: center;
  font-weight: 600; font-size: 15px;
  color: #fff;
  flex: none;
}
.side__brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.02em; }
.side__brand-sub  { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.45); }

.side__compose {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 11px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: filter .15s ease, transform .15s ease;
}
.side__compose:hover { filter: brightness(1.12); }
.side__compose:active { transform: translateY(1px); }

.side__group-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  padding: 0 8px 8px;
}
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.72);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.side__item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.side__item.is-active { background: rgba(255,255,255,0.10); color: #fff; }
.side__item-ic { width: 17px; flex: none; opacity: .85; }
.side__item-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}
.side__item.is-active .side__item-count { color: var(--accent); background: #fff; padding: 1px 7px; border-radius: 999px; }

.side__accounts { margin-top: auto; }
.side__account {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.side__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #fff; flex: none;
}
.side__account-mail { font-size: 12px; color: rgba(255,255,255,0.8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__account-host { font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,0.4); }

/* ── COLUMNA LISTA ────────────────────────────────────────────────── */
.list {
  border-right: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.list__head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.list__title-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.list__title { font-size: 19px; font-weight: 600; letter-spacing: -0.025em; }
.list__count { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.list__search {
  width: 100%;
  padding: 9px 13px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, background .15s ease;
}
.list__search::placeholder { color: var(--ink-3); }
.list__search:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.list__scroll { overflow-y: auto; flex: 1; }

/* ── FILA DE MENSAJE (patrón celda-con-borde de la familia gd) ──────── */
.msg {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 3px 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  position: relative;
  transition: background .12s ease;
}
.msg:hover { background: var(--bg-2); }
.msg.is-active { background: var(--accent-soft); }
.msg.is-active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.msg__from { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__date { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.msg__subject { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__snippet { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }

/* no leído */
.msg.is-unread .msg__from { font-weight: 600; }
.msg.is-unread .msg__subject { color: var(--ink); font-weight: 500; }
.msg__dot {
  position: absolute; left: 9px; top: 19px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  display: none;
}
.msg.is-unread .msg__dot { display: block; }
.msg.is-unread { padding-left: 26px; }

/* ── LECTOR ───────────────────────────────────────────────────────── */
.reader { background: var(--bg); overflow-y: auto; }
.reader__inner { max-width: 860px; margin: 0 auto; padding: 40px 48px; }
.reader__eyebrow { margin-bottom: 14px; }
.reader__subject { font-size: 27px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; color: var(--ink); margin-bottom: 24px; }
.reader__meta {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 28px;
}
.reader__avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7C3AED);
  display: grid; place-items: center; color: #fff; font-weight: 600; flex: none;
}
.reader__from-name { font-size: 14px; font-weight: 600; }
.reader__from-mail { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.reader__when { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-align: right; }

.reader__actions { display: flex; gap: 8px; margin-bottom: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.btn:hover { border-color: var(--ink-3); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { filter: brightness(1.1); border-color: var(--accent); }

/* cuerpo del email: SE RENDERIZA EN <iframe sandbox> (F1). Este es el
   contenedor blanco tipo "documento". */
.reader__body {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
}
.reader__body-frame { width: 100%; border: 0; display: block; height: 72vh; min-height: 420px; background: #fff; border-radius: var(--radius); }
.reader__body-text { padding: 32px 36px; font-size: 15px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; }

/* ── ESTADO VACÍO ─────────────────────────────────────────────────── */
.empty { display: grid; place-items: center; height: 100%; text-align: center; color: var(--ink-3); }
.empty__ic { font-size: 40px; margin-bottom: 14px; opacity: .4; }
.empty__title { font-size: 15px; color: var(--ink-2); margin-bottom: 4px; }
.empty__sub { font-family: var(--mono); font-size: 12px; }

/* ═══ LOGIN (F0.5) ═══════════════════════════════════════════════════ */
.login {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(ellipse 50% 40% at 20% 10%, rgba(0,102,255,.10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 90%, rgba(124,58,237,.10), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login__card {
  width: 100%; max-width: 380px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 38px 34px;
  box-shadow: 0 24px 60px -20px rgba(10,10,10,.18);
}
.login__brand { display: flex; align-items: center; gap: 11px; margin-bottom: 28px; }
.login__title { font-size: 20px; font-weight: 600; letter-spacing: -0.025em; margin-bottom: 6px; }
.login__sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 7px; }
.field__input {
  width: 100%; padding: 11px 14px; font-family: var(--sans); font-size: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); color: var(--ink);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.field__input:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login__btn {
  width: 100%; margin-top: 8px; padding: 12px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-family: var(--sans); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: filter .15s ease;
}
.login__btn:hover { filter: brightness(1.1); }
.login__error {
  background: rgba(244,63,94,.08); border: 1px solid rgba(244,63,94,.3); color: #b3203a;
  font-size: 13px; padding: 10px 13px; border-radius: var(--radius-sm); margin-bottom: 18px;
}

/* ═══ COMPOSE (F3) ═══════════════════════════════════════════════════ */
.compose {
  min-height: 100vh; display: grid; place-items: start center;
  background:
    radial-gradient(ellipse 50% 40% at 20% 10%, rgba(0,102,255,.07), transparent 60%),
    var(--bg);
  padding: 48px 24px;
}
.compose__card {
  width: 100%; max-width: 720px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px 34px; box-shadow: 0 24px 60px -28px rgba(10,10,10,.16);
}
.compose__head { margin-bottom: 22px; }
.compose__title { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; margin-top: 6px; }
.compose__body { min-height: 280px; resize: vertical; font-family: var(--sans); line-height: 1.6; }
.compose__actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.compose__send { width: auto; padding: 12px 28px; margin-top: 0; }

/* aviso enviado */
.toast {
  margin: 14px 22px 0; padding: 11px 14px; border-radius: var(--radius-sm);
  background: rgba(0,184,102,.10); border: 1px solid rgba(0,184,102,.35);
  color: #097a47; font-size: 13px;
}

/* ═══ RESPONSIVE ═════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 76px var(--list-w) 1fr; }
  .side__brand-name, .side__brand-sub, .side__group-label,
  .side__item span, .side__item-count, .side__account-mail, .side__account-host { display: none; }
  .side__compose span { display: none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 76px 1fr; }
  .reader { display: none; }
}
