/* Tema corporativo Confluence Group — según Manual de uso de la marca:
   Pantone 540C #002F54 (azul) · Pantone 3262C #00B7B3 (turquesa)
   · Pantone Warm Grey 3C #BEB7B0 · degradado 30° turquesa→azul.
   Tipografía corporativa = Effra (Dalton Maag, licencia de pago). En web usamos
   HIND — de la MISMA fundición Dalton Maag, gratuita en Google Fonts, y la más
   cercana al espécimen del manual (pág. 8). Layout estilo Gmail. */
@import url('https://fonts.googleapis.com/css2?family=Hind:wght@300;400;500;600;700&display=swap');

:root {
  --navy: #002F54;
  --teal: #00B7B3;
  --teal-dark: #009996;
  --warmgrey: #BEB7B0;
  --bg: #F5F6F8;
  --bg-elevated: #ffffff;
  --bg-hover: #EEF6F6;
  --bg-read: #F2F5F7;
  --border: #E2E6EA;
  --text: #002F54;
  --text-muted: #6E7B88;
  --accent: #00B7B3;
  --accent-dim: rgba(0, 183, 179, 0.10);
  --danger: #C62828;
  --star: #F4B400;
  --radius: 10px;
  --grad-brand: linear-gradient(30deg, #00B7B3 0%, #002F54 100%);
  --font-sans: 'Effra', 'Hind', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ===== Barra superior ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.brand img { height: 32px; display: block; }

.search-wrap {
  flex: 1;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 18px;
  color: var(--text-muted);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.search-wrap:focus-within {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 2px 10px rgba(0, 47, 84, 0.08);
}
.search-wrap input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--navy);
}
.search-wrap input:focus { outline: none; }

.topbar-actions { display: flex; gap: 8px; margin-left: auto; }

.btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--navy);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--teal); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-ghost { color: var(--text-muted); border-color: transparent; background: transparent; }

/* ===== Raíl de carpetas ===== */
.layout { flex: 1; display: flex; min-height: 0; }

.rail {
  width: 216px;
  flex-shrink: 0;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.compose-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--grad-brand);
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  margin: 0 4px 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 47, 84, 0.22);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.compose-btn:hover { box-shadow: 0 8px 22px rgba(0, 47, 84, 0.3); }
.compose-btn:active { transform: scale(0.98); }

.rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 0 999px 999px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s var(--ease);
}
.rail-item:hover { background: rgba(0, 47, 84, 0.05); }
.rail-item.active { background: var(--accent-dim); color: var(--navy); font-weight: 700; }
.rail-item.active svg { stroke: var(--teal-dark); }
.rail-item svg { flex-shrink: 0; stroke: var(--text-muted); }
.rail-item span { flex: 1; }

.badge {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--teal);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
}
.badge-soft { background: rgba(0, 47, 84, 0.10); color: var(--navy); }

.rail-accounts {
  margin-top: auto;
  padding: 12px 6px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}
.chip:hover { border-color: currentColor; }
.chip.active { color: #fff; background: var(--navy); border-color: var(--navy); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ===== Lista de correos (filas de una línea, estilo Gmail) ===== */
.sidebar {
  width: 460px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elevated);
  overflow: hidden;
}
.inbox-list { flex: 1; overflow-y: auto; }

.mail-item {
  display: grid;
  grid-template-columns: 30px 12px 148px 1fr 62px;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 9px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--bg-read);
  position: relative;
}
.mail-item:hover { box-shadow: inset 0 0 0 1px rgba(0, 47, 84, 0.10), 0 1px 4px rgba(0,47,84,0.08); z-index: 1; }
.mail-item.unread { background: #fff; }
.mail-item.selected { background: var(--accent-dim); }

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #B9C2CA;
  display: flex;
  align-items: center;
  justify-content: center;
}
.star-btn:hover { color: var(--star); }
.star-btn.on { color: var(--star); }
.star-btn svg { pointer-events: none; }

.mail-account-dot { width: 8px; height: 8px; border-radius: 50%; }

.mail-from {
  font-size: 13px;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-item.unread .mail-from { font-weight: 700; }

.mail-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
}
.mail-line .subj {
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 60%;
}
.mail-item.unread .mail-line .subj { font-weight: 700; }
.mail-line .snip {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 300;
}

.mail-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.mail-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.mail-item.unread .mail-date { color: var(--teal-dark); font-weight: 700; }

.row-trash {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}
.row-trash:hover { color: var(--danger); }
.mail-item:hover .row-trash { display: flex; }
.mail-item:hover .mail-date { display: none; }

.priority-badge {
  grid-column: 3 / 6;
  justify-self: start;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 4px;
  margin-top: 2px;
}
.priority-Urgente { background: rgba(198, 40, 40, 0.10); color: #C62828; }
.priority-Importante { background: rgba(230, 145, 0, 0.12); color: #B26A00; }
.priority-Normal { background: rgba(110, 123, 136, 0.10); color: var(--text-muted); }
.priority-Newsletter { background: rgba(0, 47, 84, 0.08); color: var(--navy); }

/* ===== Panel de lectura ===== */
.reading-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: none;
  border-bottom: none;
  border-radius: 0 14px 0 0;
}
.empty-state { margin: auto; color: var(--text-muted); font-size: 14px; }

.message-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  border-top: 3px solid;
  border-image: linear-gradient(30deg, #00B7B3, #002F54) 1;
}
.message-subject { font-size: 20px; font-weight: 700; margin: 0 0 8px; color: var(--navy); }
.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.message-meta .mono { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }

.message-actions {
  display: flex;
  gap: 8px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.message-body { flex: 1; padding: 24px 28px; }
.message-body iframe {
  width: 100%;
  min-height: 340px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
}
.message-body pre {
  white-space: pre-wrap;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.ai-panel {
  margin: 0 28px 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius);
  background: var(--bg);
}
.ai-panel h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--teal-dark);
}
.ai-panel p { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.6; }

/* ===== Ventana de redacción flotante (Gmail) ===== */
.compose-win {
  position: fixed;
  right: 26px;
  bottom: 0;
  width: 540px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 40px rgba(0, 24, 43, 0.30);
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.compose-win.minimized .compose-body { display: none; }

.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
}
.compose-head-btns { display: flex; gap: 4px; }
.compose-head-btns button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  width: 26px;
  height: 24px;
  cursor: pointer;
  border-radius: 4px;
}
.compose-head-btns button:hover { background: rgba(255,255,255,0.14); }

.compose-body { display: flex; flex-direction: column; padding: 4px 16px 12px; }
.compose-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 7px 0;
}
.compose-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  width: 46px;
  flex-shrink: 0;
}
.compose-row input, .compose-row select {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--navy);
  padding: 2px 0;
}
.compose-row input:focus, .compose-row select:focus { outline: none; }

#compose-text {
  border: none;
  resize: vertical;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  padding: 12px 0 6px;
  min-height: 180px;
}
#compose-text:focus { outline: none; }

.compose-note { font-size: 11px; color: var(--warmgrey); padding-bottom: 6px; }

.compose-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.compose-foot .btn-primary { border-radius: 999px; padding: 9px 26px; }
.status-text { font-size: 12px; color: var(--text-muted); }
.icon-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
}
.icon-btn:hover { color: var(--danger); background: rgba(198, 40, 40, 0.07); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  padding: 10px 22px;
  box-shadow: 0 8px 30px rgba(0, 24, 43, 0.35);
  z-index: 80;
  transition: opacity 0.4s var(--ease);
}

.error { color: var(--danger); font-size: 13px; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #CDD4DA; border-radius: 10px; }
