/* Ryot HQ — oscuro, semi futurista, acento azul */
:root {
  --bg: #060912;
  --bg-2: #0a0f1c;
  --glass: rgba(14, 20, 36, 0.62);
  --glass-2: rgba(22, 30, 52, 0.55);
  --line: rgba(120, 160, 255, 0.12);
  --line-strong: rgba(120, 170, 255, 0.28);
  --text: #e6ecf8;
  --muted: #8592ab;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --cyan: #22d3ee;
  --grad: linear-gradient(135deg, #3b82f6 0%, #22d3ee 100%);
  --glow: 0 0 0 1px rgba(96, 165, 250, 0.35), 0 8px 30px -6px rgba(59, 130, 246, 0.45);
  --ok: #34d399;
  --danger: #f87171;
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Inter", system-ui, sans-serif;
  --display: "Space Grotesk", "Inter", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: #060912; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
::selection { background: rgba(59, 130, 246, 0.4); }
h1, h2, h3 { margin: 0; line-height: 1.15; font-family: var(--display); letter-spacing: -0.01em; }
h2 { font-size: 1.02rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.eyebrow {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--blue-2); margin: 0 0 6px; display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: blink 2.4s ease-in-out infinite; }

/* Fondo vivo */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 600px at 50% -10%, #0d1630 0%, var(--bg) 60%); }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.o1 { width: 520px; height: 520px; background: #1d4ed8; top: -180px; left: -140px; animation: drift 22s var(--ease) infinite alternate; opacity: .35; }
.o2 { width: 460px; height: 460px; background: #0891b2; bottom: -200px; right: -120px; animation: drift 26s var(--ease) infinite alternate-reverse; opacity: .22; }
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(96,165,250,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(96,165,250,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
}

/* Campos y botones */
input, textarea, select {
  font: inherit; color: var(--text); background: rgba(8, 12, 24, 0.7);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; min-width: 0;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s;
}
input::placeholder, textarea::placeholder { color: #56627a; }
input:focus, textarea:focus { outline: none; border-color: rgba(96,165,250,.6); box-shadow: 0 0 0 3px rgba(59,130,246,.18); background: rgba(10, 16, 32, 0.9); }
input[type=date], input[type=time] { color-scheme: dark; }
textarea { resize: vertical; }

.btn {
  font: inherit; font-weight: 600; font-size: .9rem; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--glass-2); color: var(--text); white-space: nowrap;
  transition: transform .2s var(--ease), box-shadow .3s var(--ease), border-color .3s, background .3s;
  position: relative; overflow: hidden;
}
.btn:hover { border-color: rgba(96,165,250,.5); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 20px -8px rgba(59,130,246,.8); }
.btn.primary:hover { box-shadow: var(--glow); }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .7s var(--ease);
}
.btn.primary:hover::after { transform: translateX(120%); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: .82rem; }
.btn.danger { color: var(--danger); border-color: rgba(248,113,113,.3); }
.icon, .chip {
  font: inherit; background: var(--glass-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; transition: all .25s var(--ease);
}
.icon:hover, .chip:hover { border-color: rgba(96,165,250,.55); box-shadow: 0 0 14px -2px rgba(59,130,246,.5); }
.icon { width: 34px; height: 34px; font-size: 1.1rem; line-height: 1; }
.chip { padding: 5px 14px; font-size: .8rem; font-family: var(--mono); color: var(--blue-2); }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.05rem; padding: 2px 6px; border-radius: 8px; transition: color .2s, background .2s, opacity .2s; }
.x:hover { color: var(--danger); background: rgba(248,113,113,.08); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--glass); border: 1px solid var(--line);
  border-radius: 22px; padding: 32px 26px; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.04);
  animation: rise .8s var(--ease) both;
}
.login-card h1 { margin-bottom: 22px; font-size: 1.9rem; }
.login-card form { display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-size: .82rem; color: var(--muted); }

/* App */
.app { max-width: 1120px; margin: 0 auto; padding: 18px 16px 56px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0 20px; animation: rise .7s var(--ease) both; }
.rank { display: flex; align-items: center; gap: 16px; min-width: 0; }
.rank-text { min-width: 0; }
.rank h1 {
  font-size: clamp(1.35rem, 4.6vw, 2.15rem); font-weight: 700;
  background: linear-gradient(90deg, #fff 0%, #bcd4ff 45%, #67e8f9 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring-bg { stroke: rgba(96,165,250,.12); }
.ring-fg { stroke: url(#rg); stroke-linecap: round; stroke-dasharray: 175.93; stroke-dashoffset: 175.93; transition: stroke-dashoffset 1.2s var(--ease); filter: drop-shadow(0 0 6px rgba(34,211,238,.55)); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: .75rem; color: var(--blue-2); }
.next { margin-top: 8px; max-width: 440px; }
.bar { height: 5px; background: rgba(96,165,250,.1); border-radius: 999px; overflow: hidden; margin-top: 6px; position: relative; }
.bar span { display: block; height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width 1s var(--ease); position: relative; box-shadow: 0 0 12px rgba(34,211,238,.6); }
.bar span::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shimmer 2.6s ease-in-out infinite;
}

/* Pestañas con indicador deslizante */
.tabs {
  position: relative; display: flex; gap: 2px; padding: 4px; margin-bottom: 22px; overflow-x: auto;
  background: var(--glass); border: 1px solid var(--line); border-radius: 14px; width: fit-content; max-width: 100%;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); scrollbar-width: none;
  animation: rise .7s .05s var(--ease) both;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-glider {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 10px;
  background: linear-gradient(135deg, rgba(59,130,246,.9), rgba(34,211,238,.75));
  box-shadow: 0 4px 18px -4px rgba(59,130,246,.7); transition: transform .45s var(--ease), width .45s var(--ease);
}
.tabs button svg { display: none; }
.tabs button {
  position: relative; z-index: 1; font: inherit; font-size: .9rem; background: none; border: 0; color: var(--muted);
  padding: 8px 16px; cursor: pointer; border-radius: 10px; white-space: nowrap; transition: color .3s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: #fff; font-weight: 600; }

.tab.enter > * { animation: rise .55s var(--ease) both; }
.tab.enter > *:nth-child(2) { animation-delay: .06s; }
.tab.enter > *:nth-child(3) { animation-delay: .12s; }
.tab.enter > *:nth-child(4) { animation-delay: .18s; }
.tab.enter .grid > * { animation: rise .55s var(--ease) both; }
.tab.enter .grid > *:nth-child(2) { animation-delay: .07s; }
.tab.enter .grid > *:nth-child(3) { animation-delay: .14s; }
.tab.enter .stage { animation: rise .55s var(--ease) both; }
.tab.enter .stage:nth-child(2) { animation-delay: .06s; }
.tab.enter .stage:nth-child(3) { animation-delay: .12s; }
.tab.enter .stage:nth-child(4) { animation-delay: .18s; }
.tab.enter .stage:nth-child(5) { animation-delay: .24s; }

/* Tarjetas de vidrio */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
@media (min-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .wide { grid-column: 1 / -1; } }
.card, .stage, .doc {
  position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.035);
  transition: border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.card { padding: 18px; min-width: 0; }
.card:hover, .stage:hover { border-color: rgba(96,165,250,.22); }
.card::before, .stage::before {
  content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96,165,250,.55), transparent); opacity: .6;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.daynav { display: flex; align-items: center; gap: 6px; }

.row-form { display: flex; gap: 8px; margin: 10px 0; }
.row-form input[type=time] { width: 104px; flex: none; }
.row-form input[type=date] { width: 150px; flex: none; }
.row-form .btn { min-width: 44px; }
@media (max-width: 520px) {
  .row-form { flex-wrap: wrap; }
  .row-form input[type=text] { flex: 1 1 100%; order: -1; }
  .row-form input[type=time], .row-form input[type=date] { flex: 1; width: auto; }
}

/* Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-radius: 12px;
  border-bottom: 1px solid rgba(120,160,255,.06); transition: background .25s, opacity .3s;
  animation: fadein .4s var(--ease) both;
}
.list li:hover { background: rgba(59,130,246,.06); }
.list li:last-child { border-bottom: 0; }
.list li .x { opacity: .35; }
.list li:hover .x { opacity: 1; }
@media (hover: none) { .list li .x { opacity: .7; } }
.list .body { flex: 1; min-width: 0; overflow-wrap: anywhere; transition: color .3s; }
.list .meta { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin-top: 2px; }
.list .time { font-family: var(--mono); font-size: .8rem; color: var(--cyan); min-width: 96px; padding-top: 2px; text-shadow: 0 0 12px rgba(34,211,238,.35); }
.list li.is-done .body { color: var(--muted); }
.list li.is-done:not(.obj) .body, .list li.obj.is-done .t { text-decoration: line-through; text-decoration-color: rgba(133,146,171,.6); }
.list li.overdue .meta { color: var(--danger); }
.empty { color: var(--muted); font-size: .88rem; padding: 8px 0 !important; }
.empty:hover { background: none !important; }
.done-box summary { cursor: pointer; color: var(--muted); font-size: .85rem; padding: 8px 0; list-style: none; transition: color .2s; }
.done-box summary::before { content: "▸ "; display: inline-block; transition: transform .25s var(--ease); }
.done-box[open] summary::before { transform: rotate(90deg); }
.done-box summary:hover { color: var(--text); }

.check {
  appearance: none; width: 20px; height: 20px; flex: none; border: 1.5px solid #4a5874; border-radius: 7px; cursor: pointer;
  margin-top: 2px; padding: 0; background: rgba(8,12,24,.6); position: relative; transition: all .25s var(--ease);
}
.check:hover { border-color: var(--blue-2); box-shadow: 0 0 10px -2px rgba(59,130,246,.7); }
.check:checked { background: var(--grad); border-color: transparent; box-shadow: 0 0 12px -2px rgba(34,211,238,.8); animation: pop .35s var(--ease); }
.check:checked::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.list.settled > li, .notes.settled > li { animation: none; }

/* Notas */
.note-form { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.note-form textarea { flex: 1;  min-height: 46px; max-height: 220px; overflow-y: auto; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
.notes li {
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px; min-width: 0; animation: fadein .45s var(--ease) both;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.notes li:hover { transform: translateY(-2px); border-color: rgba(96,165,250,.3); box-shadow: 0 12px 30px -16px rgba(59,130,246,.5); }
.notes li.pinned { border-color: rgba(34,211,238,.45); box-shadow: inset 0 0 0 1px rgba(34,211,238,.15), 0 0 24px -12px rgba(34,211,238,.7); }
.notes .text { white-space: pre-wrap; overflow-wrap: anywhere; flex: 1; }
.notes .foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.notes .foot .acts { display: flex; gap: 4px; }

.note-main { display: flex; gap: 12px; align-items: flex-start; }
.notes li.is-done .text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(133,146,171,.6); }
.notes li.is-done { opacity: .7; }
.notes li.leaving { animation: leave .25s var(--ease) forwards; }
.notes .meta { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.act {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--muted); transition: all .2s var(--ease);
}
.act svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.act:hover { color: var(--text); background: rgba(59,130,246,.1); border-color: var(--line); }
.act.on { color: var(--cyan); }
.act.on svg { fill: rgba(34,211,238,.25); filter: drop-shadow(0 0 6px rgba(34,211,238,.6)); }
.act.danger:hover { color: var(--danger); background: rgba(248,113,113,.08); }
.act[data-armed] { width: auto; padding: 0 10px; color: var(--danger); font-size: .78rem; border-color: rgba(248,113,113,.4); }
.archived li { background: rgba(8,12,24,.5); }
#archive-box { margin-top: 12px; }

.event-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.event-row { display: flex; gap: 8px; align-items: center; }
.event-row input[type=time] { flex: 1; min-width: 0; }
.event-row .btn { flex: none; }

/* Selector Día / Semana */
.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(8,12,24,.7); border: 1px solid var(--line); }
.seg-glider { position: absolute; top: 3px; bottom: 3px; left: 3px; width: 0; border-radius: 8px; background: rgba(59,130,246,.22); border: 1px solid rgba(96,165,250,.45); box-shadow: 0 0 14px -4px rgba(59,130,246,.8); transition: transform .4s var(--ease), width .4s var(--ease); }
.seg button { position: relative; z-index: 1; font: inherit; font-size: .8rem; background: none; border: 0; color: var(--muted); padding: 6px 12px; cursor: pointer; border-radius: 8px; transition: color .25s; }
.seg button.on { color: #fff; font-weight: 600; }
.agenda-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.month-label { font-family: var(--display); font-weight: 600; font-size: 1rem; letter-spacing: -.01em; }
.nav-btns { display: flex; align-items: center; gap: 6px; }
.day-title { margin: 6px 0 4px; font-size: .82rem; color: var(--muted); font-family: var(--mono); letter-spacing: .02em; }

/* Tira de días: desplazamiento nativo que encaja semana por semana */
.week-strip {
  --gap: 4px;
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 6 * var(--gap)) / 7); gap: var(--gap);
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 0 4px; margin: 0 0 4px;
  touch-action: pan-x pan-y;
}
.week-strip::-webkit-scrollbar { display: none; }
.ws-day.monday { scroll-snap-align: start; scroll-snap-stop: always; }
.ws-day {
  font: inherit; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 6px; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 12px; color: var(--text);
  transition: background .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease), opacity .3s;
  user-select: none;
}
@media (hover: hover) { .ws-day:hover { background: rgba(59,130,246,.08); } }
.ws-dow { font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-family: var(--mono); }
.ws-num { font-family: var(--display); font-size: 1.02rem; font-weight: 600; }
.ws-dots { display: flex; gap: 3px; height: 5px; }
.ws-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.ws-day.past { opacity: .5; }
.ws-day.today .ws-num { color: var(--cyan); }
.ws-day.wsel { background: rgba(59,130,246,.12); border-color: rgba(96,165,250,.22); opacity: 1; }
.ws-day.sel { background: linear-gradient(160deg, rgba(59,130,246,.35), rgba(34,211,238,.15)); border-color: rgba(96,165,250,.5); box-shadow: 0 0 18px -6px rgba(59,130,246,.9); opacity: 1; }

/* Vista semanal */
.week-view { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.wv-day {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 10px; border-radius: 14px; cursor: pointer;
  background: rgba(8,12,24,.45); border: 1px solid rgba(120,160,255,.08); transition: border-color .25s, background .25s;
}
.wv-day:hover { border-color: rgba(96,165,250,.3); background: rgba(59,130,246,.06); }
.wv-day header { display: flex; flex-direction: column; align-items: center; gap: 0; padding-top: 2px; }
.wv-dow { font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wv-num { font-family: var(--display); font-size: 1.3rem; font-weight: 600; line-height: 1.1; }
.wv-tag { font-family: var(--mono); font-size: .58rem; color: var(--cyan); text-transform: uppercase; letter-spacing: .1em; }
.wv-day.today { border-color: rgba(34,211,238,.45); box-shadow: inset 0 0 0 1px rgba(34,211,238,.12), 0 0 22px -12px rgba(34,211,238,.9); }
.wv-day.today .wv-num { color: var(--cyan); }
.wv-day.past { opacity: .55; }
.wv-events { display: grid; gap: 5px; align-content: start; min-width: 0; }
.wv-ev {
  display: flex; gap: 8px; align-items: baseline; padding: 6px 9px; border-radius: 9px; min-width: 0;
  background: linear-gradient(90deg, rgba(59,130,246,.16), rgba(59,130,246,.04)); border-left: 2px solid var(--blue-2);
}
.wv-time { font-family: var(--mono); font-size: .72rem; color: var(--cyan); flex: none; }
.wv-title { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wv-ev.is-done { opacity: .5; }
.wv-ev.is-done .wv-title { text-decoration: line-through; }
.wv-free { font-size: .8rem; color: #4f5b73; padding: 6px 0; font-style: italic; }
@media (min-width: 860px) {
  #agenda-card.week-mode { grid-column: 1 / -1; }
  .week-mode .week-view { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week-mode .wv-day { grid-template-columns: minmax(0, 1fr); min-height: 190px; align-content: start; }
  .week-mode .wv-day header { flex-direction: row; justify-content: space-between; align-items: baseline; padding: 0 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .week-mode .wv-ev { flex-direction: column; gap: 1px; }
  .week-mode .wv-title { white-space: normal; }
}

/* Ruta */
.intro { max-width: 680px; margin: 0 0 18px; }
.stage { padding: 18px; margin-bottom: 14px; }
.stage.earned { border-color: rgba(52,211,153,.35); }
.stage.earned::before { background: linear-gradient(90deg, transparent, rgba(52,211,153,.7), transparent); }
.stage.current { border-color: rgba(96,165,250,.45); box-shadow: 0 0 0 1px rgba(96,165,250,.15), 0 0 40px -18px rgba(59,130,246,.8); }
.stage.locked { opacity: .72; }
.stage.locked:hover { opacity: 1; }
.stage.celebrate { animation: celebrate 1.6s var(--ease); }
.stage-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.stage-num { font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.stage h3 { font-size: 1.2rem; font-weight: 600; }
.stage .summary { color: var(--muted); margin: 6px 0 12px; font-size: .9rem; }
.badge { font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong); white-space: nowrap; color: var(--muted); }
.badge.ok { color: var(--ok); border-color: rgba(52,211,153,.5); background: rgba(52,211,153,.08); box-shadow: 0 0 16px -6px rgba(52,211,153,.8); }
.badge.now { color: var(--blue-2); border-color: rgba(96,165,250,.55); background: rgba(59,130,246,.1); animation: pulse 2.4s ease-in-out infinite; }
.stage .bar { margin: 8px 0 14px; }
.stage.earned .bar span { background: linear-gradient(90deg, #10b981, #34d399); box-shadow: 0 0 12px rgba(52,211,153,.6); }
.obj .detail { color: var(--muted); font-size: .83rem; }
.obj-form { display: flex; gap: 8px; margin-top: 12px; }
.stage-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: .82rem; color: var(--muted); }
.stage-tools input { width: 64px; padding: 5px 8px; }
.add-stage summary { cursor: pointer; font-weight: 600; font-family: var(--display); }
.stack { display: grid; gap: 10px; margin-top: 14px; }
.inline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.inline input { width: 80px; }

/* Documentos */
.doc-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; max-width: 880px; }
.doc { padding: clamp(18px, 4vw, 40px); max-width: 880px; overflow-wrap: anywhere; }
.doc h1 { font-size: 1.75rem; margin-bottom: 14px; background: linear-gradient(90deg, #fff, #9cc2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc h2 { font-size: 1.15rem; margin: 32px 0 12px; color: var(--blue-2); display: flex; align-items: center; gap: 10px; }
.doc h2::before { content: ""; width: 3px; height: 1em; border-radius: 2px; background: var(--grad); box-shadow: 0 0 10px rgba(34,211,238,.6); }
.doc h3 { font-size: 1rem; margin: 22px 0 8px; color: #cfe0ff; }
.doc p { color: #d3dbea; }
.doc strong { color: #fff; }
.doc hr { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); margin: 24px 0; }
.doc code { font-family: var(--mono); font-size: .82em; background: rgba(59,130,246,.1); color: #9cc2ff; padding: 2px 6px; border-radius: 6px; border: 1px solid rgba(96,165,250,.15); }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: 5px 0; color: #d3dbea; }
.doc li::marker { color: var(--blue-2); }
.doc a { color: var(--cyan); }
.doc .table-wrap { overflow-x: auto; margin: 14px 0; border-radius: 12px; border: 1px solid var(--line); }
.doc table { border-collapse: collapse; width: 100%; font-size: .87rem; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
.doc th { background: rgba(59,130,246,.08); color: #cfe0ff; font-weight: 600; }
.doc tr:last-child td { border-bottom: 0; }
.doc-editor { width: 100%; min-height: 70vh; font-family: var(--mono); font-size: .85rem; max-width: 880px; line-height: 1.6; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 10;
  background: rgba(12, 18, 34, .92); color: var(--text); border: 1px solid var(--line-strong);
  padding: 11px 18px; border-radius: 14px; font-size: .88rem; max-width: calc(100% - 32px);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 16px 40px -12px rgba(0,0,0,.8);
  animation: toastin .45s var(--ease) both;
}
.toast.win { border-color: rgba(52,211,153,.6); color: #d1fae5; box-shadow: 0 0 40px -10px rgba(52,211,153,.8); }

/* Animaciones */
@keyframes leave { to { opacity: 0; transform: translateX(30px); height: 0; padding-top: 0; padding-bottom: 0; margin: 0; } }
@keyframes slideL { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes slideR { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,.0); } 50% { box-shadow: 0 0 18px -4px rgba(59,130,246,.8); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(80px, 60px) scale(1.12); } }
@keyframes celebrate {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.0); }
  30% { box-shadow: 0 0 0 3px rgba(52,211,153,.5), 0 0 60px -6px rgba(52,211,153,.9); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

/* ---------- Celular ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  input, textarea, select { font-size: 16px; } /* evita el zoom de iOS */
  .app { padding: calc(10px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom)); }
  .top { padding: 4px 0 14px; align-items: center; }
  .rank { gap: 12px; }
  .ring { width: 48px; height: 48px; }
  .ring span { font-size: .66rem; }
  .rank h1 { font-size: 1.22rem; }
  .eyebrow { font-size: .6rem; margin-bottom: 3px; }
  .next { margin-top: 4px; }
  .next .small { font-size: .72rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #logout { padding: 6px 10px; font-size: .75rem; }

  /* Barra de pestañas abajo */
  .tabs {
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20;
    width: auto; margin: 0; padding: 6px; border-radius: 20px; display: grid; grid-template-columns: repeat(4, 1fr);
    background: rgba(10, 15, 30, .82); border-color: var(--line-strong);
    box-shadow: 0 18px 40px -10px rgba(0,0,0,.9), 0 0 0 1px rgba(96,165,250,.08);
    backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
    animation: none;
  }
  .tab-glider { top: 6px; bottom: 6px; border-radius: 14px; }
  .tabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; font-size: .68rem; border-radius: 14px; }
  .tabs button svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

  .grid { gap: 12px; }
  .card { padding: 14px; border-radius: 16px; }
  .card-head { margin-bottom: 8px; }
  .icon { width: 40px; height: 40px; }
  .chip { padding: 8px 14px; }
  .list li { padding: 12px 8px; }
  .list li .x { opacity: .7; font-size: 1.25rem; padding: 6px 10px; }
  .check { width: 24px; height: 24px; border-radius: 8px; }
  .check:checked::after { left: 8px; top: 3px; width: 6px; height: 12px; }
  .list .time { min-width: 84px; }
  .act { width: 40px; height: 40px; }
  .btn { padding: 12px 16px; }
  .notes li { padding: 12px; }
  .notes li:hover { transform: none; }
  .stage { padding: 14px; }
  .doc { padding: 18px 16px; border-radius: 16px; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  /* Franja sólida bajo la barra para que el contenido no se vea por debajo */
  body::after {
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; pointer-events: none;
    height: calc(44px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, rgba(6,9,18,0), #060912 55%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.week-mode .event-form { display: none; }

/* Cambios de contenido con fundido corto, sin saltos */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; animation-timing-function: var(--ease); }
button, .ws-day, .wv-day { -webkit-tap-highlight-color: transparent; }
