*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --black: #000; --white: #fff; --gray: #111; --gray2: #1a1a1a; --gray3: #888; --gray4: #333;
  --font-display: 'Syne', sans-serif; --font-body: 'Cormorant Garamond', serif;
}
html { scroll-behavior: smooth; }
body { background: var(--black); color: var(--white); font-family: var(--font-body); font-size: 18px; line-height: 1.6; overflow-x: hidden; }
a { color: var(--white); text-underline-offset: 4px; text-decoration-color: var(--gray4); transition: text-decoration-color .3s; }
a:hover { text-decoration-color: var(--white); }

/* CURSOR (el de divxal.com: punto + anillo con inercia + luz ambiental) */
#cursor { position: fixed; width: 8px; height: 8px; background: var(--white); border-radius: 50%; pointer-events: none; z-index: 9999; transform: translate(-50%, -50%); transition: width .2s, height .2s; mix-blend-mode: difference; left: -9999px; top: -9999px; }
#cursor-ring { position: fixed; width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; pointer-events: none; z-index: 9998; transform: translate(-50%, -50%); transition: width .4s cubic-bezier(.34,1.56,.64,1), height .4s cubic-bezier(.34,1.56,.64,1), border-color .3s; left: -9999px; top: -9999px; }
body.cursor-hover #cursor, dialog.cursor-hover #cursor { width: 4px; height: 4px; }
body.cursor-hover #cursor-ring, dialog.cursor-hover #cursor-ring { width: 60px; height: 60px; border-color: rgba(255,255,255,.8); }
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#app, #login { position: relative; z-index: 2; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 9997; pointer-events: none; }
#cursor-light { position: fixed; inset: 0; z-index: 3; pointer-events: none; mix-blend-mode: screen; }
@media (hover: hover) and (pointer: fine) { *, *::before, *::after { cursor: none !important; } }
@media not all and (hover: hover) and (pointer: fine) { #cursor, #cursor-ring, #cursor-light, #fx { display: none; } }

#grain { position: fixed; inset: -10%; width: 120%; height: 120%; z-index: 9990; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px; animation: grain .2s steps(1) infinite; }
@keyframes grain { 0%{transform:translate(0,0)}20%{transform:translate(3%,5%)}40%{transform:translate(5%,-2%)}60%{transform:translate(4%,2%)}80%{transform:translate(2%,-5%)} }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.label { font-family: var(--font-display); font-size: .65rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gray3); }
.muted { color: var(--gray3); font-style: italic; font-weight: 300; }
.logo { font-family: var(--font-display); font-weight: 800; letter-spacing: .3em; text-transform: uppercase; font-size: 1rem; }

#app { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
aside { border-right: 1px solid var(--gray4); padding: 2.5rem 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
aside .logo { display: block; margin-bottom: .6rem; cursor: pointer; }
.acct { color: var(--gray3); font-style: italic; font-size: .95rem; min-height: 1.6rem; margin-bottom: 2.2rem; }
aside .label { margin: 2rem 0 1rem; }
.nav-item { display: block; padding: .55rem 0; color: var(--gray3); cursor: pointer; border: 0; background: none; text-align: left; font: inherit; width: 100%; transition: color .3s, padding-left .3s; }
.nav-item:hover, .nav-item.active { color: var(--white); padding-left: .6rem; }
main { padding: 4rem 4.5rem; max-width: 1700px; min-width: 0; animation: fadeUp .6s cubic-bezier(.16,1,.3,1); }
h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.01em; margin-bottom: 2.5rem; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: .8rem; letter-spacing: .25em; text-transform: uppercase; color: var(--gray3); margin: 3rem 0 1rem; }
h3 { font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: .05em; margin: 2.5rem 0 .5rem; }

.row { display: flex; justify-content: space-between; gap: 2rem; align-items: baseline; padding: .9rem 0; border-bottom: 1px solid var(--gray4); }
.row .meta { color: var(--gray3); font-size: .95rem; white-space: nowrap; }
.row.click { cursor: pointer; transition: padding-left .3s; }
.row.click:hover { padding-left: .6rem; }
.tag { font-family: var(--font-display); font-size: .55rem; letter-spacing: .2em; text-transform: uppercase; border: 1px solid var(--gray4); padding: .15rem .5rem; margin-left: .8rem; color: var(--gray3); }
.desc { color: var(--gray3); font-size: .95rem; margin: .2rem 0 0; }

h2.first { margin-top: 0; }
.kbd { font-family: var(--font-display); font-size: .55rem; letter-spacing: .15em; border: 1px solid var(--gray4); padding: .1rem .4rem; margin-left: .7rem; color: var(--gray3); }
button.btn.sm { padding: .5rem 1rem; }
/* buscador */
#pal { width: min(680px, 92vw); padding: 0; margin: 12vh auto auto; }
#pal input.fld { border: 0; border-bottom: 1px solid var(--gray4); margin: 0; padding: 1.4rem 1.6rem; font-size: .8rem; }
#pal .results { max-height: 52vh; overflow-y: auto; padding: .5rem 0; }
.res { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; padding: .7rem 1.6rem; }
.res.sel { background: var(--gray2); }
.res .sub { color: var(--gray3); font-size: .9rem; }
/* subida */
.drop { border: 1px dashed var(--gray4); padding: 1.8rem 1rem; text-align: center; color: var(--gray3); transition: border-color .3s, color .3s, background .3s; margin: 1rem 0; }
.drop:hover, .drop.over { border-color: var(--white); color: var(--white); background: var(--gray); }
.bar { height: 2px; background: var(--gray4); margin: 1rem 0; }
.bar i { display: block; height: 100%; width: 0; background: var(--white); transition: width .15s; }
/* calendario */
.cal-nav { display: flex; gap: .8rem; margin: -1.2rem 0 2rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--gray4); border-left: 1px solid var(--gray4); }
.cal .dn { padding: .7rem .8rem; border-right: 1px solid var(--gray4); border-bottom: 1px solid var(--gray4); font-family: var(--font-display); font-size: .6rem; letter-spacing: .25em; text-transform: uppercase; color: var(--gray3); }
.day { min-height: 120px; padding: .5rem .7rem; border-right: 1px solid var(--gray4); border-bottom: 1px solid var(--gray4); transition: background .3s; overflow: hidden; }
.day:hover, .day.sel { background: var(--gray2); }
.day.other { opacity: .35; }
.day .num { font-family: var(--font-display); font-size: .75rem; margin-bottom: .4rem; }
.day.today .num { display: inline-block; border: 1px solid var(--white); border-radius: 50%; width: 1.8rem; height: 1.8rem; line-height: 1.7rem; text-align: center; }
.day .ev { font-size: .82rem; line-height: 1.25; color: var(--gray3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: .5rem; border-left: 1px solid var(--white); margin-bottom: .3rem; }
/* asistente */
.fab { position: fixed; right: 2rem; bottom: 2rem; z-index: 50; background: var(--black); }
.chat { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 60; background: var(--black); border-left: 1px solid var(--gray4); display: none; flex-direction: column; }
.chat.open { display: flex; animation: fadeUp .4s cubic-bezier(.16,1,.3,1); }
.chat header { display: flex; justify-content: space-between; align-items: center; padding: 1.3rem 1.6rem; border-bottom: 1px solid var(--gray4); }
.chat .msgs { flex: 1; overflow-y: auto; padding: 1.4rem 1.6rem; display: flex; flex-direction: column; gap: 1.2rem; }
.chat .note { padding: 1.6rem; color: var(--gray3); font-size: .95rem; flex: 1; }
.bubble { max-width: 94%; line-height: 1.5; overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; border: 1px solid var(--gray4); padding: .6rem 1rem; }
.bubble.assistant { color: #ddd; }
.bubble code { font-size: .85em; background: var(--gray2); padding: 0 .3rem; }
.ln:empty { height: .6rem; }
.chat form { display: flex; gap: .8rem; padding: 1rem 1.6rem 1.4rem; border-top: 1px solid var(--gray4); align-items: flex-end; }
.chat textarea { flex: 1; background: transparent; color: var(--white); border: 1px solid var(--gray4); padding: .7rem .9rem; font-family: var(--font-body); font-size: 1rem; resize: none; max-height: 8rem; }
.chat textarea:focus { outline: none; border-color: var(--white); }
@media (min-width: 1150px) { body.chat-open main { margin-right: 440px; } body.chat-open .fab { display: none; } }
.cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 5rem; align-items: start; }
.course-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 4.5rem; align-items: start; }
.rail { position: sticky; top: 2.5rem; }
.rail .row { flex-direction: column; gap: .1rem; }
.rel { color: var(--gray3); }
.rel.urgent { color: var(--white); }
.tabs { display: flex; gap: 2rem; border-bottom: 1px solid var(--gray4); margin-bottom: 1.5rem; }
.tab { font-family: var(--font-display); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; padding: .8rem 0; background: none; border: 0; color: var(--gray3); cursor: pointer; border-bottom: 1px solid transparent; margin-bottom: -1px; }
.tab.active, .tab:hover { color: var(--white); border-bottom-color: var(--white); }

button.btn, input.fld { font-family: var(--font-display); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; background: transparent; color: var(--white); border: 1px solid var(--white); padding: .8rem 1.6rem; cursor: pointer; transition: background .3s, color .3s; }
button.btn:hover:not(:disabled) { background: var(--white); color: var(--black); }
button.btn:disabled { opacity: .4; cursor: wait; }
input.fld { cursor: text; letter-spacing: .1em; width: 100%; border-color: var(--gray4); margin-bottom: .8rem; text-transform: none; }
input.fld::placeholder { color: var(--gray3); text-transform: uppercase; font-size: .6rem; letter-spacing: .2em; }
input.fld:focus { outline: none; border-color: var(--white); }
input[type=file] { font-family: var(--font-body); color: var(--gray3); margin: 1rem 0; display: block; }
input[type=file]::file-selector-button { font-family: var(--font-display); font-size: .65rem; letter-spacing: .2em; text-transform: uppercase; background: transparent; color: var(--white); border: 1px solid var(--gray4); padding: .5rem 1rem; margin-right: 1rem; cursor: pointer; }
label.chk { display: flex; gap: .6rem; align-items: center; color: var(--gray3); margin-bottom: 1.2rem; }

#login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem; }
#login form { width: min(320px, 100%); text-align: center; }
#login .logo { font-size: clamp(2rem, 10vw, 4rem); margin-bottom: 2.5rem; }
.err { color: #c66; font-size: .95rem; margin-top: 1rem; min-height: 1.5rem; }

dialog { background: var(--black); color: var(--white); border: 1px solid var(--gray4); padding: 2.5rem; width: min(640px, 92vw); margin: auto; }
dialog::backdrop { background: rgba(0,0,0,.85); }
dialog .close { float: right; }
@media (max-width: 1150px) { .cols, .course-grid { grid-template-columns: 1fr; gap: 1rem; } .rail { position: static; margin-top: 2rem; } }
@media (max-width: 800px) {
  .day { min-height: 70px; } .day .ev { display: none; } .day.has::after { content: ''; display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--white); margin-top: .2rem; }
  .fab { right: 1rem; bottom: 1rem; }
  #app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--gray4); padding: 1.5rem; }
  main { padding: 2rem 1.5rem; }
  .row { flex-direction: column; gap: .2rem; }
}

/* mapa */
.gbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: -1rem 0 1.4rem; }
.gsep { width: 1px; height: 1.4rem; background: var(--gray4); margin: 0 .4rem; }
button.btn.chip.on, button.btn.chip.on:hover:not(:disabled) { background: var(--white); color: var(--black); }
.gwrap { position: relative; height: calc(100vh - 19rem); min-height: 440px; border: 1px solid var(--gray4); overflow: hidden; }
.gcanvas { width: 100%; height: 100%; display: block; touch-action: none; }
.gtip { position: absolute; display: none; pointer-events: none; background: var(--black); border: 1px solid var(--gray4); padding: .5rem .9rem; max-width: 280px; font-size: .95rem; z-index: 2; }
