/* ============================================================
   VARIABLES — TEMA CLARO (por defecto)
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f2f0eb;
  --surface: #faf8f4;
  --surface-alt: #ede9e0;
  --surface-hover: #e4dfd4;
  --border: #dbd5c8;
  --border-strong: #5cb6f9;
  --accent: #1a8fd1;
  --accent-dark: #0e72b0;
  --accent-soft: rgba(92,182,249,0.12);
  --text: #1a1510;
  --text-muted: #4a5a6a;
  --text-soft: #8a9aaa;
  --danger: #dc2626;
  --danger-soft: rgba(220,38,38,0.08);
  --warning: #d97706;
  --success: #059669;
  --shadow-xs: 0 1px 2px rgba(30,20,10,0.06);
  --shadow-sm: 0 1px 4px rgba(30,20,10,0.08), 0 1px 2px rgba(30,20,10,0.05);
  --shadow: 0 4px 16px rgba(30,20,10,0.09);
  --shadow-lg: 0 12px 32px rgba(30,20,10,0.13);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
  --topbar-h: 64px;
  /* component vars */
  --card-bg: #faf8f4;
  --input-bg: #f2f0eb;
  --topbar-bg: rgba(242,240,235,0.95);
  --nav-bg: #faf8f4;
  --composer-bg: #faf8f4;
  --chat-bg: #f2f0eb;
  --modal-overlay: rgba(20,15,5,0.4);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-alt: #1a1a1a;
  --surface-hover: #222222;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(92,182,249,0.5);
  --accent: #5cb6f9;
  --accent-dark: #2e9de8;
  --accent-soft: rgba(92,182,249,0.12);
  --text: #f0f0f0;
  --text-muted: #888888;
  --text-soft: #555555;
  --danger: #f87171;
  --danger-soft: rgba(248,113,113,0.1);
  --warning: #fbbf24;
  --success: #34d399;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.5);
  --shadow: 0 4px 20px rgba(0,0,0,0.6);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.7);
  --card-bg: #141414;
  --input-bg: #0f0f0f;
  --topbar-bg: rgba(10,10,10,0.97);
  --nav-bg: #141414;
  --composer-bg: #141414;
  --chat-bg: #0f0f0f;
  --modal-overlay: rgba(0,0,0,0.75);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   APP SPLASH (cubre layout shift durante carga inicial)
   ============================================================ */
.app-splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.25s ease;
}
.app-splash.out { opacity: 0; pointer-events: none; }
.app-splash-inner {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.app-splash-title {
  font-family: var(--font); font-size: 28px; font-weight: 700;
  color: var(--text); letter-spacing: -0.04em;
}
.app-splash-ring {
  width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}
a { color: inherit; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
.view { min-height: 100vh; }
.mt-8 { margin-top: 8px; }

/* ============================================================
   LOGIN
   ============================================================ */
.view-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: var(--bg);
}
.login-card {
  width: min(380px, 100%);
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.brand-icon {
  width: 72px; height: 72px;
  margin: 0 auto 12px;
  background: none;
  border: none;
  display: grid; place-items: center;
}
.brand-icon img { width: 72px; height: 72px; border-radius: 18px; }
.login-brand h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.login-brand p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.login-error { min-height: 18px; margin-top: 12px; text-align: center; font-size: 13px; color: var(--danger); }

/* ============================================================
   FORMS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-soft); }
input[type="email"],input[type="password"],input[type="text"],input[type="url"],textarea,select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600; font-size: 14px;
  box-shadow: 0 2px 8px rgba(92,182,249,0.28);
  transition: all 0.15s;
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(92,182,249,0.35); }
.btn-primary:active { transform: none; }
.view-login .btn-primary { width: 100%; padding: 12px; font-size: 15px; }
.btn-new-idea { gap: 6px; font-size: 13px; padding: 8px 14px; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500; font-size: 13px;
  text-align: center;
  border: 1.5px solid var(--border-strong);
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(92,182,249,0.2); }

.btn-ghost {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  border: 1.5px solid var(--border);
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn-link { color: var(--accent); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; padding: 4px 0; }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  display: grid; place-items: center;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--accent-soft); border-color: var(--border-strong); color: var(--accent); }

.btn-danger {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px; font-weight: 500;
  border: 1.5px solid rgba(220,38,38,0.3);
  transition: all 0.15s;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* Botones en estado de carga: spinner visible */
.btn-primary.loading,
.btn-secondary.loading,
.btn-ghost.loading,
button.loading {
  pointer-events: none;
  opacity: 0.85;
  position: relative;
}
/* Spinner via ::after centrado sobre el botón */
.btn-primary.loading::after,
.btn-secondary.loading::after,
.btn-ghost.loading::after,
button.loading::after {
  content: '';
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: spin 0.6s linear infinite;
}
.btn-primary.loading::after {
  border-color: rgba(255,255,255,0.3);
  border-top-color: #fff;
}
.btn-secondary.loading::after,
.btn-ghost.loading::after,
button.loading::after {
  border-color: var(--border);
  border-top-color: var(--accent);
}
.theme-icon { display: block; }

/* ============================================================
   TOPBAR
   ============================================================ */
.view-app { display: block; min-height: 100vh; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px;
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; gap: 10px; align-items: center; }
.topbar-logo { width: 34px; height: 34px; border-radius: 0; background: none; padding: 0; }
.topbar-logo img { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-subtitle { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-soft); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.btn-logout { display: none; }
@media (min-width: 480px) { .btn-logout { display: inline-flex; } }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  padding: 18px 20px 60px;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  align-items: start;
  box-sizing: border-box;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 0;
  background: none;
  border: none;
  box-shadow: none;
  height: fit-content;
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  text-align: left;
  transition: all 0.12s;
}
.nav-item:hover { background: var(--surface-alt); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { flex-shrink: 0; opacity: 0.75; }
.nav-item.active svg { opacity: 1; }

/* ============================================================
   CONTENT & PANELS
   ============================================================ */
.content { display: flex; flex-direction: column; gap: 14px; min-width: 0; width: 100%; max-width: 100%; align-items: stretch; box-sizing: border-box; overflow: visible; }
.panel { display: none; flex-direction: column; gap: 14px; align-items: stretch; justify-content: flex-start; width: 100%; }
.panel.active { display: flex; }

/* ============================================================
   GREETING
   ============================================================ */
.greeting-block {
  display: none; /* ocultado: el saludo ya está en la topbar */
}
.greeting-block h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2px; }
.greeting-sub { color: var(--text-muted); font-size: 13px; }
.install-card {
  background: var(--accent-soft); border: 1.5px solid var(--border-strong);
  padding: 12px 14px; border-radius: var(--radius-md); max-width: 200px; flex-shrink: 0;
}
.install-card p { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.install-card .btn-primary { width: 100%; padding: 7px; font-size: 12px; }

/* ============================================================
   IMPORTANT BLOCK
   ============================================================ */
.important-block {
  border-radius: var(--radius-lg);
  border: 1.5px solid rgba(217,119,6,0.25);
  background: rgba(217,119,6,0.04);
  padding: 16px 18px;
}
[data-theme="dark"] .important-block {
  background: rgba(251,191,36,0.05);
  border-color: rgba(251,191,36,0.2);
}
.important-block > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.important-block h3 { font-size: 14px; font-weight: 600; margin-top: 2px; }
.badge-label { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--warning); }
.important-list { display: grid; gap: 8px; }
.important-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 0.15s;
}
.important-card:hover { border-color: var(--border-strong); }
.important-card .badge-priority {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 4px; display: block;
}
.important-card h4 { font-size: 14px; font-weight: 600; margin: 0; }
.important-card p { display: none; }
.btn-show-more { width: 100%; margin-top: 8px; justify-content: center; }

/* ============================================================
   CATEGORY FILTER BAR
   ============================================================ */
.category-filter-bar {
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
}
.category-filter-bar-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-soft); margin-bottom: 12px;
}
.category-filter-scroll {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
}
/* cat-pill: círculo con icono + nombre + contador */
.cat-pill {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px;
  width: 100%;
  background: none; border: none;
  cursor: pointer; padding: 2px 1px;
  transition: transform 0.15s;
}
.cat-pill:hover { transform: translateY(-3px); }
.cat-pill-icon-wrap {
  width: 100%; aspect-ratio: 1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 18%, var(--surface));
  border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cat-pill:hover .cat-pill-icon-wrap {
  box-shadow: var(--shadow-sm);
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 26%, var(--surface));
}
.cat-pill.active .cat-pill-icon-wrap {
  border-color: var(--cat-color, var(--accent));
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 28%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color, var(--accent)) 28%, transparent);
}
.cat-pill-icon-wrap svg {
  width: 42%; height: 42%;
  stroke: color-mix(in srgb, var(--cat-color, var(--accent)) 85%, #1a1510);
  flex-shrink: 0;
}
.cat-pill-name {
  font-size: 10px; font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; line-height: 1.2;
}
.cat-pill.active .cat-pill-name { color: var(--cat-color, var(--accent)); font-weight: 700; }
.cat-pill-count {
  font-size: 9px; font-weight: 500;
  color: var(--text-soft); text-align: center; line-height: 1;
}
.cat-dot { display: none; }

/* ============================================================
   COMPOSER
   ============================================================ */
.composer {
  background: var(--composer-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: visible;
}
.composer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 0;
}
.composer-title { font-size: 15px; font-weight: 700; }
.composer-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--text-muted); display: grid; place-items: center;
  transition: all 0.15s;
}
.composer-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.composer-tabs { display: flex; gap: 4px; padding: 12px 18px 0; }
.composer-tab {
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); color: var(--text-muted);
  font-size: 13px; font-weight: 500; transition: all 0.12s;
}
.composer-tab:hover:not(.active) { background: var(--surface-alt); }
.composer-tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--border-strong); font-weight: 600; }
.composer-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.composer-section { display: flex; flex-direction: column; gap: 7px; }
.composer-section label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-soft); }
.field-with-button { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.upload-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center; color: var(--text-muted);
  cursor: pointer; font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}
.upload-drop svg { opacity: 0.5; }
.upload-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-preview { border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.upload-preview img { width: 100%; display: block; }
.composer-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.priority-select { display: flex; gap: 5px; flex-wrap: wrap; }
.priority-select button {
  padding: 6px 11px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); color: var(--text-muted);
  font-size: 12px; font-weight: 500; transition: all 0.12s;
}
.priority-select button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--border-strong); font-weight: 600; }
.ai-suggestion {
  padding: 10px 13px; border-radius: var(--radius-md);
  border: 1.5px solid rgba(92,182,249,0.3); background: var(--accent-soft);
  color: var(--text-muted); font-size: 13px; line-height: 1.5;
}
.composer-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

/* ============================================================
   IDEAS LIST
   ============================================================ */
.ideas-list { display: flex; flex-direction: column; gap: 8px; }
.idea-card {
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
}
.idea-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.idea-card-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.idea-card-body { flex: 1; min-width: 0; }
.idea-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.idea-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 4px;
}
.idea-card h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; margin-bottom: 4px; }
.idea-summary-preview { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-alt); border: 1px solid var(--border);
  font-size: 11px; font-weight: 500; color: var(--text-muted);
}
.chip-importante { background: rgba(217,119,6,0.1); color: var(--warning); border-color: rgba(217,119,6,0.25); }
.chip-favorita { background: rgba(220,38,38,0.08); color: var(--danger); border-color: rgba(220,38,38,0.2); }
[data-theme="dark"] .chip-importante { background: rgba(251,191,36,0.12); color: #fbbf24; }
[data-theme="dark"] .chip-favorita { background: rgba(248,113,113,0.12); color: #f87171; }
.idea-action-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--text-soft); display: grid; place-items: center;
  font-size: 12px; transition: all 0.12s;
  cursor: pointer; text-decoration: none; flex-shrink: 0;
}
.idea-action-btn:hover { color: var(--accent); border-color: var(--border-strong); background: var(--accent-soft); }
.idea-action-btn.danger:hover { color: var(--danger); border-color: rgba(220,38,38,0.3); background: var(--danger-soft); }
.idea-card-link-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
  color: var(--accent);
  border-top: 1px solid var(--border);
  background: var(--accent-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  cursor: pointer;
  transition: opacity 0.12s;
  user-select: none;
}
.idea-card-link-bar:hover { opacity: 0.8; }
.empty {
  text-align: center; padding: 48px 20px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  color: var(--text-muted);
}
.empty svg { opacity: 0.3; margin-bottom: 10px; }
.empty p { font-size: 14px; }

/* ============================================================
   MODAL IDEA
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--modal-overlay);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-idea-box {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.modal-box {
  width: min(440px, 100%);
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-idea-header {
  display: flex; justify-content: flex-end;
  padding: 14px 16px 0;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-idea-content { padding: 4px 24px 28px; }
.modal-idea-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.modal-idea-title[contenteditable="true"]:focus { outline: 2px solid var(--accent); border-radius: 4px; }
.modal-field { margin-bottom: 16px; }
.modal-field-label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 5px; }
.modal-idea-image { width: 100%; border-radius: var(--radius-md); overflow: hidden; margin-bottom: 16px; position: relative; }
.modal-idea-image img { width: 100%; display: block; max-height: 360px; object-fit: cover; }
.modal-download-btn {
  position: absolute; bottom: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  background: rgba(5,10,48,0.7); color: #fff;
  font-size: 12px; font-weight: 500;
  backdrop-filter: blur(8px);
  transition: background 0.15s;
}
.modal-download-btn:hover { background: var(--accent); }
.modal-idea-url a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); text-decoration: none; font-size: 14px;
  word-break: break-all;
}
.modal-idea-url a:hover { text-decoration: underline; }
.modal-save-bar { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px; }

/* ============================================================
   CHAT
   ============================================================ */
.chat-panel {
  display: flex; flex-direction: column;
  min-height: 500px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--chat-bg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.chat-messages {
  flex: 1; padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-soft); padding: 40px; }
.chat-empty p { font-size: 14px; }
.chat-bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; line-height: 1.6; font-size: 14px; }
.chat-bubble.user { margin-left: auto; background: var(--accent); color: #fff; border-radius: 16px 16px 4px 16px; }
.chat-bubble.assistant { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted); border-radius: 4px 16px 16px 16px; }
.chat-input-wrap {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
}
.chat-input-wrap input { flex: 1; }
.chat-input-wrap .btn-primary { padding: 9px 12px; }

/* ============================================================
   PROFILE
   ============================================================ */
.profile-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
.profile-info h2 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.profile-email { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.profile-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.role-badge {
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border-strong);
}
.role-badge.admin { background: rgba(251,191,36,0.15); color: var(--warning); border-color: rgba(251,191,36,0.4); }
.profile-stat { font-size: 13px; color: var(--text-muted); }
.profile-stat strong { color: var(--text); }
.profile-dates {
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.profile-date-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}
.profile-date-row:last-child { border: none; }
.profile-date-row strong { color: var(--text); font-weight: 500; }
/* category-cards ahora usa el mismo componente que category-filter-scroll */
/* category-card replaced by unified cat-pill component */
.profile-actions-section, .profile-danger-section {
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.profile-actions-section h3, .profile-danger-section h3 {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-soft); margin-bottom: 14px;
}
.profile-danger-section { border-color: rgba(220,38,38,0.25); }
.profile-action-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-header { display: flex; justify-content: space-between; align-items: center; }
.admin-header h2 { font-size: 20px; font-weight: 700; }
.admin-stats {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.admin-stat-card {
  padding: 16px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.admin-stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.admin-stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.admin-users-table {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden;
}
.admin-user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.admin-user-row:last-child { border: none; }
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-info strong { font-weight: 600; display: block; }
.admin-user-info span { color: var(--text-muted); font-size: 12px; }
.admin-user-actions { display: flex; gap: 5px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(160%);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 999;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============================================================
   RESPONSIVE TABLET
   ============================================================ */
@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; gap: 10px; padding: 12px 14px 56px; width: 100%; max-width: 100%; box-sizing: border-box; }
  .sidebar {
    position: static;
    flex-direction: row; overflow-x: auto;
    gap: 2px; padding: 6px;
    scrollbar-width: none; border-radius: var(--radius-md);
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .nav-item { white-space: nowrap; flex-shrink: 0; font-size: 12px; padding: 8px 12px; }
  .category-filter-scroll { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */
@media (max-width: 580px) {
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 13px; }
  .topbar-subtitle { display: none; }
  .btn-new-idea { font-size: 12px; padding: 7px 10px; }
  .greeting-block { flex-direction: column; padding: 14px; }
  .greeting-block h2 { font-size: 17px; }
  .install-card { max-width: 100%; }
  .composer-body { padding: 12px 14px 16px; }
  .composer-header { padding: 12px 14px 0; }
  .composer-tabs { padding: 10px 14px 0; }
  .composer-grid { grid-template-columns: 1fr; }
  .field-with-button { grid-template-columns: 1fr; }
  .field-with-button button { width: 100%; }
  .composer-actions { flex-direction: column-reverse; }
  .composer-actions button { width: 100%; }
  .priority-select { width: 100%; }
  .priority-select button { flex: 1; justify-content: center; }
  .idea-card h3 { font-size: 14px; }
  .chat-bubble { max-width: 92%; }
  .modal-idea-box { max-height: 95vh; }
  .modal-idea-content { padding: 4px 16px 20px; }
  .profile-card { flex-direction: column; text-align: center; }
  .profile-meta { justify-content: center; }
  .category-cards { grid-template-columns: repeat(2, 1fr); }
  .admin-user-row { flex-wrap: wrap; }
  .toast { bottom: 12px; font-size: 12px; }
}

/* ============================================================
   NATIVE SELECT — TEMA ACORDE
   ============================================================ */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238aaccc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px !important;
  cursor: pointer;
}
[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
select option {
  background: var(--surface);
  color: var(--text);
}

/* ============================================================
   IDEA PAGE STYLES (idea.html)
   ============================================================ */
.idea-page { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.idea-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 52px;
  background: var(--topbar-bg); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.idea-topbar-left { display: flex; align-items: center; gap: 10px; }
.idea-topbar h1 { font-size: 15px; font-weight: 700; }
.idea-body {
  flex: 1; padding: 16px 16px 48px;
  max-width: 680px; margin: 0 auto; width: 100%;
}

/* ============================================================
   COLOR PICKER DE CATEGORÍA
   ============================================================ */
.color-picker-wrap {
  display: flex; flex-direction: column; gap: 8px;
}
.color-picker-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-soft);
}
.color-swatches {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.color-custom-wrap {
  display: flex; align-items: center; gap: 8px; margin-top: 2px;
}
.color-custom-input {
  width: 32px !important; height: 32px !important;
  padding: 2px !important;
  border-radius: 50% !important;
  cursor: pointer;
  border: 2px solid var(--border) !important;
  background: none !important;
  flex-shrink: 0;
}
.color-custom-input::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.color-custom-input::-webkit-color-swatch { border-radius: 50%; border: none; }
.color-custom-label { font-size: 12px; color: var(--text-muted); }

/* Modal categoría */
.modal-cat-box {
  width: min(380px, 100%);
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}
.modal-cat-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.modal-cat-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  margin-bottom: 16px;
}
.modal-cat-preview-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 18%, var(--surface));
  border: 2px solid var(--cat-color, var(--accent));
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.modal-cat-preview-icon svg { width: 22px; height: 22px; stroke: var(--cat-color, var(--accent)); }
.modal-cat-preview-name { font-size: 14px; font-weight: 600; }

/* Icon picker */
.icon-picker-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.icon-picker-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-soft);
}
.icon-picker-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 5px; max-height: 190px; overflow-y: auto; padding-right: 2px;
}
.icon-picker-grid::-webkit-scrollbar { width: 4px; }
.icon-picker-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.icon-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px; border-radius: var(--radius-sm);
  border: 1.5px solid transparent; background: var(--surface-alt);
  cursor: pointer; transition: all 0.12s;
  font-size: 9px; font-family: var(--font); color: var(--text-muted);
}
.icon-btn svg { width: 18px; height: 18px; stroke: var(--text-muted); }
.icon-btn:hover { background: var(--surface-hover); border-color: var(--border); }
.icon-btn.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.icon-btn.selected svg { stroke: var(--accent); }

/* ============================================================
   PROFILE CATEGORIES (same circular grid as filter bar)
   ============================================================ */
.profile-cat-grid {
  background: none;
  border: none;
  padding: 0;
}
.profile-cat-grid-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-soft); margin-bottom: 12px;
}
.profile-cat-grid .category-filter-scroll {
  grid-template-columns: repeat(4, 1fr);
}

/* ============================================================
   IDEA PAGE — NOTA LIBRE (sin caja)
   ============================================================ */
.note-free-area {
  min-height: 50vh;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  width: 100%;
  padding: 0;
  font-family: var(--font);
}
.note-free-area::placeholder { color: var(--text-soft); }
.note-section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.note-meta-block {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 16px 0 0;
}
.cat-confirm-row {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
}
.cat-confirm-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  background: var(--success); color: #fff;
  font-size: 12px; font-weight: 600;
  border: none; cursor: pointer;
  transition: opacity 0.15s;
}
.cat-confirm-btn:hover { opacity: 0.85; }
.cat-created-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success); font-size: 12px; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
}

/* ============================================================
   IDEA PAGE — topbar responsive
   ============================================================ */
.idea-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 56px;
  background: var(--topbar-bg); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.idea-topbar-left { display: flex; align-items: center; gap: 10px; }
.idea-topbar h1 { font-size: 15px; font-weight: 700; }
.idea-body {
  flex: 1; padding: 20px 20px 60px;
  max-width: 680px; margin: 0 auto; width: 100%;
}
.idea-tabs-bar {
  display: none; gap: 4px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.idea-tab {
  padding: 8px 16px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border: 1.5px solid transparent; border-bottom: none;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.12s;
  position: relative; bottom: -1px;
}
.idea-tab:hover { color: var(--text); }
.idea-tab.active {
  background: var(--surface); color: var(--accent);
  border-color: var(--border); border-bottom-color: var(--surface);
  font-weight: 600;
}
[data-theme="dark"] .idea-tab.active { border-bottom-color: var(--bg); background: var(--bg); }

/* ============================================================
   CHAT IDEA LINKS
   ============================================================ */
.chat-idea-links {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.chat-links-label {
  width: 100%; font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 4px;
}
.chat-idea-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--accent);
  font-size: 13px; font-weight: 500; text-decoration: none;
  border: 1.5px solid var(--border-strong);
  transition: all 0.12s; cursor: pointer;
}
.chat-idea-link:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   IDEA PAGE — CREATION DATE
   ============================================================ */
.idea-creation-date {
  font-size: 11px; color: var(--text-soft);
  padding: 12px 0 4px;
  font-family: var(--font-mono);
}

/* ============================================================
   IDEA PAGE — IMAGE PREVIEW FULL
   ============================================================ */


/* ============================================================
   NOTE-FREE-AREA: no scroll, grows freely
   ============================================================ */
.note-free-area {
  display: block;
  width: 100%;
  min-height: 40vh;
  font-size: 16px; line-height: 1.75;
  color: var(--text);
  background: transparent;
  border: none; outline: none;
  resize: none;
  overflow: hidden;  /* key: no scroll bar */
  padding: 0;
  font-family: var(--font);
}
.note-free-area::placeholder { color: var(--text-soft); }
.note-free-area:focus { box-shadow: none; border: none; outline: none; }

/* Make page itself scrollable, not the textarea */
.idea-body { overflow-y: visible; }

/* ============================================================
   TITLE INPUT — sin recuadro, estilo heading
   ============================================================ */
.title-input {
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  padding: 6px 0 10px;
  font-family: inherit;
  line-height: 1.3;
  display: block;
  width: 100%;
}
.title-input::placeholder { color: var(--text-soft); font-weight: 700; }

/* ============================================================
   IFRAME PREVIEW MODAL
   ============================================================ */
#modalIframe { background: var(--surface); }
.iframe-preview-box {
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  background: var(--surface);
}
.iframe-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.iframe-domain {
  font-size: 13px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.iframe-wrap { flex: 1; position: relative; overflow: hidden; }
.iframe-wrap iframe { width: 100%; height: 100%; border: none; display: block; }
.iframe-blocked {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px;
  background: var(--surface); color: var(--text-muted); text-align: center; font-size: 15px;
}
.iframe-footer {
  display: flex; gap: 10px; padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.iframe-footer-btn {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 6px; font-size: 14px; text-decoration: none;
}

/* ============================================================
   NOTA TOOLBAR — barra flotante encima del teclado
   ============================================================ */
.note-toolbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 4px;
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.2s ease, opacity 0.2s;
  opacity: 0;
  pointer-events: none;
}
.note-toolbar.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.note-tool-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.12s; white-space: nowrap;
}
.note-tool-btn:hover { color: var(--accent); border-color: var(--border-strong); background: var(--accent-soft); }
.note-tool-btn svg { flex-shrink: 0; }
.note-tool-sep { width: 1px; height: 28px; background: var(--border); margin: 0 6px; }
/* Botón "Lista" destacado */
.note-tool-task {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  padding: 8px 16px;
}
.note-tool-task:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   IDEA IMAGE — FULL WIDTH + LIGHTBOX
   ============================================================ */
.idea-image-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  line-height: 0; /* removes inline gap below img */
}
.idea-image-full {
  width: 100%;
  display: block;
  cursor: zoom-in;
  border-radius: var(--radius-md);
  transition: filter 0.15s;
}
.idea-image-full:hover { filter: brightness(0.94); }
.idea-replace-btn {
  position: absolute;
  bottom: 10px; right: 10px;
  font-size: 12px; padding: 5px 10px;
  background: rgba(0,0,0,0.55);
  color: #fff; border-color: transparent;
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm);
}
.idea-replace-btn:hover { background: rgba(0,0,0,0.75); color: #fff; }

/* ── LIGHTBOX ─────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 100%; max-height: 92vh;
  border-radius: var(--radius-md);
  object-fit: contain;
  cursor: default;
  user-select: none;
}
.lightbox-close {
  position: fixed; top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px);
  transition: background 0.15s;
  z-index: 10000;
}
.lightbox-close:hover { background: rgba(255,255,255,0.28); }

/* ============================================================
   IDEA PAGE — SAVE BAR FIXED BOTTOM
   ============================================================ */
.idea-save-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 12px 16px;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 90;
}
.idea-save-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(92,182,249,0.35);
}

/* ── Topbar priority buttons ─────────────────────────────── */
.topbar-priority-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-soft);
  display: grid; place-items: center;
  cursor: pointer;
  transition: color 0.15s;
}
.topbar-priority-btn:hover { color: var(--text); }

/* ── Free area label ─────────────────────────────────────── */
.free-area-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-soft);
  display: block; margin-bottom: 8px;
}

/* ============================================================
   TASK LIST VISUAL RENDER
   ============================================================ */
.task-list-view { margin-bottom: 4px; }
.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.task-row:last-child { border-bottom: none; }
.task-row.done .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-check-btn {
  flex-shrink: 0;
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin-top: -2px;
}
.task-row.done .task-check-btn { color: var(--accent); }
.task-text {
  font-size: 15px; line-height: 1.5;
  color: var(--text); flex: 1; padding-top: 3px;
  word-break: break-word;
}

/* ============================================================
   MODAL CHOOSE TYPE
   ============================================================ */
.modal-type-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 340px; width: calc(100% - 48px);
  text-align: center;
}
.modal-type-box h3 { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.modal-type-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.type-choices {
  display: flex; gap: 16px; justify-content: center;
}
.type-choice-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-alt); cursor: pointer;
  color: var(--text);
  font-size: 15px; font-weight: 600;
  transition: all 0.15s;
}
.type-choice-btn:hover, .type-choice-btn:active {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
}
.type-choice-btn svg { stroke: currentColor; }

/* ============================================================
   MODAL SHARE
   ============================================================ */
.modal-share-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 340px; width: calc(100% - 48px);
}
.modal-share-box h3 { margin: 0 0 16px; font-size: 18px; font-weight: 700; }
.share-option-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-alt); cursor: pointer;
  color: var(--text); font-size: 15px; font-weight: 500;
  text-align: left; transition: all 0.12s;
}
.share-option-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ============================================================
   PREVIEW SPLIT LAYOUT
   ============================================================ */
.preview-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  min-height: 160px;
  align-items: start;
}
.preview-pane {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  cursor: pointer;
  position: relative;
}
.preview-placeholder {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; color: var(--text-muted); font-size: 12px;
  text-align: center; padding: 16px; pointer-events: none;
}
.preview-thumb-img {
  width: 100%; height: 160px; object-fit: cover; display: block;
}
.options-pane {
  display: flex; flex-direction: column; gap: 8px;
}
.options-pane .field { margin-bottom: 0; }
.options-btn {
  width: 100%; text-align: center; justify-content: center;
}

/* Print / PDF styles */
@media print {
  .idea-topbar, .note-toolbar, .idea-tabs-bar,
  .idea-save-bar, .modal-overlay { display: none !important; }
  .idea-body { padding: 0 !important; }
  .idea-page { padding: 0 !important; }
}

/* ============================================================
   SHARE SAVE PAGE — hoja de guardado rápido al compartir
   ============================================================ */
.share-page-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  background: var(--modal-overlay);
  margin: 0;
  padding: 0;
}

/* Estado de carga */
.share-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-height: 200px;
  color: #fff;
  font-size: 14px;
}

/* Tarjeta principal */
.share-card {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: ssSlideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes ssSlideUp {
  from { transform: translateY(80px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Handle de arrastre */
.share-card-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

/* Cabecera: icono tipo + título + botón cerrar */
.share-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 10px;
}
.share-card-type-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.share-card-heading { flex: 1; min-width: 0; }
.share-card-heading h2 { font-size: 16px; font-weight: 700; margin: 0 0 2px; line-height: 1.2; }
.share-card-domain {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}

/* Miniatura de enlace */
.share-thumb-area {
  width: 100%; height: 150px;
  overflow: hidden;
  background: var(--surface-alt);
}
.share-thumb-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Preview de imagen */
.share-img-area {
  padding: 0 16px 4px;
}
.share-img-preview {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  display: block;
}

/* Formulario */
.share-form {
  padding: 12px 16px 4px;
}
.share-title-input {
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 0 12px;
  font-family: inherit;
  line-height: 1.3;
  display: block;
  width: 100%;
}
.share-title-input::placeholder { color: var(--text-soft); font-weight: 600; }

/* Botones de acción */
.share-actions {
  display: flex; gap: 10px;
  padding: 12px 16px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.share-action-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}

/* Estado de éxito */
.share-success {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 20px;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  animation: ssSlideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.share-success-checkmark {
  width: 68px; height: 68px;
  background: var(--success);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  animation: ssPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ssPop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.share-success h3 { font-size: 20px; font-weight: 700; margin: 0; }
.share-success p  { font-size: 14px; color: var(--text-muted); margin: 0; text-align: center; }

/* En pantallas anchas: centrar la tarjeta */
@media (min-width: 520px) {
  .share-page-body { justify-content: center; padding: 20px; }
  .share-card,
  .share-success { border-radius: var(--radius-xl); max-width: 420px; }
}