/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: #1e293b; background: #f1f5f9; }
a { color: inherit; text-decoration: none; }

/* === Variables === */
:root {
  --primary: #0693e3;
  --primary-dark: #0577bc;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --sidebar-w: 240px;
}

/* === Layout === */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: #0f172a; display: flex; flex-direction: column; z-index: 100;
}
.sidebar-brand {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 12px; border-bottom: 1px solid #1e293b;
}
.sidebar-title { display: none; }
.sidebar-logo { width: 160px; height: auto; object-fit: contain; }
.sidebar-title { color: white; font-size: 15px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; color: #94a3b8;
  transition: all .15s; font-size: 13px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: #1e293b; color: white; }
.nav-item.active { background: var(--primary); color: white; }
.sidebar-footer {
  padding: 16px; border-top: 1px solid #1e293b;
  display: flex; align-items: center; justify-content: space-between;
}
.user-name { color: #94a3b8; font-size: 12px; }
.logout-btn { color: #64748b; font-size: 12px; }
.logout-btn:hover { color: var(--danger); }

.main-content { margin-left: var(--sidebar-w); padding: 24px; min-height: 100vh; }

/* === Page Header === */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: #0f172a; }
.page-header p { color: #64748b; font-size: 13px; margin-top: 2px; }
.header-actions { display: flex; gap: 8px; }

/* === Stats Grid === */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border-radius: 12px; padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 28px; font-weight: 700; color: #0f172a; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 2px; }

/* === Section Card === */
.section-card {
  background: white; border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px;
}
.section-title { font-size: 15px; font-weight: 600; color: #0f172a; margin-bottom: 16px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* === Tables === */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 12px; font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid #f1f5f9; }
.data-table td { padding: 12px; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* === Buttons === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: white; color: #374151; border: 1px solid #e2e8f0; }
.btn-outline:hover { background: #f8fafc; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 7px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-lg { padding: 14px 32px; font-size: 15px; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 14px; color: #1e293b; transition: border .15s; background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(6,147,227,.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 8px; }
.form-card { max-width: 640px; }
.align-end { display: flex; align-items: flex-end; }
.inline-form .form-row { align-items: flex-end; }

/* === Progress === */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: #f1f5f9; border-radius: 99px; min-width: 80px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.progress-fill.low { background: var(--danger); }
.progress-fill.mid { background: var(--warning); }

/* === Badges & Tags === */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.status-active { background: #dcfce7; color: #166534; }
.status-closed { background: #fee2e2; color: #991b1b; }
.status-draft  { background: #f1f5f9; color: #475569; }
.status-dot { font-size: 12px; font-weight: 500; }
.status-dot.used { color: var(--success); }
.status-dot.pending { color: #94a3b8; }
.score-badge { display: inline-block; padding: 4px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.score-badge.critical { background: #fee2e2; color: var(--danger); }
.company-tag { font-size: 11px; color: #64748b; margin-left: 8px; }

/* === Alerts === */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-section { border-left: 4px solid var(--danger); }
.alert-dot { display: inline-block; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; margin-right: 6px; }
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item { display: flex; align-items: center; justify-content: space-between; padding: 10px; background: #fff5f5; border-radius: 8px; }
.alert-info { display: flex; align-items: center; }

/* === Charts === */
.chart-wrap { max-height: 300px; margin-bottom: 16px; }
.score-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-item { font-size: 12px; padding: 4px 10px; border-radius: 6px; font-weight: 500; }
.legend-item.favorable { background: #dcfce7; color: #166534; }
.legend-item.neutro { background: #fef3c7; color: #92400e; }
.legend-item.critico { background: #fee2e2; color: #991b1b; }

/* === Question rows === */
.questions-list { display: flex; flex-direction: column; gap: 12px; }
.question-row { padding: 12px; border: 1px solid #f1f5f9; border-radius: 8px; }
.question-text { font-size: 13px; color: #374151; margin-bottom: 8px; }
.question-score { display: flex; align-items: center; gap: 10px; }
.score-bar-wrap { flex: 1; height: 8px; background: #f1f5f9; border-radius: 99px; }
.score-bar { height: 100%; border-radius: 99px; }
.score-num { font-size: 14px; font-weight: 700; min-width: 36px; }
.score-tag { font-size: 11px; font-weight: 500; }
.question-type-tag { font-size: 11px; color: #94a3b8; background: #f1f5f9; padding: 2px 8px; border-radius: 4px; display: inline-block; }

/* === Open Answers === */
.open-question { margin-bottom: 20px; }
.open-question:last-child { margin-bottom: 0; }
.open-question-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 10px; }
.open-answers-list { display: flex; flex-direction: column; gap: 6px; }
.open-answer-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f8fafc; border-radius: 6px; gap: 12px; }
.open-answer-text { font-size: 13px; color: #1e293b; flex: 1; }
.count-badge { font-size: 11px; background: var(--primary); color: white; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }

/* === Filters === */
.filters-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filters-bar select { padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; background: white; }

/* === AI Report === */
.ai-report { display: flex; flex-direction: column; gap: 20px; }
.ai-summary { background: #f0f9ff; border-left: 4px solid var(--primary); padding: 16px; border-radius: 0 8px 8px 0; }
.ai-summary h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--primary); }
.ai-section { }
.ai-section h3 { font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 10px; }
.ai-section ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.ai-section ul li { font-size: 13px; color: #475569; }
.ai-section.critical { background: #fff5f5; padding: 16px; border-radius: 8px; border: 1px solid #fecaca; }
.critical-item { margin-bottom: 12px; }
.critical-item strong { color: var(--danger); }
.critical-item p { font-size: 13px; color: #64748b; margin-top: 4px; }
.rec-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 8px; margin-bottom: 8px; background: #f8fafc; font-size: 13px; }
.priority-tag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; white-space: nowrap; margin-top: 1px; }
.priority-alta .priority-tag { background: #fee2e2; color: #991b1b; }
.priority-media .priority-tag { background: #fef3c7; color: #92400e; }
.priority-baja .priority-tag { background: #dcfce7; color: #166534; }
.theme-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 6px; margin-bottom: 6px; background: #f8fafc; font-size: 13px; }
.theme-pct { font-weight: 600; color: var(--primary); }
.sentiment-negativo { border-left: 3px solid var(--danger); }
.sentiment-positivo { border-left: 3px solid var(--success); }
.sentiment-neutro { border-left: 3px solid #94a3b8; }
.ai-empty { text-align: center; padding: 24px; color: #64748b; }
.ai-generated-at { font-size: 11px; color: #94a3b8; text-align: right; }
.ai-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; }
.spinner { width: 32px; height: 32px; border: 3px solid #e2e8f0; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === Token list === */
.token-url { font-size: 11px; color: #0577bc; }

/* === Empty state === */
.empty-state { text-align: center; padding: 32px; color: #94a3b8; font-size: 14px; }

/* === Login === */
.login-body { background: linear-gradient(135deg, #0f172a 0%, #0c2340 100%); min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.login-container { width: 100%; max-width: 420px; }
.login-card { background: white; border-radius: 16px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo { width: 200px; height: auto; object-fit: contain; margin-bottom: 16px; }
.login-title { font-size: 20px; font-weight: 700; color: #0f172a; }
.login-subtitle { color: #64748b; font-size: 14px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 18px; }
.login-footer { color: rgba(255,255,255,.4); font-size: 12px; text-align: center; margin-top: 20px; }

/* === Survey public === */
.survey-body { background: #f1f5f9; min-height: 100vh; padding: 20px; }
.survey-container { max-width: 760px; margin: 0 auto; }
.survey-header { background: white; border-radius: 12px; padding: 32px; margin-bottom: 20px; text-align: center; }
.survey-logo { width: 180px; height: auto; object-fit: contain; margin-bottom: 16px; }
.survey-header h1 { font-size: 22px; font-weight: 700; color: #0f172a; }
.survey-header p { color: #64748b; margin-top: 8px; }
.survey-section { background: white; border-radius: 12px; padding: 24px; margin-bottom: 16px; }
.survey-section-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 2px solid #f1f5f9; }
.survey-section-header h2 { font-size: 16px; font-weight: 600; color: var(--primary); }
.survey-question { margin-bottom: 24px; }
.question-label { display: block; font-size: 14px; font-weight: 500; color: #1e293b; margin-bottom: 12px; }
.req-mark { color: var(--danger); margin-left: 3px; }
.likert-scale { display: flex; gap: 8px; flex-wrap: wrap; }
.likert-option { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; padding: 10px; border: 2px solid #e2e8f0; border-radius: 8px; flex: 1; min-width: 80px; transition: all .15s; }
.likert-option:hover { border-color: var(--primary); background: #f0f9ff; }
.likert-option input { display: none; }
.likert-option:has(input:checked) { border-color: var(--primary); background: #dbeafe; }
.likert-num { font-size: 20px; font-weight: 700; color: #0f172a; }
.likert-label { font-size: 10px; color: #64748b; text-align: center; line-height: 1.3; }
.radio-group, .checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option, .checkbox-option { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; transition: all .15s; font-size: 14px; }
.radio-option:hover, .checkbox-option:hover { border-color: var(--primary); background: #f0f9ff; }
.comment-field { margin-top: 10px; background: #fffbeb; padding: 12px; border-radius: 8px; border: 1px solid #fde68a; }
.comment-field label { font-size: 12px; color: #92400e; margin-bottom: 6px; display: block; }
.survey-submit { background: white; border-radius: 12px; padding: 24px; text-align: center; margin-top: 20px; }
.survey-note { font-size: 12px; color: #94a3b8; margin-bottom: 16px; }
.thanks-container { text-align: center; padding: 60px 20px; }
.thanks-icon { width: 72px; height: 72px; background: var(--success); color: white; border-radius: 50%; font-size: 36px; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; }
.error-icon { background: var(--danger); }
.thanks-container h1 { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.thanks-container p { color: #64748b; font-size: 15px; line-height: 1.6; }
.thanks-company { font-size: 13px; color: #94a3b8; margin-top: 20px; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .likert-scale { gap: 4px; }
  .likert-option { min-width: 60px; padding: 8px 4px; }
}

/* === Individual Response View === */
.employee-info-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.emp-info-item { display: flex; flex-direction: column; gap: 4px; }
.emp-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; }
.emp-value { font-size: 14px; font-weight: 600; color: #0f172a; }
.response-list { display: flex; flex-direction: column; gap: 12px; }
.response-row { display: flex; gap: 16px; padding: 12px; border: 1px solid #f1f5f9; border-radius: 8px; align-items: flex-start; }
.response-question { flex: 1; font-size: 13px; color: #374151; min-width: 200px; }
.response-answer { flex: 2; }
.likert-response { display: flex; align-items: center; gap: 10px; }
.likert-bar-wrap { flex: 1; height: 8px; background: #f1f5f9; border-radius: 99px; min-width: 80px; }
.likert-bar-fill { height: 100%; border-radius: 99px; }
.likert-val { font-size: 15px; font-weight: 700; min-width: 32px; }
.likert-text { font-size: 12px; color: #64748b; }
.checkbox-response { display: flex; flex-wrap: wrap; gap: 6px; }
.checkbox-tag { background: #e0f2fe; color: #0369a1; font-size: 12px; padding: 3px 10px; border-radius: 99px; }
.text-response { font-size: 13px; color: #1e293b; }
.response-comment { margin-top: 8px; font-size: 12px; color: #92400e; background: #fef3c7; padding: 8px 12px; border-radius: 6px; }
.comment-icon { margin-right: 4px; }
@media (max-width: 768px) { .employee-info-grid { grid-template-columns: repeat(2,1fr); } .response-row { flex-direction: column; } }
