/* ============================================================================
   APPSHELL (rediseño de menú, 2026-10-05) — MARCO PERSISTENTE.
   #shell-nav = sidebar fija (fuera de #main-view). En body.shell-mode se oculta
   el chrome antiguo, el contenido de cada ruta carga a la derecha y los banners
   a sangre se ajustan al ancho del contenido. Identidad Mi Ruta.
   ============================================================================ */
:root { --as-navy:#0f1736; --as-ink:#1a2347; --as-muted:#687192; --as-coral:#ec3f68; --as-line:#e8eaf2; --as-bg:#f6f7fb; --as-nav-w:256px; }

/* Oculta el chrome antiguo dentro del shell (el pie SÍ se conserva, ver abajo) */
body.shell-mode #pro-strip,
body.shell-mode #app-header,
body.shell-mode #app-sidebar,
body.shell-mode .pro-strip { display: none !important; }
/* El botón flotante "Mi Ruta" SÍ se mantiene dentro del marco (profesional y usuario):
   permite montar una ruta rápida (demo a un alumno, o guardar un PDF al vuelo). */
body.shell-mode #app.app-shell { display: block; }
body.shell-mode #main-view {
  margin-left: var(--as-nav-w) !important; max-width: none !important; width: auto !important;
  padding: 0 !important; background: var(--as-bg); min-height: 100vh;
}
/* El pie de página se conserva en el marco (legal, contacto, manifiesto, valora…),
   desplazado a la derecha de la sidebar como el contenido. */
body.shell-mode #app-footer { margin-left: var(--as-nav-w) !important; }
/* Banners a sangre → ancho de contenido dentro del shell (no desbordan) */
body.shell-mode #main-view .catalog-head,
body.shell-mode #main-view .list-hero,
body.shell-mode #main-view .rp .list-hero {
  width: auto !important; margin-left: 0 !important; margin-right: 0 !important; border-radius: 0 !important;
  /* El padding a sangre usa calc((100vw-1200px)/2): en pantallas anchas supera el
     ancho del contenido dentro del marco y aplasta el texto. Lo fijamos a un valor
     normal relativo al contenido (no al viewport). */
  padding-left: clamp(20px, 3vw, 44px) !important;
  padding-right: clamp(20px, 3vw, 44px) !important;
}

/* ---- Sidebar fija ---- */
#shell-nav.ashell-side {
  position: fixed; left: 0; top: 0; z-index: 50; width: var(--as-nav-w); height: 100vh;
  display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--as-line); padding: 18px 14px;
}
.ashell-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 16px; }
.ashell-brand__mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg,var(--as-navy),#273463); color:#fff; display:grid; place-items:center; font-weight:800; font-size:13px; }
.ashell-brand__name { font-weight: 800; color: var(--as-navy); font-size: 1.05rem; }
.ashell-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.ashell-sec { display: flex; flex-direction: column; gap: 2px; }
.ashell-sec__t { padding: 6px 10px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #9aa2bd; }
.ashell-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--as-ink); font-weight: 600; font-size: 14.5px; transition: background .15s, color .15s; position: relative; }
.ashell-item:hover { background: #f1f3f9; }
.ashell-item.is-active { background: #fff1f5; color: var(--as-coral); }
.ashell-item.is-active::before { content:''; position:absolute; left:-14px; top:8px; bottom:8px; width:3px; border-radius:0 3px 3px 0; background: var(--as-coral); }
.ashell-item__i { width: 20px; height: 20px; display: grid; place-items: center; color: currentColor; flex: none; }
.ashell-item__i svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ashell-item.is-active .ashell-item__i svg { stroke: var(--as-coral); }
.ashell-item__t { min-width: 0; }
.ashell-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--as-coral,#ec3f68); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

.ashell-user { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 10px; border-top: 1px solid var(--as-line); }
.ashell-user__av { width: 34px; height: 34px; border-radius: 50%; background: #e7ecfb; color: var(--as-navy); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.ashell-user__meta { flex: 1; min-width: 0; line-height: 1.2; }
.ashell-user__meta b { display: block; font-size: 13.5px; color: var(--as-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ashell-user__meta small { color: var(--as-muted); font-size: 11.5px; }
.ashell-user__out { border: 0; background: none; color: var(--as-muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.ashell-user__out:hover { background: #f1f3f9; color: var(--as-coral); }
.ashell-user__out svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---- Contenido Inicio (greeting + apps) ---- */
.ashell-main { min-width: 0; }
.ashell-body { padding: clamp(24px,3.5vw,46px) clamp(20px,3vw,40px) 60px; max-width: 1180px; width: 100%; }
.ashell-hello h1 { margin: 0; font-size: clamp(1.7rem,3vw,2.3rem); font-weight: 800; color: var(--as-navy); letter-spacing: -.02em; }
.ashell-hello p { margin: 6px 0 0; color: var(--as-muted); font-size: 1.05rem; }
.ashell-group { margin-top: clamp(26px,3.4vw,40px); }
.ashell-group__t { margin: 0 0 14px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #9aa2bd; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.app-shortcut { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: 16px; background: #fff; border: 1px solid var(--as-line); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.app-shortcut:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(16,23,52,.08); border-color: transparent; }
.app-shortcut__i { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 8px; background: linear-gradient(135deg,#eef1fb,#e3e8f8); color: var(--as-navy); }
.app-shortcut__i svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-shortcut:hover .app-shortcut__i { background: linear-gradient(135deg,var(--as-coral),#c4214c); color: #fff; }
.app-shortcut__n { font-weight: 800; color: var(--as-ink); font-size: 15px; }
.app-shortcut__m { color: var(--as-muted); font-size: 12.5px; line-height: 1.4; }

/* KPIs + acciones rápidas (panel profesional) */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: clamp(20px,2.6vw,30px); }
.kpi { background: #fff; border: 1px solid var(--as-line); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 3px; }
.kpi b { font-size: 1.9rem; font-weight: 800; color: var(--as-navy); line-height: 1; }
.kpi span { color: var(--as-muted); font-size: 13px; font-weight: 600; }
.quick-row { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-act { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--as-ink); font-weight: 700; font-size: 14px; background: #fff; border: 1px solid var(--as-line); border-radius: 11px; padding: 10px 16px; transition: border-color .15s, color .15s; }
.quick-act span { color: var(--as-coral); font-weight: 900; font-size: 16px; }
.quick-act:hover { border-color: var(--as-coral); color: var(--as-coral); }

/* Botón móvil para abrir/cerrar la sidebar */
#shell-burger { display: none; position: fixed; z-index: 70; left: 12px; top: 12px; width: 42px; height: 42px; border: 1px solid var(--as-line); background: #fff; border-radius: 11px; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgba(16,23,52,.12); }
#shell-burger svg { width: 20px; height: 20px; stroke: var(--as-navy); fill: none; stroke-width: 2; }

/* ---- Responsive ---- */
@media (max-width: 1100px) { .app-grid { grid-template-columns: repeat(auto-fill, minmax(170px,1fr)); } .kpi-row { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 860px) {
  body.shell-mode #main-view { margin-left: 0 !important; padding-top: 60px !important; }
  #shell-nav.ashell-side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 20px 50px rgba(8,12,30,.28); }
  body.shell-nav-open #shell-nav.ashell-side { transform: translateX(0); }
  body.shell-nav-open::after { content:''; position: fixed; inset: 0; background: rgba(8,12,30,.4); z-index: 45; }
  body.shell-mode #shell-burger { display: grid; }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Dentro del shell: fuera el breadcrumb viejo (la navegación es por la sidebar) */
body.shell-mode #main-view .breadcrumb { display: none !important; }

/* El botón flotante de accesibilidad (.a11y-fab, left:16px) se solapa con la
   sidebar fija del shell. Dentro del shell lo desplazamos a la derecha de la
   sidebar (zona de contenido). En móvil la sidebar es un drawer y #main-view
   vuelve a margin-left:0, así que el botón se queda en su sitio. */
body.shell-mode .a11y-fab { left: calc(var(--as-nav-w) + 16px) !important; }
body.shell-mode .a11y-panel { left: calc(var(--as-nav-w) + 16px) !important; }
@media (max-width: 860px) {
  body.shell-mode .a11y-fab { left: 16px !important; }
  body.shell-mode .a11y-panel { left: 16px !important; }
}

/* Créditos de IA del usuario en el sidebar (saldo del mes, respeta topes) */
.ashell-credits { display: flex; align-items: center; gap: 7px; margin: 10px 2px 4px; padding: 9px 12px; border-radius: 11px;
  background: #fff4f7; border: 1px solid #ffd9e3; text-decoration: none; color: var(--as-coral); font-weight: 800; font-size: 13px; }
.ashell-credits svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.ashell-credits b { font-weight: 900; }
.ashell-credits__lab { color: #c4214c; font-size: 11px; letter-spacing: .05em; }
.ashell-credits__txt { color: var(--as-muted); font-weight: 600; margin-left: auto; font-size: 11.5px; }

/* "Mi plan" */
.plan-cards { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; margin-top: clamp(18px,2.4vw,28px); }
.plan-card { background: #fff; border: 1px solid var(--as-line); border-radius: 16px; padding: 22px 24px; }
.plan-card__t { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #9aa2bd; }
.plan-card__v { display: block; margin: 8px 0 6px; font-size: 1.7rem; font-weight: 800; color: var(--as-navy); line-height: 1; }
.plan-card__m { color: var(--as-muted); font-size: 13px; line-height: 1.5; margin: 0; }
.plan-card__cta { display: inline-block; margin-top: 12px; color: var(--as-coral); font-weight: 800; font-size: 13.5px; text-decoration: none; }
.plan-sub { background: #fff; border: 1px solid var(--as-line); border-radius: 16px; padding: 22px 24px; }
.plan-sub__empty { color: var(--as-muted); font-size: 14px; margin: 0; }
.plan-sub__empty a { color: var(--as-coral); font-weight: 800; text-decoration: none; }
.plan-sub__grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 16px 24px; }
.plan-sub__grid span { display: block; color: #9aa2bd; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.plan-sub__grid b { color: var(--as-ink); font-size: 15px; }
.plan-sub__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.plan-sub__note { margin: 14px 0 0; color: var(--as-muted); font-size: 12px; }
@media (max-width: 860px) { .plan-cards { grid-template-columns: 1fr; } }

/* ---- Contenido de cuenta/configuración dentro del shell: limpio y sin duplicar
        lo que ya está en la sidebar (créditos, salir) ni en las apps del menú. ---- */
body.shell-mode #main-view .cuenta-page.page-card,
body.shell-mode #main-view .pro-config-block.page-card,
body.shell-mode #main-view .pro-config-block {
  background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important;
  padding: clamp(22px,3.5vw,42px) clamp(20px,3vw,40px) 60px !important; max-width: 1180px; margin: 0 auto;
}
body.shell-mode #main-view .cuenta-hero,
body.shell-mode #main-view .cuenta-hero--in {
  background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important;
  padding: 0 !important; min-height: 0 !important; margin-bottom: 16px !important;
}
body.shell-mode #main-view [data-account-signout] { display: none !important; } /* la sidebar ya tiene "Salir" */
body.shell-mode #main-view .espacio-creditos { display: none !important; }      /* ya están en el sidebar + Mi plan */
body.shell-mode #main-view .espacio-tools { display: none !important; }         /* duplicado por las apps del menú */

/* ---- "Herramientas de orientación" (#/profesional) dentro del shell: aplanar la
        caja y ocultar los botones/encabezado que ya están en el sidebar. ---- */
body.shell-mode #main-view .pro-dashboard.page-card,
body.shell-mode #main-view .pro-access.page-card,
body.shell-mode #main-view .inst-panel.page-card {
  background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important;
  padding: clamp(22px,3.5vw,42px) clamp(20px,3vw,40px) 60px !important; max-width: 1180px; margin: 0 auto;
}
body.shell-mode #main-view .pro-dashboard-head {
  background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; margin-bottom: 16px !important;
}
body.shell-mode #main-view .pro-dashboard-head-actions { display: none !important; } /* Contacto/Config/Cerrar sesión ya en el sidebar */

/* ---- "Gestión" (grupos + personas + buzón en una ventana) ---- */
.gestion-loading { color: var(--as-muted); padding: 20px 0; }
.seg-tabs { display: inline-flex; gap: 4px; background: #eef1f8; border-radius: 12px; padding: 4px; margin-top: clamp(18px,2.4vw,26px); }
.seg-tab { border: 0; background: none; padding: 8px 16px; border-radius: 9px; font: 700 14px 'Plus Jakarta Sans',system-ui,sans-serif; color: var(--as-muted); cursor: pointer; }
.seg-tab.is-active { background: #fff; color: var(--as-navy); box-shadow: 0 2px 8px rgba(16,23,52,.08); }
.gestion-panel { margin-top: 22px; }
.gestion-create { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.gestion-create input { flex: 1; min-width: 160px; border: 1px solid var(--as-line); border-radius: 11px; padding: 10px 14px; font: 500 14px 'Plus Jakarta Sans',system-ui,sans-serif; background: #fff; }
.gestion-create--sm { margin: 14px 0 0; }
.gestion-list { display: flex; flex-direction: column; gap: 10px; }
.gestion-row { background: #fff; border: 1px solid var(--as-line); border-radius: 14px; overflow: hidden; }
.gestion-row__head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px 18px; border: 0; background: none; cursor: pointer; text-align: left; }
.gestion-row__head b { color: var(--as-ink); font-size: 15px; }
.gestion-row__meta { color: var(--as-muted); font-size: 13px; }
.gestion-row__chev { margin-left: auto; color: var(--as-muted); transition: transform .2s; }
.gestion-row.is-open .gestion-row__chev { transform: rotate(180deg); }
.gestion-row__body { padding: 0 18px 18px; border-top: 1px solid var(--as-line); }
.gestion-alumnos { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.gestion-alumnos li { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f1f3f9; }
.ga-datos { flex-basis: 100%; width: 100%; margin-top: 6px; padding: 16px 18px; background: #f7f8fc; border: 1px solid var(--as-line, #e8eaf2); border-radius: 12px; }
.ga-name { font-weight: 700; color: var(--as-ink); font-size: 14px; }
.ga-state { color: var(--as-muted); font-size: 12.5px; }
.ga-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ga-link { border: 0; background: none; color: var(--as-coral); font-weight: 700; font-size: 12.5px; cursor: pointer; }
.ga-del { border: 0; background: none; color: #aab; font-size: 18px; cursor: pointer; line-height: 1; }
.ga-del:hover { color: var(--as-coral); }
.gestion-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--as-line); border-radius: 14px; overflow: hidden; }
.gestion-table th { text-align: left; padding: 12px 16px; background: #f6f7fb; color: var(--as-muted); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.gestion-table td { padding: 12px 16px; border-top: 1px solid #f1f3f9; color: var(--as-ink); font-size: 14px; }
.gestion-inbox { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.gestion-inbox li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f3f9; }
.gi-tipo { background: #eef1fb; color: var(--as-navy); border-radius: 7px; padding: 3px 9px; font-size: 11px; font-weight: 800; }
.gi-date { color: var(--as-muted); font-size: 12.5px; margin-left: auto; }
.gestion-inbox a { color: var(--as-coral); font-weight: 700; text-decoration: none; font-size: 13px; }
.gestion-empty { color: var(--as-muted); background: #fff; border: 1px dashed var(--as-line); border-radius: 14px; padding: 22px; text-align: center; }
.gestion-empty--sm { padding: 14px; margin: 12px 0 0; }
.gestion-note { color: var(--as-muted); font-size: 13px; margin: 0 0 14px; }
.gestion-note a { color: var(--as-coral); font-weight: 700; text-decoration: none; }
