/* Portal, encuesta y panel docente · Excel en Modo IA */
:root {
  --ink: #14261F; --paper: #F5F3EC; --sage: #E9EDE4; --card: #FDFCF8; --line: #DCDDD3;
  --green: #1F7A4D; --green-soft: #E3F0E7; --amber: #E8A33D; --amber-soft: #FBEBD0;
  --muted: #46554E; --soft: #5E6A64; --danger: #B3261E;
  --display: 'Bricolage Grotesque', 'DM Sans', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
  --shadow: 0 1px 2px rgba(20, 38, 31, .05), 0 10px 30px rgba(20, 38, 31, .06);
  --spring-ease: cubic-bezier(.2, .8, .2, 1); --spring-dur: 700ms;
  --snap-ease: cubic-bezier(.2, .8, .2, 1); --snap-dur: 380ms;
  --bounce-ease: cubic-bezier(.34, 1.5, .64, 1); --bounce-dur: 600ms;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
main { flex: 1; }
a { color: var(--green); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.015em; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 8px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 680px; }
.i16 { width: 16px; height: 16px; flex: none; }
.i20 { width: 20px; height: 20px; flex: none; }
.i24 { width: 24px; height: 24px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barra superior translúcida */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(245, 243, 236, .72); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-bottom: 1px solid rgba(20, 38, 31, .07); }
.topbar-in { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 18px var(--display); letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-sub { font-size: 14px; color: var(--soft); padding-left: 12px; border-left: 1px solid var(--line); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topnav a, .linkbtn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; color: var(--muted); font: 600 14px var(--body); text-decoration: none; background: none; border: 0; cursor: pointer; transition: background .2s, transform .1s; }
.topnav a:hover, .linkbtn:hover { background: rgba(20, 38, 31, .06); }
.topnav a:active, .linkbtn:active { transform: scale(.96); }
.inline { display: inline; margin: 0; }
@media (max-width: 640px) { .brand-sub { display: none; } .topnav span { display: none; } }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 0; background: var(--ink); color: var(--paper); font: 600 15px var(--body); text-decoration: none; cursor: pointer; transition: transform .1s ease, background .2s, opacity .2s, box-shadow .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn.amber { background: var(--amber); color: var(--ink); }
.btn.green { background: var(--green); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: rgba(20, 38, 31, .04); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px #E8C4C1; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.block { width: 100%; }

/* Portal del estudiante */
.hero { padding: 72px 0 28px; }
.eyebrow { margin: 0; font: 700 13px/1.2 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.display { margin: 14px 0 16px; font: 800 clamp(44px, 8vw, 84px)/.98 var(--display); letter-spacing: -.035em; }
.display em { font-style: normal; color: var(--amber); }
.lead { margin: 0; max-width: 620px; font-size: clamp(17px, 2.3vw, 20px); color: var(--muted); }
.sessions { display: grid; gap: 16px; padding: 20px 0 96px; }
.scard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 28px; box-shadow: var(--shadow); }
.scard.locked { background: transparent; box-shadow: none; border-style: dashed; color: var(--soft); }
.scard-head { display: flex; gap: 16px; align-items: flex-start; }
.snum { font: 800 44px/1 var(--display); color: var(--green); letter-spacing: -.03em; min-width: 46px; }
.locked .snum { color: #B9BDB3; }
.stitle { margin: 2px 0 6px; font: 700 clamp(21px, 3vw, 26px)/1.15 var(--display); }
.sdesc { margin: 0; color: var(--muted); }
.locked .sdesc, .locked .stitle { color: var(--soft); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font: 700 12px/1.4 var(--body); letter-spacing: .04em; text-transform: uppercase; background: var(--green-soft); color: #1B6B43; white-space: nowrap; }
.pill.wait { background: #ECEAE2; color: var(--soft); }
.pill.live { background: var(--amber-soft); color: #7A4E0B; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live .dot { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(232, 163, 61, .7); } 70%, 100% { box-shadow: 0 0 0 8px rgba(232, 163, 61, 0); } }
.scard-pills { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.files { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.file { display: flex; align-items: center; gap: 14px; height: 100%; padding: 14px 16px; border-radius: 18px; background: var(--paper); color: var(--ink); text-decoration: none; transition: background .2s, transform .12s ease; }
.file:hover { background: #EDEAE1; }
.file:active { transform: scale(.985); }
.ficon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--green-soft); color: var(--green); }
.ficon.pdf { background: var(--amber-soft); color: #8A560C; }
.ficon.sol { background: #E4E8F3; color: #33457A; }
.fbody { min-width: 0; }
.fname { display: block; font-weight: 700; line-height: 1.3; }
.fdesc { display: block; font-size: 14px; color: var(--soft); line-height: 1.35; }
.fget { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: var(--green); font-size: 12px; }
.fget small { color: var(--soft); white-space: nowrap; }
.survey-cta { margin-top: 18px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--ink); color: var(--paper); text-decoration: none; transition: transform .12s ease; }
.survey-cta:active { transform: scale(.985); }
.survey-cta b { display: block; }
.survey-cta span { font-size: 14px; color: #C9D6CF; }
.survey-cta .i24 { color: var(--amber); }
.survey-cta .arrow { margin-left: auto; }
.empty-note { margin: 18px 0 0; font-size: 15px; color: var(--soft); }
.sitefoot { padding: 28px 0 40px; font-size: 14px; color: var(--soft); border-top: 1px solid rgba(20, 38, 31, .06); }

/* Entrada escalonada con resorte (portal y panel) */
.rise { opacity: 0; transform: translate3d(0, 18px, 0); animation: rise var(--spring-dur) var(--spring-ease) forwards; animation-delay: calc(var(--i, 0) * 70ms + 60ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* Encuesta */
.survey { width: 100%; max-width: 640px; margin: 0 auto; padding: 32px 20px 140px; }
.survey h1 { margin: 10px 0 6px; font: 800 clamp(30px, 6vw, 40px)/1.05 var(--display); letter-spacing: -.03em; }
.survey .lead { font-size: 17px; }
fieldset.qcard { min-width: 0; }
.qcard { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 22px; margin: 14px 0; transition: border-color .3s, box-shadow .3s; }
.qcard.done { border-color: #B7D9C3; box-shadow: 0 0 0 3px rgba(31, 122, 77, .06); }
.qhead { display: flex; align-items: center; gap: 10px; }
.qnum { font: 700 12px var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.qok { width: 20px; height: 20px; color: var(--green); opacity: 0; transform: scale(.4); transition: opacity .2s, transform var(--bounce-dur) var(--bounce-ease); }
.qcard.done .qok { opacity: 1; transform: none; }
.qtext { margin: 6px 0 16px; font: 700 20px/1.25 var(--display); letter-spacing: -.01em; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale input, .opts input { position: absolute; opacity: 0; pointer-events: none; }
.scale label { display: grid; place-items: center; height: 58px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font: 700 21px var(--display); cursor: pointer; transition: transform .1s ease, background .2s, color .2s, box-shadow .2s; user-select: none; }
.scale label:active, .opts label:active { transform: scale(.94); }
.scale input:checked + label { background: var(--ink); color: var(--paper); box-shadow: none; transform: scale(1.04); transition: transform var(--bounce-dur) var(--bounce-ease), background .2s, color .2s; }
.scale input:focus-visible + label, .opts input:focus-visible + label { outline: 3px solid var(--amber); outline-offset: 2px; }
.legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--soft); }
.opts { display: grid; gap: 8px; }
.opts label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 16px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font-weight: 500; transition: transform .1s ease, background .2s, box-shadow .2s; user-select: none; }
.opts label::before { content: ''; width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px #C9CCC2; transition: box-shadow var(--snap-dur) var(--snap-ease); }
.opts input:checked + label { background: var(--green-soft); box-shadow: inset 0 0 0 2px var(--green); }
.opts input:checked + label::before { box-shadow: inset 0 0 0 6px var(--green); }
textarea, input[type=password], input[type=text] { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; transition: border-color .2s, box-shadow .2s; }
textarea { min-height: 96px; resize: vertical; }
textarea:focus, input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(31, 122, 77, .12); }
.hint { font-size: 13px; color: var(--soft); margin-top: 6px; }
.sbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: rgba(245, 243, 236, .78); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-top: 1px solid rgba(20, 38, 31, .07); }
.sbar-in { max-width: 600px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.prog { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--soft); }
.prog-track { height: 6px; border-radius: 99px; background: #E0DED5; overflow: hidden; }
.prog-track i { display: block; height: 100%; background: var(--green); transform-origin: left; transform: scaleX(0); transition: transform var(--spring-dur) var(--spring-ease); }
.state { text-align: center; padding: 88px 20px 120px; max-width: 520px; margin: 0 auto; }
.state h1 { margin: 22px 0 10px; font: 800 clamp(30px, 6vw, 40px)/1.05 var(--display); letter-spacing: -.03em; }
.state p { color: var(--muted); }
.badge-ok { width: 88px; height: 88px; margin: 0 auto; border-radius: 50%; background: var(--green); display: grid; place-items: center; animation: pop var(--bounce-dur) var(--bounce-ease) both; }
.badge-ok svg { width: 44px; height: 44px; color: #fff; stroke-width: 2.6; }
.badge-ok path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s ease-out .25s forwards; }
.badge-wait { width: 88px; height: 88px; margin: 0 auto; border-radius: 50%; background: #ECEAE2; color: var(--soft); display: grid; place-items: center; }
.badge-wait svg { width: 40px; height: 40px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.alert { padding: 14px 16px; border-radius: 14px; background: #FBE9E7; color: #8C1D18; font-size: 15px; margin: 12px 0; }
.ok-msg { padding: 14px 16px; border-radius: 14px; background: var(--green-soft); color: #1B6B43; font-size: 15px; margin: 12px 0; }

/* Formularios del panel */
.authbox { width: 100%; max-width: 420px; margin: 72px auto 96px; padding: 0 20px; }
.authcard { background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 32px; box-shadow: var(--shadow); }
.authcard h1 { margin: 16px 0 6px; font: 800 30px/1.1 var(--display); letter-spacing: -.03em; }
.authcard p { margin: 0 0 20px; color: var(--muted); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

/* Panel docente */
.admin-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 44px 0 20px; }
.admin-head h1 { margin: 6px 0 0; font: 800 clamp(32px, 5vw, 46px)/1.02 var(--display); letter-spacing: -.03em; }
.admin-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.agrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); padding-bottom: 80px; }
.acard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 24px; box-shadow: var(--shadow); }
.acard h2 { margin: 4px 0 4px; font: 700 22px/1.15 var(--display); }
.acard .sdesc { font-size: 15px; }
.trow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.trow:first-of-type { margin-top: 16px; }
.trow b { display: block; font-size: 15px; }
.trow small { display: block; font-size: 13px; color: var(--soft); line-height: 1.35; }
.switch { position: relative; margin-left: auto; width: 52px; height: 32px; flex: none; border-radius: 999px; border: 0; padding: 0; background: #D6D4CB; cursor: pointer; transition: background .25s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .04); transition: transform var(--snap-dur) var(--snap-ease), width .15s ease; }
.switch:active::after { width: 32px; }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch[aria-checked="true"]:active::after { transform: translateX(14px); }
.switch:disabled { opacity: .4; cursor: not-allowed; }
.abtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; }
.linkbox { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--paper); font: 500 13px var(--mono); color: var(--muted); }
.linkbox span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbox .btn { margin-left: auto; }
.mini-stats { display: flex; gap: 18px; margin-top: 14px; font-size: 14px; color: var(--soft); }
.mini-stats b { display: block; font: 800 24px/1.1 var(--display); color: var(--ink); }

/* Resultados */
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 20px; }
.kpi small { display: block; font-weight: 600; color: var(--soft); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.kpi b { display: block; margin-top: 6px; font: 800 44px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi b span { font-size: 20px; color: var(--soft); }
.hist { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; align-items: end; height: 64px; margin-top: 14px; }
.hist i { display: block; height: 100%; border-radius: 6px 6px 3px 3px; background: var(--green); transform-origin: bottom; transform: scaleY(var(--v, 0)); transition: transform var(--spring-dur) var(--spring-ease); min-height: 3px; }
.hist-l { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; font-size: 12px; color: var(--soft); text-align: center; margin-top: 4px; }
.panels { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-top: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.panel h2 { margin: 0 0 14px; font: 700 19px var(--display); }
.hb { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr 36px; align-items: center; gap: 12px; padding: 7px 0; font-size: 15px; }
.hb-t { height: 12px; border-radius: 99px; background: #E6E4DB; overflow: hidden; }
.hb-t i { display: block; height: 100%; border-radius: 99px; background: var(--green); transform-origin: left; transform: scaleX(var(--v, 0)); transition: transform var(--spring-dur) var(--spring-ease); }
.hb.top .hb-t i { background: var(--amber); }
.hb b { text-align: right; font-variant-numeric: tabular-nums; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 520px; overflow: auto; }
.comments li { padding: 14px 16px; border-radius: 16px; background: var(--paper); }
.comments small { display: block; margin-top: 4px; color: var(--soft); font-size: 12px; }
.liveflag { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--soft); }
.liveflag i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse-g 1.8s ease-out infinite; }
@keyframes pulse-g { 0% { box-shadow: 0 0 0 0 rgba(31, 122, 77, .6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(31, 122, 77, 0); } }
.bump { animation: bump var(--bounce-dur) var(--bounce-ease); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); color: var(--green); } 100% { transform: scale(1); } }

/* Avisos flotantes */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 999px; background: rgba(20, 38, 31, .9); color: var(--paper); font: 600 14px var(--body); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: toast 2.8s var(--spring-ease) forwards; }
.toast.err { background: rgba(140, 29, 24, .92); }
@keyframes toast { 0% { opacity: 0; transform: translateY(12px) scale(.96); } 10%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .15s !important; }
  .rise { opacity: 1; transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .sbar { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
