/* =========================================================================
   TalentFlow — Design tokens
   Paleta: navy profundo + azul estratégico + escala semántica de crecimiento
   Tipografía: Space Grotesk (display) / Inter (cuerpo) / IBM Plex Mono (datos)
   ========================================================================= */
.tfnb-scope, #tfnb-app {
	--tfnb-ink: #12162B;
	--tfnb-base: #F2F4F9;
	--tfnb-surface: #FFFFFF;
	--tfnb-surface-2: #F8F9FD;
	--tfnb-border: #E3E6F0;
	--tfnb-text: #1B2036;
	--tfnb-text-muted: #666C87;
	--tfnb-primary: #3454D1;
	--tfnb-primary-dark: #24399E;
	--tfnb-primary-tint: #EAEEFC;
	--tfnb-green: #1FAE7A;
	--tfnb-green-tint: #E4F7EF;
	--tfnb-amber: #E29A2E;
	--tfnb-amber-tint: #FCF1DF;
	--tfnb-coral: #D6455A;
	--tfnb-coral-tint: #FBE7EA;
	--tfnb-violet: #7B61D1;
	--tfnb-violet-tint: #EFEBFB;
	--tfnb-radius-sm: 8px;
	--tfnb-radius: 14px;
	--tfnb-radius-lg: 20px;
	--tfnb-shadow: 0 1px 2px rgba(18,22,43,.04), 0 8px 24px -12px rgba(18,22,43,.12);
	--tfnb-shadow-hover: 0 4px 10px rgba(18,22,43,.06), 0 16px 32px -14px rgba(18,22,43,.18);
	--font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
	--font-body: 'Inter', 'Segoe UI', sans-serif;
	--font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

.tfnb-scope, .tfnb-scope * , #tfnb-app, #tfnb-app * { box-sizing: border-box; }

.tfnb-scope { font-family: var(--font-body); color: var(--tfnb-text); }

/* Reset ligero del wrap de wp-admin para nuestras páginas */
#tfnb-app { background: var(--tfnb-base); margin: 0 -20px; padding: 28px clamp(16px, 3vw, 40px) 60px; font-family: var(--font-body); color: var(--tfnb-text); }
#tfnb-app h1, #tfnb-app h2, #tfnb-app h3 { font-family: var(--font-display); color: var(--tfnb-ink); letter-spacing: -0.01em; margin: 0; }
#tfnb-app a { text-decoration: none; }

/* ---------- Header de página ---------- */
.tfnb-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.tfnb-header__eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--tfnb-primary); margin: 0 0 6px; }
.tfnb-header h1 { font-size: 28px; font-weight: 700; }
.tfnb-header p.tfnb-sub { color: var(--tfnb-text-muted); margin: 6px 0 0; max-width: 62ch; font-size: 14px; }
.tfnb-header__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.tfnb-btn { font-family: var(--font-body); font-weight: 600; font-size: 13.5px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: transform .12s ease, box-shadow .12s ease, background .15s ease; line-height: 1.2; }
.tfnb-btn:active { transform: translateY(1px); }
.tfnb-btn--primary { background: var(--tfnb-primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(52,84,209,.55); }
.tfnb-btn--primary:hover { background: var(--tfnb-primary-dark); }
.tfnb-btn--ghost { background: var(--tfnb-surface); color: var(--tfnb-text); border-color: var(--tfnb-border); }
.tfnb-btn--ghost:hover { border-color: var(--tfnb-primary); color: var(--tfnb-primary); }
.tfnb-btn--danger { background: var(--tfnb-coral-tint); color: var(--tfnb-coral); }
.tfnb-btn--sm { padding: 6px 12px; font-size: 12.5px; }
.tfnb-btn--icon { padding: 8px; border-radius: 10px; }

/* ---------- KPI cards ---------- */
.tfnb-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.tfnb-kpi { background: var(--tfnb-surface); border: 1px solid var(--tfnb-border); border-radius: var(--tfnb-radius); padding: 18px 20px; box-shadow: var(--tfnb-shadow); position: relative; overflow: hidden; }
.tfnb-kpi::after { content:''; position:absolute; right:-30px; top:-30px; width:90px; height:90px; border-radius:50%; background: var(--tfnb-kpi-color, var(--tfnb-primary-tint)); opacity:.5; }
.tfnb-kpi__label { font-size: 12.5px; color: var(--tfnb-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tfnb-kpi__value { font-family: var(--font-mono); font-size: 30px; font-weight: 600; color: var(--tfnb-ink); margin-top: 6px; position: relative; z-index: 1; }
.tfnb-kpi__hint { font-size: 12px; color: var(--tfnb-text-muted); margin-top: 4px; position: relative; z-index: 1; }
.tfnb-kpi--green { --tfnb-kpi-color: var(--tfnb-green-tint); }
.tfnb-kpi--amber { --tfnb-kpi-color: var(--tfnb-amber-tint); }
.tfnb-kpi--coral { --tfnb-kpi-color: var(--tfnb-coral-tint); }

/* ---------- Layout de dos columnas ---------- */
.tfnb-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.tfnb-stack { display: flex; flex-direction: column; gap: 20px; }

/* ---------- Card genérica ---------- */
.tfnb-card { background: var(--tfnb-surface); border: 1px solid var(--tfnb-border); border-radius: var(--tfnb-radius); box-shadow: var(--tfnb-shadow); padding: 20px; }
.tfnb-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tfnb-card__head h3 { font-size: 16px; font-weight: 600; }

/* ---------- Matriz Nine Box (elemento distintivo) ---------- */
.tfnb-matrix-wrap { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.tfnb-matrix-yaxis { display: flex; flex-direction: column-reverse; justify-content: space-around; align-items: center; writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-mono); font-size: 11px; color: var(--tfnb-text-muted); text-transform: uppercase; letter-spacing: .06em; }
.tfnb-matrix { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, minmax(150px, auto)); gap: 10px; }
.tfnb-matrix-xaxis { grid-column: 2; display: flex; justify-content: space-around; font-family: var(--font-mono); font-size: 11px; color: var(--tfnb-text-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }

.tfnb-cell { border-radius: var(--tfnb-radius); padding: 12px; position: relative; border: 1px solid rgba(18,22,43,.05); display: flex; flex-direction: column; gap: 8px; min-height: 150px; background: var(--tfnb-cell-bg); }
.tfnb-cell__label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--tfnb-cell-fg); }
.tfnb-cell__chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Wash diagonal: coral (bajo/bajo) -> ambar -> verde (alto/alto) */
.tfnb-cell[data-q="p1_q1"] { --tfnb-cell-bg: #FBE7EA; --tfnb-cell-fg: #B23349; }
.tfnb-cell[data-q="p2_q1"] { --tfnb-cell-bg: #FCEEDC; --tfnb-cell-fg: #B0721E; }
.tfnb-cell[data-q="p3_q1"] { --tfnb-cell-bg: #EAEEFC; --tfnb-cell-fg: #24399E; }
.tfnb-cell[data-q="p1_q2"] { --tfnb-cell-bg: #FCF1DF; --tfnb-cell-fg: #B0721E; }
.tfnb-cell[data-q="p2_q2"] { --tfnb-cell-bg: #E7F1FB; --tfnb-cell-fg: #2C6FA8; }
.tfnb-cell[data-q="p3_q2"] { --tfnb-cell-bg: #E4F7EF; --tfnb-cell-fg: #157A56; }
.tfnb-cell[data-q="p1_q3"] { --tfnb-cell-bg: #F3EAFB; --tfnb-cell-fg: #6842A8; }
.tfnb-cell[data-q="p2_q3"] { --tfnb-cell-bg: #EFEBFB; --tfnb-cell-fg: #5C3FB0; }
.tfnb-cell[data-q="p3_q3"] { --tfnb-cell-bg: #DFF5EC; --tfnb-cell-fg: #0F8A5F; box-shadow: inset 0 0 0 1.5px rgba(31,174,122,.35); }

.tfnb-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.85); border-radius: 999px; padding: 4px 10px 4px 4px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid rgba(18,22,43,.06); transition: box-shadow .15s ease, transform .15s ease; }
.tfnb-chip:hover { box-shadow: var(--tfnb-shadow-hover); transform: translateY(-1px); }
.tfnb-chip__avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--tfnb-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; overflow: hidden; }
.tfnb-chip__avatar img { width: 100%; height: 100%; object-fit: cover; }
.tfnb-chip--risk { box-shadow: 0 0 0 2px var(--tfnb-coral) inset; }

/* ---------- Badges de estado ---------- */
.tfnb-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: capitalize; }
.tfnb-badge--en_curso { background: var(--tfnb-primary-tint); color: var(--tfnb-primary-dark); }
.tfnb-badge--completado { background: var(--tfnb-green-tint); color: var(--tfnb-green); }
.tfnb-badge--atrasado { background: var(--tfnb-coral-tint); color: var(--tfnb-coral); }
.tfnb-badge--draft { background: #EEF0F5; color: var(--tfnb-text-muted); }
.tfnb-badge--alto { background: var(--tfnb-coral-tint); color: var(--tfnb-coral); }
.tfnb-badge--medio { background: var(--tfnb-amber-tint); color: var(--tfnb-amber); }
.tfnb-badge--bajo { background: var(--tfnb-green-tint); color: var(--tfnb-green); }

/* ---------- Tablas ---------- */
.tfnb-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tfnb-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--tfnb-text-muted); padding: 10px 12px; border-bottom: 1px solid var(--tfnb-border); }
.tfnb-table td { padding: 12px; border-bottom: 1px solid var(--tfnb-border); vertical-align: middle; }
.tfnb-table tr:last-child td { border-bottom: none; }
.tfnb-table tr:hover td { background: var(--tfnb-surface-2); }
.tfnb-table-wrap { overflow-x: auto; }

.tfnb-person { display: flex; align-items: center; gap: 10px; }
.tfnb-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--tfnb-primary-tint); color: var(--tfnb-primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; overflow: hidden; flex-shrink: 0; }
.tfnb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tfnb-person__name { font-weight: 600; color: var(--tfnb-ink); }
.tfnb-person__role { font-size: 12px; color: var(--tfnb-text-muted); }

/* ---------- Progreso ---------- */
.tfnb-progress { height: 8px; border-radius: 999px; background: var(--tfnb-surface-2); overflow: hidden; margin: 10px 0; }
.tfnb-progress__bar { height: 100%; background: linear-gradient(90deg, var(--tfnb-primary), var(--tfnb-green)); border-radius: 999px; transition: width .4s ease; }

/* ---------- PDI ---------- */
.tfnb-pdi-list { display: flex; flex-direction: column; gap: 14px; }
.tfnb-pdi-card { border: 1px solid var(--tfnb-border); border-radius: var(--tfnb-radius); padding: 16px 18px; background: var(--tfnb-surface); }
.tfnb-pdi-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.tfnb-pdi-card__meta { font-size: 12px; color: var(--tfnb-text-muted); margin-top: 2px; }
.tfnb-items { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tfnb-item { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--tfnb-surface-2); }
.tfnb-item--completado { opacity: .65; text-decoration: line-through; }
.tfnb-item--atrasado { box-shadow: inset 0 0 0 1px var(--tfnb-coral); }
.tfnb-item__check { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--tfnb-border); flex-shrink: 0; margin-top: 1px; cursor: pointer; }
.tfnb-item--completado .tfnb-item__check { background: var(--tfnb-green); border-color: var(--tfnb-green); }
.tfnb-item__due { font-size: 11px; color: var(--tfnb-text-muted); font-family: var(--font-mono); }

/* ---------- Formularios / modales ---------- */
.tfnb-modal-backdrop { position: fixed; inset: 0; background: rgba(18,22,43,.45); backdrop-filter: blur(2px); z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.tfnb-modal { background: var(--tfnb-surface); border-radius: var(--tfnb-radius-lg); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 26px; box-shadow: 0 30px 60px -20px rgba(18,22,43,.4); }
.tfnb-modal__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.tfnb-modal__head h3 { font-size: 18px; }
.tfnb-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--tfnb-text-muted); line-height: 1; }

.tfnb-field { margin-bottom: 14px; }
.tfnb-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--tfnb-text); margin-bottom: 6px; }
.tfnb-field input[type=text], .tfnb-field input[type=email], .tfnb-field input[type=date], .tfnb-field input[type=url], .tfnb-field select, .tfnb-field textarea {
	width: 100%; padding: 10px 12px; border: 1px solid var(--tfnb-border); border-radius: var(--tfnb-radius-sm); font-family: var(--font-body); font-size: 13.5px; background: var(--tfnb-surface-2);
}
.tfnb-field textarea { min-height: 90px; resize: vertical; }
.tfnb-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tfnb-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* Selector visual de desempeño/potencial (1-3) */
.tfnb-scale { display: flex; gap: 8px; }
.tfnb-scale__opt { flex: 1; text-align: center; padding: 10px 6px; border-radius: var(--tfnb-radius-sm); border: 1px solid var(--tfnb-border); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--tfnb-text-muted); }
.tfnb-scale__opt.is-active { background: var(--tfnb-primary); border-color: var(--tfnb-primary); color: #fff; }

.tfnb-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.tfnb-toolbar select, .tfnb-toolbar input[type=search] { padding: 9px 12px; border-radius: var(--tfnb-radius-sm); border: 1px solid var(--tfnb-border); background: var(--tfnb-surface); font-size: 13px; }

.tfnb-empty { color: var(--tfnb-text-muted); font-size: 13.5px; padding: 30px 10px; text-align: center; }

/* ---------- Toast ---------- */
.tfnb-toast { position: fixed; bottom: 24px; right: 24px; background: var(--tfnb-ink); color: #fff; padding: 12px 18px; border-radius: var(--tfnb-radius-sm); font-size: 13.5px; box-shadow: var(--tfnb-shadow-hover); z-index: 100001; opacity: 0; transform: translateY(8px); transition: all .25s ease; }
.tfnb-toast.is-visible { opacity: 1; transform: translateY(0); }
.tfnb-toast.is-error { background: var(--tfnb-coral); }

/* ---------- Vista pública "mi PDI" ---------- */
.tfnb-mypdi { max-width: 720px; margin: 0 auto; }
.tfnb-mypdi__title { font-family: var(--font-display); font-size: 22px; margin-bottom: 18px; }
.tfnb-mypdi__plan { margin-bottom: 16px; }
.tfnb-mypdi__head { display: flex; justify-content: space-between; align-items: center; }
.tfnb-mypdi__items { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tfnb-mypdi__item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--tfnb-surface-2); font-size: 13.5px; }
.tfnb-mypdi__item--completado { opacity: .6; text-decoration: line-through; }
.tfnb-check { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--tfnb-border); margin-top: 2px; }
.tfnb-mypdi__item--completado .tfnb-check { background: var(--tfnb-green); border-color: var(--tfnb-green); }

/* ---------- Gráficos ---------- */
.tfnb-chart-box { position: relative; height: 260px; }
.tfnb-chart-box canvas { max-height: 100%; }

/* ---------- Panel de front-end [talentflow_panel] ---------- */
.tfnb-frontend { --tfnb-panel-radius: var(--tfnb-radius-lg); }
.tfnb-frontend #tfnb-app { margin: 0; padding: 0; }
.tfnb-panel { background: var(--tfnb-base); border: 1px solid var(--tfnb-border); border-radius: var(--tfnb-panel-radius); padding: 20px clamp(14px, 3vw, 28px) 32px; }
.tfnb-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--tfnb-border); position: sticky; top: 0; background: var(--tfnb-base); z-index: 10; }
.tfnb-tab-btn { font-family: var(--font-body); font-weight: 600; font-size: 13px; padding: 9px 16px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--tfnb-text-muted); cursor: pointer; transition: all .15s ease; }
.tfnb-tab-btn:hover { background: var(--tfnb-surface); color: var(--tfnb-text); }
.tfnb-tab-btn.is-active { background: var(--tfnb-primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(52,84,209,.5); }
.tfnb-tab-panel { display: none; }
.tfnb-tab-panel.is-active { display: block; animation: tfnb-fade .18s ease; }
@keyframes tfnb-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 782px) {
	.tfnb-tabs { position: static; overflow-x: auto; flex-wrap: nowrap; }
	.tfnb-tab-btn { flex-shrink: 0; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1100px) {
	.tfnb-grid-2 { grid-template-columns: 1fr; }
	.tfnb-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 782px) {
	#tfnb-app { margin: 0 -10px; padding: 18px 12px 50px; }
	.tfnb-header { flex-direction: column; align-items: flex-start; }
	.tfnb-kpis { grid-template-columns: 1fr; }
	.tfnb-matrix { grid-template-rows: repeat(3, minmax(120px, auto)); }
	.tfnb-matrix-wrap { grid-template-columns: 22px 1fr; }
	.tfnb-field-row { grid-template-columns: 1fr; }
	.tfnb-modal { padding: 20px; max-height: 92vh; }
	.tfnb-table { font-size: 12.5px; }
	.tfnb-toolbar { flex-direction: column; align-items: stretch; }
}
