/*
  components.css — Sistema de componentes SkillBridge AI
  Cada componente se define una sola vez y se reutiliza en las 37+ pantallas.
*/

/* =========================================================
   Botones — 4 variantes × 5 estados (default/hover/active/focus/disabled)
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.5; transform: none; }
.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: var(--fs-xs); }
.btn-lg { height: 46px; padding: 0 var(--space-6); font-size: var(--fs-base); }
.btn-block { width: 100%; }
.btn-icon-only { width: 40px; padding: 0; }
.btn-icon-only.btn-sm { width: 32px; }

.btn-primary {
  background: var(--navy-700);
  color: var(--text-inverse);
  box-shadow: var(--shadow-btn-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--navy-800); }
.btn-primary:active:not(:disabled) { background: var(--navy-900); }
.btn-primary:focus-visible { box-shadow: var(--shadow-btn-primary), var(--shadow-focus); }

.btn-secondary {
  background: var(--surface);
  color: var(--navy-700);
  border-color: var(--border-default);
}
.btn-secondary:hover:not(:disabled) { background: var(--navy-100); border-color: var(--border-strong); }
.btn-secondary:active:not(:disabled) { background: var(--tint-active); }

.btn-tertiary {
  background: transparent;
  color: var(--blue-link);
  padding-left: var(--space-2);
  padding-right: var(--space-2);
  height: 36px;
}
.btn-tertiary:hover:not(:disabled) { background: var(--navy-100); text-decoration: none; }
.btn-tertiary:active:not(:disabled) { background: var(--tint-active); }

.btn-destructive {
  background: var(--surface);
  color: var(--red-fg);
  border-color: var(--red-border);
}
.btn-destructive:hover:not(:disabled) { background: var(--red-bg); }
.btn-destructive:active:not(:disabled) { background: var(--tint-destructive-active); }
.btn-destructive-solid {
  background: var(--red-fg);
  color: var(--text-inverse);
}
.btn-destructive-solid:hover:not(:disabled) { background: #A5321F; }

.btn-group { display: inline-flex; gap: var(--space-2); flex-wrap: wrap; }

/* =========================================================
   Inputs / Formularios
   ========================================================= */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
.field-row { display: flex; gap: var(--space-4); }
.field-row > .field { flex: 1; min-width: 0; }

.field-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.field-hint { font-size: var(--fs-xs); color: var(--text-tertiary); line-height: var(--lh-normal); }
.field-error { font-size: var(--fs-xs); color: var(--red-fg); display: none; align-items: center; gap: var(--space-1); }
.field.has-error .field-error { display: flex; }
.field.has-error .input { border-color: var(--red-fg); background: var(--red-bg); }
.field.has-success .input { border-color: var(--green-fg); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.input::placeholder { color: var(--text-tertiary); }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--blue-accent); box-shadow: var(--shadow-focus); }
.input:disabled { background: var(--surface-sunken); color: var(--text-tertiary); cursor: not-allowed; }
.input-wrap .icon { position: absolute; left: var(--space-4); color: var(--text-tertiary); pointer-events: none; }
.input-wrap .input.has-left-icon { padding-left: 42px; }
.input-wrap .input-action {
  position: absolute; right: var(--space-2);
  background: none; border: none; cursor: pointer;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  color: var(--blue-link); padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}
.input-wrap .input-action:hover { background: var(--navy-100); }

.select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 36px 0 var(--space-4);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237C8496' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  cursor: pointer;
}
.select:hover { border-color: var(--border-strong); }
.select:focus { outline: none; border-color: var(--blue-accent); box-shadow: var(--shadow-focus); }

.checkbox-row { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
.checkbox-row input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--navy-700); cursor: pointer; flex-shrink: 0; }
.checkbox-row .checkbox-label { font-size: var(--fs-sm); color: var(--text-secondary); line-height: var(--lh-normal); }
.checkbox-row .checkbox-label a { font-weight: var(--fw-medium); }

/* Toggle (switch) */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }
.toggle-track {
  width: 44px; height: 24px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  transition: background var(--dur-base) var(--ease-standard);
  position: relative;
  flex-shrink: 0;
}
.toggle-track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-base) var(--ease-standard);
}
.toggle input:checked + .toggle-track { background: var(--navy-700); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-track { box-shadow: var(--shadow-focus); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) 0; border-bottom: 1px solid var(--border-subtle); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row-text { display: flex; flex-direction: column; gap: 2px; }
.toggle-row-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-primary); }
.toggle-row-desc { font-size: var(--fs-xs); color: var(--text-tertiary); }
/* Notificaciones: "Enviarme el resumen ahora" debajo de las preferencias */
.resumen-probar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
  margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }
.resumen-probar p { margin: 0; font-size: var(--fs-xs); }
.resumen-probar .btn { gap: 6px; }

/* Password strength meter */
.pw-strength { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-1); }
.pw-strength-bars { display: flex; gap: 4px; }
.pw-strength-bar { height: 4px; flex: 1; background: var(--border-subtle); border-radius: var(--radius-full); transition: background var(--dur-base) var(--ease-standard); }
.pw-strength[data-level="1"] .pw-strength-bar:nth-child(-n+1) { background: var(--red-fg); }
.pw-strength[data-level="2"] .pw-strength-bar:nth-child(-n+2) { background: var(--amber-fg); }
.pw-strength[data-level="3"] .pw-strength-bar:nth-child(-n+3) { background: var(--amber-fg); }
.pw-strength[data-level="4"] .pw-strength-bar { background: var(--green-fg); }
.pw-strength-label { font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-tertiary); }
.pw-checklist { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-2); }
.pw-check { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-xs); color: var(--text-tertiary); }
.pw-check .check-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.pw-check.met { color: var(--green-fg); }
.pw-check.met .check-dot { background: var(--green-fg); border-color: var(--green-fg); }
.pw-check.met .check-dot svg { width: 9px; height: 9px; stroke: white; }
.pw-check.unmet.is-invalid { color: var(--red-fg); }
.pw-check.unmet.is-invalid .check-dot { border-color: var(--red-fg); }

/* =========================================================
   Tarjetas
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--space-6); }
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}
.card-header-text h2, .card-header-text h3 { font-size: var(--fs-md); color: var(--text-primary); }
.card-header-text p { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: 2px; }
.card-body { padding: var(--space-6); }
.card-body-flush { padding: 0; }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* KPI tile */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.kpi-tile-label { font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: var(--fw-medium); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-tertiary); }
.kpi-tile-value { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: var(--text-primary); line-height: 1.1; letter-spacing: -0.01em; }
.kpi-tile-meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-tertiary); }
.kpi-tile-meta.up { color: var(--green-fg); }
.kpi-tile-meta.down { color: var(--red-fg); }
.kpi-tile-meta.warn { color: var(--amber-fg); }

/* Acentos de color + ícono para KPI tiles (borde superior + chip circular +
   fondo degradado + forma decorativa, mismo lenguaje visual que las tarjetas
   resumen de Asignaciones: .assignment-summary-item) */
.kpi-tile { position: relative; overflow: hidden; z-index: 0; }
.kpi-tile::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--border-subtle); z-index: 1; }
.kpi-tile.accent-blue::before { background: var(--blue-fg); }
.kpi-tile.accent-green::before { background: var(--green-fg); }
.kpi-tile.accent-amber::before { background: var(--amber-fg); }
.kpi-tile.accent-violet::before { background: var(--violet-fg); }
.kpi-tile.accent-red::before { background: var(--red-fg); }

.kpi-tile.accent-blue { --tile-bg: var(--blue-bg); --tile-border: var(--blue-border); --tile-glow: rgba(44,91,176,.10); }
.kpi-tile.accent-green { --tile-bg: var(--green-bg); --tile-border: var(--green-border); --tile-glow: rgba(21,153,120,.11); }
.kpi-tile.accent-amber { --tile-bg: var(--amber-bg); --tile-border: var(--amber-border); --tile-glow: rgba(217,144,34,.12); }
.kpi-tile.accent-violet { --tile-bg: var(--violet-bg); --tile-border: var(--violet-border); --tile-glow: rgba(110,78,190,.11); }
.kpi-tile.accent-red { --tile-bg: var(--red-bg); --tile-border: var(--red-border); --tile-glow: rgba(196,60,40,.11); }
.kpi-tile.accent-blue, .kpi-tile.accent-green, .kpi-tile.accent-amber, .kpi-tile.accent-violet, .kpi-tile.accent-red {
  background: linear-gradient(135deg, var(--surface) 10%, var(--tile-bg) 100%);
  border-color: var(--tile-border);
}
.kpi-tile.accent-blue::after, .kpi-tile.accent-green::after, .kpi-tile.accent-amber::after, .kpi-tile.accent-violet::after, .kpi-tile.accent-red::after {
  content: ""; position: absolute; width: 110px; height: 110px; right: -42px; bottom: -58px; border-radius: 50%; background: var(--tile-glow); pointer-events: none; z-index: 0;
}
.kpi-tile-icon, .kpi-tile-label, .kpi-tile-value, .kpi-tile-meta { position: relative; z-index: 1; }
.kpi-tile-icon { width: 34px; height: 34px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin-bottom: 2px; transition: transform var(--dur-base) var(--ease-standard); }
.kpi-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.kpi-tile:hover .kpi-tile-icon { transform: scale(1.1) rotate(-4deg); }
.kpi-tile-icon.blue { background: var(--blue-bg); color: var(--blue-fg); }
.kpi-tile-icon.green { background: var(--green-bg); color: var(--green-fg); }
.kpi-tile-icon.amber { background: var(--amber-bg); color: var(--amber-fg); }
.kpi-tile-icon.violet { background: var(--violet-bg); color: var(--violet-fg); }
.kpi-tile-icon.red { background: var(--red-bg); color: var(--red-fg); }

/* Chip de ícono en encabezados de card */
.card-header-icon-row { display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; }
.card-header-icon { width: 32px; height: 32px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card-header-icon.blue { background: var(--blue-bg); color: var(--blue-fg); }
.card-header-icon.green { background: var(--green-bg); color: var(--green-fg); }
.card-header-icon.violet { background: var(--violet-bg); color: var(--violet-fg); }
.card-header-icon.amber { background: var(--amber-bg); color: var(--amber-fg); }
.card-header-icon.red { background: var(--red-bg); color: var(--red-fg); }

/* =========================================================
   Badges / Chips / Pills de estado
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-neutral { background: var(--surface-sunken); color: var(--text-secondary); border-color: var(--border-subtle); }
.badge-green { background: var(--green-bg); color: var(--green-fg); border-color: var(--green-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-border); }
.badge-red { background: var(--red-bg); color: var(--red-fg); border-color: var(--red-border); }
.badge-blue { background: var(--blue-bg); color: var(--blue-fg); border-color: var(--blue-border); }
.badge-violet { background: var(--violet-bg); color: var(--violet-fg); border-color: var(--violet-border); }
.badge-dot-only::before { margin: 0; }

.counter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--red-fg);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--fw-semibold);
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--navy-600);
  color: var(--text-inverse);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-lg { width: 64px; height: 64px; font-size: var(--fs-lg); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -10px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* =========================================================
   Tabs / Segmented control
   ========================================================= */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border-subtle); }
.tab-btn {
  background: none; border: none; cursor: pointer;
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease-standard);
  display: flex; align-items: center; gap: var(--space-2);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--navy-700); border-bottom-color: var(--navy-700); }
.tab-btn .counter-badge { background: var(--border-strong); }
.tab-btn.active .counter-badge { background: var(--navy-700); }

.segmented { display: inline-flex; background: var(--surface-sunken); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.segmented-btn {
  background: none; border: none; cursor: pointer;
  padding: 7px var(--space-4);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease-standard);
}
.segmented-btn.active { background: var(--surface); color: var(--navy-700); box-shadow: var(--shadow-1); }

.chip-filter-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip-filter {
  background: var(--surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-full); padding: 6px 14px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-secondary);
  cursor: pointer; transition: all var(--dur-fast) var(--ease-standard);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip-filter:hover { border-color: var(--border-strong); }
.chip-filter.active { background: var(--navy-700); border-color: var(--navy-700); color: var(--text-inverse); }

/* =========================================================
   Tabla de datos
   ========================================================= */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.data-table tbody td {
  padding: var(--space-4);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--dur-fast) var(--ease-standard); }
.data-table tbody tr:hover { background: var(--surface-sunken); }
.data-table tbody tr:last-child td { border-bottom: none; }
.cell-primary { font-weight: var(--fw-medium); color: var(--text-primary); }
.cell-person { display: flex; align-items: center; gap: var(--space-3); }
.cell-person-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* Enlaces de nombre en tablas (Asignaciones / Proyectos / Inicio) */
a.cell-link { color: inherit; text-decoration: none; }
a.cell-link:hover { color: var(--blue-link); text-decoration: none; }
.cell-person-name { font-weight: var(--fw-medium); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-person-sub { font-size: var(--fs-xs); color: var(--text-tertiary); }
.cell-actions { display: flex; gap: var(--space-3); white-space: nowrap; }
.cell-actions button, .cell-actions a { background: none; border: none; padding: 0; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--blue-link); cursor: pointer; }
.cell-actions button:hover, .cell-actions a:hover { text-decoration: none; }
.cell-actions .danger { color: var(--red-fg); }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-subtle); }
.table-filters { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.table-filters .select { width: auto; min-width: 150px; height: 38px; font-size: var(--fs-xs); }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-6); gap: var(--space-4); flex-wrap: wrap; }

.progress-bar { width: 100%; height: 12px; background: var(--border-subtle); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: var(--radius-full); background: var(--navy-700); transition: width var(--dur-slow) var(--ease-standard); }
.progress-bar-fill.green { background: var(--green-fg); }
.progress-bar-fill.amber { background: var(--amber-fg); }
.progress-bar-fill.red { background: var(--red-fg); }
.progress-inline { display: flex; align-items: center; gap: var(--space-3); }
.progress-inline .progress-bar { flex: 1; }
.progress-inline .progress-value { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-secondary); min-width: 34px; text-align: right; }

/* Gráfico de barras verticales simple (reportes) */
.bar-chart { display: flex; align-items: flex-end; gap: var(--space-4); height: 140px; padding: 0 var(--space-2); }
.bar-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: var(--space-2); height: 100%; }
.bar-chart-track { width: 100%; max-width: 34px; flex: 1; display: flex; align-items: flex-end; }
.bar-chart-fill { width: 100%; border-radius: 4px 4px 0 0; background: var(--navy-700); transition: height var(--dur-slow) var(--ease-standard); min-height: 3px; }
.bar-chart-fill.accent { background: var(--blue-accent); }
.bar-chart-value { font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); }
.bar-chart-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: var(--tracking-label); color: var(--text-tertiary); text-transform: uppercase; }

/* Estados vacíos / carga / error de listas y tablas */
.state-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  gap: var(--space-3);
  color: var(--text-tertiary);
}
.state-panel-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface-sunken);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}
.state-panel-icon svg { width: 24px; height: 24px; }
.state-panel.is-error .state-panel-icon { background: var(--red-bg); color: var(--red-fg); }
.state-panel-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--text-primary); }
.state-panel-desc { font-size: var(--fs-sm); color: var(--text-tertiary); max-width: 380px; }

/* =========================================================
   Modales
   ========================================================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 31, 58, 0.52);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-6);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  animation: fade-in var(--dur-base) var(--ease-standard) forwards;
}
@keyframes fade-in { to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  animation: modal-in var(--dur-base) var(--ease-standard) forwards;
}
@keyframes modal-in { to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-wide { max-width: 640px; }
.modal-xwide { max-width: 820px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-6) var(--space-6) var(--space-4); }
.modal-header h2 { font-size: var(--fs-lg); }
.modal-header p { font-size: var(--fs-sm); color: var(--text-tertiary); margin-top: 4px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); flex-shrink: 0;
}
.modal-close:hover { background: var(--surface-sunken); color: var(--text-primary); }
.modal-body { padding: 0 var(--space-6) var(--space-6); overflow-y: auto; }
.modal-footer { padding: var(--space-5) var(--space-6); border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: var(--space-3); }
.modal-footer.spread { justify-content: space-between; }

/* Selector de rol */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 520px) { .role-grid { grid-template-columns: 1fr; } }
.role-card {
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: left;
  background: var(--surface);
  cursor: pointer;
  display: flex; flex-direction: column; gap: var(--space-3);
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.role-card:hover { border-color: var(--blue-accent); box-shadow: var(--shadow-2); }
.role-card:active { transform: translateY(1px); }
.role-card-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--navy-100); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
}
.role-card-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.role-card-desc { font-size: var(--fs-xs); color: var(--text-tertiary); line-height: var(--lh-normal); }

/* =========================================================
   Dropdowns (filtros custom, menú de usuario, notificaciones)
   ========================================================= */
.dropdown { position: relative; display: inline-flex; }
.dropdown-panel {
  position: absolute; top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  z-index: var(--z-dropdown);
  opacity: 0; transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}
.dropdown-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown-panel.align-right { right: 0; }
.dropdown-menu { padding: var(--space-2); min-width: 200px; }
.dropdown-item {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; padding: var(--space-3); border: none; background: none;
  border-radius: var(--radius-md); cursor: pointer; text-align: left;
  font-size: var(--fs-sm); color: var(--text-primary);
}
.dropdown-item:hover { background: var(--surface-sunken); }
.dropdown-item .icon { color: var(--text-tertiary); }
.dropdown-item.danger { color: var(--red-fg); }
.dropdown-item.danger .icon { color: var(--red-fg); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: var(--space-2); }

/* Panel de notificaciones */
.notif-panel { width: 384px; max-width: calc(100vw - 32px); max-height: 520px; display: flex; flex-direction: column; }
.notif-panel-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-4) var(--space-3); border-bottom: 1px solid var(--border-subtle); }
.notif-panel-header h3 { font-size: var(--fs-sm); }
.notif-panel-list { overflow-y: auto; }
.notif-item { display: flex; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--border-subtle); position: relative; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--notif-unread-bg); }
.notif-item-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-item-icon.alert { background: var(--red-bg); color: var(--red-fg); }
.notif-item-icon.ai { background: var(--violet-bg); color: var(--violet-fg); }
.notif-item-icon.info { background: var(--blue-bg); color: var(--blue-fg); }
.notif-item-icon.success { background: var(--green-bg); color: var(--green-fg); }
.notif-item-icon.mail { background: var(--surface-sunken); color: var(--text-tertiary); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-primary); }
.notif-item-desc { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; line-height: var(--lh-normal); }
.notif-item-time { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; font-family: var(--font-mono); }
.notif-item-action { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--blue-link); background: none; border: none; padding: 0; margin-top: 6px; cursor: pointer; }
.notif-panel-footer { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-subtle); text-align: center; }
.notif-panel-footer a, .notif-panel-footer button { font-size: var(--fs-xs); font-weight: var(--fw-medium); }

/* =========================================================
   Toasts
   ========================================================= */
.toast-region { position: fixed; bottom: var(--space-6); right: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); z-index: var(--z-toast); max-width: 360px; }
.toast {
  background: var(--navy-900); color: var(--text-inverse);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  display: flex; align-items: flex-start; gap: var(--space-3);
  font-size: var(--fs-sm);
  animation: toast-in var(--dur-base) var(--ease-standard);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast.leaving { animation: toast-out var(--dur-base) var(--ease-standard) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
.toast-icon { color: var(--blue-accent); flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: #6FD79E; }
.toast.error .toast-icon { color: #F0968A; }
.toast-text { flex: 1; }
.toast-close { background: none; border: none; color: var(--text-inverse-dim); cursor: pointer; padding: 0; flex-shrink: 0; }

/* =========================================================
   Command palette (⌘K)
   ========================================================= */
.cmdk-backdrop {
  position: fixed; inset: 0; background: rgba(11, 31, 58, 0.45);
  z-index: var(--z-command-palette);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  opacity: 0; animation: fade-in var(--dur-fast) var(--ease-standard) forwards;
}
.cmdk {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  transform: translateY(4px);
  opacity: 0;
  animation: modal-in var(--dur-base) var(--ease-standard) forwards;
}
.cmdk-input-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.cmdk-input-row .icon { color: var(--text-tertiary); }
.cmdk-input { flex: 1; border: none; outline: none; font-size: var(--fs-md); background: none; }
.cmdk-input-row kbd { font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); border: 1px solid var(--border-default); border-radius: 4px; padding: 2px 6px; }
.cmdk-results { max-height: 360px; overflow-y: auto; padding: var(--space-2); }
.cmdk-group-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-tertiary); padding: var(--space-3) var(--space-3) var(--space-1); }
.cmdk-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); cursor: pointer; }
.cmdk-item:hover, .cmdk-item.active { background: var(--surface-sunken); }
.cmdk-item-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--navy-100); color: var(--navy-700); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cmdk-item-text { flex: 1; min-width: 0; }
.cmdk-item-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-primary); }
.cmdk-item-sub { font-size: var(--fs-xs); color: var(--text-tertiary); }
.cmdk-empty { padding: var(--space-8); text-align: center; color: var(--text-tertiary); font-size: var(--fs-sm); }

/* =========================================================
   Wizards (registro, recuperar contraseña)
   ========================================================= */
.wizard-steps { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-6); }
.wizard-step { display: flex; align-items: center; gap: var(--space-2); flex: 1; }
.wizard-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  background: var(--surface-sunken); color: var(--text-tertiary);
  border: 1.5px solid var(--border-default);
  flex-shrink: 0;
  transition: all var(--dur-base) var(--ease-standard);
}
.wizard-step.done .wizard-step-dot { background: var(--green-fg); border-color: var(--green-fg); color: white; }
.wizard-step.active .wizard-step-dot { background: var(--navy-700); border-color: var(--navy-700); color: white; }
.wizard-step-line { height: 2px; flex: 1; background: var(--border-default); }
.wizard-step.done .wizard-step-line { background: var(--green-fg); }
.wizard-step-label { font-size: var(--fs-xs); color: var(--text-tertiary); display: none; }
@media (min-width: 640px) { .wizard-step-label { display: block; } }
.wizard-step.active .wizard-step-label { color: var(--navy-700); font-weight: var(--fw-medium); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; animation: fade-slide-in var(--dur-slow) var(--ease-standard); }
@keyframes fade-slide-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }

/* =========================================================
   Chat / Asistente IA
   ========================================================= */
.chat-layout { display: grid; grid-template-columns: 260px 1fr 300px; gap: var(--space-5); align-items: start; }
@media (max-width: 1180px) { .chat-layout { grid-template-columns: 1fr; } }
.chat-history-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-3); border-radius: var(--radius-md); cursor: pointer;
}
.chat-history-item:hover { background: var(--surface-sunken); }
.chat-history-item.active { background: var(--navy-100); }
.chat-history-title { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-history-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); }

.chat-window { display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.chat-messages { flex: 1; overflow-y: auto; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.chat-date-sep { text-align: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: var(--tracking-label); color: var(--text-tertiary); text-transform: uppercase; margin: var(--space-2) 0; }
.chat-msg-row { display: flex; align-items: flex-end; gap: var(--space-2); max-width: 84%; align-self: flex-start; }
.chat-msg-avatar { background: var(--navy-700); color: var(--text-inverse); }
.chat-msg-row .chat-msg { max-width: none; }
.chat-msg { display: flex; flex-direction: column; gap: 4px; max-width: 78%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.assistant { align-self: flex-start; align-items: flex-start; }
.chat-bubble { padding: var(--space-4); border-radius: var(--radius-lg); font-size: var(--fs-sm); line-height: var(--lh-relaxed); }
.chat-msg.user .chat-bubble { background: var(--navy-700); color: var(--text-inverse); border-bottom-right-radius: var(--radius-sm); }
.chat-msg.assistant .chat-bubble { background: var(--surface-sunken); color: var(--text-primary); border-bottom-left-radius: var(--radius-sm); }
.chat-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); letter-spacing: 0.02em; }
.chat-msg-card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-top: var(--space-1); width: 100%; }
.chat-msg-card-title { font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.chat-msg-card-sub { font-size: 11px; color: var(--text-tertiary); margin: 2px 0 var(--space-2); }
.chat-typing { display: inline-flex; gap: 4px; padding: var(--space-2) 0; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); animation: typing-bounce 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-suggestions { display: flex; gap: var(--space-2); flex-wrap: wrap; padding: 0 var(--space-6) var(--space-4); }
.chat-suggestion-chip { background: var(--surface); border: 1px solid var(--border-default); border-radius: var(--radius-full); padding: var(--space-2) var(--space-4); font-size: var(--fs-xs); color: var(--text-secondary); cursor: pointer; }
.chat-suggestion-chip:hover { border-color: var(--blue-accent); color: var(--blue-link); }

.chat-composer { border-top: 1px solid var(--border-subtle); padding: var(--space-4) var(--space-6); display: flex; align-items: center; gap: var(--space-3); }
.chat-composer .input { flex: 1; }
.chat-composer-send { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--navy-700); color: white; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.chat-composer-send:hover { background: var(--navy-800); }
.chat-composer-send:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-disclaimer { font-size: 11px; color: var(--text-tertiary); text-align: center; padding: 0 var(--space-6) var(--space-4); }

.ai-context-card { display: flex; flex-direction: row; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunken); }
.ai-context-card-icon { width: 32px; height: 32px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ai-context-card-icon.blue { background: var(--blue-bg); color: var(--blue-fg); }
.ai-context-card-icon.violet { background: var(--violet-bg); color: var(--violet-fg); }
.ai-context-card-icon.green { background: var(--green-bg); color: var(--green-fg); }
.ai-context-card-icon.amber { background: var(--amber-bg); color: var(--amber-fg); }
.ai-context-card-text { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.ai-context-card-title { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-primary); }
.ai-context-card-sub { font-size: 11px; color: var(--text-tertiary); }

/* Mini panel de IA embebido en dashboards */
.ai-mini-panel { background: linear-gradient(155deg, var(--navy-900), var(--navy-700)); border-radius: var(--radius-lg); padding: var(--space-6); color: white; display: flex; flex-direction: column; gap: var(--space-4); }
.ai-mini-panel-label { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: rgba(255,255,255,0.6); }
.ai-mini-panel-text { font-size: var(--fs-sm); line-height: var(--lh-relaxed); color: rgba(255,255,255,0.92); }
.ai-mini-panel-input { display: flex; gap: var(--space-2); }
.ai-mini-panel-input input { flex: 1; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18); color: white; border-radius: var(--radius-md); height: 40px; padding: 0 var(--space-3); font-size: var(--fs-sm); }
.ai-mini-panel-input input::placeholder { color: rgba(255,255,255,0.5); }
.ai-mini-panel-input button { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--blue-accent); border: none; color: white; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

/* =========================================================
   Heatmap de ocupación
   ========================================================= */
.heatmap-scroll { overflow-x: auto; }
.heatmap-table { border-collapse: collapse; width: 100%; min-width: 760px; }
.heatmap-table th { font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-tertiary); padding: var(--space-2) var(--space-2); text-align: center; }
.heatmap-table th:first-child { text-align: left; padding-left: var(--space-2); }
.heatmap-table td { padding: 4px; text-align: center; }
.heatmap-person-cell { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3) var(--space-2) 0; min-width: 190px; }
.heatmap-cell {
  width: 100%; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-medium);
  cursor: pointer; border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-standard);
}
.heatmap-cell:hover { transform: scale(1.06); border-color: rgba(0,0,0,0.12); }
.heatmap-cell.level-low { background: var(--blue-bg); color: var(--blue-fg); }
.heatmap-cell.level-optimal { background: var(--green-bg); color: var(--green-fg); }
.heatmap-cell.level-high { background: var(--amber-bg); color: var(--amber-fg); }
.heatmap-cell.level-over { background: var(--red-bg); color: var(--red-fg); }
.heatmap-legend { display: flex; gap: var(--space-5); flex-wrap: wrap; align-items: center; }
.heatmap-legend-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-xs); color: var(--text-secondary); }
.heatmap-legend-swatch { width: 14px; height: 14px; border-radius: 4px; }

/* =========================================================
   Kanban (Asignaciones — Resource Manager)
   ========================================================= */
.kanban-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-4); align-items: start; }
.kanban-column { background: var(--surface-sunken); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.kanban-column-header { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--space-1) var(--space-2); }
.kanban-column-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.kanban-column-sub { font-size: 11px; color: var(--text-tertiary); }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-3); box-shadow: var(--shadow-1);
  cursor: grab; display: flex; flex-direction: column; gap: var(--space-2);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card.drop-target { outline: 2px dashed var(--blue-accent); outline-offset: 2px; }
.kanban-card-top { display: flex; align-items: center; gap: var(--space-2); }
.kanban-card-name { font-size: var(--fs-xs); font-weight: var(--fw-medium); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card-meta { font-size: 11px; color: var(--text-tertiary); display: flex; justify-content: space-between; }
.kanban-add-btn { border: 1.5px dashed var(--border-strong); background: none; border-radius: var(--radius-md); padding: var(--space-3); font-size: var(--fs-xs); color: var(--text-tertiary); cursor: pointer; }
.kanban-add-btn:hover { border-color: var(--blue-accent); color: var(--blue-link); }

/* =========================================================
   Foros
   ========================================================= */
.thread-row { display: flex; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-subtle); cursor: pointer; align-items: flex-start; }
.thread-row:hover { background: var(--surface-sunken); }
.thread-row:last-child { border-bottom: none; }
.thread-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.thread-row-title { font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--text-primary); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.thread-row-meta { font-size: var(--fs-xs); color: var(--text-tertiary); }
.thread-row-ai { background: var(--violet-bg); color: var(--violet-fg); border-radius: var(--radius-md); padding: var(--space-3); font-size: var(--fs-xs); line-height: var(--lh-normal); display: flex; gap: var(--space-2); }
.thread-row-count { text-align: center; flex-shrink: 0; }
.thread-row-count-num { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-primary); }
.thread-row-count-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: var(--tracking-label); }

.post { display: flex; gap: var(--space-4); padding: var(--space-6) 0; border-bottom: 1px solid var(--border-subtle); }
.post:last-child { border-bottom: none; }
.post-body { flex: 1; min-width: 0; }
.post-author-row { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.post-author-name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.post-author-role { font-size: var(--fs-xs); color: var(--text-tertiary); }
.post-text { font-size: var(--fs-sm); line-height: var(--lh-relaxed); color: var(--text-primary); }
.post-actions { display: flex; align-items: center; gap: var(--space-5); margin-top: var(--space-3); }
.post-actions button { background: none; border: none; padding: 0; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-tertiary); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.post-actions button:hover { color: var(--navy-700); }
.post-actions button.voted { color: var(--blue-link); }

/* =========================================================
   Panel lateral de detalle / info
   ========================================================= */
/* minmax(0, …): sin esto, una columna no se encoge por debajo de su contenido
   y en celular la página entera se desbordaba hacia la derecha. */
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
@media (max-width: 1080px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.detail-grid > * { min-width: 0; }
/* Mi perfil (colaborador): en celular las acciones de cada habilidad bajan a su propia línea */
@media (max-width: 600px) {
  [data-habilidad-row] { flex-wrap: wrap; }
  [data-habilidad-row] > .cell-actions { flex: 1 1 100% !important; justify-content: flex-start !important; }
}
/* Filas "proyecto + avance + estado + dedicación" (colaborador/inicio): en celular bajan de línea */
@media (max-width: 600px) {
  .fila-proyecto { flex-wrap: wrap; padding: var(--space-4) !important; row-gap: var(--space-2) !important; }
  .fila-proyecto > .fila-proyecto-avance { order: 5; flex: 1 1 100%; width: auto !important; }
  .fila-proyecto > .label-mono { width: auto !important; }
}
.info-row { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-sm); }
.info-row:last-child { border-bottom: none; }
.info-row-label { color: var(--text-tertiary); }
.info-row-value { color: var(--text-primary); font-weight: var(--fw-medium); text-align: right; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: var(--space-4); position: relative; padding-bottom: var(--space-6); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--navy-700); margin-top: 4px; flex-shrink: 0; position: relative; z-index: 1; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: var(--border-subtle); }
.timeline-body { flex: 1; }
.timeline-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-primary); }
.timeline-sub { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: 2px; }

/* Breadcrumb */
.breadcrumb { font-size: var(--fs-xs); color: var(--text-tertiary); }
.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb .sep { margin: 0 6px; }
.breadcrumb .current { color: var(--text-secondary); }

/* Callout / alert banner */
.callout { display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); border: 1px solid; align-items: flex-start; }
.callout-icon { flex-shrink: 0; margin-top: 1px; }
.callout-body { flex: 1; font-size: var(--fs-sm); line-height: var(--lh-normal); }
.callout-title { display: block; font-weight: var(--fw-semibold); margin-bottom: 2px; }
.callout-actions { display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.callout.warn { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-fg-strong); }
.callout.warn .callout-icon { color: var(--amber-fg); }
.callout.danger { background: var(--red-bg); border-color: var(--red-border); color: var(--red-fg-strong); }
.callout.danger .callout-icon { color: var(--red-fg); }
.callout.info { background: var(--blue-bg); border-color: var(--blue-border); color: var(--blue-fg-strong); }
.callout.info .callout-icon { color: var(--blue-fg); }
.callout.ai { background: var(--violet-bg); border-color: var(--violet-border); color: var(--violet-fg-strong); }
.callout.ai .callout-icon { color: var(--violet-fg); }

/* Skill pill (niveles) */
.skill-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: var(--fw-medium); border: 1px solid; }
.skill-pill[data-level="Básico"] { background: var(--surface-sunken); border-color: var(--border-default); color: var(--text-secondary); }
.skill-pill[data-level="Intermedio"] { background: var(--blue-bg); border-color: var(--blue-border); color: var(--blue-fg); }
.skill-pill[data-level="Avanzado"] { background: var(--violet-bg); border-color: var(--violet-border); color: var(--violet-fg); }
.skill-pill[data-level="Experto"] { background: var(--green-bg); border-color: var(--green-border); color: var(--green-fg); }

/* Pagination */
.pagination { display: flex; gap: var(--space-2); align-items: center; }
.page-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border-default); background: var(--surface); font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-secondary); cursor: pointer; }
.page-btn:hover { border-color: var(--border-strong); }
.page-btn.active { background: var(--navy-700); border-color: var(--navy-700); color: white; }
/* Paginación con enlaces (páginas del servidor, p. ej. Auditoría): mismo aspecto que los botones. */
a.page-btn, span.page-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.page-btn:hover { text-decoration: none; color: var(--text-primary); }
.page-btn.is-disabled { opacity: .45; cursor: default; }

/* Match score ring (AI Talent Matching) */
.match-ring { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; }
.match-ring-value { font-family: var(--font-mono); font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.candidate-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); border-radius: var(--radius-md); border: 1.5px solid var(--border-subtle); cursor: pointer; background: var(--surface); }
.candidate-row:hover { border-color: var(--blue-accent); }
.candidate-row.selected { border-color: var(--navy-700); background: var(--navy-100); }
.candidate-row-text { flex: 1; min-width: 0; }
.candidate-row-name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); display: flex; align-items: center; gap: var(--space-2); }
.candidate-row-role { font-size: var(--fs-xs); color: var(--text-tertiary); }
.candidate-row-avail { font-size: var(--fs-xs); color: var(--text-secondary); text-align: right; }

.criteria-bar-row { display: flex; flex-direction: column; gap: 6px; padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.criteria-bar-row:last-child { border-bottom: none; }
.criteria-bar-top { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-xs); }
.criteria-bar-name { font-weight: var(--fw-medium); color: var(--text-primary); }
.criteria-bar-detail { color: var(--text-tertiary); }
.criteria-bar-pct { font-family: var(--font-mono); font-weight: var(--fw-semibold); }

/* Health status list (admin) */
.health-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.health-row:last-child { border-bottom: none; }
.health-row-name { font-size: var(--fs-sm); font-weight: var(--fw-medium); display: flex; align-items: center; gap: var(--space-3); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; }
.health-dot.ok { background: var(--green-fg); }
.health-dot.degraded { background: var(--amber-fg); }
.health-dot.down { background: var(--red-fg); }
.health-row-value { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-secondary); }

/* =========================================================
   SIDEBAR USER
   ========================================================= */

.sidebar-user {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;

  padding: 0.7rem 0.75rem;

  border: 0;
  border-radius: 10px;

  background: transparent;
  color: inherit;

  text-align: left;
  cursor: pointer;

  transition:
          background-color 0.2s ease,
          transform 0.2s ease;
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.08);
}


/* Avatar */

.sidebar-user-avatar {
  flex: 0 0 auto;
}


/* Contenedor nombre + correo */

.sidebar-user-text {
  min-width: 0;
  flex: 1;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;

  gap: 0.18rem;

  overflow: hidden;
}


/* Nombre */

.sidebar-user-name {
  display: block;
  width: 100%;

  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;

  color: #ffffff;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Correo */

.sidebar-user-email {
  display: block;
  width: 100%;

  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.25;

  color: rgba(255, 255, 255, 0.62);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Icono de menú */

.sidebar-user-menu-icon {
  flex: 0 0 auto;

  width: 18px;
  height: 18px;

  color: rgba(255, 255, 255, 0.65);
}

/* =========================================================
   SIDEBAR BRAND / LOGO
   ========================================================= */

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center ;

  min-height: 68px;
  padding: 0 1.25rem;
}

.sidebar-logo {
  display: block;

  width: auto;
  height: 98px;

  max-width: 190px;

  object-fit: contain;
  object-position: left center;
}

/* Ícono de marca: reemplaza al logo completo cuando el sidebar colapsa a
   íconos (76 px, entre 861 y 1180 px de ancho de ventana). Antes el logo de
   ~141 px se desbordaba sobre el contenido. Bajo 860 px el sidebar vuelve a
   ser un panel ancho (drawer) y se muestra otra vez el logo completo. */
.sidebar-logo-icon {
  display: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
}

@media (min-width: 861px) and (max-width: 1180px) {
  .sidebar-brand { padding: 0; }
  .sidebar-logo { display: none; }
  .sidebar-logo-icon { display: block; }
}

/* =========================================================
   TOPBAR - USUARIO
   ========================================================= */

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;

  min-height: 42px;
  padding: 0.25rem 0.45rem;

  border: 0;
  border-radius: 10px;

  background: transparent;
  color: var(--text-primary);

  cursor: pointer;

  transition:
          background-color 0.2s ease,
          box-shadow 0.2s ease;
}

.topbar-user-btn:hover {
  background: var(--surface-hover);
}


/* =========================================================
   CONTENEDOR DE FOTO
   ========================================================= */

.topbar-user-avatar {
  width: 36px;
  height: 36px;

  flex: 0 0 36px;

  display: flex;
  align-items: center;
  justify-content: center;
}


/* =========================================================
   FOTO DE PERFIL
   ========================================================= */

.topbar-user-photo {
  display: block;

  width: 36px;
  height: 36px;

  border-radius: 50%;

  object-fit: cover;
  object-position: center;

  background: var(--surface-muted);
}


/* =========================================================
   NOMBRE
   ========================================================= */

.topbar-user-name {
  display: block;

  max-width: 150px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 0.875rem;
  line-height: 1.25;
  font-weight: 600;

  color: var(--text-primary);
}


/* =========================================================
   FLECHA
   ========================================================= */

.topbar-user-btn > .icon {
  flex: 0 0 auto;

  color: var(--text-secondary);

  transition: transform 0.2s ease;
}


/* =========================================================
   ESTADO ACTIVO
   ========================================================= */

.topbar-user-btn[aria-expanded="true"] {
  background: var(--surface-hover);
}
/* ---------- Asignación en masa (checkboxes) — asignacion-masiva.js ---------- */
.bulk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.bulk-search { flex: 1 1 220px; max-width: 320px; }
.bulk-count { font-size: var(--fs-xs); color: var(--text-tertiary); }
.bulk-count strong { color: var(--text-primary); }
.bulk-full { color: var(--green-fg); font-weight: 600; }
.bulk-table { max-height: 300px; overflow: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface); margin-bottom: var(--space-4); }
.bulk-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.bulk-check-col { width: 40px; text-align: center; }
.bulk-check { width: 17px; height: 17px; accent-color: var(--navy-700); cursor: pointer; vertical-align: middle; }
.bulk-check:disabled { cursor: not-allowed; }
.bulk-row { cursor: pointer; }
.bulk-row.is-selected td { background: color-mix(in srgb, var(--navy-700) 7%, transparent); }
.bulk-row.is-blocked { cursor: default; opacity: .55; }
.bulk-load { min-width: 110px; }
.bulk-sub { display: block; margin-top: 2px; font-size: 11px; color: var(--text-tertiary); }
.bulk-warn { display: block; margin-top: 2px; font-size: 11px; color: var(--amber-fg); font-weight: 600; }
.bulk-empty { padding: var(--space-4); text-align: center; font-size: var(--fs-xs); color: var(--text-tertiary); }

/* ---------- Buscador con selección múltiple — multiselect.js (RG-225) ---------- */
.ms-wrap { position: relative; min-width: 0; }
.ms-native { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ms-trigger { width: 100%; text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ms-placeholder { color: var(--text-tertiary); }
.ms-wrap.open .ms-trigger { border-color: var(--navy-700); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy-700) 14%, transparent); }
.ms-panel { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border-default); border-radius: var(--radius-card); box-shadow: var(--shadow-3, 0 12px 32px rgba(15,31,66,.16)); padding: var(--space-2); }
.ms-search { display: flex; align-items: center; gap: var(--space-2); padding: 6px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-sunken); }
.ms-search .icon { color: var(--text-tertiary); flex-shrink: 0; }
.ms-input { border: 0; outline: 0; background: transparent; width: 100%; font: inherit; font-size: var(--fs-sm); color: var(--text-primary); }
.ms-tools { display: flex; justify-content: space-between; padding: 6px 4px; }
.ms-tools button { border: 0; background: none; color: var(--navy-700); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: var(--radius-sm); }
.ms-tools button:hover { background: var(--surface-sunken); }
.ms-list { max-height: 240px; overflow-y: auto; }
.ms-option { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer; font-size: var(--fs-sm); color: var(--text-primary); }
.ms-option:hover { background: var(--surface-sunken); }
.ms-option input { width: 16px; height: 16px; accent-color: var(--navy-700); flex-shrink: 0; }
.ms-empty { padding: 12px; text-align: center; font-size: var(--fs-xs); color: var(--text-tertiary); }
.ms-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ms-chips:empty { display: none; }
.ms-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: var(--radius-full); background: var(--blue-bg); color: var(--blue-fg); font-size: 11px; font-weight: 600; }
.ms-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.ms-chip button:hover { background: color-mix(in srgb, var(--blue-fg) 14%, transparent); }

/* ---------- Paginación numerada — paginacion.js (RG-226) ---------- */
.page-numbers { display: inline-flex; align-items: center; gap: 4px; }
.page-btn.page-num { min-width: 30px; width: auto; padding: 0 8px; font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.page-btn.page-num.active { background: var(--navy-700); border-color: var(--navy-700); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--navy-700) 30%, transparent); }
.page-ellipsis { min-width: 18px; text-align: center; color: var(--text-tertiary); font-size: var(--fs-xs); user-select: none; }
.page-label-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pagination { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ---------- Botones de la columna "Acciones" (RG-227) ---------- */
td.cell-actions { white-space: nowrap; }
td.cell-actions > * + * { margin-left: 6px !important; }
.cell-actions button, .cell-actions a {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-control); background: var(--surface);
  color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.cell-actions button .icon, .cell-actions a .icon { width: 14px; height: 14px; color: var(--blue-link); }
.cell-actions button:hover, .cell-actions a:hover { text-decoration: none; background: var(--blue-bg); border-color: color-mix(in srgb, var(--blue-link) 35%, transparent); color: var(--blue-fg); }
.cell-actions button:focus-visible, .cell-actions a:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.cell-actions .danger { color: var(--red-fg); }
.cell-actions .danger .icon { color: var(--red-fg); }
.cell-actions .danger:hover { background: var(--red-bg); border-color: color-mix(in srgb, var(--red-fg) 35%, transparent); color: var(--red-fg); }
.cell-actions .action-alert { background: var(--red-bg); color: var(--red-fg); border-color: color-mix(in srgb, var(--red-fg) 30%, transparent); }
.cell-actions .action-alert .icon { color: var(--red-fg); }
.cell-actions button:disabled { opacity: .5; cursor: not-allowed; }
.cell-actions > span { font-size: var(--fs-xs); }

/* Botón primario "Asignar" (RG-212) */
.btn-assign { gap: 6px; box-shadow: 0 2px 8px color-mix(in srgb, var(--navy-700) 25%, transparent); }
.btn-assign:hover { transform: translateY(-1px); }

/* Modal de equipo + asignación en masa más amplio (RG-231) */
.modal.modal-assign { max-width: 880px; }
.modal-assign .team-modal-table .data-table { width: 100%; }
.modal-assign .team-modal-table td, .modal-assign .team-modal-table th { white-space: nowrap; }
.bulk-row.is-selected td { background: var(--blue-bg) !important; }
.bulk-row .cell-person-sub { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-row td:last-child { min-width: 150px; }

/* "Finalizar" suelto dentro de modales de detalle (antes se veía como botón nativo) */
.modal-body button.danger:not(.btn) {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--red-fg) 30%, transparent); border-radius: var(--radius-control);
  background: var(--surface); color: var(--red-fg); font-size: var(--fs-xs); font-weight: 600;
}
.modal-body button.danger:not(.btn):hover { background: var(--red-bg); }

/* Icono de tecnología small (tech-icons.js) */
.tech-logo-sm { display:inline-flex; width:20px; height:20px; align-items:center; justify-content:center; flex-shrink:0; }
.tech-logo-sm img, .tech-logo-sm svg { width:20px; height:20px; }

/* ═══════════════════════════════════════════════════════════════════
   Selector propio (js/select-ui.js) — reemplaza visualmente a todos los
   <select class="select">. El botón copia las clases del select, así que
   hereda alto/ancho de cada contexto (.table-filters, .cal-filters...).
   ═══════════════════════════════════════════════════════════════════ */
/* :not(#sx) suma especificidad de id: el select oculto debe ganarle a reglas
   como ".admin-app .table-filters .select { width: 100% !important }". */
.sx-native:not(#sx) {
  position: absolute !important; max-width: 1px !important; width: 1px !important; min-width: 0 !important; height: 1px !important;
  margin: -1px !important; padding: 0 !important; border: 0 !important; overflow: hidden !important;
  clip: rect(0 0 0 0) !important; white-space: nowrap !important; opacity: 0 !important; pointer-events: none !important;
}
.select.sx-trigger {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  text-align: left; color: var(--text-primary); font-family: inherit; line-height: 1.2;
  background-image: none !important; padding-right: 36px;
  transition: border-color var(--dur-fast, .12s) ease, box-shadow var(--dur-fast, .12s) ease, background-color var(--dur-fast, .12s) ease;
}
.select.sx-trigger[hidden] { display: none; }
.select.sx-trigger { max-width: 100%; overflow: hidden; }
.select.sx-trigger:hover:not(:disabled) { background-color: var(--surface-sunken); }
.select.sx-trigger:focus-visible, .select.sx-trigger.is-open { outline: none; border-color: var(--blue-accent); box-shadow: var(--shadow-focus); }
.select.sx-trigger:disabled { cursor: not-allowed; opacity: .6; }
.select.sx-trigger.is-placeholder .sx-value { color: var(--text-tertiary); }
.sx-trigger .sx-value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-trigger .sx-icon { display: inline-flex; flex: none; }
.sx-trigger .sx-icon[hidden] { display: none; }
.sx-trigger .sx-chev {
  position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  color: var(--text-tertiary); transition: transform var(--dur-base, .18s) var(--ease-standard, ease);
}
.sx-trigger.is-open .sx-chev { transform: rotate(180deg); color: var(--blue-accent); }

.sx-panel {
  position: fixed; z-index: 1000; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-default); border-radius: 12px;
  box-shadow: var(--shadow-3); font-size: var(--fs-sm); color: var(--text-primary);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top center;
  transition: opacity .12s ease, transform .12s ease;
}
.sx-panel.is-up { transform: translateY(4px) scale(.98); transform-origin: bottom center; }
.sx-panel.is-visible { opacity: 1; transform: none; }

.sx-search { position: relative; flex: none; padding: 8px; border-bottom: 1px solid var(--border-subtle); }
.sx-search-icon { position: absolute; left: 20px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--text-tertiary); pointer-events: none; }
.sx-search-input {
  width: 100%; height: 36px; padding: 0 34px 0 36px; border: 1px solid var(--border-subtle); border-radius: 8px;
  background: var(--surface-sunken); color: var(--text-primary); font: inherit; font-size: var(--fs-sm);
}
.sx-search-input::placeholder { color: var(--text-tertiary); }
.sx-search-input:focus { outline: none; border-color: var(--blue-accent); background: var(--surface); }
.sx-clear {
  position: absolute; right: 14px; top: 50%; width: 24px; height: 24px; margin-top: -12px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: none; color: var(--text-tertiary); cursor: pointer;
}
.sx-clear[hidden] { display: none; }
.sx-clear:hover { background: var(--tint-active); color: var(--text-primary); }
.sx-clear .icon { width: 14px; height: 14px; }

.sx-list {
  flex: 1 1 auto; min-height: 0; margin: 0; padding: 4px 6px 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.sx-list:focus { outline: none; }
.sx-list::-webkit-scrollbar { width: 8px; }
.sx-list::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 8px; border: 2px solid var(--surface); }

.sx-group {
  position: sticky; top: -4px; z-index: 1; margin: 6px -6px 2px; padding: 8px 16px 6px;
  background: var(--surface); color: var(--text-tertiary);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.sx-group:first-child { margin-top: 0; }

.sx-opt {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; user-select: none; color: var(--text-primary);
}
.sx-opt.in-group { padding-left: 14px; }
.sx-opt.is-active { background: var(--surface-sunken); }
.sx-opt.is-selected { color: var(--blue-fg); font-weight: 600; background: var(--blue-bg); }
.sx-opt.is-selected.is-active { background: var(--tint-active); }
.sx-opt.is-disabled { cursor: not-allowed; opacity: .45; }
.sx-opt-icon { display: inline-flex; flex: none; }
.sx-opt-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-opt-meta { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-tertiary); font-size: var(--fs-xs); font-weight: 400; }
.sx-opt-check { flex: none; width: 16px; height: 16px; color: var(--blue-accent); visibility: hidden; }
.sx-opt.is-selected .sx-opt-check { visibility: visible; }
.sx-opt mark { background: none; color: var(--blue-accent); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.sx-empty { padding: 18px 12px; text-align: center; color: var(--text-tertiary); }

@media (max-width: 760px) {
  .sx-opt { min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .sx-panel, .sx-trigger .sx-chev, .select.sx-trigger { transition: none; }
}
