/* ==========================================================================
   Componentes reutilizables
   ========================================================================== */

/* ── Botones ── */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 650;
  font-size: var(--fs-sm);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2);
}
.btn:hover { color: var(--btn-fg); background: color-mix(in srgb, var(--btn-bg) 92%, var(--ink)); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-bd: transparent; box-shadow: var(--shadow-brand); }
.btn-primary:hover { --btn-bg: var(--brand-strong); background: var(--brand-strong); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { --btn-bg: var(--brand-soft); --btn-fg: var(--brand-text); --btn-bd: transparent; }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--brand) 12%); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: var(--on-danger); --btn-bd: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-sm { min-height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn-lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--fs-base); }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--btn-fg);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  position: relative;
  transition: background var(--dur-2), color var(--dur-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--coral);
  color: #1b0f0b;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--surface);
}

/* ── Formularios ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.field .error-text { font-size: var(--fs-xs); color: var(--danger); font-weight: 600; display: flex; gap: 4px; align-items: center; }
.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--dur-2), box-shadow var(--dur-2), background var(--dur-2);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23646284' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line-strong)); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
.input[aria-invalid='true'], .select[aria-invalid='true'], .textarea[aria-invalid='true'] { border-color: var(--danger); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > svg { position: absolute; left: 13px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.input-group > .input { padding-left: 40px; }
.input-group > .input-action { position: absolute; right: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }

.check { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-sm); min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.switch { position: relative; display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch .track { width: 44px; height: 26px; border-radius: 13px; background: var(--surface-3); position: relative; transition: background var(--dur-2); flex: none; }
.switch .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-2) var(--ease-spring); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

.segmented { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill); gap: 2px; flex-wrap: wrap; }
.segmented button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 7px 14px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); min-height: 34px; }
.segmented button[aria-pressed='true'], .segmented button[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── Tarjetas ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
.card-flat { box-shadow: none; }
.card-hover { transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: var(--fs-md); }
.card-title { display: flex; align-items: center; gap: var(--sp-2); }
.card-title svg { width: 20px; height: 20px; color: var(--brand-text); }
.card-link { color: inherit; text-decoration: none; display: block; }
.card-link:hover { color: inherit; }

/* Tarjeta de curso con franja de color */
.course-card { position: relative; overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.course-card .cover {
  height: 92px;
  background: var(--course, var(--brand));
  position: relative;
  overflow: hidden;
}
.course-card .cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.35) 0 18%, transparent 19%),
    radial-gradient(circle at 70% 120%, rgba(255, 255, 255, 0.18) 0 35%, transparent 36%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 8px, transparent 8px 18px);
}
.course-card .cover .subject { position: absolute; left: var(--sp-5); bottom: var(--sp-3); color: #fff; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.course-card .body { padding: var(--sp-4) var(--sp-5) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.course-card h3 { margin: 0; font-size: var(--fs-md); }

/* ── Indicadores ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.5;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-coral { background: var(--coral-soft); color: var(--coral-strong); }
.badge-mint { background: var(--mint-soft); color: var(--mint-strong); }
.badge-sun { background: var(--sun-soft); color: var(--sun-strong); }
.badge-outline { background: transparent; border: 1px solid var(--line-strong); }
/* Resultado académico: color + símbolo + texto (el color por sí solo no comunica el nivel). */
.grade-chip {
  --gc: var(--grade-none); --gc-bg: var(--grade-none-soft);
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: var(--r-pill);
  background: var(--gc-bg); color: var(--gc); font-size: var(--fs-xs); font-weight: 750; line-height: 1.6; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--gc) 35%, transparent);
}
.grade-chip::before { content: '–'; font-size: 0.8em; }
.grade-chip .gc-val { font-weight: 800; }
.grade-chip .gc-lbl { font-weight: 650; opacity: 0.95; }
.grade-chip[data-band='low'] { --gc: var(--grade-low); --gc-bg: var(--grade-low-soft); }
.grade-chip[data-band='low']::before { content: '▼'; }
.grade-chip[data-band='basic'] { --gc: var(--grade-basic); --gc-bg: var(--grade-basic-soft); }
.grade-chip[data-band='basic']::before { content: '◆'; }
.grade-chip[data-band='high'] { --gc: var(--grade-high); --gc-bg: var(--grade-high-soft); }
.grade-chip[data-band='high']::before { content: '▲'; }
.grade-chip[data-band='top'] { --gc: var(--grade-top); --gc-bg: var(--grade-top-soft); }
.grade-chip[data-band='top']::before { content: '★'; }
.grade-text[data-band='low'] { color: var(--grade-low); }
.grade-text[data-band='basic'] { color: var(--grade-basic); }
.grade-text[data-band='high'] { color: var(--grade-high); }
.grade-text[data-band='top'] { color: var(--grade-top); }
.badge-demo { background: repeating-linear-gradient(135deg, var(--sun-soft) 0 6px, transparent 6px 12px); color: var(--sun-strong); border: 1px dashed var(--sun-strong); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
}
.chip[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:hover { border-color: var(--brand); color: var(--ink); }
.chip[aria-pressed='true']:hover { color: var(--bg); }

.dot-color { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--brand)); flex: none; display: inline-block; }

/* ── Avatares ── */
.avatar {
  --size: 36px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--c, var(--brand));
  color: #fff;
  font-weight: 750;
  font-size: calc(var(--size) * 0.38);
  font-family: var(--font-display);
  letter-spacing: 0;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.avatar-sm { --size: 28px; }
.avatar-lg { --size: 56px; }
.avatar-xl { --size: 84px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ── Progreso ── */
.progress { height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--value, 0%); background: var(--bar, var(--brand)); border-radius: inherit; transition: width var(--dur-3) var(--ease); }
.ring { --size: 72px; --stroke: 8px; position: relative; width: var(--size); height: var(--size); flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: var(--ring-color, var(--brand)); stroke-linecap: round; transition: stroke-dashoffset 900ms var(--ease); }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 750; font-size: calc(var(--size) * 0.24); }

/* ── Tiles de métricas ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-4); }
.stat {
  position: relative;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
}
.stat .stat-label { padding-right: 44px; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .stat-label svg { width: 16px; height: 16px; }
.stat .stat-value { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 750; line-height: 1.1; margin-top: 6px; letter-spacing: -0.02em; }
.stat .stat-foot { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.stat .stat-icon { position: absolute; right: var(--sp-4); top: var(--sp-4); width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--tile, var(--brand-soft)); color: var(--tile-ink, var(--brand)); }
.stat .stat-icon svg { width: 20px; height: 20px; }

/* ── Listas ── */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.list-item + .list-item { border-top: 1px solid var(--line); }
a.list-item:hover, button.list-item:hover { background: var(--surface-2); color: inherit; }
button.list-item { width: 100%; border: 0; background: none; text-align: left; }
.list-item .meta { margin-left: auto; text-align: right; flex: none; }
.list-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--tile, var(--brand-soft)); color: var(--tile-ink, var(--brand)); flex: none; }
.list-icon svg { width: 19px; height: 19px; }

/* ── Tablas ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 700; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; padding: 12px 14px; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-sticky-first th:first-child, .table-sticky-first td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.table-sticky-first th:first-child { background: var(--surface-2); z-index: 2; }

/* ── Pestañas ── */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--sp-6); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  border: 0;
  background: none;
  padding: var(--sp-3) var(--sp-4);
  color: var(--muted);
  font-weight: 650;
  font-size: var(--fs-sm);
  white-space: nowrap;
  text-decoration: none;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'] { color: var(--ink); }
.tab[aria-selected='true']::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  animation: fade-in var(--dur-2) var(--ease);
}
.modal {
  width: min(560px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: pop-in var(--dur-3) var(--ease-spring);
  display: flex;
  flex-direction: column;
}
.modal-lg { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6) var(--sp-3); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; font-size: var(--fs-lg); }
.modal-body { padding: var(--sp-2) var(--sp-6) var(--sp-6); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }

/* ── Notificaciones flotantes ── */
.toast-region { position: fixed; z-index: 300; right: var(--sp-4); bottom: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  animation: toast-in var(--dur-3) var(--ease-spring);
}
.toast svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.toast.success svg { color: var(--accent); }
.toast.error svg { color: #ff9a8a; }
.toast.xp svg { color: var(--sun); }
.toast .toast-close { margin-left: auto; background: none; border: 0; color: inherit; opacity: 0.7; padding: 0 4px; }
.toast.leaving { animation: toast-out var(--dur-2) var(--ease) forwards; }

/* ── Estados vacíos y de error ── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-6);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--grain) 0 0 / 14px 14px, color-mix(in srgb, var(--surface) 70%, transparent);
}
.empty .illus { width: 132px; height: 104px; }
.empty h3 { margin: 0; font-size: var(--fs-md); }
.empty p { margin: 0; color: var(--muted); max-width: 46ch; font-size: var(--fs-sm); }
.empty-compact { padding: var(--sp-6); }
.empty-compact .illus { width: 88px; height: 70px; }

.alert { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--info-soft); color: var(--ink); font-size: var(--fs-sm); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.alert svg { width: 20px; height: 20px; flex: none; color: var(--brand-text); margin-top: 1px; }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-warning svg { color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-danger svg { color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-success svg { color: var(--success); }

/* ── Esqueletos de carga ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-card { height: 140px; border-radius: var(--r-lg); }

/* ── Menús desplegables ── */
.menu {
  position: absolute;
  z-index: 150;
  min-width: 240px;
  padding: var(--sp-2);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: pop-in var(--dur-2) var(--ease);
}
.menu a, .menu button {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  min-height: 40px;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--ink); }
.menu svg { width: 18px; height: 18px; color: var(--muted); }
.menu hr { margin: var(--sp-2) 0; }

/* ── Tooltip de gráficos ── */
.viz-tooltip {
  position: fixed;
  z-index: 400;
  pointer-events: none;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-xs);
  line-height: 1.45;
  box-shadow: var(--shadow-md);
  max-width: 240px;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity var(--dur-1);
}
.viz-tooltip strong { display: block; font-size: var(--fs-sm); }
.viz-tooltip .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ── Archivos ── */
.file-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.file-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.file-item .file-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-6);
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-md);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--dur-2), background var(--dur-2);
}
.dropzone:hover, .dropzone.dragging { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.dropzone svg { width: 28px; height: 28px; color: var(--brand-text); }

/* ── Kanban (proyectos) ── */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-2); }
.kanban-col { background: var(--surface-2); border-radius: var(--r-lg); padding: var(--sp-3); min-height: 200px; display: flex; flex-direction: column; gap: var(--sp-2); }
.kanban-col.drop-target { outline: 2px dashed var(--brand); outline-offset: -4px; }
.kanban-col h3 { font-size: var(--fs-sm); display: flex; align-items: center; justify-content: space-between; margin: var(--sp-1) var(--sp-2) var(--sp-2); }
.task-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); box-shadow: var(--shadow-xs); cursor: grab; display: flex; flex-direction: column; gap: var(--sp-2); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.5; }

/* ── Chat (Space AI) ── */
.bubble { max-width: min(760px, 92%); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); line-height: 1.6; overflow-wrap: anywhere; }
.bubble-user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bubble-ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

/* ── Etiquetas de estado de competencia (color + icono + texto) ── */
.mastery { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--fs-xs); padding: 3px 10px 3px 6px; border-radius: var(--r-pill); }
.mastery svg { width: 15px; height: 15px; }
.mastery-mastered { background: color-mix(in srgb, var(--status-good) 16%, transparent); color: color-mix(in srgb, var(--status-good) 70%, var(--ink)); }
.mastery-developing { background: color-mix(in srgb, var(--status-warn) 22%, transparent); color: color-mix(in srgb, var(--status-warn) 45%, var(--ink)); }
.mastery-practice { background: color-mix(in srgb, var(--status-critical) 15%, transparent); color: color-mix(in srgb, var(--status-critical) 75%, var(--ink)); }
.mastery-none { background: var(--surface-2); color: var(--muted); }

/* ── Gráficos ── */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis text, .chart text.axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .baseline { stroke: var(--chart-axis); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--ink-2); margin-top: var(--sp-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }
