/* Reusable components ------------------------------------------------------ */

/* Card --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card--flat { box-shadow: none; }
.card--pad-lg { padding: 24px; }
.card--tint { background: var(--accent-soft, var(--surface-sunken)); border-color: var(--accent-line, var(--border)); }
.card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card__title { font-size: var(--fs-base); font-weight: 700; color: var(--ink-900); }
.card__head .card__title { margin-right: auto; }
.card__note { font-size: var(--fs-sm); color: var(--ink-400); }

/* Tile icon ---------------------------------------------------------------- */
.tile {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-soft, var(--purple-50));
  color: var(--accent, var(--purple-600));
}
.tile--lg { width: 56px; height: 56px; border-radius: var(--r-lg); }
.tile--sm { width: 34px; height: 34px; border-radius: var(--r-sm); }

/* Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-base); font-weight: 650;
  line-height: 1.2;
  transition: background .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.btn--primary { background: var(--purple-600); color: var(--white); box-shadow: var(--shadow-brand); }
.btn--primary:hover { background: var(--purple-700); }

.btn--ghost { background: var(--white); color: var(--ink-700); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn--ghost:hover { background: var(--ink-50); }

.btn--soft { background: var(--accent-soft, var(--purple-50)); color: var(--accent, var(--purple-700)); }
.btn--soft:hover { filter: brightness(.97); }

.btn--quiet { color: var(--ink-500); padding: 8px 10px; }
.btn--quiet:hover { background: var(--ink-50); color: var(--ink-800); }

.btn--lg { padding: 13px 24px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn--sm { padding: 7px 12px; font-size: var(--fs-sm); }
.btn--block { width: 100%; }

/* Circle action button (roadmap cards) */
.btn-circle {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--white);
  border: 1px solid var(--accent-line, var(--border-strong));
  color: var(--accent, var(--purple-600));
  box-shadow: var(--shadow-xs);
}
.btn-circle:hover { background: var(--accent-soft, var(--purple-50)); }

/* Pills / badges ----------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 700;
  background: var(--ink-50); color: var(--ink-500);
  white-space: nowrap;
}
.pill--purple { background: var(--purple-50); color: var(--purple-700); }
.pill--green  { background: var(--green-50);  color: var(--green-600); }
.pill--amber  { background: var(--amber-50);  color: var(--amber-600); }
.pill--blue   { background: var(--blue-50);   color: var(--blue-600); }
.pill--teal   { background: var(--teal-50);   color: var(--teal-600); }
.pill--red    { background: var(--red-50);    color: var(--red-500); }
.pill--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-500); }
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--ink-400); font-weight: 600;
}
.meta .icon { color: var(--ink-300); }
.metarow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Progress ----------------------------------------------------------------- */
.bar { height: 7px; border-radius: var(--r-full); background: var(--ink-100); overflow: hidden; }
.bar > span {
  display: block; height: 100%; border-radius: var(--r-full);
  background: var(--accent, var(--purple-600));
  transition: width .4s var(--ease);
}
.bar--lg { height: 10px; }

.ring { display: grid; place-items: center; position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring__track { stroke: var(--ink-100); }
.ring__value { stroke: var(--accent, var(--purple-600)); stroke-linecap: round; transition: stroke-dashoffset .5s var(--ease); }
.ring__label {
  position: absolute; display: grid; justify-items: center; line-height: 1.1;
}
.ring__num { font-size: var(--fs-lg); font-weight: 800; color: var(--ink-900); }
.ring__cap { font-size: var(--fs-xs); color: var(--ink-400); }

/* Stat card ---------------------------------------------------------------- */
.stat { display: flex; align-items: center; gap: 14px; }
.stat__body { min-width: 0; }
.stat__num { font-size: var(--fs-2xl); font-weight: 800; color: var(--ink-900); line-height: 1.15; letter-spacing: -.02em; }
.stat__label { font-size: var(--fs-sm); color: var(--ink-400); font-weight: 600; }
.stat__hint { font-size: var(--fs-xs); font-weight: 700; margin-top: 2px; }

/* Form controls ------------------------------------------------------------ */
.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-500); }
.field__hint { font-size: var(--fs-xs); color: var(--ink-400); }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--ink-800);
  font-size: var(--fs-base);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--purple-400);
  box-shadow: 0 0 0 3px var(--purple-100);
}
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237C789A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.textarea { resize: vertical; min-height: 180px; line-height: 1.7; }

/* Segmented control -------------------------------------------------------- */
.segmented {
  display: inline-flex; padding: 4px; gap: 4px;
  background: var(--ink-50);
  border-radius: var(--r-md);
  max-width: 100%;
  overflow-x: auto;
}
.segmented__btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-md); font-weight: 650;
  color: var(--ink-500);
  white-space: nowrap;
}
.segmented__btn:hover { color: var(--ink-800); }
.segmented__btn[aria-pressed="true"] { background: var(--purple-600); color: var(--white); box-shadow: var(--shadow-xs); }

/* Tabs --------------------------------------------------------------------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tabs__btn {
  padding: 10px 2px 12px;
  font-weight: 650; color: var(--ink-400);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs__btn:hover { color: var(--ink-700); }
.tabs__btn[aria-selected="true"] { color: var(--purple-700); border-bottom-color: var(--purple-600); }

/* Filter bar --------------------------------------------------------------- */
.filters {
  display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
}
.filters__group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.filters__label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-400); }

/* Table -------------------------------------------------------------------- */
.tablewrap { overflow-x: auto; border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th {
  text-align: left; font-weight: 700; color: var(--ink-400); font-size: var(--fs-sm);
  padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-sunken); }

/* Toast -------------------------------------------------------------------- */
.toasts {
  position: fixed; z-index: 90;
  right: 20px; bottom: 20px;
  display: grid; gap: 10px; justify-items: end;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--ink-900); color: var(--white);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-md);
  animation: toastIn .2s var(--ease);
  pointer-events: auto;
}
.toast--error { background: var(--red-600); }
.toast--success { background: var(--green-600); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* Modal -------------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(23, 20, 56, .42);
}
.modal__box {
  width: min(520px, 100%);
  max-height: min(86dvh, 720px);
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

/* Mi cuaderno: mas ancho que un dialogo de confirmar, porque lleva tabla. */
.nb { width: min(760px, 100%); }
.nb__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nb__headactions { display: inline-flex; align-items: center; gap: 4px; }
/* A pantalla completa sigue siendo una capa encima: la pagina del alumno se
   queda debajo, intacta, y al cerrar aparece donde estaba. */
.nb--full {
  width: 100%; max-width: none;
  height: 100%; max-height: none;
  border-radius: 0;
}
/* De borde a borde: el margen del modal es lo unico que quedaba entre el
   cuaderno y los bordes de la pantalla. */
.modal:has(.nb--full) { padding: 0; }
.nb--full .nb__body { padding-bottom: 8px; }
@media (min-width: 700px) {
  .nb--full .nb__form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nb--full .nb__field--wide { grid-column: auto; }
}
.nb__head h3 { display: flex; align-items: center; gap: 9px; }
.nb__tabs {
  display: flex; gap: 6px; margin-top: 16px;
  padding: 4px; border-radius: var(--r-full); background: var(--ink-50);
}
.nb__tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 12px;
  border-radius: var(--r-full);
  color: var(--ink-500); font-weight: 700; font-size: var(--fs-sm);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nb__tab:hover { color: var(--ink-800); }
.nb__tab[aria-selected="true"] { background: var(--white); color: var(--purple-700); box-shadow: var(--shadow-xs); }
.nb__body { margin-top: 18px; }
.nb__hint { margin-top: 12px; font-size: var(--fs-sm); }
.nb__pane { display: grid; gap: 18px; }
.nb__pane--empty { justify-items: center; text-align: center; padding: 26px 10px; }
.nb__form {
  display: grid; gap: 12px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nb__field--wide, .nb__formactions { grid-column: 1 / -1; }
.nb__formactions { display: flex; justify-content: flex-end; gap: 10px; }
.nb__search { margin-bottom: 4px; }
.nb__tablewrap { margin-top: 12px; }
.nb__table { width: 100%; }
/* Los botones de icono son cuadriculas, es decir, bloques: cada uno se ponia en
   su linea y la fila crecia el doble de lo que necesitaba. En linea, y algo mas
   pequenos que en una barra de herramientas, la fila mide lo que mide el texto. */
.nb__table td { vertical-align: middle; padding-top: 10px; padding-bottom: 10px; }
.nb__table .speakbtn,
.nb__table .iconbtn { display: inline-grid; vertical-align: middle; }
.nb__table .speakbtn { margin-right: 8px; }
.nb__table .iconbtn { width: 30px; height: 30px; }
.nb__note { color: var(--ink-500); }
.nb__actions { white-space: nowrap; text-align: right; width: 1%; }
.nb__none { color: var(--ink-400); }
.nb__none td { padding: 22px 12px; text-align: center; }
.nb__count { margin-top: 10px; font-size: var(--fs-sm); }
@media (max-width: 560px) {
  .nb__form { grid-template-columns: 1fr; }
}


/* Empty state -------------------------------------------------------------- */
.empty {
  display: grid; justify-items: center; gap: 10px;
  padding: 44px 24px; text-align: center;
  color: var(--ink-400);
}
.empty__title { font-size: var(--fs-lg); font-weight: 700; color: var(--ink-700); }
.empty__text { max-width: 44ch; font-size: var(--fs-md); }

/* Skeleton ----------------------------------------------------------------- */
.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--ink-50) 25%, var(--ink-100) 37%, var(--ink-50) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Checklist ---------------------------------------------------------------- */
.checklist { display: grid; gap: 10px; }
.checklist__item { display: flex; align-items: center; gap: 10px; font-size: var(--fs-md); color: var(--ink-500); }
.checklist__item[data-done="true"] { color: var(--ink-800); }
.checklist__mark { flex: none; color: var(--ink-200); }
.checklist__item[data-done="true"] .checklist__mark { color: var(--green-500); }

/* Callout ------------------------------------------------------------------ */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--accent-soft, var(--purple-50));
  color: var(--ink-700);
  font-size: var(--fs-md);
}
.callout .icon { color: var(--accent, var(--purple-600)); flex: none; margin-top: 1px; }
.callout strong { color: var(--ink-900); }

/* Divider ------------------------------------------------------------------ */
.hr { height: 1px; background: var(--border); border: 0; margin: 18px 0; }

/* Utilities ---------------------------------------------------------------- */
.stack { display: grid; gap: 12px; }
.stack--lg { gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.push { margin-left: auto; }
.muted { color: var(--ink-400); }
.small { font-size: var(--fs-sm); }
.strong { font-weight: 700; color: var(--ink-900); }
.center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 12px; }

/* Small pastel tags - the discreet way to state a number without a sentence */
.tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--green-50);
  border: 1px solid var(--green-100);
  color: var(--green-600);
  font-size: var(--fs-xs); font-weight: 700;
  white-space: nowrap;
}

/* Marca ------------------------------------------------------------------ */
/* Presente en la landing, el login, el onboarding y la app, asi que se
   define aqui: es la unica hoja que cargan las cuatro paginas. */
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark { width: 34px; height: 34px; flex: none; }
.brand__name {
  font-family: var(--font-brand); font-size: 1.15rem; font-weight: 700;
  color: #000; letter-spacing: -.015em;
}

/* Pantalla de apoyo (writing con senales de autolesion) --------------------- */
/* Sobria a proposito: ni alarma roja ni iconografia medica. Es una nota de la
   casa diciendo que aqui se para, no un diagnostico. */
.sup { width: min(540px, 100%); }
.sup__head { display: flex; align-items: center; gap: 10px; }
.sup__head h3 { font-size: var(--fs-lg); }
.sup__lead { margin-top: 12px; line-height: 1.6; }
.sup__lines { list-style: none; margin: 18px 0 14px; padding: 0; display: grid; gap: 10px; }
.sup__lines li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-sunken);
}
.sup__num {
  flex: none; min-width: 54px;
  font-size: var(--fs-lg); font-weight: 700; color: var(--blue-600);
  font-variant-numeric: tabular-nums;
}
.sup__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Constelacion de palabras ------------------------------------------------- */
/* El cielo va sobre el fondo del dashboard, con su mismo degradado: es la
   pagina la que se ve detras de las estrellas, no un panel aparte. */
.cons {
  position: relative;
  border-radius: var(--r-lg);
  background: var(--bg-app);
  background-image: var(--bg-app-accent);
  border: 1px solid var(--border);
  overflow: hidden;
}
.cons__sky { display: block; width: 100%; height: auto; }
.cons__slot { margin-top: 14px; }

/* Halo y nucleo. El halo es el pastel del area y el nucleo su tono hondo: sobre
   claro, un pastel solo se pierde y el punto deja de leerse. */
.cons__glow { opacity: .38; }
.cons__core { opacity: .95; }
.cons__link { stroke-width: 1; stroke-opacity: .3; }
.cons__label {
  font-size: 9.5px; font-weight: 800; letter-spacing: .09em;
}
.cons__count { font-size: 8.5px; font-weight: 600; fill: var(--ink-400); }

.cons__dot { cursor: pointer; }
.cons__dot:hover .cons__glow { opacity: .6; }
.cons__dot:hover .cons__core { r: 6; }

.cons__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 10px;
}

/* Popup: mas ancho que el cuaderno porque el cielo necesita sitio, y con los
   controles flotando sobre el cielo en vez de en una barra, que le robaria
   alto. Todos cuelgan de .cons__stage, que es el cielo: contra la caja, la
   leyenda acababa fuera de el. */
.cons__box { width: min(920px, 100%); padding: 16px; }
.cons__srtitle {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.cons__stage {
  position: relative;
  border-radius: var(--r-lg);
  background: var(--bg-app);
  background-image: var(--bg-app-accent);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cons__filters {
  position: absolute; z-index: 2; top: 12px; left: 12px;
  display: flex; flex-wrap: wrap; gap: 6px;
  max-width: calc(100% - 62px);       /* nunca por debajo del boton de cerrar */
}
.cons__filter {
  min-height: 30px; padding: 4px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: rgba(255, 255, 255, .82);
  color: var(--ink-500); font-size: var(--fs-sm); font-weight: 700;
  cursor: pointer; backdrop-filter: blur(4px);
}
.cons__filter[aria-pressed="true"] { background: var(--white); color: var(--purple-700); border-color: var(--purple-200); }
.cons__filter[aria-pressed="false"] { opacity: .6; }

.cons__close {
  position: absolute; z-index: 3; top: 12px; right: 12px;
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--r-full);
  background: rgba(255, 255, 255, .82); color: var(--ink-500);
  cursor: pointer; backdrop-filter: blur(4px);
}
.cons__close:hover { background: var(--white); color: var(--ink-800); }

.cons__legend {
  position: absolute; z-index: 2; top: 54px; right: 12px;
  display: grid; gap: 7px; margin: 0; padding: 10px 13px;
  list-style: none;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
  font-size: var(--fs-xs); font-weight: 700; color: var(--ink-500);
}
.cons__legend li { display: flex; align-items: center; gap: 9px; }
/* El tamano del circulo de la leyenda sale del mismo radio con el que se pinta
   cada escalon: si cambia uno, cambia el otro. */
.cons__key { flex: none; border-radius: 50%; background: var(--ink-300); }

.cons__zoom {
  position: absolute; z-index: 2; left: 12px; bottom: 12px;
  display: grid; gap: 4px;
}
.cons__zoom button {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .82); border: 1px solid var(--border-strong);
  color: var(--ink-500); cursor: pointer; backdrop-filter: blur(4px);
}
.cons__zoom button:hover { background: var(--white); color: var(--ink-800); }

/* La tarjeta del raton. Va dentro del cielo y no toca los eventos: si los
   tomara, aparecer debajo del cursor la cerraria al instante. */
.cons__card {
  position: absolute; z-index: 4; pointer-events: none;
  display: grid; gap: 2px;
  min-width: 128px; max-width: 230px; padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--white); border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.cons__cardterm { font-weight: 700; color: var(--ink-900); }
.cons__cardmean { color: var(--ink-500); font-size: var(--fs-sm); }
.cons__cardmeta {
  display: flex; align-items: center; gap: 6px; margin-top: 3px;
  color: var(--ink-400); font-size: var(--fs-xs); font-weight: 600;
}
.cons__cardarea { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.cons__note { margin-top: 10px; color: var(--ink-400); font-size: var(--fs-xs); }
.cons__wait, .cons__void { padding: 76px 20px; text-align: center; color: var(--ink-400); }
.cons__voidtitle { font-weight: 700; color: var(--ink-800); margin-bottom: 6px; }

/* En estrecho no caben los filtros arriba a la izquierda y la leyenda arriba a
   la derecha: se pisaban. La leyenda baja a la esquina libre y se pone en
   linea, que es donde hay sitio y donde no tapa el cielo. */
/* En estrecho la leyenda no se pinta: entre ella, los filtros y el zoom no
   quedaba cielo. Lo que decia sigue escrito debajo del cuadro, en la nota. */
@media (max-width: 620px) {
  .cons__filter { padding: 4px 10px; font-size: var(--fs-xs); }
  .cons__box { padding: 12px; }
}
