/* ========================================
   PsychCRM — Dark Intelligence Platform
   Design System v1.0
   ======================================== */

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

/* ==================== */
/*   DESIGN TOKENS      */
/* ==================== */
:root {
  /* Background layers */
  --bg-0: #060a11;
  --bg-1: #0b1120;
  --bg-2: #101827;
  --bg-3: #162031;
  --bg-4: #1c2a3e;
  --bg-5: #22334c;

  /* Borders */
  --border-1: rgba(255, 255, 255, 0.05);
  --border-2: rgba(255, 255, 255, 0.09);
  --border-3: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(59, 130, 246, 0.55);

  /* Text hierarchy */
  --text-1: #edf2f9;
  --text-2: #8899b8;
  --text-3: #546380;
  --text-4: #3d4f6a;

  /* Brand */
  --brand: #3b82f6;
  --brand-light: #60a5fa;
  --brand-dark: #2563eb;
  --brand-glow: rgba(59, 130, 246, 0.15);
  --brand-bg: rgba(59, 130, 246, 0.08);

  /* Risk system */
  --risk-critical: #ff3355;
  --risk-critical-bg: rgba(255, 51, 85, 0.08);
  --risk-critical-border: rgba(255, 51, 85, 0.22);
  --risk-critical-glow: rgba(255, 51, 85, 0.15);

  --risk-high: #ff7129;
  --risk-high-bg: rgba(255, 113, 41, 0.08);
  --risk-high-border: rgba(255, 113, 41, 0.22);

  --risk-medium: #f59e0b;
  --risk-medium-bg: rgba(245, 158, 11, 0.08);
  --risk-medium-border: rgba(245, 158, 11, 0.22);

  --risk-positive: #22c55e;
  --risk-positive-bg: rgba(34, 197, 94, 0.08);
  --risk-positive-border: rgba(34, 197, 94, 0.22);

  --risk-neutral: #64748b;
  --risk-neutral-bg: rgba(100, 116, 139, 0.08);
  --risk-neutral-border: rgba(100, 116, 139, 0.20);

  --risk-info: #60a5fa;
  --risk-info-bg: rgba(96, 165, 250, 0.08);
  --risk-info-border: rgba(96, 165, 250, 0.22);

  /* Status */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ff3355;
  --info: #60a5fa;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing scale */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px; --sp-5: 20px;  --sp-6: 24px;
  --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Radii */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --r-xl: 18px; --r-2xl: 24px; --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.45);
  --shadow-md: 0 4px 18px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.55);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.65);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.05);

  /* Transitions */
  --t-fast: 120ms ease;
  --t-normal: 200ms ease;
  --t-slow: 320ms ease;

  /* Layout */
  --header-h: 62px;
  --max-w: 1200px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; }

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

button { cursor: pointer; border: none; background: none; }
ul { list-style: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-5); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ==================== */
/*   LAYOUT             */
/* ==================== */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  z-index: 100;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  white-space: nowrap;
}

.app-logo .logo-icon {
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px var(--brand-glow));
}

.header-center { flex: 1; max-width: 420px; margin: 0 auto; }

.header-search {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search input {
  width: 100%;
  padding: var(--sp-2) var(--sp-4) var(--sp-2) 36px;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-full);
  color: var(--text-1);
  font-size: 0.875rem;
  transition: border-color var(--t-normal), background var(--t-normal);
  outline: none;
}

.header-search input::placeholder { color: var(--text-3); }
.header-search input:focus {
  border-color: var(--border-focus);
  background: var(--bg-4);
}

.header-search .search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-3);
  font-size: 0.9rem;
  pointer-events: none;
}

.header-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }

/* Main content */
.app-main {
  flex: 1;
  padding-top: calc(var(--header-h) + var(--sp-8));
  padding-bottom: var(--sp-12);
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
}

/* ==================== */
/*   LOGIN PAGE         */
/* ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59,130,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(99,102,241,0.04) 0%, transparent 50%);
  padding: var(--sp-6);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-2xl);
  padding: var(--sp-10) var(--sp-8);
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.login-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  display: block;
  filter: drop-shadow(0 0 16px var(--brand-glow));
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  margin-bottom: var(--sp-1);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: var(--sp-8);
}

.login-error {
  background: var(--risk-critical-bg);
  border: 1px solid var(--risk-critical-border);
  color: var(--risk-critical);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.875rem;
  margin-bottom: var(--sp-4);
  display: none;
}

.login-error.visible { display: block; }

/* ==================== */
/*   BUTTONS            */
/* ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all var(--t-normal);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 0 0 0 var(--brand-glow);
}
.btn-primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 4px 16px var(--brand-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-4);
  color: var(--text-1);
  border-color: var(--border-2);
}
.btn-secondary:hover {
  background: var(--bg-5);
  border-color: var(--border-3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text-1); }

.btn-danger {
  background: var(--risk-critical-bg);
  color: var(--risk-critical);
  border-color: var(--risk-critical-border);
}
.btn-danger:hover {
  background: rgba(255,51,85,0.18);
}

.btn-success {
  background: var(--risk-positive-bg);
  color: var(--risk-positive);
  border-color: var(--risk-positive-border);
}
.btn-success:hover { background: rgba(34,197,94,0.18); }

.btn-sm {
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.8125rem;
  border-radius: var(--r-sm);
}

.btn-lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: 1rem;
  border-radius: var(--r-lg);
}

.btn-full { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--bg-3);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-1);
  transition: all var(--t-fast);
  font-size: 1rem;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg-4); color: var(--text-1); border-color: var(--border-2); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* FAB */
.fab {
  position: fixed;
  bottom: var(--sp-8);
  right: var(--sp-8);
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--brand);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(59,130,246,0.4), var(--shadow-lg);
  transition: all var(--t-normal);
  z-index: 50;
  border: none;
  cursor: pointer;
}
.fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 32px rgba(59,130,246,0.5), var(--shadow-xl);
}
.fab:active { transform: translateY(0) scale(0.98); }

/* ==================== */
/*   FORMS & INPUTS     */
/* ==================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-label .optional {
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
  margin-left: var(--sp-1);
}

.form-input, .form-select, .form-textarea {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color var(--t-normal), background var(--t-normal), box-shadow var(--t-normal);
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-3); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-4);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option { background: var(--bg-3); }

.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}

.form-section {
  margin-bottom: var(--sp-8);
}

.form-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-1);
  margin-bottom: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Tag input with chips */
.tag-input-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.tag-input-row {
  display: flex;
  gap: var(--sp-2);
}

.tag-input-row .form-input { flex: 1; }

.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  min-height: 28px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--bg-4);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  transition: all var(--t-fast);
  white-space: nowrap;
}

.chip:hover { border-color: var(--border-3); }

.chip-remove {
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.chip-remove:hover { background: rgba(255,51,85,0.4); }

/* Chip color variants */
.chip-gusto   { background: var(--risk-positive-bg); border-color: var(--risk-positive-border); color: var(--risk-positive); }
.chip-molesta { background: var(--risk-high-bg); border-color: var(--risk-high-border); color: var(--risk-high); }
.chip-miedo   { background: var(--risk-critical-bg); border-color: var(--risk-critical-border); color: var(--risk-critical); }
.chip-motiv   { background: var(--brand-bg); border-color: rgba(59,130,246,0.25); color: var(--brand-light); }
.chip-comp    { background: var(--bg-4); border-color: var(--border-2); color: var(--text-2); }
.chip-rasgo   { background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.25); color: #a5b4fc; }

/* ==================== */
/*   CARDS              */
/* ==================== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-normal), box-shadow var(--t-normal), transform var(--t-normal);
}

.card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
}

.card-padded { padding: var(--sp-6); }

/* Person cards grid */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}

.person-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  border-left: 4px solid var(--risk-neutral);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all var(--t-normal);
  position: relative;
  overflow: hidden;
}

.person-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.person-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
}

.person-card:active { transform: translateY(0); }

/* Risk border variants */
.person-card.risk-critical { border-left-color: var(--risk-critical); }
.person-card.risk-high     { border-left-color: var(--risk-high); }
.person-card.risk-medium   { border-left-color: var(--risk-medium); }
.person-card.risk-positive { border-left-color: var(--risk-positive); }
.person-card.risk-neutral  { border-left-color: var(--risk-neutral); }
.person-card.risk-info     { border-left-color: var(--risk-info); }

.card-top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
  border-radius: var(--r-lg);
}

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

.card-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-relacion {
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-top: 2px;
  text-transform: capitalize;
}

.card-risk-badge { margin-left: auto; }

.card-profiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
  min-height: 22px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.profile-chip.tipo-peligro {
  background: var(--risk-critical-bg);
  color: var(--risk-critical);
  border: 1px solid var(--risk-critical-border);
}
.profile-chip.tipo-precaucion {
  background: var(--risk-high-bg);
  color: var(--risk-high);
  border: 1px solid var(--risk-high-border);
}
.profile-chip.tipo-informacion {
  background: var(--risk-info-bg);
  color: var(--risk-info);
  border: 1px solid var(--risk-info-border);
}
.profile-chip.tipo-positivo {
  background: var(--risk-positive-bg);
  color: var(--risk-positive);
  border: 1px solid var(--risk-positive-border);
}

.card-stats {
  display: flex;
  gap: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-1);
}

.card-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* ==================== */
/*   RISK BADGES        */
/* ==================== */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.risk-badge.risk-critical {
  background: var(--risk-critical-bg);
  color: var(--risk-critical);
  border: 1px solid var(--risk-critical-border);
}
.risk-badge.risk-high {
  background: var(--risk-high-bg);
  color: var(--risk-high);
  border: 1px solid var(--risk-high-border);
}
.risk-badge.risk-medium {
  background: var(--risk-medium-bg);
  color: var(--risk-medium);
  border: 1px solid var(--risk-medium-border);
}
.risk-badge.risk-positive {
  background: var(--risk-positive-bg);
  color: var(--risk-positive);
  border: 1px solid var(--risk-positive-border);
}
.risk-badge.risk-neutral {
  background: var(--risk-neutral-bg);
  color: var(--risk-neutral);
  border: 1px solid var(--risk-neutral-border);
}
.risk-badge.risk-info {
  background: var(--risk-info-bg);
  color: var(--risk-info);
  border: 1px solid var(--risk-info-border);
}

/* ==================== */
/*   TABS               */
/* ==================== */
.tabs-nav {
  display: flex;
  gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 4px;
  margin-bottom: var(--sp-6);
}

.tab-btn {
  flex: 1;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--t-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}

.tab-btn:hover { background: var(--bg-4); color: var(--text-1); }

.tab-btn.active {
  background: var(--bg-4);
  color: var(--text-1);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

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

/* ==================== */
/*   PROFILE SECTION    */
/* ==================== */
.person-hero {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-5);
  position: relative;
  overflow: hidden;
}

.person-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(59,130,246,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.hero-info { flex: 1; }

.hero-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.hero-meta {
  color: var(--text-2);
  font-size: 0.9rem;
  margin-bottom: var(--sp-4);
}

.hero-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.hero-actions { display: flex; gap: var(--sp-2); align-items: flex-start; }

/* Profile analysis blocks */
.analysis-profiles { display: flex; flex-direction: column; gap: var(--sp-3); }

.analysis-profile-item {
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}

.profile-item-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.profile-item-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.profile-item-name {
  font-weight: 600;
  font-size: 0.9375rem;
  flex: 1;
}

.probability-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-full);
  letter-spacing: 0.03em;
}

.prob-alta { background: var(--risk-critical-bg); color: var(--risk-critical); }
.prob-media { background: var(--risk-medium-bg); color: var(--risk-medium); }
.prob-baja { background: var(--risk-neutral-bg); color: var(--risk-neutral); }

.profile-item-desc {
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: var(--sp-2);
}

.confidence-bar {
  height: 4px;
  background: var(--bg-4);
  border-radius: var(--r-full);
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.6s ease;
}

.conf-peligro .confidence-fill { background: linear-gradient(90deg, var(--risk-critical), rgba(255,51,85,0.5)); }
.conf-precaucion .confidence-fill { background: linear-gradient(90deg, var(--risk-high), rgba(255,113,41,0.5)); }
.conf-informacion .confidence-fill { background: linear-gradient(90deg, var(--risk-info), rgba(96,165,250,0.5)); }
.conf-positivo .confidence-fill { background: linear-gradient(90deg, var(--risk-positive), rgba(34,197,94,0.5)); }

/* Red flags list */
.red-flags-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.red-flag-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--risk-critical-bg);
  border: 1px solid var(--risk-critical-border);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  color: var(--text-1);
}

.red-flag-icon { font-size: 1rem; flex-shrink: 0; }

/* Emotions grid */
.emotions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}

.emotion-block {
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

.emotion-block-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-4);
}

.emotion-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ==================== */
/*   GEMINI ANALYSIS    */
/* ==================== */
.analysis-panel {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.analysis-panel-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  background: linear-gradient(135deg, rgba(59,130,246,0.04), transparent);
}

.analysis-panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.analysis-panel-body { padding: var(--sp-6); }

.analysis-text {
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-1);
  white-space: pre-wrap;
  margin-bottom: var(--sp-6);
}

.analysis-recomendacion {
  background: var(--brand-bg);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  font-size: 0.875rem;
  color: var(--brand-light);
  margin-bottom: var(--sp-6);
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
}

.disclaimer-box {
  background: var(--risk-neutral-bg);
  border: 1px solid var(--risk-neutral-border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.8125rem;
  color: var(--text-3);
  font-style: italic;
  margin-top: var(--sp-4);
}

/* Question cards */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}

.question-card {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: all var(--t-normal);
}

.question-card.answered {
  border-color: var(--risk-positive-border);
  background: rgba(34,197,94,0.03);
}

.question-card.skipped { opacity: 0.5; }

.question-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.question-num {
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--bg-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0;
  margin-top: 2px;
}

.question-card.answered .question-num {
  background: var(--risk-positive-bg);
  color: var(--risk-positive);
}

.question-text {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-1);
  flex: 1;
  line-height: 1.5;
}

.question-razon {
  font-size: 0.8125rem;
  color: var(--text-3);
  font-style: italic;
  margin-bottom: var(--sp-3);
  padding-left: calc(26px + var(--sp-3));
}

.question-cat-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-5);
  color: var(--text-3);
  margin-bottom: var(--sp-3);
  margin-left: calc(26px + var(--sp-3));
}

.question-answer-area {
  padding-left: calc(26px + var(--sp-3));
}

.question-answer-area .form-textarea {
  min-height: 70px;
}

.question-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-left: calc(26px + var(--sp-3));
}

/* ==================== */
/*   HISTORY            */
/* ==================== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.history-item {
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  gap: var(--sp-4);
}

.history-date {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.history-body {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.65;
}

/* ==================== */
/*   PAGE HEADERS       */
/* ==================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-actions { display: flex; gap: var(--sp-2); align-items: center; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  color: var(--text-2);
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  transition: all var(--t-fast);
  cursor: pointer;
  text-decoration: none;
}
.back-btn:hover { background: var(--bg-4); color: var(--text-1); text-decoration: none; }

/* ==================== */
/*   SECTION HEADERS    */
/* ==================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.section-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.section-count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--bg-4);
  color: var(--text-3);
}

/* ==================== */
/*   INFO BOXES         */
/* ==================== */
.info-box {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  line-height: 1.55;
}

.info-box.info  { background: var(--risk-info-bg);     border: 1px solid var(--risk-info-border);     color: var(--risk-info); }
.info-box.warn  { background: var(--risk-medium-bg);   border: 1px solid var(--risk-medium-border);   color: var(--risk-medium); }
.info-box.error { background: var(--risk-critical-bg); border: 1px solid var(--risk-critical-border); color: var(--risk-critical); }
.info-box.success{ background: var(--risk-positive-bg);border: 1px solid var(--risk-positive-border); color: var(--risk-positive); }

/* ==================== */
/*   LOADING / SPINNER  */
/* ==================== */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-2);
  border-top-color: var(--brand);
  border-radius: var(--r-full);
  animation: spin 0.75s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-12) var(--sp-8);
  color: var(--text-2);
  font-size: 0.9rem;
}

/* ==================== */
/*   EMPTY STATE        */
/* ==================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-12) var(--sp-8);
  color: var(--text-3);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: var(--sp-2);
}

.empty-state-desc {
  font-size: 0.875rem;
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: var(--sp-6);
}

/* ==================== */
/*   TOAST              */
/* ==================== */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-full);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
  backdrop-filter: blur(16px);
  max-width: 380px;
}

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

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

.toast.out { animation: toastOut 0.3s ease forwards; }

.toast.success { background: rgba(22,35,22,0.95); border: 1px solid var(--risk-positive-border); color: var(--risk-positive); }
.toast.error   { background: rgba(35,12,12,0.95); border: 1px solid var(--risk-critical-border); color: var(--risk-critical); }
.toast.info    { background: rgba(12,22,45,0.95); border: 1px solid var(--risk-info-border); color: var(--risk-info); }
.toast.warning { background: rgba(35,28,12,0.95); border: 1px solid var(--risk-medium-border); color: var(--risk-medium); }

/* ==================== */
/*   MODAL              */
/* ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  animation: fadeIn 0.2s ease;
}

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

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: var(--sp-2); }
.modal-body  { color: var(--text-2); font-size: 0.9rem; margin-bottom: var(--sp-6); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); }

/* ==================== */
/*   SETTINGS PAGE      */
/* ==================== */
.settings-section {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-1);
}

.api-key-hint {
  background: var(--brand-bg);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  font-size: 0.875rem;
  color: var(--brand-light);
  margin-top: var(--sp-3);
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  line-height: 1.55;
}

/* ==================== */
/*   DASHBOARD TOOLBAR  */
/* ==================== */
.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.dashboard-filters {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
}

.filter-chip:hover { background: var(--bg-4); color: var(--text-1); }
.filter-chip.active { background: var(--brand-bg); border-color: rgba(59,130,246,0.3); color: var(--brand-light); }

/* ==================== */
/*   TRANSITIONS        */
/* ==================== */
.view-enter { animation: viewIn 0.2s ease forwards; }

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

/* ==================== */
/*   DIVIDERS / UTILS   */
/* ==================== */
.divider {
  height: 1px;
  background: var(--border-1);
  margin: var(--sp-6) 0;
}

.text-muted { color: var(--text-3); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8125rem; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

/* ==================== */
/*   RESPONSIVE         */
/* ==================== */
@media (max-width: 768px) {
  .app-main { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .app-header { padding: 0 var(--sp-4); }
  .header-center { display: none; }

  .people-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .emotions-grid { grid-template-columns: 1fr; }

  .tabs-nav { gap: 1px; }
  .tab-btn { font-size: 0.8125rem; padding: var(--sp-2) var(--sp-3); }

  .person-hero { flex-direction: column; }
  .hero-actions { align-self: flex-end; }

  .fab { bottom: var(--sp-5); right: var(--sp-5); }
  .page-title { font-size: 1.2rem; }
}

@media (max-width: 480px) {
  .modal { padding: var(--sp-6); }
  .login-card { padding: var(--sp-8) var(--sp-5); }
}
