/* css/styles.css — v0.2.1 */
:root {
  /* Colors - Light Theme (Default) */
  --bg: #f8fafc;
  --bg2: #ffffff;
  --sidebar: #0f172a;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbe6;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --accent2: #1d4ed8; /* Darker blue for hovers */
  --bg3: #f1f5f9;
  --text1: #0f172a;

  /* Premium - Glassmorphism & Effects */
  --glass: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --blur: blur(12px);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
  --bg: #020617;
  --bg2: #0f172a;
  --sidebar: #020617;
  --accent: #60a5fa; /* Más vibrante en oscuro */
  --accent-light: rgba(96, 165, 250, 0.1);
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #475569;
  --border: #1e293b;
  
  --glass: rgba(15, 23, 42, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);

  --success-bg: rgba(34, 197, 94, 0.15);
  --warning-bg: rgba(234, 179, 8, 0.15);
  --danger-bg: rgba(239, 68, 68, 0.15);
  --accent2: #3b82f6; /* Brighter blue for dark hover */
  --bg3: #1e293b;
  --text1: #f1f5f9;

  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.7);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Tooltip */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: var(--bg2);
  color: var(--text3);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  cursor: help;
  border: 1px solid var(--border);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  vertical-align: middle;
}
.tooltip-icon:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: scale(1.15);
}


/* ── LOGIN ── */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top left, var(--accent) 0%, var(--sidebar) 100%);
}
.login-card {
  background: var(--bg2); 
  border-radius: 24px; 
  padding: 48px;
  width: 100%; 
  max-width: 420px; 
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
}

.login-logo-wrap { margin-bottom: 32px; text-align: center; }

.login-logo-wrap img { height: 42px; width: auto; border-radius: 6px; }
.login-sub-text { font-size: 12px; color: var(--text3); margin-top: 6px; }
.login-title { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.login-desc { font-size: 13px; color: var(--text2); margin-bottom: 18px; }
.login-demo-hint {
  display: flex; align-items: flex-start; gap: 7px;
  margin-top: 14px; padding: 10px 12px;
  background: var(--accent-light); border-radius: var(--radius-sm);
  font-size: 11px; color: var(--accent); line-height: 1.5;
}
.login-demo-hint svg { flex-shrink: 0; margin-top: 1px; }
.login-roles-label { font-size: 12px; color: var(--text3); margin-bottom: 10px; }
.roles-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.role-btn {
  padding: 14px 8px; border-radius: var(--radius); border: 1.5px solid var(--border);
  background: var(--bg); cursor: pointer; text-align: center; transition: all .15s; font-family: inherit;
}
.role-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.role-icon { font-size: 22px; margin-bottom: 6px; }
.role-name { font-size: 13px; font-weight: 600; color: var(--text); }
.role-desc { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── APP ── */
#app { display: none; min-height: 100vh; }
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: 240px; min-width: 180px; max-width: 400px; background: var(--sidebar); flex-shrink: 0;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
  resize: horizontal; overflow: hidden;
}
.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo img { height: 30px; width: auto; border-radius: 4px; }
.sidebar-logo-sub { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 5px; }
.sidebar-user {
  padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white; flex-shrink: 0;
}
.sidebar-username { font-size: 13px; font-weight: 500; color: white; }
.sidebar-role { font-size: 11px; color: rgba(255,255,255,0.4); }
.sidebar-nav { flex: 1 1 auto; min-height: 120px; padding: 10px 0; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
/* COLAB-VIS-01: Mi equipo con tope de altura y scroll propio, para no aplastar el menu de navegacion cuando hay muchos subordinados. */
#sidebar-equipo { flex: 0 1 auto; max-height: 35vh; overflow-y: auto; scrollbar-width: thin; }
#sidebar-equipo::-webkit-scrollbar { width: 4px; }
#sidebar-equipo::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.nav-section {
  padding: 10px 18px 3px; font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,0.22); letter-spacing: 0.08em; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  color: rgba(255,255,255,0.5); font-size: 13px; cursor: pointer;
  transition: all .2s ease; border-left: 3px solid transparent; margin: 1px 0;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-item.active { color: white; background: rgba(30,111,217,0.22); border-left-color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.65; stroke-width: 2; }
.nav-item.active svg { opacity: 1; }
.nav-item span { line-height: 1; margin-top: 1px; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: white;
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 10px;
}
.nav-item-evals { position: relative; }
.nav-eval-popup {
  display: none;
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card, #1e2533);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  pointer-events: none;
  min-width: 150px;
}
.nav-item-evals:hover .nav-eval-popup { display: flex; flex-direction: column; gap: 5px; }
.nav-eval-popup-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.75);
}
.nav-eval-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.nav-eval-dot.danger { background: var(--danger); }
.nav-eval-dot.accent { background: var(--accent); }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-version { font-size: 10px; color: rgba(255,255,255,0.2); font-family: 'DM Mono', monospace; margin-top: 8px; }
.btn-logout {
  display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,0.35);
  font-size: 12px; cursor: pointer; background: none; border: none;
  font-family: inherit; transition: color .15s; padding: 0;
}
.btn-logout:hover { color: rgba(255,255,255,0.7); }

/* ── MAIN ── */
.main { margin-left: 240px; display: flex; flex-direction: column; width: calc(100vw - 240px); max-width: calc(100vw - 240px); overflow-x: hidden; }
.topbar {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  gap: 12px;
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
}

.topbar-hamburger { display: none; }
.topbar-title { display: none; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-version {
  font-size: 10px; color: var(--text3); font-family: 'DM Mono', monospace;
  padding: 3px 8px; background: var(--bg2); border-radius: 20px; border: 1px solid var(--border);
}
.topbar-notif {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.notif-dot {
  width: 7px; height: 7px; background: var(--danger); border-radius: 50%;
  position: absolute; top: 6px; right: 6px; border: 1.5px solid var(--bg2);
}
.page { padding: 24px; flex: 1; min-width: 0; }
.page-section { display: none; }
.page-section.active { display: block; }

/* ── COMPONENTES BASE ── */
.btn-sm {
  padding: 7px 13px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: all .15s;
  border: 1.5px solid var(--border); background: var(--bg2); color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-sm:hover { 
  border-color: var(--accent); 
  color: var(--accent); 
  background: var(--accent-light); 
}
.btn-sm.primary { 
  background: var(--accent); 
  color: white; 
  border-color: var(--accent); 
}
.btn-sm.primary:hover, #btn-login:hover { 
  background: var(--accent2) !important; 
  color: white !important; 
  border-color: var(--accent2) !important; 
  opacity: 1;
}
.btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 14px; font-weight: 600; }
.page-title { font-size: 17px; font-weight: 600; margin-bottom: 18px; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { 
  background: var(--bg2); 
  border-radius: var(--radius); 
  padding: 20px 24px; 
  box-shadow: var(--shadow); 
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  border-color: var(--accent);
}
/* [AUDIT] Animación movida al bloque final (AUDIT IMPROVEMENTS v0.2.3) */
.stat-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; float: right; }
.stat-icon svg { width: 17px; height: 17px; }
.stat-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 600; margin-bottom: 3px; }
.stat-delta { font-size: 11px; color: var(--text3); }
.stat-delta.up { color: var(--success); }
.stat-delta.warn { color: var(--warning); }

/* ── ALERTS ── */
.alert-item {
  background: var(--bg2); border-radius: var(--radius); padding: 13px 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.alert-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.alert-dot.danger { background: var(--danger); }
.alert-dot.warn { background: var(--warning); }
.alert-text { flex: 1; font-size: 13px; }
.alert-item:hover { transform: translateX(4px); border-color: var(--accent); }

/* ── TABLE ── */
.table-wrap {
  background: var(--bg2); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow);
  border: 1px solid var(--border); 
  overflow: hidden; 
  margin-bottom: 24px;
}
.table-toolbar {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.search-input {
  flex: 1; min-width: 160px; padding: 7px 11px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; outline: none; color: var(--text); background: var(--bg);
}
.search-input:focus { border-color: var(--accent); background: white; }
.form-select {
  padding: 7px 11px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; font-family: inherit; color: var(--text); background: var(--bg); outline: none; cursor: pointer;
}
.form-select:focus { border-color: var(--accent); }
.filter-row th { padding: 4px 8px 10px 8px; background: var(--bg); border-bottom: 1px solid var(--border); }
.table-filter {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg2);
  outline: none;
  transition: all 0.15s;
}
.table-filter:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg); }
th {
  padding: 10px 14px; text-align: left; font-size: 10px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
td { padding: 11px 14px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; cursor: pointer; }
tbody tr:hover { background: var(--accent-light); }
.col-name { display: flex; align-items: center; gap: 9px; }
.avatar-sm {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: white;
}
.name-text { font-weight: 500; font-size: 13px; }
.name-sub { font-size: 11px; color: var(--text3); }
.action-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 500;
  border: 1.5px solid var(--border); background: var(--bg2); color: var(--text2);
  cursor: pointer; font-family: inherit; transition: all .15s; white-space: nowrap;
}
.action-btn:hover { border-color: var(--accent); color: white; background: var(--accent); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-gray { background: var(--bg2); color: var(--text3); }
.badge-360 { background: var(--accent-light); color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ── PROGRESS ── */
.progress-wrap { display: flex; align-items: center; gap: 7px; }
.progress-bar { height: 5px; border-radius: 3px; background: var(--bg2); width: 72px; overflow: hidden; flex-shrink: 0; }
.progress-fill { height: 100%; border-radius: 3px; }
.pct { font-size: 12px; font-weight: 500; color: var(--text2); min-width: 30px; }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--border); justify-content: flex-end; }
.page-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1.5px solid var(--border);
  background: var(--bg2); cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text2);
  display: flex; align-items: center; justify-content: center; transition: all .12s;
}
.page-btn:hover, .page-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 12px; color: var(--text3); margin-right: 6px; }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Inducción Tabs */
.ind-tabs { display: flex; gap: 8px; margin-bottom: 20px; background: var(--bg); padding: 5px; border-radius: 12px; border: 1px solid var(--border); }
.btn-ind-tab {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: none; background: transparent; color: var(--text3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-ind-tab:hover { color: var(--text); background: rgba(0,0,0,0.03); }
.btn-ind-tab.active {
  background: white; color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.btn-ind-tab svg { width: 16px; height: 16px; opacity: 0.7; }
.btn-ind-tab.active svg { opacity: 1; }

/* ── TWO COL ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; display: block; }
.form-input {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
  color: var(--text); background: var(--bg); outline: none;
}
.form-input:focus { border-color: var(--accent); background: var(--bg2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.textarea-obs {
  width: 100%; padding: 7px 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; font-family: inherit;
  color: var(--text); background: var(--bg); resize: none; height: 48px; outline: none; margin-top: 6px;
}
.textarea-obs:focus { border-color: var(--accent); background: var(--bg2); }

/* ── MODALES ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); 
  border-radius: 20px; 
  padding: 32px; 
  width: 100%; 
  max-width: 500px;
  box-shadow: var(--shadow-lg); 
  max-height: 90vh; 
  overflow-y: auto;
  border: 1px solid var(--glass-border);
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-sub { font-size: 13px; color: var(--text3); margin-bottom: 20px; }
.modal-header { 
  display: flex; align-items: center; justify-content: space-between; 
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-close { 
  background: var(--bg); border: 1.5px solid var(--border); width: 32px; height: 32px; 
  border-radius: 8px; display: flex; align-items: center; justify-content: center; 
  cursor: pointer; font-size: 20px; color: var(--text2); transition: all 0.15s;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 20px 20px; }

/* ── PILLS / TABS INTERNOS ── */
.btn-pill {
  padding: 8px 16px; border-radius: 30px; border: 1.5px solid var(--border);
  background: var(--bg2); color: var(--text2); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-pill.active { background: var(--accent); color: white; border-color: var(--accent); }
.btn-pill:hover:not(.active) { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

.checklist-grid {
  display: grid; grid-template-columns: 1fr; gap: 10px;
}
.check-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; 
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
}
.check-item:hover { background: var(--accent-light); }
.check-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }

/* ── EVALUACIÓN ── */
.eval-header {
  background: var(--bg2); 
  border-radius: var(--radius); 
  padding: 24px; 
  margin-bottom: 20px;
  border: 1px solid var(--border); 
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.eval-avatar { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: white; flex-shrink: 0; }
.eval-info h2 { font-size: 17px; font-weight: 600; }
.eval-info p { font-size: 12px; color: var(--text3); margin-top: 2px; }
.eval-meta { margin-left: auto; text-align: right; }
.result-card { background: var(--accent); border-radius: var(--radius); padding: 22px; color: white; margin-bottom: 14px; }
.result-pct { font-size: 44px; font-weight: 600; line-height: 1; }
.result-label { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.result-bar { height: 7px; background: rgba(255,255,255,0.2); border-radius: 4px; margin-top: 14px; overflow: hidden; }
.result-fill { height: 100%; background: white; border-radius: 4px; transition: width .5s; }
.comp-card { background: white; border-radius: var(--radius); padding: 18px; margin-bottom: 10px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.comp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.comp-title { font-size: 13px; font-weight: 600; }
.comp-pond { font-size: 12px; color: var(--text3); background: var(--bg2); padding: 2px 8px; border-radius: 20px; }
.attr-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 7px; flex-wrap: wrap; }
.attr-name { flex: 1; font-size: 12px; min-width: 120px; }
.attr-pond { font-size: 11px; color: var(--text3); width: 36px; text-align: right; flex-shrink: 0; }
.rating-stars { display: flex; gap: 3px; }
.star {
  width: 26px; height: 26px; border-radius: 5px; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 11px; font-weight: 600; color: var(--text3); background: white; transition: all .12s;
}
.star:hover, .star.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ── DECISIÓN ── */
.decision-bloqueada {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: var(--bg2); border-radius: var(--radius-sm); color: var(--text3); font-size: 13px;
}
.decision-opciones { display: none; flex-direction: column; gap: 8px; }
.decision-opciones.visible { display: flex; }
.decision-option {
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px;
  padding: 10px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}

/* ── PERFIL ── */
/* ── PERSONA CARD PREMIUM (APS) ── */
.persona-card-premium {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 32px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
  color: white;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(30,111,217,0.2);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.persona-card-premium::before {
  content: "";
  position: absolute;
  top: -50%; right: -20%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.persona-card-premium:hover {
  transform: translateY(-4px);
}
.pc-avatar-wrap {
  position: relative;
  width: 84px; height: 84px;
  flex-shrink: 0;
}
.pc-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.4);
  object-fit: cover;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.pc-info { min-width: 0; }
.pc-welcome { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.8; font-weight: 600; margin-bottom: 6px; }
.pc-name { font-size: 28px; font-weight: 800; line-height: 1.2; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-meta { font-size: 14px; opacity: 0.9; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.pc-dot { opacity: 0.5; }
.pc-stats { display: flex; gap: 32px; white-space: nowrap; }
.pc-stat-item { text-align: center; }
.pc-stat-val { font-size: 24px; font-weight: 800; line-height: 1.1; }
.pc-stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; font-weight: 600; margin-top: 4px; }

/* Responsive Persona Card */
@media (max-width: 768px) {
  .persona-card-premium {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 24px; gap: 16px;
  }
  .pc-avatar-wrap { margin: 0 auto; }
  .pc-stats { justify-content: center; gap: 20px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 16px; margin-top: 8px; }
  .pc-name { font-size: 22px; white-space: normal; }
  .pc-meta { justify-content: center; flex-wrap: wrap; }
}

/* ── TIMELINE ── */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.timeline-body { flex: 1; }
.timeline-title { font-size: 13px; font-weight: 500; }
.timeline-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.timeline-right { text-align: right; flex-shrink: 0; }

/* ── COMUNICACIONES ── */
.notif-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 8px; }
.notif-icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-text { flex: 1; font-size: 13px; }
.notif-date { font-size: 11px; color: var(--text3); white-space: nowrap; }

/* ── 360 / RADAR ── */
.radar-wrap { background: white; border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 14px; }
.radar-legend { display: flex; gap: 16px; margin-top: 12px; justify-content: center; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── DESCRIPTORES ── */
.descriptor-form { background: white; border-radius: var(--radius); padding: 22px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.comp-edit-block { background: var(--bg); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; border: 1px solid var(--border); }
.comp-edit-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; background: white; padding: 8px 12px; border-radius: 6px; }
.edit-input { border: 1.5px solid transparent; border-radius: 6px; padding: 4px 8px; font-size: 13px; font-family: inherit; background: transparent; outline: none; width: 100%; }
.edit-input:focus { border-color: var(--accent); background: white; }
.pond-input { width: 64px; padding: 5px 8px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; font-family: inherit; text-align: center; outline: none; }
.pond-input:focus { border-color: var(--accent); }
.attr-edit-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: white; border-radius: 6px; margin-bottom: 4px; border: 1px solid var(--border); }
.btn-remove { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 18px; padding: 0 4px; line-height: 1; }

/* ── PONDERACIONES ── */
#tbl-pond { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
#tbl-pond th { padding: 9px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); background: var(--bg); }
#tbl-pond td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
#tbl-pond tr:last-child td { border-bottom: none; }
#tbl-pond input[type="number"] { width: 72px; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; text-align: center; outline: none; }
#tbl-pond input[type="number"]:focus { border-color: var(--accent); }
#fila-total td { font-weight: 600; }
#celda-total { font-size: 16px; font-weight: 700; text-align: center; }

/* ── UPLOAD ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 28px; text-align: center; cursor: pointer; transition: all .15s; margin-bottom: 14px;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-light); }

/* === TOUR === */
.tour-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9000;
  pointer-events: none;
}
.tour-highlight-box {
  position: absolute;
  z-index: 8999;
  border: 2px solid var(--accent);
  border-radius: 6px;
  pointer-events: none;
  transition: top .15s, left .15s, width .15s, height .15s;
}
.tour-burbuja {
  position: absolute;
  z-index: 9001;
  background: white;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 16px;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(30,111,217,0.18);
}

/* ── 📱 RESPONSIVE SYSTEM (APS v0.3.1) ── */

/* UTILS - Responsive Flex/Grid */
.flex-resp { display: flex; gap: 16px; }
.grid-resp { display: grid; gap: 16px; }

/* TABLET & SMALL LAPTOPS (≤1024px) */
@media (max-width: 1024px) {
  .sidebar { width: 68px; overflow: visible; }
  .sidebar-logo-sub, .sidebar-username, .sidebar-role, .nav-section, .nav-item span:not(.nav-badge), .sidebar-version { display: none; }
  .sidebar-user { padding: 14px 0; justify-content: center; }
  .nav-item { justify-content: center; padding: 12px 0; border-left: none; }
  .nav-item.active { border-left: none; background: var(--accent); color: white; border-radius: 8px; width: 44px; margin: 4px auto; }
  .main { margin-left: 68px; width: calc(100% - 68px); }
  
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .two-col { grid-template-columns: 1fr; }
}

/* MOBILE (≤768px) */
/* RESP-02: defensivos universales para mobile */
@media (max-width: 768px) {
  /* Evitar scroll horizontal accidental por elementos que sobresalen */
  html, body { overflow-x: hidden; max-width: 100vw; }
  /* Texto largo (emails, URLs, RUTs concatenados) que rompe layouts */
  .name-text, .name-sub, .badge, td, .card, .stat-card, .progress-wrap { word-break: break-word; overflow-wrap: anywhere; }
  /* Imagenes y embeds nunca exceden el contenedor */
  img, video, canvas, iframe, svg { max-width: 100%; height: auto; }
}

/* PROTOTYPE: Bottom navigation bar — mobile only */
#bottom-nav { display: none; }
@media (max-width: 768px) {
  #bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    z-index: 1500;
    padding: 4px 0 max(4px, env(safe-area-inset-bottom));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  #bottom-nav .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    cursor: pointer;
    color: var(--text3);
    text-decoration: none;
    border: none;
    background: none;
    font-size: 10px;
    font-weight: 500;
    min-height: 56px;
    transition: color 0.15s ease;
  }
  #bottom-nav .bn-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
  }
  #bottom-nav .bn-item.active {
    color: var(--accent);
    font-weight: 700;
  }
  #bottom-nav .bn-item.active svg {
    stroke-width: 2.5;
  }
  #bottom-nav .bn-item .bn-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  /* Espacio inferior para que el contenido no quede tapado por la bottom nav */
  .main { padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
  .page-section.active { padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
  /* Quitar el shadow del sidebar en mobile cuando hay bottom nav (es redundante) */
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; width: 280px; height: 100vh;
    z-index: 2000; transform: translateX(-100%);
    box-shadow: 20px 0 60px rgba(0,0,0,0.2);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  /* Restaurar textos del sidebar (el @media 1024 los oculta para iconos) */
  .sidebar-logo-sub, .sidebar-username, .sidebar-role, .sidebar-version { display: block !important; }
  .nav-section { display: block !important; }
  .nav-item { justify-content: flex-start !important; padding: 10px 18px !important; border-left: 3px solid transparent !important; }
  .nav-item.active { background: rgba(30,111,217,0.22) !important; border-radius: 0 !important; width: auto !important; margin: 1px 0 !important; border-left: 3px solid var(--accent) !important; }
  .nav-item span:not(.nav-badge) { display: inline !important; }
  .sidebar-user { padding: 14px 18px !important; justify-content: flex-start !important; }
  /* Footer del sidebar: mostrar boton salir con texto + iconos de la fila superior */
  .sidebar-footer { padding: 14px 18px !important; }
  .btn-logout { justify-content: flex-start !important; gap: 10px !important; padding: 10px 0 !important; font-size: 13px !important; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { 
    display: none; position: fixed; inset: 0; 
    background: rgba(0,0,0,0.5); z-index: 1999; 
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  }
  .sidebar-overlay.active { display: block; }
  
  .main { margin-left: 0 !important; width: 100% !important; max-width: 100% !important; }
  .topbar { display: flex !important; padding: 0 16px; height: 60px; align-items: center; background: var(--glass); border-bottom: 1px solid var(--glass-border); position: sticky; top: 0; z-index: 50; }
  .topbar-hamburger { display: flex !important; align-items: center; justify-content: center; width: 40px; height: 40px; cursor: pointer; color: var(--text1); background: var(--bg2); border-radius: 8px; border: 1px solid var(--border); }
  .topbar-hamburger svg { width: 20px; height: 20px; }
  .topbar-title { display: block !important; font-size: 16px; font-weight: 700; color: var(--text1); line-height: 1.2; }
  .topbar-right { display: flex !important; align-items: center; gap: 6px; margin-left: auto; }
  /* Configuracion: ocultar pestañas horizontales y mostrar dropdown */
  .cfg-tabs-desktop { display: none !important; }
  .cfg-tab-mobile { display: block !important; }

  .page { padding: 16px; }
  .page-title { font-size: 16px; margin-bottom: 20px; }
  
  /* Grids & Layouts */
  .stats-grid, .two-col, .form-row, .checklist-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .flex-resp { flex-direction: column; }
  .grid-resp { grid-template-columns: 1fr !important; }
  
  /* Tables with proper container and scrolling.
     Excepcion: mobile-card-table se renderiza como tarjetas verticales,
     no necesita scroll horizontal ni min-width:600px. */
  .table-responsive, .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    background: var(--bg);
  }
  table { min-width: 600px; }
  table.mobile-card-table { min-width: 0 !important; width: 100% !important; max-width: 100% !important; }
  /* El wrapper de tablas NO debe scrollear horizontalmente cuando contiene
     una mobile-card-table (ya esta en modo tarjeta vertical) */
  .table-wrap { overflow-x: visible !important; }
  
  /* Cabeceras Adaptativas */
  .eval-header, .profile-header, .resp-header { 
    flex-direction: column !important; 
    text-align: center; gap: 16px; 
    padding: 24px 16px; align-items: center !important; 
    border-radius: 20px;
  }
  .eval-meta, .profile-stats, .resp-meta { 
    margin: 0 !important; 
    text-align: center; width: 100%; 
    justify-content: center !important; 
    display: flex; flex-wrap: wrap; 
    gap: 12px; 
  }
  .profile-avatar, .eval-avatar { width: 64px; height: 64px; margin: 0 auto; }
  
  /* Evaluación: Filas de atributos con mayor espacio táctil */
  .attr-row { flex-direction: column; align-items: flex-start; padding: 14px; gap: 12px; }
  .attr-name { width: 100%; font-size: 13px; margin-bottom: 4px; }
  .attr-pond { align-self: flex-end; order: 3; font-size: 10px; opacity: 0.6; }
  .rating-stars { width: 100%; justify-content: space-between; order: 2; margin-top: 4px; }
  .star { width: 44px !important; height: 44px !important; aspect-ratio: 1/1; font-size: 13px; border-radius: 8px; flex-shrink: 0; }
  .rating-stars { gap: 6px !important; justify-content: flex-start !important; flex-wrap: wrap; }
  
  /* Modales Fullscreen con scroll */
  .modal-overlay.open { align-items: flex-end; }
  .modal { 
    margin: 0 !important; 
    max-width: 100vw !important; 
    width: 100% !important; 
    height: auto !important; 
    max-height: 92vh !important; 
    border-radius: 24px 24px 0 0 !important; 
    padding: 24px 20px !important; 
    border-bottom: none !important;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2) !important;
    overflow-y: auto !important;
  }
  .modal-footer { 
    padding: 16px 20px; 
    flex-direction: column-reverse; 
    border-radius: 0; 
    background: var(--bg2);
  }
  .modal-footer .btn-sm { width: 100% !important; height: 50px; }
  
  /* Ajustes UX generales */
  .btn-sm { min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
  .topbar-right { gap: 6px; }
  .topbar-version { display: none; }
  .avatar-topbar { width: 34px; height: 34px; }
  .topbar-name { display: none; } /* Ocultar nombre en topbar en mobile */
  
  .login-card { padding: 32px 24px; width: 92% !important; border-radius: 24px; margin: 20px auto; }
  .roles-grid { grid-template-columns: 1fr; gap: 8px; }

  /* Responsive Items (Inducción/Config) */
  .resp-item { flex-direction: column; align-items: flex-start !important; gap: 8px !important; }
  .resp-item .btn-remove { align-self: flex-end; order: -1; }
  .resp-item-actions { width: 100%; justify-content: flex-end; margin-top: 8px; }
}

/* SMALL MOBILE (≤480px) */
@media (max-width: 480px) {
  .topbar-title { font-size: 14px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .profile-stats { gap: 12px; }
  .profile-stat-val { font-size: 18px; }
  .ai-chat-window { bottom: 0; right: 0; width: 100vw; height: 100vh; border-radius: 0; z-index: 3000; }
  .ai-fab { bottom: 16px; right: 16px; width: 52px; height: 52px; }
  
  .table-wrap table { min-width: 600px; }
  .table-wrap table.mobile-card-table { min-width: 0 !important; width: 100% !important; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }
}

/* ── ASISTENTE IA (EVA) ── */
.ai-fab { display: none; }
.ai-fab:hover { display: none; }
.ai-fab svg { display: none; }

.ai-chat-window {
  position: fixed; bottom: 90px; right: 24px;
  width: 480px; height: 500px; max-height: calc(100vh - 120px);
  background: white; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  display: none; flex-direction: column; overflow: hidden;
  z-index: 1000; border: 1px solid var(--border);
  animation: ai-slide-in .3s ease-out;
}
@keyframes ai-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-chat-window.open { display: flex; }

.ai-chat-header {
  padding: 18px 24px; background: var(--sidebar); color: white;
  display: flex; align-items: center; justify-content: space-between;
}
.ai-chat-title { display: flex; align-items: center; gap: 10px; }
.ai-chat-title span { font-size: 15px; font-weight: 600; }
.ai-chat-close { cursor: pointer; opacity: 0.7; transition: opacity .2s; }
.ai-chat-close:hover { opacity: 1; }

.ai-messages {
  flex: 1; padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  background: #f8fafc;
}
.ai-msg { max-width: 92%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.ai-msg.user {
  align-self: flex-end; background: var(--accent); color: white;
  border-bottom-right-radius: 2px;
}
.ai-msg.bot {
  align-self: flex-start; background: white; color: var(--text);
  border-bottom-left-radius: 2px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}

.ai-typing {
  align-self: flex-start; padding: 12px 16px; background: white;
  border-radius: 14px; display: none; gap: 4px; border: 1px solid var(--border);
}
.ai-typing span { width: 6px; height: 6px; background: var(--text3); border-radius: 50%; animation: ai-blink 1.4s infinite; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-blink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.ai-chat-input-wrap { padding: 16px; background: white; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.ai-chat-input {
  flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .2s;
}
.ai-chat-input:focus { border-color: var(--accent); }
.ai-chat-send {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--accent); color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ai-chat-send:hover { background: var(--accent2); }

@media (max-width: 500px) {
  .ai-chat-window { bottom: 0; right: 0; width: 100%; height: 100%; border-radius: 0; }
  .ai-fab { bottom: 16px; right: 16px; }
}

/* Eliminado bloque redundante de media query */

/* === TOUR === */
.tour-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9000;
  pointer-events: none;
}
.tour-highlight-box {
  position: absolute;
  z-index: 8999;
  border: 2px solid var(--accent);
  border-radius: 6px;
  pointer-events: none;
  transition: top .15s, left .15s, width .15s, height .15s;
}
.tour-burbuja {
  position: absolute;
  z-index: 9001;
  background: white;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 16px;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(30,111,217,0.18);
}

/* ── UI COMPONENTS ── */
.premium-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 10px;
}
.premium-switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
}
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border);
  transition: .3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(18px); }

.checklist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-item { 
  display: flex; align-items: flex-start; gap: 12px; padding: 16px; 
  background: var(--bg2); border: 1.5px solid var(--border); 
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden;
}
.check-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.check-item.cumplido { border-color: var(--success); background: var(--success-bg); }
.check-item input { margin-top: 3px; transform: scale(1.15); cursor: pointer; }
.check-item-content { flex: 1; }
.check-item-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.check-item-desc { font-size: 11.5px; color: var(--text3); line-height: 1.4; }

.btn-pill { padding: 6px 14px; font-size: 11px; font-weight: 600; background: var(--bg2); color: var(--text2); border: 1px solid var(--border); border-radius: 20px; cursor: pointer; transition: all 0.15s; }
.btn-pill.active { background: var(--accent); color: white; border-color: var(--accent); }

/* --- AUDIT IMPROVEMENTS (v0.2.3) --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes enterUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.page-section.active { animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.login-card { animation: enterUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.stat-card { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); cursor: default; }
.stat-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-lg); border-color: var(--accent-light); }
.nav-item:active { transform: scale(0.98); }

/* ── ROL: ocultar edicion para usuarios normales ── */
body.rol-usuario .btn-rrhh-only,
body.rol-usuario .rrhh-only,
body.rol-usuario [onclick*="openDescriptorEditor"],
body.rol-usuario [onclick*="editarColabCompleto"],
body.rol-usuario [onclick*="eliminarFormulario"],
body.rol-usuario [onclick*="agregarSeccion"],
body.rol-usuario [onclick*="abrirEditorFormulario"],
body.rol-usuario [onclick*="_cambiarRol"],
body.rol-usuario [onclick*="_resetPassword"],
body.rol-usuario [onclick*="_subirFotoUsuario"],
body.rol-usuario [onclick*="crearNuevaEvaluacion"],
body.rol-usuario [onclick*="eliminarEvaluacion"] {
  display: none !important;
}

/* ── PRINT STYLES ── */
@page { size: A4 portrait; margin: 14mm; }
@media print {
  .sidebar, .topbar, .no-print, .btn-sm, .ai-fab, .sidebar-overlay, .nav-item,
  .action-btn, button, .topbar-hamburger, #sidebar-equipo, .nav-badge,
  #informe-config-formulario .editable, .modal-overlay, #bottom-nav {
    display: none !important;
  }
  /* Eliminar scrollbars y forzar contenido visible */
  * { scrollbar-width: none !important; }
  *::-webkit-scrollbar { display: none !important; }
  html, body, .main, .page, .page-section, .layout, #app {
    display: block !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    background: white !important;
    color: black !important;
    position: static !important;
    float: none !important;
  }
  .main { margin-left: 0 !important; }
  .page { padding: 16px !important; }
  .print-only { display: block !important; }
  .table-wrap, .comp-card, #informe-wrap > div {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
  /* Bloques del informe: permitir partir si son largos */
  #informe-wrap > div { page-break-inside: auto; }
  /* Bloques pequeños que NO deben partirse */
  .stat-card { page-break-inside: avoid; }
  .informe-firmas { page-break-inside: avoid; }
  .informe-retro-wrap { page-break-inside: avoid; }
  /* Headings quedan con su contenido */
  h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
  /* Canvas */
  canvas { max-width: 100% !important; }
  .page-section { display: none !important; }
  .page-section.active { display: block !important; overflow: visible !important; padding-bottom: 0 !important; }
}
.print-only { display: none; }

@keyframes aiPulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.ai-help-text { white-space: nowrap; }


/* Responsividad para nuevos componentes */
@media (max-width: 768px) {
  /* Perfil cabecera: vertical */
  #page-perfil > div:first-of-type { flex-direction: column !important; text-align: center; }
  #pd-stats { flex-wrap: wrap !important; justify-content: center !important; }
  /* Perfil grid 3 cols → 1 col */
  #page-perfil > div:nth-of-type(2) { grid-template-columns: 1fr !important; }
  /* Dashboard usuario: grids a 1 col */
  .dash-grid-2 { grid-template-columns: 1fr !important; }
  .dash-grid-equipo { grid-template-columns: 1fr !important; }
  .dash-grid-equipo [style*="position:sticky"] { position: static !important; }
  /* Eval detalle */
  #eval-detalle-sticky > div { flex-direction: column !important; gap: 8px !important; }
  #result-nivel-info { font-size: 11px !important; }
  #result-badge { min-width: auto !important; }
  /* Arboles */
  .atree-wrap { padding: 12px !important; }
  .atree-card { min-width: 140px !important; max-width: 100% !important; }
  .dtree-panel { width: 100vw !important; }
  .eval-header { flex-wrap: wrap !important; }
  /* Stats grid dashboard RRHH */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  /* Componentes complementarios eval */
  .comp-card [style*="flex-wrap"] { flex-direction: column !important; }
  /* Tabla evaluaciones */
  .table-wrap { overflow-x: auto; }
  table { min-width: 600px; }
  table.mobile-card-table { min-width: 0 !important; width: 100% !important; }
}
@media (max-width: 480px) {
  /* Todo a 1 columna */
  .stats-grid { grid-template-columns: 1fr !important; }
  #pd-stats { flex-direction: column !important; }
  .atree-row { flex-direction: column !important; }
  .atree-branch { flex-direction: column !important; }
  .atree-connector { display: none !important; }
  #eval-detalle-sticky { top: 56px !important; }
  /* Persona card */
  .persona-card-premium { padding: 16px !important; gap: 12px !important; }
  .pc-name { font-size: 18px !important; }
  .pc-stats { gap: 12px !important; }
  /* Topbar compacto */
  .topbar-right { gap: 4px !important; }
  #topbar-name { display: none; }
}
.badge-custom { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }

/* Stat card alerta: borde rojo + fondo suave cuando hay un problema critico */
.stat-card.stat-card-alert {
  border: 1.5px solid var(--danger, #ef4444) !important;
  background: rgba(239, 68, 68, 0.04) !important;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.12) !important;
}
.stat-card.stat-card-alert .stat-label {
  color: var(--danger, #ef4444) !important;
}

/* Banner de filtro activo (Induccion) */
.ind-filter-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text1);
  flex-wrap: wrap;
}
.ind-filter-banner-text { flex: 1; min-width: 0; }
.ind-filter-banner-clear {
  background: white;
  color: var(--danger, #ef4444);
  border: 1.5px solid var(--danger, #ef4444);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ind-filter-banner-clear:hover {
  background: var(--danger, #ef4444);
  color: white;
}

/* ============================================================
   Lote-header (acordeon "Por jefatura / Por antiguedad / ...")
   Clase-based para control total sin interferencia de reglas
   mobile-card-table. Aplica en todos los tamanos.
   ============================================================ */
table tr.lote-header {
  background: var(--bg2);
  cursor: pointer;
}
table tr.lote-header > td {
  padding: 10px 14px !important;
  border: none !important;
  margin: 0 !important;
  display: table-cell !important;
  vertical-align: top !important;
}
.lote-head-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.lote-head-chev {
  flex: 0 0 auto;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.4;
}
.lote-head-icon {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1.2;
}
.lote-head-body {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.lote-head-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text1);
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.lote-head-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

/* Override las reglas mobile-card-table para el lote-header: debe
   funcionar como un bloque simple, no como tarjeta con split first/last */
@media (max-width: 768px) {
  table.mobile-card-table tbody tr.lote-header {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 0 6px 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: var(--bg2) !important;
    border-radius: 0 !important;
  }
  table.mobile-card-table tbody tr.lote-header > td,
  table.mobile-card-table tbody tr.lote-header > td:first-child,
  table.mobile-card-table tbody tr.lote-header > td:last-child {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    border: none !important;
    flex: none !important;
  }
}

/* Evaluaciones por area: acordeon responsive */
.area-acord {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: visible;
  max-width: 100%;
}
.area-acord-head {
  padding: 10px 14px;
  background: var(--bg2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.area-acord-title {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.area-acord-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.area-acord-resp {
  font-size: 11px;
  color: var(--text3);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.area-acord-chevron { color: var(--text3); flex-shrink: 0; }
@media (max-width: 768px) {
  .area-acord-head {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .area-acord-title {
    flex: 1 1 100%;
    white-space: normal;
  }
  .area-acord-badges {
    flex: 1 1 auto;
    order: 2;
  }
  .area-acord-resp {
    display: none;
  }
  .area-acord-chevron { order: 3; }
}

/* Informe: bloque perfil de competencias */
.informe-perfil-grid {
  display: grid;
  grid-template-columns: minmax(0,440px) minmax(0,1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .informe-perfil-grid { grid-template-columns: 1fr; }
}

/* Informe: pie de firmas responsivo */
.informe-firmas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 30px;
}
@media (max-width: 768px) {
  .informe-firmas-grid { grid-template-columns: 1fr; gap: 24px; }
}
.firma-linea {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text3);
}
.firma-linea .firma-slot {
  flex: 1;
  border-bottom: 1px dotted var(--text3);
  height: 14px;
  min-width: 0;
}

/* Perfil de colaborador: grid responsivo */
.perfil-grid {
  display: grid;
  grid-template-columns: 240px minmax(0,1fr) minmax(0,1fr);
  gap: 16px;
}
@media (max-width: 1024px) {
  .perfil-grid { grid-template-columns: 1fr 1fr; }
}
/* Configuracion: adaptacion mobile integral */
@media (max-width: 768px) {
  /* Menos padding en los wrappers de paneles de config */
  #page-config .table-wrap,
  #page-config [class="table-wrap"],
  #page-config .table-wrap[style*="padding:24px"],
  #page-config .table-wrap[style*="padding: 24px"] {
    padding: 14px !important;
  }

  /* Grids de formulario en paneles de config: 1 columna en mobile */
  #page-config [style*="grid-template-columns:1fr 1fr"],
  #page-config [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Panel Historial Actividad: el header con filtros se apila vertical */
  #cfg-panel-actividad > div:first-child {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px;
  }
  #cfg-panel-actividad > div:first-child > div:last-child {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100%;
  }
  #cfg-panel-actividad > div:first-child input,
  #cfg-panel-actividad > div:first-child select {
    width: 100% !important;
    min-width: 0 !important;
  }
  #cfg-panel-actividad > div:first-child button { width: 100% !important; }

  /* Movilizacion masiva: fecha + boton apilados */
  #cfg-panel-induccion [style*="display:flex; gap:16px; align-items:flex-end"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  #cfg-panel-induccion [style*="display:flex; gap:16px; align-items:flex-end"] > * {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Paneles de config: section-headers con flex → apilados */
  #cfg-panel-induccion > .table-wrap > div[style*="display:flex"][style*="justify-content:space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px;
  }
  #cfg-panel-induccion > .table-wrap > div[style*="display:flex"][style*="justify-content:space-between"] button {
    width: 100% !important;
  }

  /* Aula virtual: stats internos a 1 col si hace falta */
  #aula-virtual-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* Titulo de Configuracion: mas compacto */
  #page-config > .page-title {
    font-size: 18px !important;
    margin-bottom: 12px;
  }
}

/* Reducir tamaño de iconos decorativos y titulos grandes en mobile */
@media (max-width: 768px) {
  /* Section header de Induccion: reducir badge icono + titulo */
  #page-induccion .section-header > div > div[style*="width:32px"],
  #page-induccion .section-header > div > div[style*="width: 32px"] {
    width: 24px !important;
    height: 24px !important;
    border-radius: 6px !important;
  }
  #page-induccion .section-header .page-title { font-size: 18px !important; }
  #page-induccion .section-header i[data-lucide] { width: 14px !important; height: 14px !important; }

  /* Titulos grandes de pagina: reducir en mobile */
  .page-title { font-size: 18px !important; }

  /* Cualquier badge de icono circular/cuadrado decorativo: max 24x24 */
  [style*="width:40px; height:40px"],
  [style*="width: 40px; height: 40px"],
  [style*="width:36px; height:36px"],
  [style*="width: 36px; height: 36px"],
  [style*="width:32px;height:32px"],
  [style*="width: 32px; height: 32px"] {
    max-width: 28px !important;
    max-height: 28px !important;
  }
}

@media (max-width: 768px) {
  .perfil-grid { grid-template-columns: 1fr; }
  /* Defensivos contra overflow horizontal dentro del perfil */
  #page-perfil { overflow-x: hidden; max-width: 100%; }
  #page-perfil, #page-perfil * { min-width: 0; }
  #page-perfil a,
  #page-perfil #pd-info,
  #page-perfil #pd-info * { word-break: break-word; overflow-wrap: anywhere; }
  #page-perfil .btn-sm {
    max-width: 100%;
    white-space: normal;
  }

  /* Colaboradores: ocultar boton +Nuevo en mobile (agregar via +Modal en desktop) */
  #page-colaboradores .section-header .btn-rrhh-only { display: none; }

  /* Stat cards compactos en mobile: menos padding, fonts mas chicos,
     grid de 2 columnas para que entren mas en pantalla */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .stat-card {
    padding: 12px 14px !important;
    min-height: 0;
  }
  .stat-card .stat-label {
    font-size: 9px !important;
    margin-bottom: 4px;
  }
  .stat-card .stat-value {
    font-size: 22px !important;
    line-height: 1.1;
  }
  .stat-card .stat-trend,
  .stat-card .stat-delta {
    font-size: 10px !important;
    margin-top: 2px;
  }
  .stat-card .stat-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
  }
  .stat-card .stat-icon svg {
    width: 14px !important;
    height: 14px !important;
  }
}

/* ============================================================
   Splash screen animado post-login
   ============================================================ */
#splash-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: splash-fade-in 0.35s ease-out forwards;
}
#splash-screen.fade-out {
  animation: splash-fade-out 0.45s ease-in forwards;
}
@keyframes splash-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes splash-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  text-align: center;
  padding: 40px;
  transform: translateY(12px);
  animation: splash-rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}
@keyframes splash-rise {
  to { transform: translateY(0); }
}

.splash-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: splash-logo-pulse 2s ease-in-out infinite;
}
.splash-logo svg { width: 36px; height: 36px; color: white; max-width: none !important; }
@keyframes splash-logo-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
  50%      { transform: scale(1.05); box-shadow: 0 14px 50px rgba(0,0,0,0.25); }
}

.splash-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.splash-sub {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 32px;
  letter-spacing: 0.3px;
}

.splash-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.splash-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  opacity: 0.4;
  animation: splash-dot 1.2s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: 0.15s; }
.splash-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes splash-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%      { opacity: 1;   transform: scale(1.1); }
}

.splash-status {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 18px;
  min-height: 16px;
  letter-spacing: 0.3px;
  font-weight: 500;
  transition: opacity 0.25s ease;
}
.splash-status.fade { opacity: 0; }

.splash-version {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  opacity: 0.65;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  letter-spacing: 0.5px;
}

/* ============================================================
   Topbar right: version chip, theme toggle, user dropdown
   ============================================================ */
.topbar-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  color: var(--text2);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.topbar-icon-btn:hover {
  background: var(--bg3, rgba(0,0,0,0.04));
  color: var(--text1);
}
.topbar-icon-btn:active { transform: scale(0.95); }

.topbar-user {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.topbar-user:hover { background: var(--bg3, rgba(0,0,0,0.04)); }

.topbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.topbar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text1);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  padding: 6px;
  z-index: 1000;
  backdrop-filter: blur(12px);
}
.topbar-user-menu .tum-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text1);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.topbar-user-menu .tum-item:hover { background: var(--bg2); }
.topbar-user-menu .tum-item svg { flex-shrink: 0; color: var(--text3); }
.topbar-user-menu .tum-danger { color: var(--danger, #ef4444); }
.topbar-user-menu .tum-danger svg { color: var(--danger, #ef4444); }
.topbar-user-menu .tum-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 2px;
}

/* Blindar los SVGs del menu contra la regla universal mobile
   (img, video, canvas, iframe, svg { max-width: 100%; height: auto; }) */
.topbar-user-menu svg,
.topbar-icon-btn svg,
.topbar-user > svg {
  max-width: none !important;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.topbar-icon-btn svg { width: 18px; height: 18px; }

/* Compactar en mobile: ocultar chip version y nombre (avatar permanece) */
@media (max-width: 768px) {
  #topbar-version { display: none; }
  .topbar-user-name { display: none; }
  .topbar-user > svg { display: none; } /* solo el chevron directo, no los svgs del dropdown */
  .topbar-user { padding: 3px; }
  .topbar-icon-btn { width: 32px; height: 32px; }
}

/* ============================================================
   mobile-card-table — convierte filas de una tabla marcada con
   la clase .mobile-card-table en tarjetas verticales SOLO en
   viewports <=768px. No afecta tablas sin la clase.
   ============================================================ */
@media (max-width: 768px) {
  table.mobile-card-table { display: block; width: 100%; }
  table.mobile-card-table thead { display: none; }
  table.mobile-card-table tbody { display: block; width: 100%; }

  table.mobile-card-table tbody tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.03);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  }
  /* Header de lote (Por jefatura, etc) — color mas fuerte para marcar
     donde empieza la seccion */
  table.mobile-card-table tbody tr.lote-header {
    background: rgba(99, 102, 241, 0.13) !important;
    border: 1px solid rgba(99, 102, 241, 0.22) !important;
    border-radius: 10px !important;
    margin: 10px 0 4px 0 !important;
  }
  /* Filas hijas de un lote (las evaluaciones individuales dentro de
     "Por jefatura: X") — mismo color pero mas suave para marcar que
     pertenecen a la seccion */
  table.mobile-card-table tbody tr[class*="lote-row-"] {
    background: rgba(99, 102, 241, 0.05) !important;
    border: 1px solid rgba(99, 102, 241, 0.12) !important;
    margin-left: 12px;
    margin-right: 0;
    margin-bottom: 6px;
    position: relative;
  }
  /* Indicador visual de pertenencia: linea vertical a la izquierda */
  table.mobile-card-table tbody tr[class*="lote-row-"]::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(99, 102, 241, 0.25);
    border-radius: 1px;
  }

  table.mobile-card-table tbody tr td {
    display: block;
    width: 100%;
    border: none;
    padding: 4px 0;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  /* Reducir info: solo primera columna (nombre con avatar/cargo/area) y
     ultima (acciones). Las del medio se ocultan para una vista limpia. */
  table.mobile-card-table tbody tr td:not(:first-child):not(:last-child) {
    display: none;
  }

  /* Primera celda (nombre + avatar) destacada */
  table.mobile-card-table tbody tr td:first-child {
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }

  /* Fila de acciones: recupera flex horizontal */
  table.mobile-card-table tbody tr td[style*="display:flex"],
  table.mobile-card-table tbody tr td:last-child {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px solid var(--border);
  }

  /* La caja del area accordion que envuelve el acordeon: permitir que
     el contenido defina la altura pero sin cortar el ancho */
  .area-acord { overflow: visible !important; border-radius: 10px; }

  /* Defensa universal en mobile: ninguna page-section debe causar scroll
     horizontal. Si algo se desborda, lo ocultamos en el container padre. */
  .page-section { overflow-x: hidden; max-width: 100%; }
  html, body { overflow-x: hidden !important; max-width: 100vw !important; }
  .main, .page { overflow-x: hidden !important; max-width: 100vw !important; }

  /* Descriptor de cargo: tablas label/valor (Identificacion, Requisitos, etc) */
  table.desc-seccion-table {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
  }
  table.desc-seccion-table td {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }
  table.desc-seccion-table td:first-child {
    width: 40% !important;
  }

  /* page-descriptor-edit: defensivo */
  #page-descriptor-edit { overflow-x: hidden; max-width: 100%; }
  #page-descriptor-edit, #page-descriptor-edit * { min-width: 0; }
  #page-descriptor-edit .comp-edit-block {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Descriptores de cargo: arbol horizontal → vertical en mobile */
  .atree-wrap {
    overflow-x: visible !important;
    padding: 16px !important;
  }
  .atree-row { flex-direction: column !important; align-items: stretch !important; }
  .atree-branch { flex-direction: column !important; }
  .atree-connector { display: none !important; }
  .atree-line-h { display: none !important; }
  .atree-children { margin-left: 14px; padding-left: 10px; border-left: 2px solid var(--border); }
  .atree-children::before { display: none !important; }
  .atree-child-wrap { padding-left: 0 !important; }
  .atree-child-wrap::before { display: none !important; }
  .atree-card {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    margin-bottom: 6px;
  }

  /* Fila "sin resultados" (colspan full) */
  table.mobile-card-table tbody tr td[colspan] {
    text-align: center;
    border: none;
    padding: 16px 0;
    margin: 0;
  }

  /* DASH-EVAL-TABLE-MOBILE-01: mostrar barra de resultado duplicada
     dentro de la última celda (badge+progreso) ya que la celda
     intermedia se oculta en mobile */
  .mobile-only-result { display: block !important; }
  /* Evitar que nombres largos rompan el layout en tarjetas */
  table.mobile-card-table .name-text { word-break: normal; overflow-wrap: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
  table.mobile-card-table .name-sub { word-break: normal; overflow-wrap: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
}
