/* =============================================
   NoteFlow — Premium Notes App Styles
   ============================================= */

/* =============================================
   SISTEMA DE ARMONÍAS DE COLOR — NoteFlow
   =============================================
   Base:     hsl(215°) Azul Cerúleo
   Análogos: hsl(200°) Acero · hsl(230°) Zafiro · hsl(248°) Índigo
   Tríada-1: hsl(335°) Carmesí   (+120° → warm accent · danger)
   Tríada-2: hsl(152°) Esmeralda (+240° → cool accent · success)
   ===================================================== */
:root {
  /* ── Fondos análogos (tema claro) ────────────────── */
  --bg-base:      hsl(230, 40%, 94%);   /* záfiro muy pálido */
  --bg-surface:   hsl(0, 0%, 100%);
  --bg-surface-2: hsl(225, 38%, 96%);   /* análogo índigo, casi blanco */
  --bg-surface-3: hsl(228, 32%, 89%);   /* záfiro suave */

  /* ── Bordes análogos cerúleo/záfiro ──────────────── */
  --border:        hsla(225, 70%, 58%, 0.18);
  --border-strong: hsla(215, 75%, 55%, 0.38);

  /* ── Textos (análogos oscuros del azul base) ─────── */
  --text-primary:   hsl(245, 42%, 18%);   /* índigo profundo */
  --text-secondary: hsl(235, 22%, 38%);   /* záfiro-oscuro medio */
  --text-muted:     hsl(230, 18%, 58%);   /* gris-azulado suave */

  /* ── Acento principal — Cerúleo hsl(215°) ──────── */
  --accent:        hsl(215, 88%, 58%);   /* #2b91f4 cerúleo */
  --accent-hover:  hsl(215, 88%, 50%);
  --accent-light:  hsla(215, 88%, 58%, 0.10);
  --accent-light-2:hsla(215, 88%, 58%, 0.20);

  /* ── Tríada 1 — Carmesí hsl(335°) — danger/warm ── */
  --danger:        hsl(335, 78%, 55%);   /* #e82d6a */
  --danger-light:  hsla(335, 78%, 55%, 0.12);

  /* ── Tríada 2 — Esmeralda hsl(152°) — success ──── */
  --success:       hsl(152, 68%, 40%);   /* #22c278 */
  --success-light: hsla(152, 68%, 40%, 0.12);

  /* ── Análogo cálido — Ámbar (hsl(38°)) — warning ── */
  --warning:       hsl(38, 92%, 52%);    /* #f5a623 */

  /* ── Layout ───────────────────────────────────────── */
  --sidebar-width: 260px;
  --radius:        12px;
  --radius-sm:      8px;
  --radius-lg:     16px;

  /* ── Sombras con tono cerúleo ───────────────────── */
  --shadow-sm: 0 1px 4px  hsla(215, 80%, 50%, 0.10), 0 1px 2px  rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px hsla(215, 80%, 50%, 0.15), 0 2px 6px  rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 32px hsla(215, 80%, 50%, 0.18), 0 4px 12px rgba(0,0,0,0.09);
  --shadow-xl: 0 20px 60px hsla(215, 80%, 50%, 0.22), 0 8px 24px rgba(0,0,0,0.12);

  --transition: 0.2s ease;
  --font-main:    'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
}

/* ── Tema Oscuro — armonías profundas ─────────────────── */
[data-theme="dark"] {
  /* Fondos análogos oscuros (azul-medianoche → záfiro → índigo) */
  --bg-base:      hsl(240, 28%, 8%);    /* índigo casi negro */
  --bg-surface:   hsl(230, 30%, 12%);   /* záfiro muy oscuro */
  --bg-surface-2: hsl(232, 28%, 16%);   /* záfiro oscuro */
  --bg-surface-3: hsl(235, 26%, 20%);   /* záfiro medio */

  /* Bordes análogos más luminosos en dark */
  --border:        hsla(220, 65%, 60%, 0.14);
  --border-strong: hsla(215, 75%, 62%, 0.30);

  /* Textos claros con tinte análogo */
  --text-primary:   hsl(225, 30%, 94%);   /* blanco-azulado */
  --text-secondary: hsl(225, 20%, 68%);   /* gris-cerúleo */
  --text-muted:     hsl(228, 16%, 42%);   /* muted azulado */

  /* Acento cerúleo más luminoso para dark */
  --accent:        hsl(215, 90%, 66%);   /* cerúleo brillante */
  --accent-hover:  hsl(215, 90%, 58%);
  --accent-light:  hsla(215, 90%, 66%, 0.13);
  --accent-light-2:hsla(215, 90%, 66%, 0.22);

  /* Tríada 1 — Carmesí vibrante en dark */
  --danger:        hsl(335, 75%, 62%);
  --danger-light:  hsla(335, 75%, 62%, 0.14);

  /* Tríada 2 — Esmeralda más brillante en dark */
  --success:       hsl(152, 65%, 48%);
  --success-light: hsla(152, 65%, 48%, 0.14);

  /* Ámbar en dark */
  --warning:       hsl(38, 90%, 58%);

  /* Sombras dark (más opacas, sin tinte de color) */
  --shadow-sm:  0 1px 3px  rgba(0,0,0,0.35);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.55);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.65);
}

/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============ APP LAYOUT ============ */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
}

.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .section-header span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .groups-list,
.sidebar.collapsed .sidebar-footer span {
  display: none;
}

.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .section-header { justify-content: center; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  /* Gradiente análogo: cerúleo → zafiro */
  background: linear-gradient(135deg, hsl(215, 88%, 58%), hsl(248, 82%, 66%));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 12px 8px;
  padding: 8px 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

.sidebar-search:focus-within {
  border-color: var(--accent);
  background: var(--accent-light);
}

.sidebar-search svg { color: var(--text-muted); flex-shrink: 0; }
.sidebar-search input { background: none; border: none; outline: none; width: 100%; color: var(--text-primary); font-size: 13px; }
.sidebar-search input::placeholder { color: var(--text-muted); }

.sidebar-nav {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
  font-size: 13.5px;
}

.nav-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-item.active svg { stroke: var(--accent); }

.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.groups-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.group-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 36px;           /* altura fija → no se mueve al hacer hover */
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  color: var(--text-secondary);
  font-size: 13.5px;
}

.group-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.group-item.active { background: var(--accent-light); color: var(--text-primary); }

.group-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-icon-svg {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.group-icon-svg svg { width: 16px; height: 16px; }
.group-name { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-count {
  font-size: 11px;
  background: var(--bg-surface-3);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 99px;
}

/* Acciones siempre presentes en layout, invisibles hasta hover → sin salto */
.group-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
  flex-shrink: 0;
}

.group-item:hover .group-actions {
  opacity: 1;
  visibility: visible;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 8px;
}

.btn-icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  transition: all var(--transition);
  width: 100%;
}

.btn-icon-row:hover { background: var(--bg-surface-2); color: var(--text-primary); }

/* ============ MAIN ============ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

/* ============ TOPBAR ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.topbar-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  padding: 7px 10px;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
  border-right: 1px solid var(--border);
}

.view-btn:last-child { border-right: none; }
.view-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.view-btn.active { background: var(--accent-light); color: var(--accent); }

/* ============ NOTES CONTAINER ============ */
.notes-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.notes-grid.list-layout {
  grid-template-columns: 1fr;
  gap: 10px;
}

/* ============ NOTE CARD ============ */
.note-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  animation: fadeInCard 0.3s ease both;
  box-shadow: var(--shadow-sm);
}

@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.note-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.note-card-cover {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.note-card-body { padding: 16px; }

.note-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

.note-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card-menu {
  opacity: 0;
  transition: opacity var(--transition);
}

.note-card:hover .note-card-menu { opacity: 1; }

.note-card-author {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.note-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-card-group {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--accent-light);
  color: var(--accent);
}

.note-card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.note-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.note-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.shared-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  /* Tríada carmesí cálido para badge compartido */
  background: linear-gradient(135deg, hsl(215, 88%, 58%), hsl(335, 72%, 58%));
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.05em;
}

/* ============================================================
   LIST LAYOUT — Datos izquierda · Contenido derecha
   ============================================================ */
.notes-grid.list-layout .note-card {
  display: flex;
  flex-direction: row;
  border-radius: var(--radius-sm);
  min-height: 90px;
  overflow: hidden;
}

/* Ocultar portada en lista — se reemplaza por layout de columnas */
.notes-grid.list-layout .note-card-cover,
.notes-grid.list-layout .note-card-accent {
  display: none;
}

/* Columna izquierda: franja de acento + metadata */
.notes-grid.list-layout .note-card-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  padding: 0;
  gap: 0;
}

/* PANEL IZQUIERDO — info: título, autor, grupo, fecha, tags */
.notes-grid.list-layout .note-card-body::before {
  /* franja de color lateral */
  content: '';
  width: 4px;
  flex-shrink: 0;
  background: var(--accent);
  opacity: 0.6;
}

.notes-grid.list-layout .note-card-info {
  flex: 0 0 260px;            /* ancho fijo para la columna de info */
  min-width: 180px;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

/* PANEL DERECHO — preview del contenido */
.notes-grid.list-layout .note-card-preview-col {
  flex: 1;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  align-self: center;
}

/* Ajustes para los elementos dentro de la info */
.notes-grid.list-layout .note-card-header {
  margin-bottom: 2px;
}
.notes-grid.list-layout .note-card-title {
  font-size: 14px;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}
.notes-grid.list-layout .note-card-author {
  margin-bottom: 2px;
  font-size: 11.5px;
}
.notes-grid.list-layout .note-card-footer {
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.notes-grid.list-layout .note-card-preview {
  display: none; /* se usa .note-card-preview-col en su lugar */
}
.notes-grid.list-layout .note-card-tags {
  margin-top: 4px;
}
.notes-grid.list-layout .note-card-attachments {
  margin-top: 4px;
}
/* hover en lista — solo elevar, no mover */
.notes-grid.list-layout .note-card:hover {
  transform: none;
  box-shadow: var(--shadow-md);
}

/* ============ EMPTY STATE ============ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  gap: 12px;
  text-align: center;
}

.empty-state.hidden { display: none; }
.empty-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 8px; opacity: 0.5; color: var(--accent); }
.empty-icon svg { width: 64px; height: 64px; }
.empty-state h3 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.empty-state p { color: var(--text-secondary); margin-bottom: 8px; }

/* ============ SEARCH BANNER ============ */
.search-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--accent-light);
  border-bottom: 1px solid var(--border-strong);
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
  animation: slideDown 0.2s ease;
}

.search-banner.hidden { display: none; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-banner svg { color: var(--accent); flex-shrink: 0; }
.search-banner strong { color: var(--accent); font-weight: 700; }

.search-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 99px;
}

.btn-clear-search {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-clear-search:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ============ SEARCH HIGHLIGHT ============ */
mark.search-highlight {
  background: rgba(251, 211, 50, 0.45);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}

[data-theme="dark"] mark.search-highlight {
  background: rgba(251, 191, 36, 0.3);
}

/* Shared badge SVG alignment */
.shared-badge {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============ BUTTONS ============ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  /* Gradiente análogo: cerúleo → zafiro-índigo */
  background: linear-gradient(135deg, hsl(215, 88%, 58%), hsl(245, 80%, 62%));
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px hsla(215, 80%, 50%, 0.32);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px hsla(215, 80%, 50%, 0.44);
  background: linear-gradient(135deg, hsl(215, 88%, 50%), hsl(245, 80%, 55%));
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13.5px;
  transition: all var(--transition);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13.5px;
  transition: all var(--transition);
}

.btn-ghost:hover { background: var(--bg-surface-2); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-icon:hover { background: var(--bg-surface-2); color: var(--text-primary); }

.btn-icon-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.btn-icon-sm:hover { background: var(--accent-light); color: var(--accent); }

/* ============ MODALS ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-small { max-width: 440px; }
.modal-medium { max-width: 540px; }
.modal-large { max-width: 800px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.modal-header-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }

.modal-body { padding: 0; }
.modal-body:not(.note-editor) { padding: 22px; }

/* Note editor gets its own internal padding on fields only */
.note-fields { padding: 22px 22px 16px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ============ NOTE EDITOR ============ */
.note-cover-area {
  position: relative;
  border-bottom: 1px solid var(--border);
  min-height: 50px;
}

.note-cover-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.note-cover-img.hidden { display: none; }

.note-cover-actions {
  position: absolute;
  bottom: 10px;
  left: 16px;
  display: flex;
  gap: 8px;
}

.cover-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: #333;
  border: 1px solid rgba(0,0,0,0.1);
  transition: all var(--transition);
  cursor: pointer;
}

.cover-btn:hover { background: white; }

.note-fields { padding: 22px; }

.note-title-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 10px;
}

.note-title-input::placeholder { color: var(--text-muted); }

.note-author-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

.note-author-input::placeholder { color: var(--text-muted); }

.tags-area { margin-bottom: 16px; }

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid hsla(215, 80%, 58%, 0.28);
  animation: popIn 0.15s ease;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.tag-chip button {
  color: var(--accent);
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.tag-chip button:hover { opacity: 1; }

.tag-input {
  background: none;
  border: none;
  outline: none;
  font-size: 12.5px;
  color: var(--text-secondary);
  width: 220px;
}

.tag-input::placeholder { color: var(--text-muted); }

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: none;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition);
  min-width: 30px;
  height: 30px;
}

.toolbar-btn:hover { background: var(--accent-light); color: var(--accent); }

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.note-content-input {
  min-height: 140px;
  max-height: 240px;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  outline: none;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color var(--transition);
}

.note-content-input:focus { border-color: var(--accent); }

.note-content-input:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.note-content-input img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  box-shadow: var(--shadow-sm);
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
}

.form-input:focus { border-color: var(--accent); background: var(--accent-light); }
.form-input::placeholder { color: var(--text-muted); }

.select-group {
  padding: 6px 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
}

.select-group:focus { border-color: var(--accent); }

/* ============ COLOR PICKER ============ */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text-primary); transform: scale(1.1); }

/* ============ EMOJI PICKER ============ */
.emoji-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.emoji-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
}

.emoji-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.emoji-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light-2); }

/* ============ SHARE MODAL ============ */
.share-subtitle {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.access-type-group, .duration-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.access-btn, .duration-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.access-btn:hover, .duration-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.access-btn.active, .duration-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); font-weight: 600; }

.active-shares-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.active-shares-section.hidden { display: none; }
.active-shares-section h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }

.active-shares-list { display: flex; flex-direction: column; gap: 8px; }

.share-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.share-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  /* Análogo cerúleo → zafiro */
  background: linear-gradient(135deg, hsl(215, 88%, 58%), hsl(248, 80%, 66%));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.share-item-info { flex: 1; }
.share-item-email { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.share-item-meta { font-size: 11px; color: var(--text-muted); }

.share-item-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}

.badge-view { background: var(--success-light); color: var(--success); }
.badge-edit { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-expired { background: var(--danger-light); color: var(--danger); }

.share-revoke {
  color: var(--danger);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}

.share-revoke:hover { background: var(--danger-light); }

/* ============ CONTEXT MENU ============ */
.context-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 6px;
  z-index: 2000;
  animation: popIn 0.12s ease;
}

.context-menu.hidden { display: none; }

.context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  width: 100%;
  text-align: left;
  transition: all var(--transition);
}

.context-item:hover { background: var(--bg-surface-2); }
.context-item.danger { color: var(--danger); }
.context-item.danger:hover { background: var(--danger-light); }

.context-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.hidden { display: none; }

/* ============ UTILITY ============ */
.hidden { display: none !important; }
.mobile-only { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    transition: left var(--transition);
    z-index: 200;
  }

  .sidebar.mobile-open { left: 0; }
  .mobile-only { display: flex !important; }

  .topbar { padding: 12px 16px; }
  .notes-container { padding: 16px; }
  .notes-grid { grid-template-columns: 1fr; }
}

/* ============ GROUP HEADER ============ */
.group-header-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  flex-shrink: 0;
}

.group-header-icon {
  font-size: 28px;
}

.group-header-info h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.group-header-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Gradient accent line */
.sidebar-header::after {
  display: none;
}

/* Card color accent */
.note-card-accent {
  height: 3px;
  width: 100%;
}

/* Loading animation */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

/* ============ LIGHT THEME ENHANCEMENTS ============ */
/* Sidebar gets a subtle left gradient to pop off the base */
.sidebar {
  /* Sombra lateral cerúlea */
  box-shadow: 2px 0 12px hsla(215, 80%, 50%, 0.12);
}

/* Topbar gets a bottom shadow to separate from content */
.topbar {
  box-shadow: 0 2px 8px hsla(215, 80%, 50%, 0.10);
}

/* Section labels in sidebar more prominent */
.section-header {
  color: var(--accent);
  font-weight: 800;
}

/* Note cards in light mode get stronger shadow + left accent border */
.note-card {
  /* Tinte análogo cerúleo/záfiro */
  border-left: 3px solid hsla(215, 75%, 55%, 0.35);
}

/* Search banner in light mode */
:root .search-banner {
  border-left: 3px solid var(--accent);
}

/* ============ ATTACHMENTS PANEL ============ */
.attachments-section {
  border-top: 1px solid var(--border);
  padding: 16px 22px;
  background: var(--bg-surface-2);
}

.attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.attachments-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachments-title svg { color: var(--accent); }

.attach-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition);
}

.attach-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.attach-btn svg { flex-shrink: 0; }

/* Path input */
.path-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.path-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
  font-family: 'Courier New', monospace;
}

.path-input::placeholder { color: var(--text-muted); font-family: var(--font-main); }
.path-input:focus { border-color: var(--accent); background: var(--accent-light); }

.btn-add-path {
  padding: 8px 14px;
  background: var(--accent-light);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-add-path:hover { background: var(--accent); color: white; }

/* Attachment list */
.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: fadeInCard 0.2s ease;
  transition: border-color var(--transition);
}

.attachment-item:hover { border-color: var(--border-strong); }

.attachment-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

/* Armonías: imagen=cerúleo, video=carmesí, audio=esmeralda, archivo=ámbar, ruta=acero */
.attachment-icon.type-image  { background: hsla(215, 88%, 58%, 0.12); color: hsl(215, 88%, 58%); }
.attachment-icon.type-video  { background: hsla(335, 78%, 55%, 0.12); color: hsl(335, 78%, 55%); }
.attachment-icon.type-audio  { background: hsla(152, 68%, 40%, 0.12); color: hsl(152, 68%, 40%); }
.attachment-icon.type-file   { background: hsla(38,  92%, 52%, 0.12); color: hsl(38,  92%, 52%); }
.attachment-icon.type-path   { background: hsla(200, 80%, 48%, 0.12); color: hsl(200, 80%, 48%); }

.attachment-info { flex: 1; min-width: 0; }

.attachment-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.attachment-preview-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.btn-remove-attach {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-remove-attach:hover { background: var(--danger-light); color: var(--danger); }

/* Attachment counter badge on note cards */
.note-card-attachments {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.attach-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
}

/* Audio player inline */
.attachment-audio {
  width: 100%;
  height: 32px;
  outline: none;
  border-radius: 6px;
  margin-top: 4px;
}

/* Video player inline */
.attachment-video-preview {
  width: 60px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
}

/* ============================================================
   GLOBAL TOOLTIP  (data-tooltip attribute)
   ============================================================ */
[data-tooltip] {
  position: relative;
  cursor: default;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: pre-wrap;
  max-width: 240px;
  width: max-content;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
/* Small arrow */
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 9999;
}
[data-tooltip]:hover::before { opacity: 1; }

/* ============================================================
   IMPORTANCE LEVEL  —  Editor Row
   ============================================================ */
.importance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.importance-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.importance-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.imp-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.imp-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Importancia: none=muted, low=esmeralda, medium=ámbar, high=carmesí, urgent=índigo */
.imp-btn.active[data-level="none"]   { border-color: var(--text-muted);   color: var(--text-muted);   background: var(--bg-surface-2); }
.imp-btn.active[data-level="low"]    { border-color: hsl(152, 68%, 40%); color: hsl(152, 68%, 40%); background: hsla(152, 68%, 40%, 0.10); }
.imp-btn.active[data-level="medium"] { border-color: hsl(38,  92%, 50%); color: hsl(38,  92%, 50%); background: hsla(38,  92%, 50%, 0.10); }
.imp-btn.active[data-level="high"]   { border-color: hsl(335, 78%, 55%); color: hsl(335, 78%, 55%); background: hsla(335, 78%, 55%, 0.10); }
.imp-btn.active[data-level="urgent"] { border-color: hsl(248, 80%, 60%); color: hsl(248, 80%, 60%); background: hsla(248, 80%, 60%, 0.10); font-weight: 700; }

/* ============================================================
   IMPORTANCE  —  Note Card
   ============================================================ */
.note-imp-bar {
  height: 3px;
  width: 100%;
  border-radius: 0;
  opacity: 0.85;
}
.note-imp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  border: none;
  cursor: default;
  white-space: nowrap;
}

/* ============================================================
   SHARE AVATARS ROW  —  Note Card
   ============================================================ */
.share-avatars-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
}
.share-avatars-row > svg { flex-shrink: 0; }
.share-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--bg-surface);
  margin-left: -6px;
  cursor: default;
  position: relative;
  transition: transform 0.15s ease, z-index 0s;
  z-index: 1;
}
.share-avatar:first-of-type { margin-left: 0; }
.share-avatar:hover { transform: translateY(-3px) scale(1.15); z-index: 10; }

/* tooltip for share-avatar: keeps same global [data-tooltip] but anchors to bottom-left */
.share-avatar[data-tooltip]::after {
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  text-align: left;
  font-family: var(--font-mono, monospace);
}
.share-avatar[data-tooltip]:hover::after {
  transform: translateX(-50%) scale(1);
}

/* ============================================================
   GROUP NAME TOOLTIP  (description)
   ============================================================ */
.group-name[data-tooltip] { cursor: help; }
.group-name[data-tooltip]::after {
  left: 0;
  transform: translateX(0) scale(0.92);
  bottom: calc(100% + 8px);
  min-width: 160px;
}
.group-name[data-tooltip]:hover::after {
  transform: translateX(0) scale(1);
}
.group-name[data-tooltip]::before {
  left: 14px;
  transform: translateX(0);
}


/* ============================================================
   USER MENU  —  Topbar
   ============================================================ */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 30px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface-2);
  cursor: pointer;
  transition: all var(--transition);
}
.user-avatar-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.user-avatar-btn[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-light); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.user-menu-caret {
  color: var(--text-secondary);
  transition: transform var(--transition);
}
.user-avatar-btn[aria-expanded="true"] .user-menu-caret { transform: rotate(180deg); }

/* Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.user-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header inside dropdown */
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 10px;
}
.user-dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.user-dropdown-info { flex: 1; min-width: 0; }
.user-dropdown-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown-email {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}
.user-dropdown-item:hover { background: var(--bg-surface-2); }
/* Danger = Tríada 1 Carmesí */
.user-dropdown-item.danger { color: hsl(335, 78%, 55%); }
.user-dropdown-item.danger:hover { background: hsla(335, 78%, 55%, 0.10); }

/* ============================================================
   MODAL SM  (profile / settings)
   ============================================================ */
.modal-sm { max-width: 440px; }

/* Profile avatar section */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0 18px;
}
.profile-avatar-large {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
}
.profile-avatar-upload {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
}

/* Settings rows */
.settings-section { margin-bottom: 20px; }
.settings-section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 0 2px 8px;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  margin-bottom: 6px;
}
.settings-row-info { flex: 1; }
.settings-row-label { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.settings-row-desc  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.settings-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.settings-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Danger = Tríada 1 Carmesí */
.settings-toggle-btn.danger { color: hsl(335, 78%, 55%); border-color: hsla(335, 78%, 55%, 0.28); }
.settings-toggle-btn.danger:hover { background: hsla(335, 78%, 55%, 0.10); border-color: hsl(335, 78%, 55%); }

/* ============================================================
   AUTH SCREEN  —  Armonía de colores: Análogos + Tríada
   ============================================================
   Base: hsl(215°) Azul Cerúleo
   Análogos (±15°): hsl(200°) Acero | hsl(215°) | hsl(230°) Zafiro | hsl(245°) Îndigo
   Tríada (+120°): hsl(335°) Carmesí Apagado | hsl(95°) Lima/Salvia
   ============================================================ */
:root {
  /* Fondos — Armonía Análoga (azules adyacentes, muy oscuros) */
  --auth-bg:         hsl(218, 55%, 5.5%);   /* #080e1f — azul medianoche */
  --auth-panel-l:    hsl(225, 52%, 8%);     /* #0d1228 — azul-záfiro oscuro */
  --auth-panel-r:    hsl(212, 50%, 9%);     /* #0b1422 — azul-acero oscuro */

  /* Tono base — Azul Cerúleo hsl(215°) */
  --auth-cerulean:   hsl(215, 90%, 62%);    /* #3b91f5 */
  --auth-cer-lt:     hsla(215, 90%, 62%, 0.12);
  --auth-cer-bd:     hsla(215, 90%, 62%, 0.22);

  /* Tríada 1 — Carmesí apagado hsl(335°) — acentos cálidos principales */
  --auth-crimson:    hsl(335, 70%, 58%);    /* #e0436e */
  --auth-cri-lt:     hsla(335, 70%, 58%, 0.13);
  --auth-cri-bd:     hsla(335, 70%, 58%, 0.28);

  /* Tríada 2 — Lima/Salvia hsl(95°) — acentos frescos secundarios */
  --auth-sage:       hsl(152, 65%, 45%);    /* #28c27a — esmeralda suave */
  --auth-sage-lt:    hsla(152, 65%, 45%, 0.12);
  --auth-sage-bd:    hsla(152, 65%, 45%, 0.25);

  /* Textos (análogos tibios del azul base) */
  --auth-txt-1:      hsl(210, 25%, 93%);    /* crema azulada casi blanco */
  --auth-txt-2:      hsl(215, 20%, 68%);    /* gris-azulado medio */
  --auth-txt-3:      hsl(220, 18%, 45%);    /* muted */

  /* Bordes (análogo záfiro) */
  --auth-border:     hsla(225, 60%, 55%, 0.14);
  --auth-border-g:   hsla(335, 70%, 58%, 0.2);
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-bg);
  transition: opacity 0.45s ease;
  padding: 20px;
  overflow-y: auto;
}
.auth-screen.auth-screen--out { opacity: 0; pointer-events: none; }
.auth-screen.hidden { display: none; }

/* ── Canvas background ── */
.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Geometric decorative rings */
.auth-geo {
  position: absolute;
  border-radius: 50%;
  /* Análogo base — zafiro */
  border: 1px solid hsla(225, 60%, 55%, 0.07);
  animation: geoSpin 40s linear infinite;
}
.auth-geo-1 {
  width: 620px; height: 620px;
  top: -220px; left: -220px;
  /* Tríada 1 — Carmesí */
  border-color: hsla(335, 65%, 55%, 0.06);
  animation-duration: 50s;
}
.auth-geo-2 {
  width: 420px; height: 420px;
  bottom: -160px; right: -110px;
  /* Base — Cerúleo */
  border-color: hsla(215, 85%, 60%, 0.07);
  animation-duration: 35s;
  animation-direction: reverse;
}
.auth-geo-3 {
  width: 290px; height: 290px;
  top: 40%; left: 40%;
  /* Tríada 2 — Esmeralda */
  border-color: hsla(152, 65%, 45%, 0.05);
  animation-duration: 28s;
}
@keyframes geoSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Floating metric cards */
.auth-metric {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  /* Panel análogo oscuro translucido */
  background: hsla(220, 55%, 7%, 0.8);
  border: 1px solid var(--auth-border-g);
  border-radius: 10px;
  padding: 10px 14px;
  backdrop-filter: blur(14px);
  opacity: 0;
  animation: metricFloat 6s ease-out forwards;
  pointer-events: none;
}
.auth-metric-1 { bottom: 12%; left:  4%; animation-delay: 0.9s; }
.auth-metric-2 { top:    14%; right: 4%; animation-delay: 1.4s; }
.auth-metric-3 { bottom: 22%; right: 4%; animation-delay: 1.9s; }

@keyframes metricFloat {
  0%   { opacity: 0; transform: translateY(16px); }
  60%  { opacity: 1; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Tríada 1 — Carmesí: métrica de actividad */
.auth-metric-1 .auth-metric-icon {
  width: 30px; height: 30px;
  background: var(--auth-cri-lt);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--auth-crimson);
  flex-shrink: 0;
  border: 1px solid var(--auth-cri-bd);
}
/* Base — Cerúleo: métrica de conectividad */
.auth-metric-2 .auth-metric-icon {
  width: 30px; height: 30px;
  background: var(--auth-cer-lt);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--auth-cerulean);
  flex-shrink: 0;
  border: 1px solid var(--auth-cer-bd);
}
/* Tríada 2 — Esmeralda: métrica de seguridad */
.auth-metric-3 .auth-metric-icon {
  width: 30px; height: 30px;
  background: var(--auth-sage-lt);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--auth-sage);
  flex-shrink: 0;
  border: 1px solid var(--auth-sage-bd);
}
.auth-metric-val {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--auth-txt-1);
  letter-spacing: -0.3px;
  line-height: 1;
}
.auth-metric-label {
  font-size: 10.5px;
  color: var(--auth-txt-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── Split container ── */
.auth-split {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  max-width: 900px;
  min-height: 580px;
  max-height: 92vh;
  border-radius: 18px;
  /* borde análogo — cerúleo subtíl */
  border: 1px solid hsla(215, 75%, 60%, 0.1);
  box-shadow:
    0 0 0 1px hsla(335, 65%, 55%, 0.05),
    0 40px 100px rgba(0,0,0,0.72),
    0 10px 30px rgba(0,0,0,0.4);
  overflow: hidden;
  animation: splitIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes splitIn {
  from { opacity: 0; transform: translateY(36px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Left panel ── */
.auth-panel-left {
  flex: 1;
  background: var(--auth-panel-l);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 44px;
  position: relative;
  overflow: hidden;
}

/* Gradiente análogo — azul cerúleo → záfiro → índigo */
.auth-panel-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(155deg,
      hsl(200, 65%, 10%) 0%,
      hsl(218, 62%, 12%) 40%,
      hsl(235, 58%, 13%) 70%,
      hsl(248, 52%, 14%) 100%);
  pointer-events: none;
}

/* Tríada 1 — línea carmesí en la parte superior del panel */
.auth-panel-left::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--auth-crimson) 30%,
    var(--auth-cerulean) 70%,
    transparent);
  opacity: 0.5;
}

.auth-panel-left-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 320px;
}

/* Animated reveal for each child */
.auth-panel-left-inner > * {
  opacity: 0;
  animation: revealUp 0.6s ease forwards;
}
.auth-panel-left-inner > *:nth-child(1) { animation-delay: 0.35s; }
.auth-panel-left-inner > *:nth-child(2) { animation-delay: 0.5s; }
.auth-panel-left-inner > *:nth-child(3) { animation-delay: 0.65s; }
.auth-panel-left-inner > *:nth-child(4) { animation-delay: 0.8s; }
.auth-panel-left-inner > *:nth-child(5) { animation-delay: 0.95s; }

@keyframes revealUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-panel-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Logo — cerúleo (tono base de la tríada) */
.auth-panel-logo-icon {
  width: 46px; height: 46px;
  background: var(--auth-cer-lt);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--auth-cer-bd);
  /* pequeño glow cerúleo */
  box-shadow: 0 0 18px hsla(215, 90%, 62%, 0.2);
}

.auth-panel-logo-name {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--auth-txt-1);
}

.auth-panel-headline {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--auth-txt-1);
  margin: 0;
}

.auth-panel-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--auth-txt-2);
  margin: 0;
}

/* Feature list */
.auth-feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  color: var(--auth-txt-2);
  font-weight: 500;
}

/* Íconos features — tríada alternada */
.auth-feature-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
/* ícono 1 — Carmesí */
.auth-feature-item:nth-child(1) .auth-feature-icon {
  background: var(--auth-cri-lt);
  border: 1px solid var(--auth-cri-bd);
  color: var(--auth-crimson);
}
/* ícono 2 — Cerúleo (base) */
.auth-feature-item:nth-child(2) .auth-feature-icon {
  background: var(--auth-cer-lt);
  border: 1px solid var(--auth-cer-bd);
  color: var(--auth-cerulean);
}
/* ícono 3 — Esmeralda */
.auth-feature-item:nth-child(3) .auth-feature-icon {
  background: var(--auth-sage-lt);
  border: 1px solid var(--auth-sage-bd);
  color: var(--auth-sage);
}
/* ícono 4 — Carmesí otra vez (ciclo tríada) */
.auth-feature-item:nth-child(4) .auth-feature-icon {
  background: var(--auth-cri-lt);
  border: 1px solid var(--auth-cri-bd);
  color: var(--auth-crimson);
}

/* Separador — gradiente análogo cerúleo→esmeralda */
.auth-panel-divider {
  height: 1px;
  background: linear-gradient(90deg,
    var(--auth-cer-bd) 0%,
    var(--auth-sage-bd) 60%,
    transparent 100%);
  margin: 4px 0;
}

/* Quote — borde carmesí (tríada 1) */
.auth-panel-quote {
  font-size: 12px;
  font-style: italic;
  color: var(--auth-txt-3);
  border-left: 2px solid var(--auth-cri-bd);
  padding-left: 12px;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.auth-panel-quote-mark {
  font-size: 24px;
  font-style: normal;
  opacity: 0.3;
  line-height: 1;
  margin-bottom: -4px;
  color: var(--auth-crimson);
}
.auth-panel-quote-author {
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
  color: hsla(335, 65%, 65%, 0.5);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ── Right panel (form card) ── */
.auth-card {
  position: relative;
  z-index: 1;
  width: 390px;
  min-width: 340px;
  flex-shrink: 0;
  background: var(--auth-panel-r);
  padding: 40px 34px 30px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Tríada 1 — Carmesí en acento superior */
  border-top: 2px solid var(--auth-cri-bd);
}

/* Staggered reveal for right panel children */
.auth-card > * {
  opacity: 0;
  animation: revealUp 0.5s ease forwards;
}
.auth-card > *:nth-child(1) { animation-delay: 0.5s; }
.auth-card > *:nth-child(2) { animation-delay: 0.6s; }
.auth-card > *:nth-child(3) { animation-delay: 0.7s; }
.auth-card > *:nth-child(4) { animation-delay: 0.8s; }

@keyframes authCardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Brand shown only on mobile (hidden on desktop) */
.auth-brand.auth-brand-mobile {
  display: none;
}

/* Brand */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
/* Brand icon — Cerúleo (color base) */
.auth-brand-icon {
  width: 40px; height: 40px;
  background: var(--auth-cer-lt);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--auth-cer-bd);
  box-shadow: 0 0 14px hsla(215, 90%, 62%, 0.18);
}
.auth-brand-name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 800;
  color: var(--auth-txt-1);
  letter-spacing: -0.5px;
}
.auth-tagline {
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-txt-3);
  margin-bottom: 20px;
  line-height: 1.5;
  letter-spacing: 0.2px;
}

/* Tabs — Tríada Carmesí en activo */
.auth-tabs {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 22px;
  border: 1px solid var(--auth-border);
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-txt-3);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.1px;
}
/* Tab activo — Carmesí apagado (Tríada 1) */
.auth-tab.active {
  background: var(--auth-cri-lt);
  color: var(--auth-crimson);
  box-shadow: 0 0 0 1px var(--auth-cri-bd);
}

/* Auth forms */
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-form .form-group { margin-bottom: 14px; }
.auth-form .form-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--auth-txt-3);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 6px;
  display: block;
}

/* Input field — foco cerúleo (color base análogo) */
.auth-field {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--auth-border);
  border-radius: var(--radius-sm);
  background: hsla(215, 40%, 8%, 0.6);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.auth-field:focus-within {
  border-color: hsla(215, 85%, 60%, 0.5);
  box-shadow: 0 0 0 3px hsla(215, 85%, 60%, 0.09);
}
.auth-field > svg {
  flex-shrink: 0;
  margin: 0 10px;
  color: var(--auth-txt-3);
}
.auth-input {
  flex: 1;
  padding: 11px 10px 11px 0;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--auth-txt-1);
  outline: none;
  font-family: var(--font-main);
}
.auth-input::placeholder { color: hsla(215, 20%, 55%, 0.4); }
.auth-show-pwd {
  background: transparent;
  border: none;
  padding: 0 10px;
  cursor: pointer;
  color: var(--auth-txt-3);
  display: flex; align-items: center;
  transition: color var(--transition);
}
/* Hover ojo — Esmeralda (Tríada 2) */
.auth-show-pwd:hover { color: var(--auth-sage); }

/* Error message */
.auth-error {
  font-size: 12.5px;
  color: #ef4444;
  background: #ef444412;
  border: 1px solid #ef444430;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-error.hidden { display: none; }

/* Primary button — Cerúleo luminoso (tono base análogo +20% brillo) */
.btn-auth-primary {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    135deg,
    hsl(215, 85%, 52%) 0%,
    hsl(230, 80%, 58%) 50%,
    hsl(215, 85%, 52%) 100%
  );
  background-size: 200% auto;
  color: hsl(215, 30%, 96%);
  font-size: 13px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow:
    0 4px 20px hsla(215, 85%, 55%, 0.3),
    0 0 0 1px hsla(215, 85%, 70%, 0.15) inset;
  transition: all 0.3s ease;
  margin-top: 6px;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.btn-auth-primary:hover {
  background-position: right center;
  transform: translateY(-1px);
  box-shadow: 0 8px 32px hsla(215, 85%, 55%, 0.4);
}
.btn-auth-primary:active { transform: translateY(0); }

/* ── Divider o/or ─────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--auth-txt-3);
  font-size: 11.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

/* ── Botón Google ─────────────────────────────────────────── */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: hsl(0, 0%, 100%);
  color: hsl(0, 0%, 20%);
  border: 1px solid hsla(215, 40%, 55%, 0.25);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 1px 6px rgba(0,0,0,0.18);
  letter-spacing: 0.15px;
  font-family: var(--font-main);
}
.btn-google:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.26);
  background: hsl(0, 0%, 98%);
  border-color: hsla(215, 60%, 55%, 0.35);
}
.btn-google:active { transform: translateY(0); box-shadow: 0 1px 6px rgba(0,0,0,0.18); }

/* Switch link — Esmeralda (Tríada 2) */
.auth-switch {
  text-align: center;
  font-size: 12px;
  color: var(--auth-txt-3);
  margin-top: 16px;
}
.auth-link {
  background: none;
  border: none;
  color: var(--auth-sage);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.8;
}
.auth-link:hover { opacity: 1; }


/* Responsive auth — hide left panel on small screens */
@media (max-width: 720px) {
  .auth-split {
    flex-direction: column;
    max-height: none;
    min-height: auto;
    border-radius: var(--radius-lg);
  }
  .auth-panel-left {
    display: none;
  }
  .auth-card {
    width: 100%;
    min-width: 0;
    padding: 28px 24px 24px;
    overflow-y: visible;
  }
  .auth-brand.auth-brand-mobile {
    display: flex;
    margin-bottom: 0;
  }
}

/* Hide app until logged in */
#app.hidden { display: none; }

/* ============================================================
   PHASE 1 FEATURES
   ============================================================ */

/* --- Nav Badges --- */
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent-light-2);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.nav-badge:empty { display: none; }
.nav-badge-danger { background: #ef444420; color: #ef4444; }
.nav-item-danger { color: var(--text-muted); }
.nav-item-danger:hover, .nav-item-danger.active { color: #ef4444; background: #ef444412; }

/* --- Note Badges Overlay (pin / star) --- */
.note-badges-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 2;
}
.note-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
/* pin=cerúleo (base), star=ámbar (análogo cálido) */
.pin-badge  { background: hsl(215, 88%, 55%); color: #fff; }
.star-badge { background: hsl(38,  90%, 50%); color: #fff; }
.note-card  { position: relative; } /* ensure overlay works */

/* --- Kanban Board --- */
.kanban-board {
  display: flex;
  gap: 16px;
  padding: 0 24px 24px;
  overflow-x: auto;
  align-items: flex-start;
  min-height: calc(100vh - 120px);
}
.kanban-col {
  flex: 0 0 280px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.kanban-col-header {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-2);
}
.kanban-count {
  background: var(--bg-surface-3);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
}
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card  { margin: 0 !important; animation: none !important; }

/* --- Context Menu Color Picker --- */
.ctx-color-row {
  padding: 6px 12px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctx-color-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  flex-shrink: 0;
}
.ctx-colors { display: flex; gap: 5px; flex-wrap: wrap; }
.ctx-color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), border-color var(--transition);
  padding: 0;
}
.ctx-color-dot:hover { transform: scale(1.2); border-color: var(--accent) !important; }
.ctx-color-dot svg   { color: var(--text-muted); }

/* --- Trash Modal --- */
.modal-wide { max-width: 600px; }
.trash-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.trash-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.trash-item-info { flex: 1; min-width: 0; }
.trash-item-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-item-meta  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.trash-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.trash-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.trash-empty p { font-size: 14px; }
.trash-empty svg { opacity: 0.3; }

/* --- Stats Modal --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
}
.stat-num   { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1; font-family: var(--font-display); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stats-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 16px 0 10px;
}
.stats-imp-bars { display: flex; flex-direction: column; gap: 6px; }
.stats-imp-row  { display: flex; align-items: center; gap: 10px; }
.stats-imp-label { font-size: 12px; font-weight: 600; width: 72px; flex-shrink: 0; }
.stats-imp-bar-wrap { flex: 1; height: 12px; background: var(--bg-surface-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.stats-imp-bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; }
.stats-imp-count { font-size: 12px; font-weight: 700; color: var(--text-secondary); width: 24px; text-align: right; }
.stats-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.stats-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}
.stats-tag b { font-weight: 800; }

/* --- Share Channels (email / WhatsApp / copy link) --- */
.share-channels {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--bg-surface-2);
  animation: fadeInUp 0.2s ease;
}
.share-channels-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 10px;
}
.share-channels-row {
  display: flex;
  gap: 8px;
}
.share-channel-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  transition: all var(--transition);
}
.share-channel-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}
.share-channel-whatsapp:hover {
  border-color: #25d366;
  color: #25d366;
  background: #25d36612;
}
.share-channel-whatsapp svg { color: #25d366; }
.share-link-preview {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  font-family: monospace;
  background: var(--bg-surface-3);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile First
   xs ≤ 375px  iPhone SE  |  sm ≤ 480px  Mobile  |  md ≤ 768px  Tablet
   ══════════════════════════════════════════════════════════════════ */

/* ── Helpers de visibilidad ──────────────────────────────────────── */
.mobile-only  { display: none !important; }
.desktop-only { display: flex  !important; }

/* ── Sidebar backdrop (overlay mobile) ──────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
  animation: fadeInBd 0.22s ease;
}
.sidebar-backdrop.active { display: block; }
@keyframes fadeInBd { from { opacity: 0; } to { opacity: 1; } }

/* ════════════════ TABLET ≤ 768px ════════════════ */
@media (max-width: 768px) {

  /* Sidebar: drawer lateral */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1),
                width 0.28s ease, min-width 0.28s ease;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transform: translateX(-100%);
  }
  .sidebar.collapsed.mobile-open { transform: translateX(0); }

  .main { width: 100%; }

  .mobile-only  { display: flex !important; }
  .desktop-only { display: none  !important; }

  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar-title { font-size: 17px; }
  .view-toggle { display: none; }

  .notes-grid { grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
  .notes-container { padding: 16px; }

  /* Auth */
  .auth-panel-left { display: none; }
  .auth-split { flex-direction: column; align-items: center; justify-content: center; width: 100%; }
  .auth-card { width: 100%; max-width: 440px; border-radius: var(--radius-lg); padding: 32px 28px; }
  .auth-metric { display: none; }

  /* Modales */
  .modal-overlay { padding: 16px; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 90vh; overflow-y: auto; }
  .modal-large, .modal-medium, .modal-small { width: 100%; max-width: 100%; }

  .user-dropdown { right: 0; }
}

/* ════════════════ MOBILE ≤ 480px ════════════════ */
@media (max-width: 480px) {

  html, body { font-size: 13px; }

  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar-title { font-size: 15px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  #btn-new-note { padding: 8px 10px; }
  .user-avatar { width: 32px; height: 32px; }

  .notes-grid { grid-template-columns: 1fr; gap: 10px; }
  .notes-container { padding: 12px; }

  /* Auth */
  .auth-screen { padding: 0; align-items: stretch; }
  .auth-split { min-height: 100dvh; padding: 20px 16px; overflow-y: auto; }
  .auth-card { padding: 28px 20px; border-radius: var(--radius-lg); }
  .auth-tab { padding: 8px 14px; font-size: 13px; }
  .btn-auth-primary { padding: 12px; font-size: 14px; }
  .btn-google { padding: 10px 14px; font-size: 13px; }
  .auth-divider { margin: 10px 0 8px; }

  /* Modales bottom-sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 95dvh; width: 100%; }
  .modal-header { padding: 16px 16px 12px; }
  .modal-body { padding: 12px 16px 24px; }

  /* Editor */
  .note-title-input { font-size: 20px; }
  .importance-btns { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .editor-toolbar { gap: 4px; flex-wrap: wrap; }

  /* Color picker 4 columnas */
  .color-picker { display: grid; grid-template-columns: repeat(4,1fr) !important; }

  .user-dropdown { right: -8px; width: calc(100vw - 24px); max-width: 300px; }
  .toast { left: 12px !important; right: 12px !important; bottom: 16px !important; transform: none !important; max-width: 100% !important; }
}

/* ════════════════ iPhone SE ≤ 375px ════════════════ */
@media (max-width: 375px) {

  .topbar { padding: 8px 10px; }
  .topbar-title { font-size: 13px; max-width: 80px; }

  .auth-card { padding: 22px 14px; }
  .auth-tab { padding: 7px 10px; font-size: 12px; }

  .notes-container { padding: 8px; }
  .notes-grid { gap: 8px; }

  .sidebar { width: min(var(--sidebar-width), 88vw); min-width: unset; }
  .tag { font-size: 10px; padding: 2px 6px; }
}

/* ════════════════ Desktop — sidebar posición normal ════════════════ */
@media (min-width: 769px) {
  .sidebar { transform: none !important; position: relative !important; }
  .sidebar-backdrop { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   INPUTS, ICONS, TOASTS — Responsive & Touch-friendly
   ══════════════════════════════════════════════════════════════════ */

/* ── Touch target mínimo de 44px (WCAG / Apple HIG) ─────────────── */
button,
[role="button"],
.btn-icon,
.btn-primary,
.btn-secondary,
.btn-ghost,
.nav-item,
.group-item,
.toolbar-btn,
.auth-tab,
.user-dropdown-item {
  min-height: 36px;   /* desktop OK */
}

/* ── Inputs base: touch-friendly ─────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
  /* Evitar zoom automático en iOS (requiere font-size ≥ 16px en focus) */
  font-size: 16px;
  /* Eliminar estilos nativos en iOS */
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--radius-sm);
}

/* Inputs de formulario (auth, modales, perfil) */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-main);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light-2);
}

/* ── Barra de herramientas del editor ────────────────────────────── */
.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 8px 12px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.editor-toolbar::-webkit-scrollbar { display: none; }

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.15s;
  flex-shrink: 0;
}
.toolbar-btn:hover  { background: var(--bg-surface-3); color: var(--text-primary); }
.toolbar-btn.active { background: var(--accent-light); color: var(--accent); }

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Toasts / Notificaciones flotantes ───────────────────────────── */
#toast-container,
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: hsl(240, 25%, 18%);
  box-shadow: 0 8px 32px rgba(0,0,0,0.32), 0 2px 8px rgba(0,0,0,0.18);
  pointer-events: all;
  backdrop-filter: blur(12px);
  border: 1px solid hsla(220,60%,60%,0.15);
  animation: toastIn 0.28s cubic-bezier(0.34,1.56,0.64,1) both;
  max-width: 420px;
  white-space: nowrap;
}

.toast.toast-hide {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* Variantes de color */
.toast.success { background: hsl(152, 60%, 22%); border-color: hsl(152,68%,40%,0.3); }
.toast.error   { background: hsl(335, 60%, 22%); border-color: hsl(335,78%,55%,0.3); }
.toast.warning { background: hsl(38,  60%, 22%); border-color: hsl(38, 92%,52%,0.3); }
.toast.info    { background: hsl(215, 45%, 22%); border-color: hsl(215,88%,58%,0.3); }

.toast-icon { flex-shrink: 0; display: flex; align-items: center; }

/* ── SVG Icons — tamaño táctil consistente ───────────────────────── */
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.btn-icon svg   { pointer-events: none; }

/* ── PWA safe area (iPhone X+ notch) ────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .topbar {
    padding-left:  max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }
  #toast-container,
  .toast-container {
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  }
  .modal-overlay {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* ── Touch: eliminar highlight azul en móvil ─────────────────────── */
* { -webkit-tap-highlight-color: transparent; }

/* ── Inputs responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  button,
  .btn-primary,
  .btn-secondary,
  .btn-icon,
  .nav-item,
  .toolbar-btn {
    min-height: 44px;   /* Apple HIG touch target mínimo */
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px;    /* Evita zoom en iOS */
    padding: 12px 14px;
  }

  .editor-toolbar {
    flex-wrap: nowrap;  /* Scroll horizontal en mobile */
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
  }

  .toolbar-btn {
    width: 40px;
    height: 40px;
  }

  /* Toast: full-width en mobile */
  #toast-container,
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 16px;
    transform: none;
    align-items: stretch;
    width: auto;
    max-width: 100%;
  }

  .toast {
    max-width: 100%;
    white-space: normal;
    width: 100%;
    border-radius: 14px;
  }
}

@media (max-width: 480px) {
  .toolbar-sep { display: none; }   /* Más espacio en toolbar mobile */

  .btn-primary {
    padding: 11px 16px;
    font-size: 14px;
  }

  .form-group label { font-size: 12px; }

  /* Input full-width en forms */
  input[type="text"],
  input[type="email"],
  input[type="password"] {
    width: 100%;
  }
}

/* =============================================
   PENDING APPROVAL SCREEN
   ============================================= */
.pending-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-base, hsl(230, 40%, 94%));
  overflow-y: auto;
}
.dark-mode .pending-screen { background: hsl(218, 55%, 5%); }

/* Card */
.pending-card {
  position: relative;
  z-index: 2;
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border, rgba(99,102,241,.18));
  border-radius: 24px;
  padding: 40px 36px 32px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,.14), 0 4px 20px rgba(99,102,241,.12);
  animation: toastIn .4s cubic-bezier(.34,1.56,.64,1) both;
}
.dark-mode .pending-card {
  background: hsl(220, 40%, 9%);
  border-color: hsla(215, 60%, 55%, 0.14);
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}

/* Logo */
.pending-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.pending-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, hsl(215,88%,58%), hsl(248,72%,62%));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px hsla(215,88%,58%,.35);
}
.pending-logo-name {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(90deg, hsl(215,88%,58%), hsl(248,72%,62%));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Avatar + pulso */
.pending-avatar-wrap {
  position: relative;
  width: 90px; height: 90px;
  margin: 0 auto 24px;
}
.pending-avatar {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(215,88%,58%), hsl(248,72%,62%));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: #fff;
  border: 3px solid var(--bg-surface, #fff);
  overflow: hidden;
  position: relative; z-index: 2;
}
.dark-mode .pending-avatar { border-color: hsl(220,40%,9%); }

/* Anillos de pulso */
.pending-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid hsla(215, 88%, 58%, 0.4);
  animation: pendingPulse 2s ease-out infinite;
  z-index: 1;
}
.pending-pulse-2 {
  inset: -16px;
  border-color: hsla(215, 88%, 58%, 0.2);
  animation-delay: .6s;
}
@keyframes pendingPulse {
  0%   { transform: scale(.95); opacity: 1; }
  70%  { transform: scale(1.1); opacity: 0; }
  100% { transform: scale(1.1); opacity: 0; }
}

/* Badge de reloj */
.pending-clock-badge {
  position: absolute;
  bottom: 0; right: 0;
  width: 28px; height: 28px;
  background: hsl(215,88%,58%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-surface, #fff);
  z-index: 3;
  box-shadow: 0 2px 8px rgba(43,145,244,.4);
}
.dark-mode .pending-clock-badge { border-color: hsl(220,40%,9%); }

/* Título */
.pending-title {
  font-size: 24px; font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 10px;
}
.pending-subtitle {
  font-size: 14px; color: var(--text-secondary);
  line-height: 1.65; margin: 0 0 28px;
}
.pending-email {
  color: var(--accent);
  font-weight: 600;
}

/* Pasos */
.pending-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
  text-align: left;
}
.pending-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .2s;
}
.pending-step:last-child { border-bottom: none; }

/* Dot */
.pending-step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--bg-surface-3);
  border: 2px solid var(--border);
  color: var(--text-muted);
}
.pending-step.done .pending-step-dot {
  background: hsl(152, 60%, 42%);
  border-color: hsl(152, 60%, 42%);
  color: #fff;
}
.pending-step.active .pending-step-dot {
  background: hsla(215,88%,58%,.12);
  border-color: hsl(215,88%,58%);
  color: hsl(215,88%,58%);
}

/* Spinner en el paso activo */
.pending-dot-spinner {
  width: 14px; height: 14px;
  border: 2.5px solid hsla(215,88%,58%,.3);
  border-top-color: hsl(215,88%,58%);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.pending-step-label {
  font-size: 13.5px; font-weight: 600;
  color: var(--text-primary);
}
.pending-step.active .pending-step-label { color: hsl(215,88%,58%); }
.pending-step-desc {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}

/* Info box */
.pending-info-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: hsla(215,88%,58%,.07);
  border: 1px solid hsla(215,88%,58%,.2);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  text-align: left;
  margin-bottom: 24px;
}
.pending-info-box svg { flex-shrink: 0; margin-top: 1px; color: hsl(215,88%,58%); }
.pending-info-box strong { color: var(--text-primary); }

/* Botones */
.pending-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 20px;
}
.pending-btn-check {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, hsl(215,88%,58%), hsl(248,72%,62%));
  color: #fff; border: none; border-radius: 10px;
  padding: 11px 22px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: opacity .2s, transform .15s;
  box-shadow: 0 4px 14px hsla(215,88%,58%,.35);
}
.pending-btn-check:hover { opacity: .9; transform: translateY(-1px); }
.pending-btn-logout {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 22px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.pending-btn-logout:hover {
  border-color: var(--danger, hsl(335,75%,55%));
  color: var(--danger, hsl(335,75%,55%));
}

.pending-footer {
  font-size: 11.5px; color: var(--text-muted); margin: 0;
}

/* =============================================
   ADMIN PANEL MODAL
   ============================================= */
.modal-admin {
  max-width: 620px !important;
  width: 100%;
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.admin-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px;
  border: none; background: transparent;
  border-radius: 7px;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s;
}
.admin-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.admin-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  font-size: 10px; font-weight: 700;
  padding: 0 5px;
}
.admin-badge:empty { display: none; }

/* User list */
.admin-user-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 440px;
  overflow-y: auto;
}
.admin-user-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color .2s;
}
.admin-user-card:hover { border-color: var(--border-strong); }
.admin-user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(215,88%,58%), hsl(248,72%,62%));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-user-email {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-user-meta {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}
.admin-user-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 9px;
  font-size: 10.5px; font-weight: 600;
  margin-top: 4px;
}
.admin-user-tag.pending  { background: hsla(38,97%,60%,.15); color: hsl(38,97%,50%); }
.admin-user-tag.active   { background: hsla(152,60%,45%,.15); color: hsl(152,60%,40%); }
.admin-user-tag.rejected { background: hsla(335,75%,55%,.12); color: hsl(335,75%,50%); }
.admin-user-tag.google   { background: hsla(215,88%,58%,.12); color: hsl(215,88%,55%); }

.admin-user-actions { display: flex; gap: 6px; flex-shrink: 0; }
.admin-btn-approve {
  display: inline-flex; align-items: center; gap: 5px;
  background: hsl(152,60%,42%);
  color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: opacity .2s;
}
.admin-btn-approve:hover { opacity: .85; }
.admin-btn-reject {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent;
  color: hsl(335,75%,55%);
  border: 1.5px solid hsla(335,75%,55%,.35);
  border-radius: 8px;
  padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.admin-btn-reject:hover { background: hsla(335,75%,55%,.1); }
.admin-btn-revoke {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.admin-btn-revoke:hover { color: hsl(335,75%,55%); border-color: hsla(335,75%,55%,.35); }

.admin-empty {
  text-align: center;
  padding: 36px 0;
  color: var(--text-muted);
  font-size: 14px;
}
.admin-empty svg { display: block; margin: 0 auto 12px; opacity: .4; }

/* Botón de admin en el user dropdown */
.dropdown-item-admin {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; width: 100%;
  background: none; border: none;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: hsl(215,88%,58%);
  cursor: pointer; text-align: left;
  transition: background .15s;
}
.dropdown-item-admin:hover { background: hsla(215,88%,58%,.1); }
.admin-badge-nav {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  background: hsl(38,97%,55%);
  color: #fff; border-radius: 9px;
  font-size: 10px; font-weight: 700;
  padding: 0 5px; margin-left: auto;
}
.admin-badge-nav:empty { display: none; }

@media (max-width: 480px) {
  .pending-card { padding: 28px 20px 24px; }
  .pending-title { font-size: 20px; }
  .admin-user-card { flex-wrap: wrap; }
  .admin-user-actions { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   SIDEBAR RAIL — Botón en la costura sidebar/contenido
   Usa un flex item de ancho-cero: se mueve EXACTAMENTE con
   el sidebar durante su transición CSS sin ningún JS.
   ============================================================ */

/* El track es un flex item de ancho 0 — se mueve solo */
.sidebar-rail-track {
  position: relative;      /* para posicionar el btn dentro */
  width: 0;
  flex-shrink: 0;
  overflow: visible;       /* el botón sobresale sin cortarse */
  z-index: 200;
}

/* El botón se ancla al centro-izquierdo del track */
.sidebar-rail-btn {
  position: absolute;
  top: 50vh;               /* centrado vertical en el viewport */
  left: 0;
  transform: translate(-50%, -50%);   /* centrado sobre la costura */

  /* Pastilla */
  width: 20px;
  height: 48px;
  border-radius: 0 8px 8px 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-muted);
  box-shadow: 2px 0 12px hsla(215, 80%, 50%, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Solo transición visual — el movimiento lo hace el flex padre */
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-rail-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light-2), 2px 0 12px hsla(215, 80%, 50%, 0.30);
}

/* SVG: ‹ → › cuando sidebar colapsado (hermano anterior en el DOM) */
.sidebar-rail-btn svg {
  transition: transform 0.22s ease;
  flex-shrink: 0;
}
.sidebar.collapsed ~ .sidebar-rail-track .sidebar-rail-btn svg {
  transform: rotate(180deg);
}

/* Ocultar en mobile */
@media (max-width: 768px) {
  .sidebar-rail-track { display: none; }
  .sidebar-header { justify-content: flex-start; }
}

/* ============================================================
   VIEW PICKER DROPDOWN — Selector de vista (grid/list/kanban)
   ============================================================ */
.view-picker-wrap {
  position: relative;
}

.btn-view-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-view-picker:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-view-picker .vp-icon {
  display: flex;
  align-items: center;
  line-height: 0;
}
.btn-view-picker .vp-caret {
  opacity: 0.55;
  transition: transform 0.18s ease;
}
.view-picker-menu.open ~ * .vp-caret,
.view-picker-wrap:has(.open) .vp-caret {
  transform: rotate(180deg);
}

/* Dropdown menu */
.view-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 148px;
  padding: 4px;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.view-picker-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.vp-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.vp-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.vp-item.active {
  background: var(--accent-light-2);
  color: var(--accent);
  font-weight: 600;
}
.vp-item.active svg {
  stroke: var(--accent);
}
