/* ============================================================
   SISTEMA MVP — Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');

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

:root {
  --bg:        #0D0D0D;
  --surface:   #141414;
  --surface-2: #1C1C1C;
  --border:    rgba(255,255,255,0.07);
  --border-2:  rgba(255,255,255,0.12);
  --text:      #F0EDE6;
  --muted:     #666;
  --muted-2:   #999;
  --accent:    #C9A96E;
  --accent-dim:rgba(201,169,110,0.12);
  --accent-border: rgba(201,169,110,0.25);
  --green:     #4ADE80;
  --green-dim: rgba(74,222,128,0.1);
  --yellow:    #FBBF24;
  --yellow-dim:rgba(251,191,36,0.1);
  --red:       #F87171;
  --red-dim:   rgba(248,113,113,0.1);
  --radius:    10px;
  --radius-lg: 14px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Sync badge ── */
.sync-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500; padding: 4px 10px;
  border-radius: 20px; border: 1px solid var(--border-2);
  color: var(--muted-2); background: var(--surface-2);
  transition: all 0.3s;
}
.sync-badge.ok      { color: #4ade80; border-color: rgba(74,222,128,0.25); background: rgba(74,222,128,0.06); }
.sync-badge.error   { color: #f87171; border-color: rgba(248,113,113,0.25); background: rgba(248,113,113,0.06); }
.sync-badge.loading { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); }

.sync-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); display: inline-block; flex-shrink: 0;
}
.sync-badge.ok    .sync-dot { background: #4ade80; }
.sync-badge.error .sync-dot { background: #f87171; }
.sync-badge.loading .sync-dot {
  background: var(--accent);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }

/* ============================================================
   LOGIN
   ============================================================ */
#view-login {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#view-login.active { display: flex; }

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
}

.login-logo {
  text-align: center;
  margin-bottom: 40px;
}
.login-logo .wordmark {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.login-logo .tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.login-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.login-card .sub {
  font-size: 14px;
  color: var(--muted-2);
  margin-bottom: 32px;
}

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-2);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-border);
}
.field input::placeholder { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #0D0D0D;
  width: 100%;
}
.btn-primary:hover { opacity: 0.9; }
.btn-ghost {
  background: transparent;
  color: var(--muted-2);
  border: 1px solid var(--border-2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-2); }
/* Los botones pequeños van siempre en línea: anulan el ancho
   completo que .btn-primary necesita en el formulario de login */
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; }

.error-msg {
  background: var(--red-dim);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

/* ============================================================
   LAYOUT — APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header .wordmark {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.sidebar-header .role-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-2);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--muted); }

/* Main content */
.main-content {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
}

.page-header {
  padding: 32px 40px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
}
.page-header .sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.page-body { padding: 32px 40px; }

/* ============================================================
   CARDS & STATS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-card.green::before { background: var(--green); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.red::before { background: var(--red); }
.stat-card.gold::before { background: var(--accent); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red { color: var(--red); }
.stat-value.gold { color: var(--accent); }
.stat-meta {
  font-size: 12px;
  color: var(--muted-2);
}

/* Alert box */
.alert {
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.alert.red { background: var(--red-dim); border: 1px solid rgba(248,113,113,0.2); }
.alert.yellow { background: var(--yellow-dim); border: 1px solid rgba(251,191,36,0.2); }
.alert.green { background: var(--green-dim); border: 1px solid rgba(74,222,128,0.2); }
.alert-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.alert-body { font-size: 13px; color: var(--muted-2); line-height: 1.6; }

/* Card generic */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
}
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge.green { background: var(--green-dim); color: var(--green); }
.badge.yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge.red { background: var(--red-dim); color: var(--red); }
.badge.gold { background: var(--accent-dim); color: var(--accent); }
.badge.muted { background: rgba(255,255,255,0.06); color: var(--muted-2); }

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }

/* ============================================================
   CLIENT CARDS (Admin view)
   ============================================================ */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
  overflow: hidden;
}
.client-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.client-card.status-red { border-left: 3px solid var(--red); }
.client-card.status-yellow { border-left: 3px solid var(--yellow); }
.client-card.status-green { border-left: 3px solid var(--green); }

.client-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.client-info .name { font-size: 15px; font-weight: 600; }
.client-info .company { font-size: 12px; color: var(--muted); margin-top: 2px; }

.client-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.client-metric .label { font-size: 10px; color: var(--muted); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.client-metric .value { font-size: 20px; font-weight: 700; margin-top: 2px; }

.client-alert {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 16px;
}
.client-alert strong { color: var(--text); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  padding: 0 40px;
}
.tab {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-2);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   PRIORITIES LIST
   ============================================================ */
.priorities { display: flex; flex-direction: column; gap: 10px; }
.priority-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.priority-num {
  width: 24px; height: 24px;
  min-width: 24px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 1px;
}
.priority-text .title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.priority-text .desc { font-size: 12px; color: var(--muted-2); }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.6s ease;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 24px;
}
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 16px; }
.empty-state p { font-size: 14px; }

/* ============================================================
   BACK BUTTON
   ============================================================ */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted-2);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 8px;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }

/* ============================================================
   LOGOUT BTN
   ============================================================ */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s;
}
.logout-btn:hover { color: var(--red); }

/* ============================================================
   SEMAFORO OVERVIEW
   ============================================================ */
.overview-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.overview-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.overview-pill.green { background: var(--green-dim); color: var(--green); }
.overview-pill.yellow { background: var(--yellow-dim); color: var(--yellow); }
.overview-pill.red { background: var(--red-dim); color: var(--red); }
.overview-pill.muted { background: var(--surface); color: var(--muted-2); border: 1px solid var(--border); }

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-header {
  margin-bottom: 28px;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.section-desc {
  font-size: 13px;
  color: var(--muted-2);
  line-height: 1.6;
  max-width: 600px;
}

/* Color CSS vars for JS use */
.green  { color: var(--green);  }
.yellow { color: var(--yellow); }
.red    { color: var(--red);    }
.gold   { color: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-header { padding: 24px 20px 20px; }
  .page-body { padding: 20px; }
  .tabs { padding: 0 20px; overflow-x: auto; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   TOAST (confirmación de guardado)
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok    { border-color: rgba(74,222,128,0.4); }
.toast.error { border-color: rgba(248,113,113,0.5); color: var(--red); }

/* ============================================================
   ZONAS EDITABLES
   ============================================================ */
.editable { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.editable:hover { border-color: var(--accent-border); }
.stat-card.editable:hover { background: var(--surface-2); }
#ed-body textarea:focus,
#ed-body input:focus,
#ed-body select:focus { outline: none; border-color: var(--accent-border); }

/* ============================================================
   BOTÓN DE MENÚ (móvil)
   ============================================================ */
.menu-btn {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 16px;
  cursor: pointer;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    z-index: 900;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
  }
  /* Se repite aquí para que gane siempre, sea cual sea el orden del fichero */
  .sidebar.open { transform: translateX(0); }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .stats-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
}

/* ============================================================
   CENTRO DE MANDO
   ============================================================ */
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent);
  color: #1a1a1a;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar .nav-item { display: flex; align-items: center; gap: 10px; }

/* ============================================================
   CEREBRO DINÁMICO
   ============================================================ */
.cerebro-lienzo {
  position: relative;
  width: 100%;
  height: min(66vh, 620px);
  min-height: 380px;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(201,169,110,0.055), transparent 70%),
    radial-gradient(ellipse 100% 80% at 50% 50%, #0c0c10, #070709 75%);
  border: 1px solid var(--border);
}
#cerebro-canvas { display: block; width: 100%; height: 100%; }

.cerebro-pie {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 22px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(7,7,9,0.85), transparent);
}
.cerebro-leyenda {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.cerebro-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.cerebro-leyenda .punto {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.punto.green { background: var(--green); }
.punto.yellow { background: var(--yellow); }
.punto.red { background: var(--red); }
.punto.off { background: transparent; border: 1px dashed rgba(150,150,158,0.6); }

/* El foco: una sola frase, sin caja, sin ruido */
.cerebro-foco { margin-top: 34px; max-width: 720px; }
.cerebro-foco-etiqueta {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.cerebro-foco-texto {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(17px, 2.4vw, 23px);
  line-height: 1.5;
  color: var(--text);
}

.cerebro-tooltip {
  position: fixed;
  z-index: 1200;
  pointer-events: none;
  background: rgba(18,18,22,0.97);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 11px 14px;
  min-width: 150px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s, transform 0.12s;
  backdrop-filter: blur(8px);
}
.cerebro-tooltip.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 768px) {
  .cerebro-lienzo { height: 58vh; min-height: 320px; }
  .cerebro-leyenda { gap: 12px; font-size: 9.5px; }
}

/* ============================================================
   JARVIS
   ============================================================ */
#jarvis-boton {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 1250;
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 1px solid var(--accent-border);
  background: radial-gradient(circle at 35% 30%, rgba(201,169,110,0.35), rgba(20,20,20,0.96));
  color: var(--accent);
  font-size: 19px;
  cursor: pointer;
  box-shadow: 0 6px 26px rgba(0,0,0,0.5);
  transition: transform 0.15s, box-shadow 0.2s;
}
#jarvis-boton:hover { transform: scale(1.06); box-shadow: 0 6px 32px rgba(201,169,110,0.28); }

#jarvis-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw);
  z-index: 1260;
  background: var(--surface);
  border-left: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
  transform: translateX(101%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -20px 0 50px rgba(0,0,0,0.45);
}
#jarvis-panel.abierto { transform: translateX(0); }

.jarvis-cabecera {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.jarvis-titulo {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700;
}
.jarvis-sub {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-top: 1px;
}
.jarvis-icono {
  background: none; border: 1px solid var(--border-2); border-radius: 7px;
  color: var(--muted); width: 28px; height: 28px; cursor: pointer; font-size: 13px;
}
.jarvis-icono:hover { color: var(--text); }

.jarvis-conversacion {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}

.jarvis-vacio { margin: auto 0; text-align: left; }
.jarvis-vacio-titulo {
  font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; margin-bottom: 8px;
}
.jarvis-vacio-sub { font-size: 13px; color: var(--muted-2); line-height: 1.6; margin-bottom: 20px; }
.jarvis-sugerencias { display: flex; flex-direction: column; gap: 8px; }
.jarvis-sugerencias button {
  text-align: left; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--muted-2); font-size: 12.5px; cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.jarvis-sugerencias button:hover { border-color: var(--accent-border); color: var(--text); }

.jarvis-msg { display: flex; gap: 10px; }
.jarvis-msg.user { justify-content: flex-end; }
.jarvis-avatar {
  width: 24px; height: 24px; min-width: 24px; border-radius: 50%;
  border: 1px solid var(--accent-border); background: var(--accent-dim);
  color: var(--accent); font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.jarvis-burbuja {
  font-size: 13px; line-height: 1.65; max-width: 86%;
  padding: 11px 14px; border-radius: 12px;
}
.jarvis-msg.user .jarvis-burbuja {
  background: var(--accent-dim); border: 1px solid var(--accent-border); color: var(--text);
}
.jarvis-msg.assistant .jarvis-burbuja {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}

.jarvis-pensando { display: flex; align-items: center; gap: 4px; padding: 0 20px 10px; }
.jarvis-punto {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  animation: jarvis-latir 1.2s ease-in-out infinite;
}
.jarvis-punto:nth-child(2) { animation-delay: 0.15s; }
.jarvis-punto:nth-child(3) { animation-delay: 0.3s; }
@keyframes jarvis-latir {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50%      { opacity: 1;    transform: translateY(-3px); }
}

.jarvis-entrada {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border);
}
.jarvis-entrada textarea {
  flex: 1; resize: none; max-height: 120px;
  background: var(--bg); border: 1px solid var(--border-2); border-radius: 10px;
  padding: 11px 13px; font-size: 13px; font-family: inherit; color: var(--text);
  outline: none; line-height: 1.5;
}
.jarvis-entrada textarea:focus { border-color: var(--accent-border); }
.jarvis-entrada button {
  width: 38px; height: 38px; border-radius: 10px; border: none;
  background: var(--accent); color: #0D0D0D; font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.jarvis-entrada button:hover { opacity: 0.9; }

@media (max-width: 768px) {
  #jarvis-panel { width: 100vw; }
  #jarvis-boton { right: 16px; bottom: 16px; width: 46px; height: 46px; }
}
