/* ── Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #080a0f;
  --surface:   #0f1117;
  --s2:        #161922;
  --s3:        #1d2130;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.13);
  --text:      #e6eaf5;
  --text2:     #8890aa;
  --text3:     #454e68;
  --accent:    #4f46e5;
  --accentg:   rgba(79,70,229,0.3);
  --nav-h:     58px;
  --time-w:    68px;
  --hour-h:    62px;
  --sched-s:   7;
  --sched-e:   22;
}

html { font-size: 14px; scroll-behavior: smooth; color-scheme: dark; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; overflow-x: hidden;
}

/* ── Blobs ──────────────────────────────────────────────────────────── */
.blob {
  position: fixed; border-radius: 50%; pointer-events: none;
  filter: blur(90px); z-index: 0; animation: blobFloat 12s ease-in-out infinite;
}
.blob-1 { width: 600px; height: 600px; background: rgba(79,70,229,0.14); top: -200px; left: -150px; }
.blob-2 { width: 500px; height: 500px; background: rgba(139,92,246,0.1);  bottom: -150px; right: -100px; animation-delay: -5s; }
@keyframes blobFloat { 0%,100% { transform: scale(1) translateY(0); } 50% { transform: scale(1.07) translateY(-25px); } }

/* ── Utilities ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.glass-card {
  background: rgba(15,17,23,0.82);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border2);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03);
}
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 20px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-family: 'Inter', sans-serif; font-size: .92rem; font-weight: 600;
  cursor: pointer; transition: background .2s, box-shadow .2s, transform .15s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { background: #4338ca; box-shadow: 0 0 28px var(--accentg); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spinX .7s linear infinite; }
@keyframes spinX { to { transform: rotate(360deg); } }

/* ── LOGIN ──────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 200;
  overflow-y: auto;
}
.dotgrid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto; /* Required to catch mouse events for the dots */
  z-index: 0;
}
@media (hover: none) {
  /* On touch/mobile devices, disable canvas pointer events so the login form is accessible */
  .dotgrid-canvas { pointer-events: none; }
}
.login-card { padding: 44px 48px; width: min(440px, 94vw); position: relative; z-index: 10; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; font-size: 1.1rem; font-weight: 600; }
.brand-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.icesi-brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}
.icesi-brand-logo.sm { height: 32px; }
.icesi-brand-logo.lg { height: 60px; }
.brand-icon.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 1.05rem; }
.login-card h1 {
  font-size: 2rem; font-weight: 800; letter-spacing: -.5px;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.login-sub { color: var(--text2); font-size: .88rem; margin-bottom: 30px; }
.field-group { margin-bottom: 18px; }
.field-group label { display: block; font-size: .79rem; font-weight: 600; color: var(--text2); margin-bottom: 7px; }
.input-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--s2); border: 1px solid var(--border2); border-radius: 12px;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accentg); }
.input-ico { position: absolute; left: 13px; color: var(--text3); font-size: 1.15rem; pointer-events: none; }
.input-wrap input {
  width: 100%; padding: 13px 14px 13px 40px;
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'Inter', sans-serif; font-size: .9rem;
}
.input-wrap input::placeholder { color: var(--text3); }
.eye-btn {
  background: none; border: none; color: var(--text3); font-size: 1.1rem;
  padding: 8px 12px; cursor: pointer; transition: color .15s;
  touch-action: manipulation; flex-shrink: 0;
}
.eye-btn:hover { color: var(--text); }
.terms-group {
  margin: 15px 0 25px 0;
}
.terms-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text2);
  cursor: pointer;
}
.terms-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.terms-text a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}
.terms-text a:hover {
  color: #a5b4fc;
}
.login-error {
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
  border-radius: 10px; padding: 10px 14px; font-size: .84rem; color: #f87171; margin-bottom: 14px;
}
.login-note { display: flex; align-items: center; gap: 6px; margin-top: 18px; font-size: .74rem; color: var(--text3); }
.about-link-btn { display: flex; align-items: center; gap: 6px; margin-top: 14px; background: none; border: none; cursor: pointer; color: var(--text2); font-size: .82rem; font-family: 'Inter', sans-serif; padding: 6px 0; transition: color .2s; }
.about-link-btn:hover { color: var(--accent); }

/* ── APP SHELL ──────────────────────────────────────────────────────── */
.app-screen { display: flex; flex-direction: column; height: 100vh; overflow: hidden; position: relative; z-index: 1; }

/* ── TOP NAV ────────────────────────────────────────────────────────── */
.top-nav {
  height: var(--nav-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; flex-shrink: 0;
  background: rgba(8,10,15,.9); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border); z-index: 50;
}
.nav-left { display: flex; align-items: center; gap: 18px; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 700; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 7px; padding: 7px 14px;
  border-radius: 10px; border: none; background: transparent;
  color: var(--text2); font-family: 'Inter', sans-serif; font-size: .83rem; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap; position: relative;
}
.nav-link:hover { color: var(--text); background: var(--s2); }
.nav-link.active { background: rgba(79,70,229,.18); color: #a5b4fc; }
.nav-link i { font-size: 1.1rem; }
.badge-count {
  position: absolute; top: 3px; right: 5px;
  min-width: 18px; height: 18px; border-radius: 99px; padding: 0 5px;
  background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--s2); color: var(--text2); cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.nav-icon-btn:hover { color: var(--text); border-color: var(--border2); background: var(--s3); }
.nav-icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; font-size: .9rem; }
.live-clock { font-size: .8rem; font-weight: 600; color: var(--text2); font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.refresh-pill { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: .72rem; color: var(--text2); }
.last-updated-text { font-size: .72rem; color: var(--text2); display: flex; align-items: center; justify-content: flex-end; margin-right: 8px; font-weight: 500; transition: color 0.3s; line-height: 1.1; }
.last-updated-text.outdated { color: #ef4444; font-weight: 700; }
.refresh-pill-bar { width: 100px; height: 3px; background: var(--border2); border-radius: 99px; overflow: hidden; }
.refresh-pill-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }

/* ── PAGES ──────────────────────────────────────────────────────────── */
.page { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page::-webkit-scrollbar { width: 5px; }
.page::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── INICIO ─────────────────────────────────────────────────────────── */
.inicio-layout { display: grid; grid-template-columns: 1fr 340px; gap: 0; height: 100%; }
.inicio-left { padding: 24px; overflow-y: auto; border-right: 1px solid var(--border); }
.inicio-right { padding: 24px; overflow-y: auto; }
.inicio-left::-webkit-scrollbar, .inicio-right::-webkit-scrollbar { width: 4px; }
.inicio-left::-webkit-scrollbar-thumb, .inicio-right::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.section-block { margin-bottom: 28px; }
.section-title { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text); margin-bottom: 14px; }
.section-title i { color: var(--accent); font-size: 1.1rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.section-header .section-title { margin-bottom: 0; }

/* Courses Grid */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.course-card {
  background: var(--s2); border: 1px solid var(--border2); border-radius: 14px;
  padding: 16px; cursor: pointer; transition: all .18s;
  border-left: 3px solid var(--course-color, #4f46e5);
  position: relative; overflow: hidden;
}
.course-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--course-color, #4f46e5)10, transparent 80%);
  opacity: .06; pointer-events: none;
}
.course-card:hover { transform: translateY(-2px); border-color: var(--course-color, #4f46e5); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.course-code { font-size: .68rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.course-name { font-size: .88rem; font-weight: 600; color: var(--text); line-height: 1.35; margin-bottom: 10px; }
.course-task-count { font-size: .75rem; color: var(--text2); }

/* Tasks List */
.tasks-list { display: flex; flex-direction: column; gap: 8px; }
.tasks-list.full { padding: 24px; max-height: calc(100vh - var(--nav-h) - 80px); overflow-y: auto; }
.tasks-list.full::-webkit-scrollbar { width: 4px; }
.tasks-list.full::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--s2); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px; transition: all .15s;
}
.task-item:hover { border-color: var(--border2); }
.task-item.completed { opacity: .55; }
.task-item.overdue { border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.05); }

.checkbox-wrap { position: relative; flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.checkbox-wrap input[type="checkbox"] { opacity: 0; position: absolute; width: 100%; height: 100%; cursor: pointer; z-index: 1; margin: 0; }
.checkmark {
  position: absolute; inset: 0; border-radius: 6px;
  border: 2px solid var(--border2); background: var(--s3);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.checkbox-wrap input:checked ~ .checkmark { background: #10b981; border-color: #10b981; }
.checkbox-wrap input:checked ~ .checkmark::after { content: ''; width: 5px; height: 9px; border: 2px solid #fff; border-top: none; border-left: none; transform: rotate(45deg) translateY(-1px); }
.task-details { flex: 1; min-width: 0; }
.task-title { font-size: .88rem; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 5px; }
.task-item.completed .task-title { text-decoration: line-through; }
.task-meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: .75rem; color: var(--text2); }
.task-meta-row i { font-size: .9rem; }
.task-due { display: flex; align-items: center; gap: 5px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 99px; font-size: .7rem; font-weight: 600;
}
.badge.pending  { background: rgba(79,70,229,.15);  color: #a5b4fc; }
.badge.urgent   { background: rgba(239,68,68,.15);  color: #fca5a5; }
.badge.soon     { background: rgba(245,158,11,.15); color: #fcd34d; }
.badge.overdue  { background: rgba(239,68,68,.2);   color: #ef4444; }
.badge.done     { background: rgba(16,185,129,.15); color: #6ee7b7; }

/* Filter Tabs */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ftab {
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text2); cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: .78rem; font-weight: 500;
  transition: all .15s;
}
.ftab:hover { border-color: var(--border2); color: var(--text); }
.ftab.active { background: rgba(79,70,229,.18); border-color: rgba(79,70,229,.4); color: #a5b4fc; }

/* ── CALENDAR WIDGET ─────────────────────────────────────────────── */
.calendar-widget { }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 6px; }
.cal-weekdays div { text-align: center; font-size: .7rem; font-weight: 600; color: var(--text3); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-day {
  aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: .78rem; color: var(--text2); cursor: default; position: relative;
  transition: background .12s;
}
.cal-day.today { background: var(--accent); color: #fff; font-weight: 700; }
.cal-day.has-event::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: #10b981; }
.cal-day.overdue::after { background: #ef4444; }
.cal-day.empty { }

/* AI Preview */
.ai-preview-block { background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(139,92,246,.08)); border: 1px solid rgba(79,70,229,.25); border-radius: 16px; padding: 18px; }
.ai-preview-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.ai-ico { font-size: 2rem; color: #8b5cf6; }
.ai-preview-header h3 { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.ai-preview-header p { font-size: .8rem; color: var(--text2); line-height: 1.4; }
.ai-gen-btn { background: linear-gradient(135deg, #4f46e5, #7c3aed); }

/* Skeleton */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 12px; }
.skeleton-card { height: 90px; background: var(--s2); border-radius: 14px; animation: pulse 1.6s ease-in-out infinite; }
.skeleton-tasks { display: flex; flex-direction: column; gap: 8px; }
.skeleton-task { height: 64px; background: var(--s2); border-radius: 12px; animation: pulse 1.6s ease-in-out infinite; }
.skeleton-task:nth-child(2) { animation-delay: .2s; }
.skeleton-task:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%,100%{opacity:.5} 50%{opacity:.8} }

/* ── HORARIO ─────────────────────────────────────────────────────── */
#page-horario { display: flex; flex-direction: column; }
.schedule-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0; flex-wrap: wrap; gap: 10px;
}
.sched-nav-left { display: flex; align-items: center; gap: 8px; }
.today-btn {
  height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--s2); color: var(--text2); cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: .8rem; font-weight: 600;
  transition: all .15s;
}
.today-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.week-label-text { font-size: .82rem; color: var(--text2); font-weight: 500; padding-left: 4px; }
.legend-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.legend-pill { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: .72rem; font-weight: 500; color: var(--text2); background: var(--s2); border: 1px solid var(--border); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.schedule-outer { flex: 1; overflow: auto; position: relative; }
.schedule-outer::-webkit-scrollbar { width: 5px; height: 5px; }
.schedule-outer::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

.schedule-grid {
  display: grid;
  grid-template-columns: var(--time-w) repeat(6, 1fr);
  min-width: 680px; position: relative;
}

.time-col-header { height: 52px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.time-col-hour {
  height: var(--hour-h); display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 3px 8px 0 0; font-size: .68rem; color: var(--text3); font-weight: 500;
  border-bottom: 1px solid var(--border);
  line-height: 1;
}

.day-col { border-left: 1px solid var(--border); position: relative; }
.day-header {
  height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
  background: var(--surface);
}
.day-name-label { font-size: .68rem; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.day-num { font-size: .95rem; font-weight: 700; color: var(--text); }
.day-header.is-today .day-num {
  background: var(--accent); color: #fff;
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.hour-cell {
  height: var(--hour-h); border-bottom: 1px solid var(--border); position: relative;
}
.hour-cell::after {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  border-top: 1px dashed rgba(255,255,255,.035); pointer-events: none;
}

/* Class Blocks */
.class-block {
  position: absolute; left: 3px; right: 3px; border-radius: 10px;
  padding: 7px 9px; cursor: pointer; overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  transition: transform .15s, box-shadow .15s, filter .15s;
  display: flex; flex-direction: column; gap: 2px;
}
.class-block:hover { transform: scale(1.025) translateY(-1px); box-shadow: 0 8px 28px rgba(0,0,0,.4); filter: brightness(1.12); z-index: 5; }
.cb-name { font-size: .76rem; font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.cb-room { font-size: .66rem; color: rgba(255,255,255,.55); font-weight: 500; margin-top: 1px; }
.cb-time { font-size: .63rem; color: rgba(255,255,255,.4); margin-top: auto; padding-top: 3px; }

/* Time Line */
.time-line {
  position: absolute; left: 0; z-index: 20; pointer-events: none;
  display: flex; align-items: center;
  transition: top .4s linear;
  min-width: 680px; /* Match schedule-grid min-width so the bar reaches the edge on mobile */
  width: 100%;
}
.tl-dot { width: 11px; height: 11px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; margin-left: calc(var(--time-w) - 5.5px); flex-shrink: 0; }
.tl-bar { flex: 1; height: 2px; background: linear-gradient(90deg, #ef4444 0%, rgba(239,68,68,0) 100%); }

/* ── TAREAS PAGE ─────────────────────────────────────────────────── */
.tareas-layout { display: flex; flex-direction: column; height: 100%; }
.tareas-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px; }
.tareas-header h2 { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tareas-header h2 i { color: var(--accent); }

/* ── MAPA / CONSTRUCCIÓN ─────────────────────────────────────────── */
.construction-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; text-align: center; padding: 40px 20px; gap: 14px;
}
.construction-icon { font-size: 4rem; color: var(--text3); animation: iconBob 3s ease-in-out infinite; }
@keyframes iconBob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.construction-page h2 { font-size: 1.5rem; font-weight: 800; }
.construction-page p { color: var(--text2); font-size: .9rem; }
.construction-page .sub { color: var(--text3); font-size: .82rem; max-width: 360px; }
.construction-bar { width: 200px; height: 6px; background: var(--s2); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.construction-progress { height: 100%; width: 35%; background: linear-gradient(90deg, var(--accent), #7c3aed); border-radius: 99px; animation: constrLoad 2s ease-in-out infinite; }
@keyframes constrLoad { 0%{width:10%} 50%{width:60%} 100%{width:10%} }
.construction-label { font-size: .75rem; color: var(--text3); }

/* ── MODALS ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 20px; width: min(420px, 96vw); overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  animation: modalPop .2s ease;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
}
.modal-box.large { width: min(560px, 96vw); }
.modal-box.xlarge { width: min(820px, 96vw); }
@keyframes modalPop { from{opacity:0;transform:scale(.92) translateY(10px)} to{opacity:1;transform:none} }
.modal-color-bar { height: 5px; flex-shrink: 0; }
.modal-inner { padding: 26px 28px 30px; overflow-y: auto; }
.modal-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header-row h2 { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-meta { display: flex; flex-direction: column; gap: 10px; }
.modal-meta-row { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--text2); }
.modal-meta-row i { font-size: 1rem; color: var(--text3); }
.modal-close { background: var(--s2); border: 1px solid var(--border); border-radius: 8px; color: var(--text2); cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: all .15s; flex-shrink: 0; }
.modal-close:hover { background: var(--s3); color: var(--text); }

/* AI Modal */
.ai-content { min-height: 200px; }
.ai-idle { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: 20px 0; }
.ai-idle-ico { font-size: 3rem; color: #8b5cf6; }
.ai-idle p { color: var(--text2); font-size: .88rem; max-width: 400px; line-height: 1.6; }
.ai-full-btn { max-width: 280px; background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.ai-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 30px 0; }
.ai-loading-dots { display: flex; gap: 8px; }
.ai-loading-dots span { width: 10px; height: 10px; border-radius: 50%; background: #7c3aed; animation: dotPulse 1.2s ease-in-out infinite; }
.ai-loading-dots span:nth-child(2) { animation-delay: .2s; }
.ai-loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse { 0%,100%{transform:scale(.5);opacity:.4} 50%{transform:scale(1.1);opacity:1} }
.ai-result { padding: 0 4px; display: flex; flex-direction: column; gap: 16px; }
.ai-cards { display: flex; flex-direction: column; gap: 14px; }
.ai-card { background: var(--s2); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; animation: fadeInUp 0.4s ease-out forwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.ai-card-title { display: none; } /* removed */
.ai-card-body { padding: 18px 20px; }
.ai-markdown { font-size: .88rem; color: var(--text2); line-height: 1.6; }
.ai-markdown h3 { background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(139,92,246,.08)); padding: 12px 16px; font-weight: 700; font-size: .95rem; color: #a5b4fc; border-radius: 8px; margin: 24px 0 14px 0; border: 1px solid rgba(79,70,229,.2); display: flex; align-items: center; gap: 8px; }
.ai-markdown h3:first-child { margin-top: 0; }
.ai-markdown h4 { color: var(--text); margin-bottom: 8px; font-size: .9rem; }
.ai-markdown p { margin-bottom: 10px; }
.ai-markdown p:last-child { margin-bottom: 0; }
.ai-markdown ul { list-style: none; display: flex; flex-direction: column; gap: 6px; padding-left: 4px; margin-bottom: 10px; }
.ai-markdown ul:last-child { margin-bottom: 0; }
.ai-markdown li { display: flex; align-items: flex-start; }
.ai-markdown li::before { content: '•'; color: #8b5cf6; margin-right: 8px; font-size: 1.1rem; line-height: 1.2; }
.ai-markdown strong { color: var(--text); font-weight: 700; }
.ai-markdown table { width: 100%; border-collapse: collapse; margin-bottom: 14px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.ai-markdown th { background: rgba(79,70,229,.12); color: #a5b4fc; padding: 10px 14px; text-align: left; font-weight: 600; font-size: .85rem; border-bottom: 1px solid var(--border); }
.ai-markdown td { padding: 10px 14px; text-align: left; font-size: .85rem; border-bottom: 1px solid var(--border2); }
.ai-markdown tr:last-child td { border-bottom: none; }
.ai-regen { margin-top: 4px; align-self: flex-start; max-width: 200px; }

/* About Modal */
.about-box .modal-inner { padding: 28px 30px 32px; }
.about-brand { display: flex; align-items: center; gap: 12px; }
.about-brand h2 { font-size: 1.3rem; font-weight: 800; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .about-grid { grid-template-columns: 1fr; } }
.about-card { background: var(--s2); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.about-card-ico { font-size: 1.5rem; color: var(--accent); margin-bottom: 10px; }
.about-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: 10px; }
.about-card p { font-size: .82rem; color: var(--text2); line-height: 1.6; }
.team-list { display: flex; flex-direction: column; gap: 12px; }
.team-member { display: flex; align-items: center; gap: 12px; }
.member-avatar { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #4f46e5, #7c3aed); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; color: #fff; flex-shrink: 0; }
.member-name { font-size: .84rem; font-weight: 600; }
.member-role { font-size: .74rem; color: var(--text2); }
.beta-cta { font-size: .78rem; color: var(--text2); margin-top: 8px; }
.beta-cta a { color: var(--accent); text-decoration: none; }
.version-card { display: flex; flex-direction: column; justify-content: center; }
.version-info { display: flex; flex-direction: column; gap: 8px; }
.version-badge { display: inline-flex; align-items: center; padding: 5px 12px; background: rgba(79,70,229,.2); border: 1px solid rgba(79,70,229,.4); border-radius: 99px; font-size: .82rem; font-weight: 700; color: #a5b4fc; width: fit-content; }
.tech-stack { font-size: .78rem; color: var(--text2); }

/* Loading Overlay */
.loading-overlay { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.8); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; }
.loading-card { padding: 40px 44px; width: min(380px, 94vw); text-align: center; }
.loading-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.1rem; font-weight: 700; margin-bottom: 24px; color: var(--text2); }
.loading-brand i { font-size: 1.5rem; color: var(--accent); }
.loading-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.loading-desc { font-size: .82rem; color: var(--text2); margin-bottom: 24px; }
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 6px; background: var(--s3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #7c3aed); border-radius: 99px; transition: width .4s ease; }
.progress-wrap span { font-size: .78rem; font-weight: 700; color: var(--accent); min-width: 36px; }

/* ── SOBRE PAGE ──────────────────────────────────────────────────── */
#page-sobre { overflow-y: auto; }
#page-sobre::-webkit-scrollbar { width: 5px; }
#page-sobre::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.sobre-page { max-width: 960px; margin: 0 auto; padding: 36px 28px 60px; }

.brand-icon.lg { width: 68px; height: 68px; border-radius: 20px; font-size: 2.2rem; }

.sobre-hero {
  display: flex; align-items: center; gap: 24px;
  padding: 36px; margin-bottom: 40px;
  background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(139,92,246,.07));
  border: 1px solid rgba(79,70,229,.22); border-radius: 24px;
}
.sobre-hero h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 4px; }
.sobre-hero p { color: var(--text2); font-size: .92rem; margin-bottom: 12px; }
.version-badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 99px;
  background: rgba(79,70,229,.2); border: 1px solid rgba(79,70,229,.4);
  color: #a5b4fc; font-size: .76rem; font-weight: 700;
}

.sobre-section { margin-bottom: 40px; }
.sobre-section-title {
  font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px;
  color: var(--text2); margin-bottom: 18px; text-transform: uppercase; letter-spacing: .4px; font-size: .8rem;
}
.sobre-section-title i { color: var(--accent); font-size: 1.15rem; }

.sobre-desc-card {
  background: var(--s2); border: 1px solid var(--border2); border-radius: 18px; padding: 24px;
}
.sobre-desc-card p { font-size: .9rem; color: var(--text2); line-height: 1.7; margin-bottom: 20px; }
.sobre-desc-card strong { color: var(--text); }
.sobre-features { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.feature-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 99px; font-size: .8rem; font-weight: 500;
  background: var(--s3); border: 1px solid var(--border2); color: var(--text2);
  transition: all .15s;
}
.feature-pill i { color: var(--accent); font-size: .95rem; }
.feature-pill:hover { border-color: var(--accent); color: var(--text); background: rgba(79,70,229,.1); }
/* ── Logo Loop ────────────────────────────────────────────── */
.logo-loop-container {
  position: relative;
  overflow: hidden;
  height: 60px;
  width: 100%;
  margin-top: 15px;
  border-radius: 8px;
}
.logo-loop-track {
  display: flex;
  align-items: center;
  gap: 60px;
  width: max-content;
  height: 100%;
  animation: logoLoop 20s linear infinite;
}
.logo-loop-track:hover {
  animation-play-state: paused;
}
.logo-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}
.logo-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(165, 180, 252, 0.3));
  transition: transform 0.2s, filter 0.2s;
  cursor: pointer;
}
.logo-item img:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 0 12px rgba(165, 180, 252, 0.8));
}
@keyframes logoLoop {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-50% - 30px)); /* -50% of track minus half gap */ }
}
.logo-loop-fade {
  position: absolute;
  top: 0;
  width: 60px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.fade-left {
  left: 0;
  background: linear-gradient(to right, var(--s2), transparent);
}
.fade-right {
  right: 0;
  background: linear-gradient(to left, var(--s2), transparent);
}

/* ── Team Grid (Sobre) ────────────────────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 10px 0;
}
.team-card-wrapper {
  perspective: 1000px;
  width: 100%;
  aspect-ratio: 1 / 1;
}
.team-card {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}
.team-card-wrapper.has-desc:hover .team-card {
  transform: rotateY(180deg);
}
.team-card-front, .team-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  background: var(--s2);
  border: 1px solid rgba(56, 189, 248, 0.15);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}
.team-card-front {
  z-index: 2;
}
.team-card-back {
  transform: rotateY(180deg);
  background: var(--s2);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 8px 30px rgba(56, 189, 248, 0.15);
}
.team-card-back p {
  color: var(--text2);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
}
.team-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 16px;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3), 0 0 20px rgba(56, 189, 248, 0.4);
  object-fit: cover;
}
.team-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fbbf24; /* yellow */
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.team-role {
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8; /* cyan */
}

/* ── AI Markdown ────────────────────────────────────────────────────── */
.ai-markdown {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}
.ai-markdown h1, .ai-markdown h2, .ai-markdown h3 {
  color: #a5b4fc;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.ai-markdown h1:first-child, .ai-markdown h2:first-child, .ai-markdown h3:first-child {
  margin-top: 0;
}
.ai-markdown p { 
  margin-bottom: 14px; 
  color: var(--text2);
}
.ai-markdown h3 {
  margin: 1.8rem 0 1rem;
  font-size: 1.15rem;
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-markdown h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 4px;
}
.ai-markdown ul, .ai-markdown ol {
  margin-bottom: 1.5rem;
  padding-left: 20px;
}
.ai-markdown li {
  margin-bottom: 10px;
  line-height: 1.6;
  color: var(--text2);
}
.ai-markdown li::marker {
  color: var(--primary);
  font-weight: bold;
}
.ai-markdown strong {
  color: #fff;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}
.ai-markdown blockquote {
  border-left: 4px solid var(--primary);
  color: var(--text2);
  background: var(--s2);
  padding: 14px 20px;
  border-radius: 0 12px 12px 0;
  margin-bottom: 1.5rem;
  font-style: italic;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.ai-markdown code {
  background: rgba(99, 102, 241, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.85em;
  color: #a5b4fc;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .inicio-layout { grid-template-columns: 1fr; }
  .inicio-right { border-right: none; border-top: 1px solid var(--border); }
  :root { --time-w: 52px; --hour-h: 56px; }
  .schedule-grid { grid-template-columns: var(--time-w) repeat(6, minmax(80px, 1fr)); }
}
@media (max-width: 640px) {
  .login-screen { align-items: flex-start; padding: 16px 0 40px; }
  .login-card { padding: 28px 20px; }
  /* Prevent iOS auto-zoom on input focus (requires font-size >= 16px) */
  .input-wrap input { font-size: 16px; }
  .nav-link span { display: none; }
  .top-nav { padding: 0 4px; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .top-nav::-webkit-scrollbar { display: none; }
  .nav-left { gap: 4px; }
  .nav-right { gap: 2px; flex-shrink: 0; }
  .nav-brand { font-size: 0; gap: 0; margin-right: 4px; }
  .nav-brand img { height: 22px; margin-right: 2px; }
  .nav-links { gap: 2px; }
  .nav-link { padding: 6px; }
  .nav-link i { font-size: 1.1rem; }
  .nav-icon-btn { width: 28px; height: 28px; font-size: 1rem; }
  .week-label-text, .legend-strip { display: none; }
  .live-clock { display: none; }
}

input[name="cc-color"]:checked + .color-swatch {
  border-color: #ffffff !important;
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
}
input[name="cc-color"]:hover + .color-swatch {
  transform: scale(1.1);
}

/* ── CARNET PAGE ──────────────────────────────────────────────────────── */
.carnet-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: calc(100vh - var(--nav-h)); padding: 40px 20px;
}

/* Empty state */
.carnet-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center; max-width: 440px;
  animation: fadeInUp .4s ease;
}
.carnet-empty-icon {
  width: 90px; height: 90px; border-radius: 24px;
  background: linear-gradient(135deg, rgba(79,70,229,.25), rgba(124,58,237,.25));
  border: 1px solid rgba(99,102,241,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; color: #a5b4fc; margin-bottom: 8px;
}
.carnet-empty-state h2 { font-size: 1.6rem; font-weight: 800; }
.carnet-empty-state p { color: var(--text2); font-size: .9rem; line-height: 1.5; }
.carnet-upload-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 12px 28px; width: auto; border-radius: 12px;
  font-size: .92rem; font-weight: 600; font-family: 'Inter', sans-serif;
  margin-top: 6px;
}
.carnet-privacy-note {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: .74rem; color: var(--text3);
}

/* Loaded state */
.carnet-loaded-state {
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  width: 100%; max-width: 500px;
  animation: fadeInUp .4s ease;
}
.carnet-display-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
}
.carnet-card-outer {
  position: relative; display: inline-block;
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  transition: transform .3s ease, box-shadow .3s ease;
}
.carnet-card-outer:hover { transform: scale(1.02); box-shadow: 0 40px 100px rgba(79,70,229,.35), 0 0 0 1px rgba(165,180,252,.2); }
.carnet-glow {
  position: absolute; inset: -40px; z-index: -1;
  background: radial-gradient(circle, rgba(79,70,229,.4) 0%, transparent 70%);
  filter: blur(30px); pointer-events: none;
}
.carnet-img {
  display: block; max-width: min(380px, 90vw); max-height: 70vh;
  width: auto; height: auto; object-fit: contain;
}

/* Actions row */
.carnet-actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  width: 100%;
}
.carnet-action-btn {
  flex: 1; min-width: 140px; max-width: 200px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; font-size: .875rem; font-weight: 600;
  cursor: pointer; font-family: 'Inter', sans-serif;
}
.carnet-change-btn {
  background: var(--s3); border: 1px solid var(--border2); color: var(--text);
  transition: background .15s, border-color .15s;
}
.carnet-change-btn:hover { background: var(--s2); border-color: var(--border2); }
.carnet-delete-btn {
  flex: 0 0 auto; padding: 11px 18px; border-radius: 12px; border: 1px solid rgba(239,68,68,.3);
  background: rgba(239,68,68,.1); color: #f87171; font-size: .875rem; font-weight: 600;
  cursor: pointer; font-family: 'Inter', sans-serif; display: flex; align-items: center; gap: 7px;
  transition: background .15s, border-color .15s;
}
.carnet-delete-btn:hover { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.5); }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 500px) {
  .carnet-action-btn { min-width: 100%; max-width: 100%; }
  .carnet-delete-btn { width: 100%; justify-content: center; }
}
