/* Axioma: estilos. Claro y oscuro automático. */
/*
  Sistema visual
  - Neutros fríos + tinta casi negra; un solo acento (cobalto). Los colores de ramo los elige el usuario.
  - Radios: botones y chips = pastilla; tarjetas = 16px; campos, pestañas y segmentos = 10px; modales = 20px.
  - Tipografía: Geist (texto) y Geist Mono (relojes y cifras grandes), autoalojadas.
*/
@font-face { font-family: "Geist"; src: url("vendor/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("vendor/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --bg: #f4f5f7;
  --bg2: #fbfbfc;
  --card: #fdfdfe;
  --card2: #f1f2f5;
  --text: #17171c;
  --muted: #5d5f67;
  --faint: #74767e;
  --line: #e6e7eb;
  --line2: #d3d5db;
  --ink: #17171c;
  --ink-text: #fbfbfc;
  --ink-hover: #2c2c33;
  --accent: #2f4de6;
  --accent-fill: #3b5bff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(59, 91, 255, 0.1);
  --green: #1d9a50;
  --teal: #1f8fa6;
  --orange: #c96a10;
  --red: #dc3b40;
  --purple: #7a52c7;
  --yellow: #c99a06;
  --shadow: 0 1px 2px rgba(23, 23, 28, 0.04), 0 8px 28px rgba(23, 23, 28, 0.06);
  --shadow-lg: 0 24px 64px rgba(23, 23, 28, 0.18);
  --scrim: rgba(23, 23, 28, 0.36);
  --radius: 16px;
  --radius-s: 10px;
  --side: 252px;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0f; --bg2: #111115; --card: #17171c; --card2: #1e1e24; --text: #f2f3f5; --muted: #a1a3ab; --faint: #8a8c94;
    --line: #26262d; --line2: #35353d; --ink: #f2f3f5; --ink-text: #111115; --ink-hover: #d9dade;
    --accent: #8a9dff; --accent-fill: #3b5bff; --accent-soft: rgba(138, 157, 255, 0.14);
    --green: #3cc46f; --teal: #43b8cf; --orange: #f0953a; --red: #f2666a; --purple: #a98bea; --yellow: #e2b93b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55); --scrim: rgba(5, 5, 8, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0f; --bg2: #111115; --card: #17171c; --card2: #1e1e24; --text: #f2f3f5; --muted: #a1a3ab; --faint: #8a8c94;
  --line: #26262d; --line2: #35353d; --ink: #f2f3f5; --ink-text: #111115; --ink-hover: #d9dade;
  --accent: #8a9dff; --accent-fill: #3b5bff; --accent-soft: rgba(138, 157, 255, 0.14);
  --green: #3cc46f; --teal: #43b8cf; --orange: #f0953a; --red: #f2666a; --purple: #a98bea; --yellow: #e2b93b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55); --scrim: rgba(5, 5, 8, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 15px/1.5 var(--font); font-feature-settings: "ss01", "cv11"; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body.no-scroll { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 10px; }
small { font-size: 12.5px; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--card2); padding: 1px 5px; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---------- Botones e inputs ---------- */
button { font: inherit; color: inherit; }
button, a, label, select, summary, [role="button"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--ink); color: var(--ink-text); padding: 10px 16px; border-radius: 999px; font-weight: 600; }
.skip:focus { top: 12px; }
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--card); color: var(--text); font-weight: 550; cursor: pointer;
  transition: transform .12s var(--ease), background-color .15s ease, border-color .15s ease, opacity .15s; white-space: nowrap; text-decoration: none !important; font-size: 14.5px;
}
.btn:hover { background: var(--card2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-accent { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--faint); border-top-color: transparent; animation: spin .7s linear infinite; }
.btn-primary.is-busy::after { border-color: var(--ink-text); border-top-color: transparent; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: inline-grid; place-items: center; color: var(--muted); font-size: 15px; }
.icon-btn:hover { background: var(--card2); color: var(--text); }
.icon-btn .i { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger:hover { color: var(--red); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 550; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line2); border-radius: var(--radius-s);
  padding: 9px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="color"] { padding: 2px; height: 38px; width: 56px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 5px; color: var(--text); font-weight: 400; }
.form { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.stack { display: grid; gap: 12px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); font-size: 14px; cursor: pointer; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 4px; }

/* ---------- Layout ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2) 70%, transparent); backdrop-filter: saturate(180%) blur(20px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; padding: 4px 10px 18px; letter-spacing: -0.02em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-weight: 500; text-decoration: none; font-size: 14.5px; }
.nav a:hover { background: var(--card2); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .i { width: 19px; height: 19px; color: var(--muted); }
.nav a.active .i { color: var(--accent); }
.nav .count { margin-left: auto; font-variant-numeric: tabular-nums; background: var(--red); color: #fff; border-radius: 999px; font-size: 11.5px; padding: 1px 7px; font-weight: 650; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 16px 10px 6px; font-weight: 650; }
.nav-courses a .dot { margin: 0 4px 0 6px; }
.side-foot { margin-top: auto; padding: 14px 10px 0; font-size: 12px; color: var(--faint); }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent; min-height: 58px;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { opacity: 0; transition: opacity .2s; }
.topbar.scrolled h1, .topbar.always h1 { opacity: 1; }
.topbar h1 { font-size: 20px; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { padding: 8px 28px 60px; max-width: 1360px; margin: 0 auto; }
.topbar { padding-left: max(28px, calc((100% - 1360px) / 2 + 28px)); padding-right: max(28px, calc((100% - 1360px) / 2 + 28px)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 10px 0 22px; }
.page-head h1 { font-size: 32px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.section { margin-top: 28px; }
.section > h2, .section-title { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.timer-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: var(--accent-fill); color: #fff; font-weight: 650; font-variant-numeric: tabular-nums; cursor: pointer; font-size: 13.5px; border: 0; }
.timer-pill.break { background: var(--green); }
.timer-pill.paused { background: var(--faint); }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-in-out infinite; }
.timer-pill.paused .pill-dot { animation: none; opacity: .7; }

.tabbar { display: none; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
@media (prefers-color-scheme: light) { .card { border-color: transparent; } }
.card-flat { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 18px; }
.card h3 + p { margin-top: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
@media (prefers-color-scheme: light) { .stat { border-color: transparent; } }
.stat .label { font-size: 13.5px; color: var(--muted); font-weight: 550; }
.stat .value { white-space: nowrap; font-size: clamp(22px, 2.2vw, 28px); font-feature-settings: "tnum"; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--muted); }
.stat.clickable { cursor: pointer; transition: transform .12s; }
.stat.clickable:hover { transform: translateY(-2px); }
a.stat { color: inherit; text-decoration: none !important; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.course-card { position: relative; overflow: hidden; cursor: pointer; transition: transform .12s ease, box-shadow .12s; padding-top: 24px; }
.course-card:hover { transform: translateY(-2px); }
a.course-card { color: inherit; text-decoration: none !important; display: block; }
.course-card .stripe { position: absolute; inset: 0 0 auto 0; height: 6px; }
.course-card .code { font-size: 12.5px; font-weight: 650; color: var(--muted); letter-spacing: .04em; }
.course-card h3 { font-size: 18px; margin: 3px 0 12px; }
.course-card .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.course-card.archived { opacity: .55; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card2); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.st-gray { background: var(--card2); color: var(--muted); }
.st-blue { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.st-orange { background: rgba(255,149,0,.14); color: var(--orange); border-color: transparent; }
.st-green { background: rgba(48,177,88,.14); color: var(--green); border-color: transparent; }
.st-red { background: rgba(255,59,48,.12); color: var(--red); border-color: transparent; }
.st-purple { background: rgba(175,82,222,.13); color: var(--purple); border-color: transparent; }

/* ---------- Listas ---------- */
.list { display: grid; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
@media (prefers-color-scheme: light) { .list { border-color: transparent; } }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.item:last-child { border-bottom: 0; }
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: var(--card2); }
.item .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--card2); color: var(--muted); }
.item .ico .i { width: 18px; height: 18px; }
.item .ico.ok { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.item .ico.bad { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.item .ico.mid { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange); }
.item .ico.acc { background: var(--accent-soft); color: var(--accent); }
a.item { color: inherit; text-decoration: none; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item .actions { display: flex; gap: 2px; align-items: center; flex: none; }
.item select.inline { width: auto; padding: 4px 26px 4px 10px; font-size: 12.5px; border-radius: 999px; }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); overflow-x: auto; margin-bottom: 20px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 14px; border: 0; background: none; cursor: pointer; text-decoration: none; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; }
.tabs a .i { width: 16px; height: 16px; }
.tabs a:hover { color: var(--text); }
.tabs a.active, .tabs button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line2); background: var(--card); padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 550; cursor: pointer; color: var(--text); display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { border-color: var(--faint); }
.chip.active { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.chip .i { width: 15px; height: 15px; }
.chip .n { opacity: .6; font-size: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; }

.meter { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--scrim); opacity: 0; transition: opacity .18s; }
.modal-wrap.open { opacity: 1; }
.modal { background: var(--bg2); border-radius: 20px; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.98); transition: transform .22s var(--ease); }
.modal-wrap.open .modal { transform: none; }
.modal-wide { width: min(960px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; gap: 10px; }
.modal-head h2 { font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 6px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.viewer-frame { width: 100%; height: 72vh; border: 0; border-radius: 12px; background: var(--card2); }
.viewer-img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: 12px; }

#toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 14px; background: var(--ink); color: var(--ink-text); font-weight: 550; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: opacity .25s var(--ease), transform .25s var(--ease); max-width: 90vw; }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--red); color: #fff; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--card2); color: var(--muted); }
.empty-icon .i { width: 28px; height: 28px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }
.loading { display: grid; place-items: center; padding: 60px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent-fill); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .card { width: min(400px, 100%); padding: 32px; }
.auth h1 { font-size: 28px; margin: 14px 0 4px; }
.auth .logo { width: 58px; height: 58px; border-radius: 15px; }

/* ---------- Markdown ---------- */
.md { line-height: 1.65; overflow-wrap: anywhere; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { padding-left: 22px; margin: 0 0 10px; }
.md h1, .md h2, .md h3 { margin: 14px 0 8px; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 16px; }
.md blockquote { margin: 0 0 10px; padding: 4px 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.md pre { background: var(--card2); padding: 12px; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 0 0 10px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line2); padding: 5px 10px; }
.md img { max-width: 100%; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* ---------- Editor de apuntes ---------- */
.editor-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; margin: 8px 0 16px; }
.title-input { font-size: 26px; font-weight: 700; border: 0; background: transparent; padding: 4px 0; letter-spacing: -0.02em; box-shadow: none !important; }
.editor-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.editor-meta select { width: auto; }
.save-state { font-size: 13px; color: var(--muted); min-width: 90px; text-align: right; }
.fields { display: grid; gap: 16px; }
.fields.cornell { grid-template-columns: minmax(200px, 1fr) 2fr; }
.fields.cornell .f-full { grid-column: 1 / -1; }
.field { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--card2); }
.field-head strong { font-size: 13.5px; }
.field textarea { border: 0; border-radius: 0; min-height: 90px; font-family: var(--font); box-shadow: none !important; background: var(--card); flex: 1; }
.field .preview { padding: 14px; min-height: 90px; }
.field .hint { padding: 0 14px 10px; }
.field.cornell-left { background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.sel-fab { position: fixed; z-index: 60; transform: translate(-50%, -120%); }
.md-help { font-size: 12.5px; color: var(--muted); }

/* ---------- Flashcards ---------- */
.review { max-width: 760px; margin: 0 auto; }
.flash { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); min-height: 300px; padding: 34px; display: flex; flex-direction: column; gap: 18px; }
.flash .side-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; }
.flash .front { font-size: 20px; }
.flash .back { border-top: 1px dashed var(--line2); padding-top: 18px; font-size: 17px; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.rate button { border-radius: 14px; padding: 12px 6px; border: 1px solid var(--line2); background: var(--card); cursor: pointer; font-weight: 650; display: grid; gap: 2px; }
.rate button small { font-weight: 500; color: var(--muted); }
.rate .r1 { color: var(--red); } .rate .r2 { color: var(--orange); } .rate .r3 { color: var(--green); } .rate .r4 { color: var(--accent); }
.rate button { transition: transform .12s var(--ease), background-color .15s; }
.rate button:active { transform: scale(0.98); }
.rate button:hover { background: var(--card2); }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line2); border-radius: 5px; padding: 0 5px; color: var(--muted); }
.progress-line { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 6px 0 18px; }
.progress-line span { display: block; height: 100%; background: var(--accent-fill); transition: width .3s var(--ease); }

/* ---------- Timer ---------- */
.timer-page { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.timer-page > *, .split > *, .split-even > * { min-width: 0; }
.clock { display: grid; place-items: center; padding: 26px 10px 10px; }
.ring { position: relative; width: min(320px, 78vw); aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--accent-fill); stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.ring.break .fg { stroke: var(--green); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .time { font-family: var(--mono); font-size: clamp(44px, 10vw, 64px); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.ring .phase { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.timer-controls { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--card2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.seg button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.focus-pick { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.focus-pick legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
.focus-pick label { cursor: pointer; }
.focus-pick input { position: absolute; opacity: 0; pointer-events: none; }
.focus-pick span { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line2); color: var(--text); font-weight: 650; }
.focus-pick input:checked + span { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.focus-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Gráficos ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bars .b span { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--accent-fill); min-height: 2px; transition: height .4s; }
.bars .b small { font-size: 10.5px; color: var(--muted); white-space: nowrap; height: 14px; line-height: 14px; display: block; }
.bars .b span.zero { min-height: 0; }
.bars .b.today span { background: var(--green); }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.hbar .val { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); grid-auto-columns: 13px; justify-content: start; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 13px; height: 13px; border-radius: 3px; background: var(--line); display: block; }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--green) 30%, var(--line)); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--green) 55%, var(--line)); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--green) 78%, var(--line)); }
.heat i[data-l="4"] { background: var(--green); }
.heat i.future { visibility: hidden; }
.chart-svg { width: 100%; height: auto; overflow: visible; display: block; }
.chart-svg.wide { max-height: 360px; }
.chart-svg text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.insight { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--card2); align-items: flex-start; font-size: 14px; }
.insight > .i { width: 20px; height: 20px; color: var(--accent); margin-top: 1px; }
.ring-goal { width: 74px; height: 74px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
@media (prefers-color-scheme: light) { .table-wrap { border-color: transparent; } }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; }
table.t th, table.t td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: var(--card2); }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grade { font-weight: 700; font-variant-numeric: tabular-nums; }
.grade.bad { color: var(--red); } .grade.ok { color: var(--green); }
.parts-rows { display: grid; gap: 8px; }
.parts-row { display: grid; grid-template-columns: 1fr 90px 90px 34px; gap: 8px; align-items: center; }

/* ---------- Métodos ---------- */
.method-card { cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: transform .12s; }
.method-card:hover { transform: translateY(-2px); }
.method-card .emoji { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.method-card .emoji .i { width: 24px; height: 24px; }
.steps { display: flex; gap: 6px; margin: 10px 0 20px; flex-wrap: wrap; }
.steps span { flex: 1; min-width: 40px; height: 5px; border-radius: 5px; background: var(--line); }
.steps span.done { background: var(--accent-fill); }
.steps span.now { background: color-mix(in srgb, var(--accent-fill) 50%, var(--line)); }
.gaps { display: grid; gap: 6px; margin: 10px 0; }
.gaps label { display: flex; gap: 10px; align-items: center; color: var(--text); font-weight: 500; font-size: 14.5px; }

/* ---------- Simulacros ---------- */
.sim-top { position: sticky; top: 58px; z-index: 10; background: var(--bg); padding: 10px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sim-clock { font-family: var(--mono); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sim-clock.low { color: var(--red); }
.sim-nav { display: flex; gap: 5px; flex-wrap: wrap; }
.sim-nav button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line2); background: var(--card); cursor: pointer; font-size: 12.5px; font-weight: 600; }
.sim-nav button.cur { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sim-nav button.r1 { background: rgba(48,177,88,.18); }
.sim-nav button.r05 { background: rgba(255,149,0,.2); }
.sim-nav button.r0 { background: rgba(255,59,48,.16); }
.result-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.result-btns .btn.sel { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.big-score { font-size: 64px; font-weight: 700; letter-spacing: -0.04em; font-feature-settings: "tnum"; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .split, .split-even, .timer-page { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .page { padding: 4px 16px calc(90px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 27px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg2) 85%, transparent); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 1px; font-size: 10.5px; color: var(--muted); font-weight: 600; text-decoration: none; border: 0; background: none; cursor: pointer; padding: 2px 0; position: relative; }
  .tabbar .i { width: 23px; height: 23px; }
  .tabbar .active { color: var(--accent); }
  .tabbar .count { position: absolute; top: -2px; left: 56%; background: var(--red); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 5px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats > :first-child { grid-column: 1 / -1; }
  .stat { padding: 14px; }
  .stat .value { font-size: 23px; }
  .page-head { margin-bottom: 16px; }
  .page-head .row .btn { padding: 8px 14px; }
  .fields.cornell { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 100px 1fr auto; }
  .modal-wrap { place-items: end center; padding: 0; }
  .modal { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-wide { width: 100%; }
  .flash { padding: 22px; min-height: 240px; }
  .rate { grid-template-columns: repeat(2, 1fr); }
  .toolbar select, .toolbar input { min-width: 0; flex: 1; }
  .sim-top { top: 54px; }
  .editor-head { grid-template-columns: 1fr; }
  .title-input { font-size: 22px; }
  #toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .item .actions .opt { display: none; }
}
.more-sheet a { display: flex; gap: 12px; align-items: center; padding: 14px 6px; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 550; text-decoration: none; }
.more-sheet a:last-child { border-bottom: 0; }
.dropzone { border: 2px dashed var(--line2); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background-color .15s, color .15s; width: 100%; background: none; font: inherit; }
.dropzone .i { width: 30px; height: 30px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.filelist { font-size: 13px; color: var(--text); margin-top: 8px; text-align: left; }
.uprog { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.uprog span { display: block; height: 100%; width: 0; background: var(--accent-fill); transition: width .2s; }

.legend i.hm { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: var(--line); }
.legend i.hm[data-l="1"] { background: color-mix(in srgb, var(--green) 30%, var(--line)); }
.legend i.hm[data-l="2"] { background: color-mix(in srgb, var(--green) 55%, var(--line)); }
.legend i.hm[data-l="3"] { background: color-mix(in srgb, var(--green) 78%, var(--line)); }
.legend i.hm[data-l="4"] { background: var(--green); }
.more-sheet .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; font-weight: 650; }
.more-sheet .i { width: 20px; height: 20px; color: var(--muted); }

/* Esqueletos de carga */
.skel { display: grid; gap: 14px; padding-top: 10px; }
.skel span { display: block; height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--card2), var(--line), var(--card2)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skel .h { height: 34px; width: 40%; }
.skel .b { height: 120px; border-radius: 16px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Plan de hoy */
.plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); color: inherit; text-decoration: none !important; transition: border-color .15s; }
.plan-item:hover { border-color: var(--line2); }
.plan-item .i { width: 20px; height: 20px; color: var(--accent); margin-top: 2px; }
.plan-item strong { display: block; }
.plan-item small { color: var(--muted); }

/* Reloj de los métodos */
.flash .side-label { display: flex; align-items: center; gap: 6px; }
.badge .i { width: 13px; height: 13px; }
.btn .i { width: 17px; height: 17px; }
.btn-lg .i { width: 19px; height: 19px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

button.item, .item[role="button"] { cursor: pointer; }
.item[role="button"]:focus-visible { outline-offset: -2px; }
.side-label .faint { margin-left: 6px; font-weight: 600; }
.course-card .meta span { display: inline-flex; gap: 5px; align-items: center; }
.course-card .meta .i { width: 15px; height: 15px; }
.method-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.method-icon .i { width: 28px; height: 28px; }
.item .sub span { display: inline-flex; align-items: center; gap: 4px; }
.item .sub .i { width: 14px; height: 14px; color: var(--faint); }
.chip { gap: 6px; }
