
/* AXIOM · identidad visual 1.2 — académico premium
   Azul marino #0B2033 · Azul noche #102B42 · Champagne #D6B477 · Dorado suave #E9D2A5
   Marfil #F8F4ED · Blanco cálido #FFFCF8 · Gris cálido #A8A5A0 · Texto #172332
   Tipografía: Cormorant Garamond (SIL Open Font License, incluida en assets/fonts) + fuente del sistema */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url(../assets/fonts/cormorant-garamond-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url(../assets/fonts/cormorant-garamond-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 700; font-display: swap; src: url(../assets/fonts/cormorant-garamond-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url(../assets/fonts/cormorant-garamond-latin-500-italic.woff2) format("woff2"); }
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --navy: #0B2033; --navy-2: #102B42; --navy-3: #173A57; --champagne: #D6B477; --gold-light: #E9D2A5; --ivory: #F8F4ED; --warm-white: #FFFCF8; --warm-gray: #A8A5A0;
  --petrol: #0B2033;

  --bg: #F8F4ED;
  --bg-grad: radial-gradient(1000px 520px at 100% 0%, #FBF7F0 0%, rgba(251,247,240,0) 60%), radial-gradient(800px 500px at 0% 100%, #F2EBDF 0%, rgba(242,235,223,0) 60%), #F8F4ED;
  --surface: #FFFCF8;
  --surface-2: #F3EDE3;
  --surface-3: #EAE1D2;
  --glass: rgba(255,252,248,.86);
  --text: #172332;
  --text-2: #4B5563;
  --text-3: #8A8680;
  --line: rgba(11,32,51,.08);
  --line-2: rgba(11,32,51,.15);
  --gold-line: rgba(214,180,119,.55);
  --primary: #0B2033;
  --primary-hover: #173A57;
  --primary-text: #F8F4ED;
  --accent: #B48C4A;
  --accent-hover: #9E7A3E;
  --accent-text: #FFFCF8;
  --accent-soft: #F3E7D0;
  --accent-ink: #7A5C2A;
  --gold: #D6B477;
  --gold-ink: #8A6A33;
  --gold-soft: #F4EAD6;
  --night: #0B2033;
  --danger: #A8473F;
  --danger-soft: #F6E3DF;
  --ok: #3D7A5B;
  --warn: #A1742A;
  --ring-track: rgba(11,32,51,.09);
  --shadow-1: 0 1px 2px rgba(11,32,51,.04), 0 4px 14px rgba(60,44,20,.06);
  --shadow-2: 0 4px 10px rgba(11,32,51,.06), 0 16px 40px rgba(60,44,20,.10);
  --shadow-3: 0 24px 64px rgba(11,32,51,.28);
  --hero: linear-gradient(150deg, #0B2033 0%, #102B42 60%, #173A57 100%);
  --r-s: 10px; --r-m: 14px; --r-l: 18px; --r-xl: 24px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --nav-h: 72px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #08182A;
  --bg-grad: radial-gradient(1000px 520px at 100% 0%, #0F2A44 0%, rgba(15,42,68,0) 60%), #08182A;
  --surface: #0F2438;
  --surface-2: #14304A;
  --surface-3: #1B3B5A;
  --glass: rgba(10,26,42,.88);
  --text: #F3EDE2;
  --text-2: #C9C2B6;
  --text-3: #918C84;
  --line: rgba(233,210,165,.09);
  --line-2: rgba(233,210,165,.17);
  --gold-line: rgba(214,180,119,.45);
  --primary: #D6B477;
  --primary-hover: #E2C48D;
  --primary-text: #0B2033;
  --accent: #D6B477;
  --accent-hover: #E2C48D;
  --accent-text: #0B2033;
  --accent-soft: rgba(214,180,119,.14);
  --accent-ink: #E9D2A5;
  --gold: #D6B477;
  --gold-ink: #E9D2A5;
  --gold-soft: rgba(214,180,119,.13);
  --danger: #E59286;
  --danger-soft: rgba(229,146,134,.13);
  --ok: #86C3A2;
  --warn: #E2BC78;
  --ring-track: rgba(233,210,165,.12);
  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow-2: 0 2px 8px rgba(0,0,0,.3), 0 16px 40px rgba(0,0,0,.32);
  --shadow-3: 0 24px 64px rgba(0,0,0,.6);
  --hero: linear-gradient(150deg, #0A1C2E 0%, #0F2A44 60%, #173A57 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent-ink); }
.icw { display: inline-flex; line-height: 0; }
.ic { flex: none; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--accent-soft); }

/* ---------- pantalla de carga ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: #F8F4ED; transition: opacity .5s var(--ease), visibility .5s;
}
#splash.out { opacity: 0; visibility: hidden; }
#splash .mark { width: 132px; height: 132px; border-radius: 30px; box-shadow: 0 18px 50px rgba(11,32,51,.18); animation: rise .9s var(--ease) both; }
#splash .word { margin-top: 18px; font-family: var(--font-display); font-size: 26px; letter-spacing: .02em; color: #0B2033; text-align: center; animation: rise .9s .12s var(--ease) both; }
#splash .sub { margin-top: 4px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: #D6B477; text-align: center; animation: rise .9s .2s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- estructura ---------- */
.app { min-height: 100vh; display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: calc(var(--safe-t) + 8px) calc(20px + var(--safe-r)) calc(var(--nav-h) + var(--safe-b) + 32px) calc(20px + var(--safe-l)); }
.page { max-width: 1040px; margin: 0 auto; animation: pageIn .35s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* barra inferior (celular) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 6px calc(8px + var(--safe-r)) calc(6px + var(--safe-b)) calc(8px + var(--safe-l));
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 2px; color: var(--text-3); font-size: 10.5px; font-weight: 500; letter-spacing: .01em; border-radius: 12px; transition: color .2s; }
.tab.active { color: var(--accent); }
.tab .ic { width: 25px; height: 25px; }
.tab:active { transform: scale(.94); }

@media (min-width: 960px) {
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; width: 252px; flex: none;
    padding: 28px 16px 20px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 55%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 22px; }
  .brand img { width: 36px; height: 36px; border-radius: 10px; }
  .brand b { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: .01em; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text-2); font-weight: 500; font-size: 15px; transition: background .2s, color .2s; text-decoration: none; }
  .side-link:hover { background: var(--surface-2); color: var(--text); }
  .side-link.active { background: var(--accent-soft); color: var(--accent-ink); }
  .side-sep { height: 1px; background: var(--line); margin: 12px 10px; }
  .side-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--text-3); }
  .main { padding: 40px 48px 64px; }
}

/* ---------- encabezados ---------- */
.topbar { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0 -6px 2px; }
.topbar .spacer { flex: 1; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-size: 16px; padding: 6px; border-radius: 10px; max-width: 70%; }
.back span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--text-2); transition: background .2s, transform .15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.accent { color: var(--accent); }
.icon-btn.filled { background: var(--accent); color: var(--accent-text); }

.eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin: 6px 0 4px; }
.title { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1.12; letter-spacing: -.01em; margin: 0 0 6px; }
.title.sm { font-size: 28px; }
.subtitle { color: var(--text-2); margin: 0 0 22px; font-size: 15.5px; }
.section { margin: 30px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section h2 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.section .link { color: var(--accent); font-size: 15px; font-weight: 500; }
@media (min-width: 960px) { .title { font-size: 40px; } }

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); border: 1px solid var(--line); }
.card.pad { padding: 18px; }
.card.hover { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.card.press:active { transform: scale(.985); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr; }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } }

/* tarjeta héroe del período */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 22px; color: #F8F4ED;
  background: var(--hero);
  box-shadow: 0 18px 44px rgba(11,32,51,.24);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(233,210,165,.22), rgba(233,210,165,0) 70%); }
.hero .k { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--champagne); }
.hero h3 { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 6px 0 2px; }
.hero p { margin: 0; color: #C9C3B8; font-size: 14px; }
.hero .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; z-index: 1; }
.hero .ring { color: #D6B477; }
.hero .ring span { color: #F8F4ED; }
.hero-stats { display: flex; gap: 22px; margin-top: 18px; position: relative; z-index: 1; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 20px; font-weight: 600; }
.hero-stats small { font-size: 12px; color: #B8B2A6; }

.ring { position: relative; display: inline-grid; place-items: center; color: var(--accent); flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring svg circle:last-child { transition: stroke-dashoffset .8s var(--ease); }
.ring span { font-size: 11.5px; font-weight: 650; color: var(--text); }

/* tarjeta de materia */
.subject { display: flex; flex-direction: column; gap: 14px; padding: 18px; text-decoration: none; color: inherit; position: relative; overflow: hidden; }
.subject .s-top { display: flex; align-items: center; gap: 12px; }
.s-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.subject h4 { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.3; }
.subject .meta { font-size: 13px; color: var(--text-3); }
.bar { height: 5px; border-radius: 3px; background: var(--ring-track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: currentColor; transition: width .8s var(--ease); }

/* accesos rápidos */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.q { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: 12.5px; font-weight: 500; color: var(--text-2); text-align: center; transition: transform .2s var(--ease); }
.q .qi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.q:active { transform: scale(.95); }
@media (min-width: 700px) { .quick { grid-template-columns: repeat(4, minmax(0, 160px)); } }

/* mini estadísticas */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 14px; }
.stat .v { font-size: 22px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.stat .l { font-size: 12.5px; color: var(--text-3); }
.stat .v .ic { color: var(--accent); }

/* listas */
.list { background: var(--surface); border-radius: var(--r-l); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 56px; text-decoration: none; color: inherit; width: 100%; text-align: left; position: relative; }
.list .row + .row::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; height: 1px; background: var(--line); }
.list.plain .row + .row::before { left: 16px; }
button.row:hover, a.row:hover { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 550; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .d { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chev { color: var(--text-3); }
.row-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.row-ic.accent { background: var(--accent-soft); color: var(--accent-ink); }
.row-ic.exam { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 14px; font-weight: 600; font-size: 15.5px; transition: background .2s, transform .15s, opacity .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.fab { position: fixed; right: calc(20px + var(--safe-r)); bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 25; width: 56px; height: 56px; border-radius: 18px; background: var(--primary); color: var(--primary-text); display: grid; place-items: center; box-shadow: 0 10px 28px rgba(11,32,51,.32); transition: transform .2s var(--ease); }
.fab:active { transform: scale(.92); }
@media (min-width: 960px) { .fab { bottom: 32px; right: 40px; } }

/* chips / filtros */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 0 -20px 10px; padding-left: 20px; padding-right: 20px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; font-weight: 500; transition: all .2s; }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
@media (min-width: 960px) { .chips { margin: 0 0 10px; padding-left: 0; padding-right: 0; flex-wrap: wrap; } }

/* buscador */
.searchbox { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--text-3); margin-bottom: 14px; }
.searchbox input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--text); min-width: 0; }
.searchbox input::placeholder { color: var(--text-3); }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* formularios */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { color: var(--text-3); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=url], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface); font-size: 16px; outline: none; transition: border-color .2s, box-shadow .2s; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.invalid { border-color: var(--danger) !important; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .15s; }
.swatch.sel { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.icon-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ip { height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.ip.sel { background: var(--accent); color: var(--accent-text); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); gap: 2px; }
.seg button { height: 34px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* hoja inferior */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(6,14,24,.38); opacity: 0; transition: opacity .28s var(--ease); pointer-events: auto; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-3); transform: translateY(100%); transition: transform .32s var(--ease); pointer-events: auto; padding-bottom: var(--safe-b); }
.sheet-wrap.in .sheet-backdrop { opacity: 1; }
.sheet-wrap.in .sheet { transform: none; }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 4px 22px; }
.sheet-head h3 { margin: 0; font-size: 18px; font-weight: 650; }
.sheet-body { padding: 8px 22px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-actions { display: flex; gap: 10px; padding: 10px 22px 16px; border-top: 1px solid var(--line); }
.sheet-actions .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; max-height: 84vh; border-radius: 24px; transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .28s var(--ease), opacity .28s; }
  .sheet.wide { width: 720px; }
  .sheet-wrap.in .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-grab { display: none; }
}
.menu-list { display: flex; flex-direction: column; margin: 0 -10px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 13px 12px; border-radius: 12px; font-size: 16px; text-align: left; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .ic { color: var(--text-2); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }

/* avisos */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: 520px; padding: 12px 16px; border-radius: 14px; background: #0B2033; color: #F8F4ED; font-size: 14.5px; box-shadow: var(--shadow-3); opacity: 0; transform: translateY(10px); transition: all .3s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast-act { color: #E9D2A5; font-weight: 600; }
@media (min-width: 960px) { #toasts { bottom: 28px; } }

/* vacío */
.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty-ic { width: 60px; height: 60px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h4 { margin: 0 0 4px; font-size: 17px; color: var(--text); }
.empty p { margin: 0 auto 16px; max-width: 360px; font-size: 14.5px; }

/* ---------- materia / unidades / temas ---------- */
.subject-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 18px; }
.subject-head .s-ic { width: 60px; height: 60px; border-radius: 18px; }
.unit { margin-bottom: 12px; }
.unit-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; width: 100%; text-align: left; }
.unit-head .num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-2); flex: none; }
.unit-head h4 { margin: 0; font-size: 16px; font-weight: 600; }
.unit-head .tw { transition: transform .25s var(--ease); color: var(--text-3); }
.unit.closed .unit-head .tw { transform: rotate(-90deg); }
.unit.closed .unit-body { display: none; }
.unit-body { border-top: 1px solid var(--line); }
.topic-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; min-height: 50px; }
.topic-row + .topic-row { border-top: 1px solid var(--line); }
.topic-row.sub { padding-left: 44px; }
.topic-row a { flex: 1; min-width: 0; color: inherit; text-decoration: none; font-size: 15px; }
.status-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--text-3); flex: none; }
.status-btn.studying { color: var(--warn); }
.status-btn.mastered { color: var(--ok); }
.add-inline { display: flex; align-items: center; gap: 8px; padding: 12px 16px; color: var(--accent); font-weight: 500; font-size: 15px; width: 100%; border-top: 1px solid var(--line); }

/* estado de un tema */
.status-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.status-seg button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; font-weight: 550; }
.status-seg button.on.pending { background: var(--surface-3); color: var(--text); }
.status-seg button.on.studying { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--warn); border-color: transparent; }
.status-seg button.on.mastered { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); border-color: transparent; }

/* ---------- biblioteca ---------- */
.mat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .mat-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.mat { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit; text-align: left; }
.mat .thumb { aspect-ratio: 4/3; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); position: relative; overflow: hidden; }
.mat .thumb img, .mat .thumb video { width: 100%; height: 100%; object-fit: cover; }
.mat .thumb .ext { position: absolute; left: 10px; bottom: 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; padding: 3px 7px; border-radius: 6px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-1); }
.mat .thumb .fav { position: absolute; right: 8px; top: 8px; color: var(--gold); }
.mat .info { padding: 10px 12px 12px; }
.mat .info b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.mat .info small { color: var(--text-3); font-size: 12px; }
.note-thumb { padding: 14px; font-size: 11.5px; line-height: 1.45; color: var(--text-2); text-align: left; align-self: stretch; justify-self: stretch; overflow: hidden; background: linear-gradient(var(--surface-2), var(--surface-2)); }
.note-thumb::after { content: ""; }
.folder-card { display: flex; align-items: center; gap: 12px; padding: 14px; text-decoration: none; color: inherit; }
.folder-card .row-ic { background: var(--accent-soft); color: var(--accent-ink); }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13.5px; color: var(--text-3); margin: 0 0 10px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--r-l); padding: 26px; text-align: center; color: var(--text-2); transition: all .2s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* visor */
.viewer { margin: 0 -20px; }
@media (min-width: 960px) { .viewer { margin: 0; } }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0 20px; overflow-x: auto; }
.pdf-pages canvas, .pdf-page-ph { background: #fff; box-shadow: var(--shadow-2); border-radius: 4px; max-width: none; }
.pdf-page-ph { display: grid; place-items: center; color: #9AA4AF; font-size: 13px; }
.viewer-bar { position: sticky; top: calc(var(--safe-t) + 4px); z-index: 10; display: flex; align-items: center; gap: 6px; justify-content: center; margin: 0 auto 12px; width: max-content; padding: 4px 6px; border-radius: 14px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: 14px; color: var(--text-2); }
.doc-html { background: var(--surface); border-radius: var(--r-l); padding: 24px 22px; border: 1px solid var(--line); line-height: 1.65; overflow-wrap: anywhere; }
.doc-html img { max-width: 100%; height: auto; border-radius: 6px; }
.doc-html table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.doc-html td, .doc-html th { border: 1px solid var(--line-2); padding: 6px 8px; }
.slide { padding: 20px; margin-bottom: 14px; }
.slide .sn { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.slide p { margin: 0 0 6px; }
.slide p:first-of-type { font-weight: 650; font-size: 18px; font-family: var(--font-display); }
.slide .imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.slide .imgs img { width: 100%; border-radius: 8px; background: var(--surface-2); }
.media-view { width: 100%; max-height: 72vh; border-radius: var(--r-l); background: #000; display: block; }
.img-view { width: 100%; height: auto; border-radius: var(--r-l); display: block; background: var(--surface-2); }
.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.meta-grid dt { color: var(--text-3); }
.meta-grid dd { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- editor de apuntes ---------- */
.editor-wrap { background: var(--surface); border-radius: var(--r-l); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.toolbar { position: sticky; top: calc(var(--safe-t)); z-index: 5; display: flex; gap: 2px; padding: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar button { flex: none; width: 38px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--text-2); }
.toolbar button:hover, .toolbar button.on { background: var(--surface-2); color: var(--text); }
.toolbar .sep { width: 1px; background: var(--line); margin: 6px 4px; flex: none; }
.note-title { width: 100%; border: 0 !important; box-shadow: none !important; background: transparent !important; font-family: var(--font-display); font-size: 26px !important; font-weight: 600; padding: 16px 20px 0 !important; height: auto !important; }
.editor { min-height: 46vh; padding: 10px 20px 28px; outline: none; font-size: 17px; line-height: 1.7; overflow-wrap: anywhere; }
.editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.editor h2, .doc-html h2 { font-family: var(--font-display); font-size: 22px; margin: 18px 0 6px; font-weight: 600; }
.editor h3, .doc-html h3 { font-size: 18px; margin: 14px 0 4px; font-weight: 650; }
.editor blockquote, .doc-html blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--text); }
.editor mark, .doc-html mark { background: color-mix(in srgb, #E2B84E 38%, transparent); }
.save-state { font-size: 12.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }

/* lector en voz alta */
.tts-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 35; display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px; border-radius: 18px; background: #0B2033; color: #F8F4ED; box-shadow: var(--shadow-3); font-size: 14px; max-width: calc(100% - 24px); }
.tts-bar .icon-btn { color: #F8F4ED; width: 36px; height: 36px; }
.tts-bar .icon-btn:hover { background: rgba(255,255,255,.08); }
.tts-bar select { height: 32px; width: auto; padding: 0 28px 0 10px; border-radius: 9px; background-color: rgba(255,255,255,.08); border: 0; color: #F8F4ED; font-size: 13px; background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; }
@media (min-width: 960px) { .tts-bar { bottom: 28px; } }

/* hoja de ruta */
.phase { display: flex; gap: 14px; padding: 16px; }
.phase .pn { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; background: var(--surface-2); color: var(--text-2); }
.phase.now .pn { background: var(--accent); color: var(--accent-text); }
.phase h4 { margin: 0 0 2px; font-size: 15.5px; }
.phase p { margin: 0; font-size: 13.5px; color: var(--text-2); }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-m); background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; line-height: 1.45; }
.notice.warn { background: color-mix(in srgb, var(--warn) 13%, transparent); color: var(--warn); }
.notice b { color: inherit; }

/* bienvenida */
.welcome { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.welcome-card { width: 100%; max-width: 440px; text-align: center; }
.welcome-card img { width: 84px; height: 84px; border-radius: 22px; box-shadow: var(--shadow-2); }
.welcome-card h1 { font-family: var(--font-display); font-size: 34px; margin: 18px 0 6px; font-weight: 600; }
.welcome-card p { color: var(--text-2); margin: 0 0 26px; }
.welcome-card .form { text-align: left; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ajustes finos */
.tab, .back, .link, .side-link, .section a, .hero, .row, .subject, .mat, .folder-card, .q { text-decoration: none; }
.searchbox input[type=search], .searchbox input { border: 0; height: auto; padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; }
.hero h3 { font-size: 23px; line-height: 1.2; }


/* ================= AXIOM 1.0 ================= */
kbd { margin-left: auto; font: 600 11px var(--font); color: var(--text-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; }
.brand { text-decoration: none; color: inherit; }
.brand b { letter-spacing: .12em; font-family: var(--font-display); }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link { color: var(--accent-ink); font-weight: 550; background: none; border: 0; cursor: pointer; }
.seg.wrap { flex-wrap: wrap; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-chips .chip { height: auto; min-height: 34px; padding: 6px 14px; text-align: left; }

/* inicio de sesión */
.welcome-card { padding: 34px 26px; }
.login-logo { width: 120px; height: 120px; border-radius: 28px; box-shadow: var(--shadow-2); }
.welcome-card h1 { color: var(--petrol); }
:root[data-theme="dark"] .welcome-card h1 { color: var(--text); }
.login-msg { color: var(--text-2); font-size: 14px; margin: 16px 0 0; text-align: center; }
.code-in { font-size: 18px !important; text-align: center; font-variant-numeric: tabular-nums; }

/* pastilla de sincronización */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); text-decoration: none; margin-right: 4px; }
.sync-pill.ok { color: var(--ok); } .sync-pill.warn { color: var(--warn); } .sync-pill.danger { color: var(--danger); }

/* widgets del inicio */
.widgets { display: grid; grid-template-columns: 1fr; gap: 14px; }
.widgets > * { min-width: 0; }
.widgets .hero { display: block; text-decoration: none; }
.w { padding: 16px; text-decoration: none; color: inherit; display: block; }
.w-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.w-head b { font-size: 15px; flex: 1; }
.w-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.w-more { color: var(--text-3); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
.w-more:hover { background: var(--surface-2); }
.w-line { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14.5px; min-width: 0; }
.w-line + .w-line { border-top: 1px solid var(--line); }
.w-line .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-line .grow { flex: 1; min-width: 0; }
.w-date { width: 42px; text-align: center; border-radius: 10px; background: var(--gold-soft); color: var(--gold-ink); padding: 4px 0; line-height: 1.1; flex: none; }
.w-date b { display: block; font-size: 17px; } .w-date small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.w-empty { color: var(--text-3); font-size: 14px; margin: 6px 0 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.money-mid { font-size: 26px; font-weight: 650; letter-spacing: -.01em; margin-top: 2px; }
.quick-card { padding: 12px; }
.quick-card .quick { gap: 8px; }
.quick-card .q { box-shadow: none; border: 0; background: transparent; }
.quick-card .q:hover { background: var(--surface-2); }
.list.flat { border: 0; box-shadow: none; background: transparent; margin: 0 -16px; }
.anat { background: linear-gradient(135deg, var(--surface) 40%, var(--gold-soft)); }
@media (min-width: 760px) {
  .widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .w-wide { grid-column: 1 / -1; }
}
@media (min-width: 1180px) {
  .widgets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .widgets .hero.w-wide { grid-column: span 2; }
  .widgets .quick-card.w-wide { grid-column: span 1; }
  .quick-card .quick { grid-template-columns: repeat(2, 1fr); }
  .w-cal { grid-row: span 2; }
}

/* calendario */
.w-cal { padding: 12px 14px 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head b { font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-dow { font-size: 11px; font-weight: 700; color: var(--text-3); padding: 4px 0; }
.cal-day { position: relative; aspect-ratio: 1 / .9; border-radius: 10px; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text); }
.cal-day:hover { background: var(--surface-2); }
.cal-day.today span:first-child { background: var(--primary); color: var(--primary-text); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; font-weight: 700; }
.cal-dots { display: flex; gap: 3px; position: absolute; bottom: 3px; }
.cal-dots i, .cal-legend i { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
i.exam { background: var(--danger); } i.task { background: var(--accent); } i.plan { background: var(--gold); }
.cal-legend { display: flex; gap: 14px; justify-content: center; margin-top: 8px; font-size: 11.5px; color: var(--text-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* herramientas de la materia y "Más" */
.study-tools, .tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
@media (min-width: 760px) { .study-tools { grid-template-columns: repeat(4, 1fr); } .tiles { grid-template-columns: repeat(3, 1fr); } }
.tool, .tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; text-align: left; text-decoration: none; color: inherit; }
.tool .qi, .tile .qi { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 6px; }
.tool small, .tile small { color: var(--text-3); font-size: 12.5px; }
.tile b { font-size: 15px; }

/* exámenes */
.score-chip { min-width: 42px; height: 36px; padding: 0 8px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.score-chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.score-chip.bad { background: var(--danger-soft); color: var(--danger); }
.q-area { margin-top: 14px; }
.q-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--text-3); font-weight: 600; margin-bottom: 8px; }
.q-stem { font-size: 18.5px; line-height: 1.5; font-weight: 550; margin: 4px 0 16px; white-space: pre-wrap; }
.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-opt { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line-2); text-align: left; font-size: 16px; line-height: 1.45; transition: border-color .15s, background .15s, transform .1s; width: 100%; }
button.q-opt:hover { border-color: var(--accent); }
button.q-opt:active { transform: scale(.99); }
.q-opt.sel { border-color: var(--primary); background: var(--accent-soft); }
.q-letter { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--text-2); flex: none; }
.q-opt.sel .q-letter { background: var(--primary); color: var(--primary-text); }
.q-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; }
.icon-btn.flagged { color: var(--gold); background: var(--gold-soft); }
.q-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.q-dot { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2); }
.q-dot.ans { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.q-dot.flag { box-shadow: inset 0 -3px 0 var(--gold); }
.q-dot.cur { outline: 2px solid var(--primary); outline-offset: 1px; }
.result-hero { display: flex; align-items: center; gap: 20px; padding: 22px; border-radius: var(--r-xl); color: #fff; background: var(--hero); box-shadow: var(--shadow-2); }
.result-hero.bad { background: linear-gradient(140deg, #3A2E2C, #6E4A42 60%, #A86A55); }
.result-hero .ring { color: #E9D2A5; } .result-hero .ring span { color: #fff; font-size: 16px; }
.result-hero.bad .ring { color: #F1D3C5; }
.result-grade { font-size: 44px; font-weight: 700; line-height: 1.05; font-family: var(--font-display); }
.result-grade small { font-size: 18px; opacity: .75; font-family: var(--font); }
.review { padding: 16px; margin-bottom: 12px; border-left: 4px solid var(--line-2); }
.review.ok { border-left-color: var(--ok); } .review.bad { border-left-color: var(--danger); } .review.partial, .review.pending { border-left-color: var(--warn); }
.review-opts .q-opt { border-width: 1px; padding: 11px 12px; font-size: 15px; }
.q-opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); color: var(--text); }
.q-opt.right .q-letter { background: var(--ok); color: #fff; }
.q-opt.right > .icw { color: var(--ok); }
.q-opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.q-opt.wrong .q-letter { background: var(--danger); color: #fff; }
.q-opt.wrong > .icw { color: var(--danger); }
.tag-me { margin-left: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.why { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.rv-block { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; }
.rv-block.ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.rv-block p { margin: 4px 0 0; white-space: pre-wrap; }
.rv-ref { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }

/* tarjetas */
.flash { width: 100%; min-height: 300px; padding: 28px 22px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); display: grid; place-items: center; text-align: center; transition: transform .35s var(--ease); }
.flash.flipped { background: linear-gradient(160deg, var(--surface), var(--accent-soft)); animation: flip .35s var(--ease); }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: none; } }
.flash-text { font-size: 21px; line-height: 1.45; font-weight: 550; white-space: pre-wrap; }
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.grade-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 14px; font-weight: 650; font-size: 14.5px; background: var(--surface-2); }
.grade-btn small { font-weight: 500; font-size: 11.5px; color: var(--text-3); }
.grade-btn.bad { color: var(--danger); } .grade-btn.warn { color: var(--warn); } .grade-btn.ok { color: var(--ok); } .grade-btn.accent { color: var(--accent-ink); }

/* economía */
.hero.money .money-big { font-size: 38px; font-weight: 700; letter-spacing: -.01em; margin: 4px 0 6px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.hero.money p { color: #E9DFCD; position: relative; z-index: 1; }
.hero.money .hero-stats { flex-wrap: wrap; row-gap: 10px; }
.period-nav { display: flex; align-items: center; gap: 4px; }
.period-nav b { min-width: 120px; text-align: center; font-size: 14.5px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.mini-stats small { display: block; color: var(--text-3); font-size: 12px; }
.mini-stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 15px; }
.amount.in { color: var(--ok); } .amount.out { color: var(--text); } .amount.planned { color: var(--text-3); font-style: italic; }

/* gráficos */
.chart-scroll { overflow-x: auto; scrollbar-width: none; }
.chart-scroll::-webkit-scrollbar { display: none; }
.chart svg { display: block; max-width: none; }
.ch-l { font-size: 11px; fill: var(--text-3); font-family: var(--font); }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-target { stroke: var(--gold); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.donut { position: relative; flex: none; }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 13px; }
.donut-c small { color: var(--text-3); font-size: 11.5px; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 13px; flex: 1; min-width: 160px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend span { flex: 1; color: var(--text-2); }

/* plan del parcial */
.day { padding: 12px 14px; margin-bottom: 10px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-1); }
.day.past { opacity: .72; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.plan-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 15px; }
.plan-item.done .grow { text-decoration: line-through; color: var(--text-3); }

/* resúmenes e IA */
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-card { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; text-align: left; }
.mode-card span { font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.mode-card.on { border-color: var(--primary); background: var(--accent-soft); }
@media (max-width: 420px) { .mode-cards { grid-template-columns: 1fr; } }
.prompt-box { font-family: var(--font-mono); font-size: 12.5px !important; margin-top: 8px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 14.5px; }
.note-thumb.summary { background: linear-gradient(160deg, var(--surface-2), var(--gold-soft)); }
.doc-html table, .editor table { border-collapse: collapse; width: 100%; font-size: 14.5px; margin: 10px 0; display: block; overflow-x: auto; }
.editor td, .editor th { border: 1px solid var(--line-2); padding: 6px 8px; text-align: left; }
.editor th { background: var(--surface-2); }
details summary { cursor: pointer; }

/* entradas: puntero fino, teclado y lápiz */
@media (hover: hover) and (pointer: fine) { .q-opt, .chip, .row { cursor: pointer; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.editor { touch-action: manipulation; }

/* impresión */
@media print {
  .sidebar, .tabbar, .topbar, .toolbar, .fab, #toasts, .btn-row, .tts-bar { display: none !important; }
  body { background: #fff; }
  .main { padding: 0 !important; }
  .editor-wrap, .card { box-shadow: none; border: 0; }
}

/* protección contra desbordes horizontales en pantallas angostas */
.main { min-width: 0; overflow-x: clip; }
.section { flex-wrap: wrap; row-gap: 8px; }
.sheet-body { min-height: 0; }
.period-nav { margin-left: auto; }
@media (max-width: 420px) { .period-nav b { min-width: 96px; } .seg button { padding: 0 11px; } }
.hero-stats { flex-wrap: wrap; row-gap: 10px; }
.q-nav .btn { padding: 0 14px; }
a.btn, .btn { text-decoration: none; }
.page:has(.fab) { padding-bottom: 76px; }

/* ===================== AXIOM 1.1 ===================== */
.flip svg, svg.flip { transform: rotate(180deg); }
/* bloqueo Face ID */
.lock-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: var(--bg); text-align: center; }
.lock-screen img { width: 88px; height: 88px; border-radius: 22px; box-shadow: var(--shadow-2); margin-bottom: 16px; }
.lock-screen h1 { font-size: 24px; margin: 0 0 6px; }
.lock-screen p { color: var(--text-2); margin: 0 0 22px; }
.lock-screen .btn { min-width: 220px; }
/* economía */
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.formula b { font-weight: 650; }
.formula .op { color: var(--text-3); font-weight: 700; }
.hero.money.negative { background: linear-gradient(150deg, #7a3a34, #B4534A); }
.budget-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.budget-row:last-child { border-bottom: 0; }
.budget-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.budget-top small { color: var(--text-3); }
/* IA */
.ai-spark { color: var(--gold-ink); }
.gen-btn { gap: 6px; }
.flash-face { display: flex; flex-direction: column; gap: 10px; align-items: center; }
/* figuras en resúmenes y apuntes */
.editor figure, .doc figure, .note-body figure { margin: 14px 0; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.editor figure img, .doc figure img, .note-body figure img, figure img { display: block; max-width: 100%; height: auto; border-radius: var(--r-s); margin: 0 auto; }
figcaption { font-size: 12.5px; color: var(--text-3); text-align: center; margin-top: 6px; }
/* clase en vivo */
.rec-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 16px; margin: 14px 0; }
.rec-btn { width: 84px; height: 84px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: var(--shadow-2); cursor: pointer; transition: transform .2s var(--ease); }
.rec-btn:active { transform: scale(.95); }
.rec-btn.rec { background: var(--danger); animation: recpulse 1.6s infinite; }
.rec-btn.paused { background: var(--warn); }
.rec-btn.saving, .rec-btn.saved { opacity: .6; }
@keyframes recpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(180,83,74,.45); } 50% { box-shadow: 0 0 0 14px rgba(180,83,74,0); } }
.rec-clock { font-size: 34px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rec-meter { width: min(260px, 80%); height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rec-meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.timed-notes { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.tn { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); color: inherit; font: inherit; }
button.tn { cursor: pointer; }
.tn > span:nth-child(2) { flex: 1; white-space: pre-wrap; }
.tn-t { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 650; min-width: 46px; }
/* practica */
.subject-pick { max-width: 420px; }
.practice-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .practice-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .practice-grid { grid-template-columns: repeat(3, 1fr); } }
.practice-tile { display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; color: inherit; font: inherit; }
.practice-tile .qi { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.practice-tile b { display: block; }
.practice-tile span { font-size: 13px; color: var(--text-3); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-grid > div { display: flex; flex-direction: column; gap: 8px; }
.match-item { min-height: 54px; padding: 10px 12px; border-radius: var(--r-m); border: 1.5px solid var(--line-2); background: var(--surface); color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: background .2s, border-color .2s, transform .15s; }
.match-item.def { font-size: 13px; color: var(--text-2); }
.match-item.on { border-color: var(--accent); background: var(--accent-soft); }
.match-item.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); opacity: .7; cursor: default; }
.match-item.bad { border-color: var(--danger); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* tutor */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 40vh; padding: 6px 0 12px; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.bot, .msg.sys { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); line-height: 1.5; font-size: 15px; overflow-wrap: anywhere; }
.bubble > :first-child { margin-top: 0; } .bubble > :last-child { margin-bottom: 0; }
.bubble blockquote { margin: 8px 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 6px; font-size: 13.5px; }
.msg.me .bubble { background: var(--accent); color: #fff; border-color: transparent; border-bottom-right-radius: 6px; }
.msg.sys .bubble { background: transparent; border-style: dashed; color: var(--text-2); font-size: 13.5px; }
.msg-src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg-src .chip { font-size: 12px; text-decoration: none; }
.dots::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.chat-input { position: sticky; bottom: calc(var(--tabbar-h, 64px) + env(safe-area-inset-bottom) + 8px); display: flex; gap: 8px; align-items: flex-end; padding: 8px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); }
.chat-input textarea { flex: 1; border: 0; background: transparent; resize: none; min-height: 44px; box-shadow: none; }
@media (min-width: 900px) { .chat-input { bottom: 12px; } }
.hero.money .formula { background: rgba(255,255,255,.12); color: #fff; margin-top: 14px; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 10px 14px; }
.hero.money .formula > div { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: baseline; }
.hero.money .formula small { font-size: 13px; opacity: .85; }
.hero.money .formula b { font-size: 14px; white-space: nowrap; }
.hero.money .formula i { font-style: normal; font-weight: 700; opacity: .8; text-align: center; }
.hero.money .formula .eq { border-top: 1px solid rgba(255,255,255,.25); padding-top: 6px; margin-top: 2px; }
.page:has(> .fab) { padding-bottom: 110px; }
.chips[role=tablist] { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chips[role=tablist]::-webkit-scrollbar { display: none; }
.chips[role=tablist] .chip { flex: none; }

.grid > * { min-width: 0; }
.list .row .grow { min-width: 0; }
.row .amount { white-space: nowrap; flex: none; } .row .badge { flex: none; }

/* =====================================================================
   AXIOM 1.2 · identidad "académico premium": marino, champagne y marfil
   ===================================================================== */
body { background: var(--bg-grad); }
:root { --display-tight: -.005em; }
.title { font-family: var(--font-display); font-weight: 600; font-size: 38px; letter-spacing: var(--display-tight); color: var(--text); }
.title.sm { font-size: 32px; }
@media (min-width: 960px) { .title { font-size: 46px; } }
.eyebrow { color: var(--gold-ink); letter-spacing: .2em; font-size: 11.5px; }
.subtitle { color: var(--text-2); }
.section h2 { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: 0; }
.section .link, a.link { color: var(--gold-ink); display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.sheet-head h3 { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.back { color: var(--gold-ink); }
.icon-btn.accent { color: var(--gold-ink); }
.card, .list, .editor-wrap { border-color: rgba(214,180,119,.20); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .list, :root[data-theme="dark"] .editor-wrap { border-color: rgba(214,180,119,.12); }
.row-ic.accent, .w-ic { background: var(--gold-soft); color: var(--gold-ink); }
.badge.accent { background: var(--gold-soft); color: var(--gold-ink); }
.chip.on { background: var(--navy); color: var(--ivory); }
:root[data-theme="dark"] .chip.on { background: var(--champagne); color: var(--navy); }
.btn.primary { box-shadow: 0 6px 18px rgba(11,32,51,.18); }
.btn.soft { background: var(--gold-soft); color: var(--gold-ink); }
.btn.gold { background: linear-gradient(160deg, #E9D2A5, #C9A462); color: #0B2033; }
.seg button.on { color: var(--text); }
:focus-visible { outline-color: var(--champagne); }
input:focus, select:focus, textarea:focus { border-color: var(--champagne); box-shadow: 0 0 0 4px rgba(214,180,119,.22); }
.fab { background: linear-gradient(160deg, #E9D2A5, #C9A462); color: #0B2033; border-radius: 50%; box-shadow: 0 10px 26px rgba(150,110,40,.35), inset 0 1px 0 rgba(255,255,255,.5); }
.notice { background: var(--gold-soft); color: var(--gold-ink); }
.hero { background: var(--hero); box-shadow: 0 18px 44px rgba(11,32,51,.26); border: 1px solid var(--gold-line); }
.hero .k { color: var(--champagne); }
.hero .ring { color: var(--champagne); --ring-track: rgba(255,255,255,.12); }
.bar > i { background: currentColor; }
.ring span { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
#splash { background: radial-gradient(800px 500px at 50% 30%, #173A57 0%, #0B2033 70%); }
#splash .mark { width: 150px; height: auto; border-radius: 0; box-shadow: none; }
#splash .word { color: #F8F4ED; font-size: 38px; letter-spacing: .22em; font-weight: 600; }
#splash .sub { color: #D6B477; letter-spacing: .5em; }

/* barra de estado del iPhone sobre marino (app instalada) */
@media (display-mode: standalone) { body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: var(--safe-t); background: #0B2033; z-index: 40; } }

/* ---------- barra inferior marino con botón dorado ---------- */
.tabbar {
  background: linear-gradient(180deg, #102B42, #0B2033); border-top: 1px solid rgba(214,180,119,.28);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: end;
  padding: 6px calc(10px + var(--safe-r)) calc(6px + var(--safe-b)) calc(10px + var(--safe-l));
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(11,32,51,.22);
}
.tab { color: rgba(248,244,237,.72); font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: .01em; padding: 7px 0 5px; border: 1px solid transparent; }
.tab .ic { width: 23px; height: 23px; }
.tab.active { color: var(--champagne); background: rgba(214,180,119,.12); border-color: rgba(214,180,119,.45); }
.tab-add { justify-self: center; width: 62px; height: 62px; margin-top: -30px; margin-bottom: 4px; border-radius: 50%; display: grid; place-items: center; color: #0B2033;
  background: radial-gradient(circle at 35% 28%, #F6E7C4 0%, #E2C48D 38%, #C29A55 100%);
  box-shadow: 0 0 0 4px #0B2033, 0 0 0 5px rgba(214,180,119,.55), 0 12px 26px rgba(0,0,0,.35); transition: transform .2s var(--ease); }
.tab-add:active { transform: scale(.93); }
.tab-add .ic { width: 28px; height: 28px; stroke-width: 1.8; }
.fab { bottom: calc(var(--nav-h) + var(--safe-b) + 22px); }

/* ---------- menú lateral marino (computadora) y menú ☰ (celular) ---------- */
.sidebar { background: linear-gradient(180deg, #0B2033 0%, #102B42 100%) !important; color: #F8F4ED; border-right: 1px solid rgba(214,180,119,.25) !important; overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; color: #F8F4ED; }
.brand img { width: 52px !important; height: auto !important; border-radius: 0 !important; }
.brand span { display: flex; flex-direction: column; line-height: 1; }
.brand b { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: .2em; color: #F8F4ED; }
.brand small { font-size: 10px; letter-spacing: .45em; text-transform: uppercase; color: var(--champagne); margin-top: 5px; }
.side-add { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; margin: 0 6px 10px; border-radius: 14px; font-weight: 650; color: #0B2033; background: linear-gradient(160deg, #EED9B0, #C9A462); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.side-group { font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: rgba(214,180,119,.75); padding: 14px 12px 4px; }
.sidebar .side-link { color: rgba(248,244,237,.78) !important; font-size: 15px; padding: 9px 12px; border: 1px solid transparent; }
.sidebar .side-link:hover { background: rgba(255,255,255,.06) !important; color: #fff !important; }
.sidebar .side-link.active { background: rgba(214,180,119,.13) !important; color: var(--champagne) !important; border-color: rgba(214,180,119,.35); }
.sidebar .side-sep { background: rgba(214,180,119,.18); }
.sidebar .side-foot { color: rgba(248,244,237,.45); }
.sidebar kbd { color: rgba(248,244,237,.5); border-color: rgba(248,244,237,.2); }
.drawer-backdrop { display: none; }
@media (max-width: 959px) {
  .sidebar { display: flex; flex-direction: column; gap: 2px; position: fixed; z-index: 80; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); padding: calc(var(--safe-t) + 22px) 14px calc(var(--safe-b) + 18px); transform: translateX(-105%); transition: transform .32s var(--ease); box-shadow: 20px 0 50px rgba(0,0,0,.35); }
  .sidebar.open { transform: none; }
  .sidebar .side-link { display: flex; align-items: center; gap: 12px; border-radius: 12px; text-decoration: none; }
  .sidebar .side-sep { height: 1px; margin: 10px; }
  .sidebar .side-foot { margin-top: auto; padding: 12px; font-size: 12px; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 79; background: rgba(4,12,22,.5); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .drawer-backdrop.in { opacity: 1; pointer-events: auto; }
}
@media (min-width: 960px) { .sidebar { width: 264px; padding: 26px 14px 20px; } }

/* ---------- inicio: encabezado marino ---------- */
.home-hero {
  position: relative; overflow: hidden; color: #F8F4ED;
  margin: calc(-8px - var(--safe-t)) calc(-20px - var(--safe-r)) 0 calc(-20px - var(--safe-l));
  padding: calc(var(--safe-t) + 10px) 20px 74px;
  background:
    radial-gradient(520px 260px at 85% 20%, rgba(23,58,87,.9) 0%, rgba(23,58,87,0) 70%),
    radial-gradient(400px 200px at -10% 90%, rgba(214,180,119,.10) 0%, rgba(214,180,119,0) 70%),
    linear-gradient(170deg, #0B2033 0%, #0E2740 55%, #102B42 100%);
}
.home-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(180deg, rgba(11,32,51,0), rgba(11,32,51,.0) 30%, var(--bg) 100%); opacity: .0; pointer-events: none; }
.hh-anatomy { position: absolute; top: 36px; right: -78px; width: 300px; height: auto; opacity: .62; pointer-events: none; }
.hh-bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 2px; min-height: 48px; }
.hh-bar .spacer { flex: 1; }
.hh-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #F8F4ED; }
.hh-btn:active { transform: scale(.92); }
.hh-btn:hover { background: rgba(255,255,255,.07); }
.hh-profile { color: var(--champagne); text-decoration: none; }
.hh-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--champagne); box-shadow: 0 0 0 2px #0B2033; }
.home-hero .sync-pill { background: rgba(255,255,255,.08); border-color: rgba(214,180,119,.3); color: #E9D2A5; height: 28px; font-size: 12px; }
.home-hero .sync-pill.ok { color: #A9D6BC; }
.hh-brand { position: relative; z-index: 1; text-align: center; margin-top: -6px; }
.hh-brand img { width: 92px; height: auto; display: block; margin: 0 auto 2px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.hh-word { font-family: var(--font-display); font-weight: 600; font-size: 42px; line-height: 1; letter-spacing: .2em; padding-left: .2em; color: #F8F4ED; }
.hh-sub { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .48em; text-transform: uppercase; color: #E9D2A5; padding-left: .48em; }
.hh-sub i { width: 30px; height: 1px; background: var(--champagne); opacity: .8; }
.hh-tag { margin-top: 8px; font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 17px; color: rgba(248,244,237,.82); letter-spacing: .02em; }
.hh-greet { position: relative; z-index: 1; margin-top: 18px; display: flex; flex-direction: column; }
.hh-greet span { font-family: var(--font-display); font-size: 22px; font-weight: 500; color: rgba(248,244,237,.88); }
.hh-greet b { font-family: var(--font-display); font-size: 44px; font-weight: 600; line-height: 1.05; color: #FFFCF8; letter-spacing: .005em; }
.hh-line { width: 44px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #E9D2A5, #C29A55); margin-top: 8px; }
.home-body { position: relative; z-index: 2; margin-top: -56px; }
@media (min-width: 700px) {
  .hh-anatomy { right: -20px; width: 360px; top: 10px; }
  .hh-brand img { width: 104px; }
}
@media (min-width: 960px) {
  .home-hero { margin: -16px 0 0; border-radius: 28px; padding: 18px 40px 88px; border: 1px solid rgba(214,180,119,.28); box-shadow: 0 24px 60px rgba(11,32,51,.22); }
  .hh-menu { display: none; }
  .hh-anatomy { right: 10px; width: 400px; top: -10px; }
  .hh-greet { margin-top: -6px; }
  .home-body { margin: -60px 28px 0; }
}

/* tarjeta de progreso académico */
.progress-card, .progress-hero {
  display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: 22px; text-decoration: none; color: #F8F4ED;
  background: linear-gradient(150deg, #0E2740 0%, #0B2033 100%);
  border: 1px solid rgba(214,180,119,.6); box-shadow: 0 18px 40px rgba(11,32,51,.28), inset 0 1px 0 rgba(255,255,255,.06);
  --ring-track: rgba(255,255,255,.12); margin-bottom: 14px;
}
.progress-card .ring, .progress-hero .ring { color: var(--champagne); }
.progress-card .ring span, .progress-hero .ring span { color: #FFFCF8; font-size: 26px; font-weight: 600; }
.pc-sep { width: 1px; align-self: stretch; background: linear-gradient(180deg, rgba(214,180,119,0), rgba(214,180,119,.7), rgba(214,180,119,0)); }
.pc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--champagne); }
.pc-head b, .progress-hero h3 { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: #FFFCF8; margin: 0; }
.pc-period { font-family: var(--font-display); font-size: 18px; color: rgba(248,244,237,.82); margin: 0 0 10px; }
.progress-card small, .progress-hero small, .progress-hero p { display: block; font-family: var(--font-display); font-size: 16px; color: rgba(248,244,237,.85); margin: 8px 0 0; }
.progress-hero small { font-size: 14px; color: rgba(248,244,237,.6); margin-top: 2px; }
.gold-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.gold-bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #C29A55, #E9D2A5); transition: width .8s var(--ease); }
.progress-hero { margin: 4px 0 16px; }

/* próxima actividad */
.next-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px 12px 12px; border-radius: 18px; text-align: left; color: var(--text);
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid rgba(214,180,119,.28); box-shadow: var(--shadow-1); }
.nc-ic { width: 54px; height: 50px; flex: none; border-radius: 13px; display: grid; place-items: center; color: var(--gold-ink); background: linear-gradient(160deg, #F4EAD6, #E9D2A5); }
:root[data-theme="dark"] .nc-ic { background: rgba(214,180,119,.16); color: var(--champagne); }
.next-card b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.2; }
.next-card small { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-family: var(--font-display); font-size: 16px; color: var(--text-2); margin-top: 3px; }
.next-card .chev { color: var(--text-2); }

/* herramientas */
.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tool-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; padding: 14px 4px 11px; min-height: 112px; border-radius: 16px; text-align: center; color: var(--text);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); border: 1px solid rgba(214,180,119,.22); box-shadow: 0 1px 1px rgba(11,32,51,.04), 0 6px 16px rgba(60,44,20,.07); transition: transform .2s var(--ease), box-shadow .2s; }
.tool-tile:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.tool-tile:active { transform: scale(.96); }
.tt-ic { color: var(--gold-ink); margin-bottom: 4px; }
.tt-ic svg { stroke-width: 1.35; }
:root[data-theme="dark"] .tt-ic { color: var(--champagne); }
.tool-tile b { font-family: var(--font-display); font-size: 17px; font-weight: 700; line-height: 1.1; }
.tool-tile small { font-family: var(--font-display); font-size: 14px; color: var(--text-2); line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; padding: 0 2px; }
.tool-tile.soon small { font-style: italic; color: var(--gold-ink); }
@media (max-width: 369px) { .tools { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 700px) { .tools { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* mis materias */
.subject-list { display: flex; flex-direction: column; gap: 10px; }
.subj-card { display: flex; align-items: center; gap: 14px; padding: 11px 14px 11px 11px; border-radius: 16px; text-decoration: none; color: var(--text);
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid rgba(214,180,119,.22); border-left: 3px solid var(--champagne); box-shadow: var(--shadow-1); }
.subj-card b { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.15; }
.subj-card small { display: block; font-family: var(--font-display); font-size: 15.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-card .muted { font-size: 14px; color: var(--text-3); }
.subj-bar { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.subj-bar span { font-family: var(--font-display); font-size: 17px; font-weight: 600; min-width: 38px; text-align: right; }
.navy-bar { flex: 1; height: 7px; border-radius: 5px; background: rgba(11,32,51,.1); overflow: hidden; }
.navy-bar > i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #0B2033, #24476A); transition: width .8s var(--ease); }
:root[data-theme="dark"] .navy-bar { background: rgba(233,210,165,.12); }
:root[data-theme="dark"] .navy-bar > i { background: linear-gradient(90deg, #C29A55, #E9D2A5); }
.s-art { flex: none; display: grid; place-items: center; border-radius: 13px; color: var(--champagne);
  background: radial-gradient(circle at 30% 25%, #1E4467 0%, #0B2033 75%); box-shadow: inset 0 0 0 1px rgba(214,180,119,.35), inset 0 -3px 0 var(--sc, #D6B477); }
.s-art svg { stroke-width: 1.3; }

/* widgets restantes */
.widgets { gap: 12px; }
.home .widgets .w-wide { grid-column: 1 / -1; }
.w-head b { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.w-date { background: var(--gold-soft); color: var(--gold-ink); }
.cal-head b { font-family: var(--font-display); font-size: 20px; }

/* acciones rápidas (+) */
.qa-list { display: flex; flex-direction: column; gap: 6px; margin: 0 -6px; }
.qa { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px; border-radius: 14px; text-align: left; color: var(--text); }
.qa:hover { background: var(--surface-2); }
.qa-ic { width: 44px; height: 44px; flex: none; border-radius: 13px; display: grid; place-items: center; color: var(--champagne); background: radial-gradient(circle at 30% 25%, #1E4467, #0B2033 75%); box-shadow: inset 0 0 0 1px rgba(214,180,119,.35); }
.qa b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.2; }
.qa small { color: var(--text-3); font-size: 13px; }
.qa .chev { color: var(--text-3); }

/* progreso */
.stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat .v { font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.stat .v .ic { color: var(--gold-ink); }

/* inicio de sesión */
.welcome { background: radial-gradient(900px 600px at 50% 0%, #173A57 0%, #0B2033 65%); }
.welcome-card { background: var(--surface); border: 1px solid rgba(214,180,119,.45); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.welcome-card h1 { font-family: var(--font-display); font-size: 36px; color: var(--text) !important; }
.lock-screen { background: radial-gradient(900px 600px at 50% 0%, #173A57 0%, #0B2033 65%); }

/* hojas y menús */
.sheet { background: var(--surface); }
.sheet-head { border-bottom: 1px solid rgba(214,180,119,.18); padding-bottom: 10px; }
.toast { background: #0B2033; color: #F8F4ED; border: 1px solid rgba(214,180,119,.35); }
.toast-act { color: var(--champagne); }
/* ajustes tras revisar en iPhone */
.hh-anatomy { top: 96px; right: -122px; width: 286px; opacity: .6; }
@media (min-width: 700px) { .hh-anatomy { right: -30px; top: 30px; width: 340px; } }
@media (min-width: 960px) { .hh-anatomy { right: 20px; top: -6px; width: 380px; } }
.home-hero { padding-bottom: 80px; }
.home-hero::after { opacity: 1; height: 70px; background: linear-gradient(180deg, rgba(248,244,237,0) 0%, var(--bg) 100%); }
:root[data-theme="dark"] .home-hero::after { background: linear-gradient(180deg, rgba(8,24,42,0) 0%, var(--bg) 100%); }
@media (min-width: 960px) { .home-hero::after { display: none; } }
.home-body { margin-top: -62px; }
.progress-card { gap: 14px; padding: 16px 16px 16px 14px; }
.progress-card .ring span { font-size: 23px; }
.pc-head b { font-size: 21px; white-space: nowrap; }
.pc-period { font-size: 16.5px; margin-bottom: 8px; }
.progress-card small { font-size: 14.5px; line-height: 1.3; }
.next-card b { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-card .grow { min-width: 0; }
.next-card small { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; font-size: 15.5px; }
.next-card small span { overflow: hidden; text-overflow: ellipsis; }
.next-card .nc-sub { color: var(--text-3); font-size: 14px; }
.tool-tile { min-height: 116px; padding: 13px 3px 10px; }
.tool-tile b { font-size: 15.5px; letter-spacing: -.005em; }
.tool-tile small { font-size: 13px; }
.home-foot { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 4px; color: var(--text-3); font-size: 13px; }
.home-foot .link { font-size: 16px; gap: 6px; }
@media (min-width: 700px) { .tool-tile b { font-size: 17px; } .tool-tile small { font-size: 14px; } }
html { font-feature-settings: "lnum" 1; }
.title, .hh-greet, .ring span, .stat .v, .money-big, .money-mid, .result-grade, .subj-bar span, .tool-tile small, .next-card, .progress-card, .progress-hero { font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; }
.qa .grow { flex: 1; min-width: 0; }
.sidebar > * { flex-shrink: 0; }
.side-add { min-height: 44px; }
/* "Más" y mosaicos */
.tiles .tile { align-items: center; text-align: center; padding: 16px 8px 14px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); border-color: rgba(214,180,119,.22); }
.tile .qi { width: 46px; height: 46px; border-radius: 14px; color: var(--champagne) !important; background: radial-gradient(circle at 30% 25%, #1E4467, #0B2033 75%) !important; box-shadow: inset 0 0 0 1px rgba(214,180,119,.35); }
.tile b { font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.15; }
.tile small { font-family: var(--font-display); font-size: 14.5px; color: var(--text-2) !important; }
.tool .qi { color: var(--champagne) !important; background: radial-gradient(circle at 30% 25%, #1E4467, #0B2033 75%) !important; }
.tool b { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.next-card .grow, .subj-card .grow, .progress-card .grow, .progress-hero .grow { flex: 1; min-width: 0; }
/* ilustración anatómica (imagen elegida por la usuaria): a la derecha, junto al saludo; nunca encima del logo ni de los textos */
.hh-anatomy { top: auto; bottom: 0; right: -18px; width: 210px; height: auto; opacity: 1; z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%), linear-gradient(90deg, transparent 0%, #000 14%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%), linear-gradient(90deg, transparent 0%, #000 14%); mask-composite: intersect; }
.home-hero { min-height: 0; }
.hh-greet { max-width: calc(100% - 175px); }
.hh-greet b { overflow-wrap: anywhere; }
@media (min-width: 700px) { .hh-anatomy { right: 0; width: 290px; } .hh-greet { max-width: calc(100% - 300px); } }
@media (min-width: 960px) { .hh-anatomy { right: 8px; width: 340px; bottom: 0; } }
/* ilustración: celular, iPad y ventanas medianas → junto al saludo, debajo del logo y los textos */
.hh-greet { position: relative; max-width: none; padding-right: 150px; }
.hh-greet > span, .hh-greet > b, .hh-greet > .hh-line { position: relative; z-index: 1; }
.hh-greet b { font-size: clamp(32px, 10.5vw, 44px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.hh-anatomy { position: absolute; top: -14px; bottom: auto; right: -40px; width: 210px; z-index: 0; pointer-events: none; }
@media (min-width: 700px) { .hh-greet { padding-right: 230px; margin-top: 22px; } .hh-anatomy { top: -26px; right: -36px; width: 290px; } }
@media (min-width: 960px) { .hh-greet { margin-top: 20px; } .hh-anatomy { right: -44px; } }
/* pantallas anchas → arriba a la derecha, como en el diseño elegido */
@media (min-width: 1280px) {
  .hh-greet { position: static; padding-right: 0; margin-top: -6px; }
  .hh-anatomy { top: 6px; right: 6px; width: 340px; }
}
.hh-anatomy { -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 74%); mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 74%); -webkit-mask-composite: source-over; mask-composite: add; }
@media (min-width: 1280px) { .hh-anatomy { -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%), linear-gradient(90deg, transparent 0%, #000 12%); -webkit-mask-composite: source-in; mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%), linear-gradient(90deg, transparent 0%, #000 12%); mask-composite: intersect; } }
/* acceso sin códigos */
.login-box { text-align: left; }
.login-msg.warn { color: var(--danger); }
.pair-intro { margin-bottom: 14px; }
.pair-intro > b { display: block; font-family: var(--font-display); font-size: 21px; font-weight: 600; margin-bottom: 4px; }
.pair-intro p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.45; }
.pair-in { font-size: 24px !important; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.login-alt { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 14px; }
.pair-code { font-family: var(--font-display); font-size: 48px; font-weight: 600; letter-spacing: .12em; text-align: center; color: var(--text); padding: 18px 0 6px; font-variant-numeric: lining-nums tabular-nums; }
.pair-steps { margin: 12px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.access-card { display: flex; flex-direction: column; gap: 14px; }
.access-row { display: flex; align-items: center; gap: 12px; }
.access-row b { display: block; font-size: 15px; }
.access-row small { color: var(--text-3); font-size: 13px; line-height: 1.35; display: block; }
.access-row .grow { flex: 1; min-width: 0; }
.key-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.key-row .grow { flex: 1; } .key-row small { color: var(--text-3); }

.pair-intro p b { font-weight: 650; color: var(--text); }
.access-row { flex-wrap: wrap; }
.access-row > .btn { margin-left: 50px; }
@media (min-width: 560px) { .access-row { flex-wrap: nowrap; } .access-row > .btn { margin-left: 0; } }
.access-row .grow { flex: 1 1 180px; }
.warn-text { color: var(--danger) !important; margin: 0 0 6px !important; }
.muted-link { color: var(--text-3) !important; }
.login-box .pair-steps { margin: 8px 0 16px; }
