/* Centro de confirmación de sesiones · Papaya Tutor
   Tokens tomados del dashboard de littera-data (app/dashboard/index.html). */
:root {
  color-scheme: light;
  --plane: #ffffff;
  --surface: #fbfaf8;
  --surface-2: #f3f1ec;
  --ink: #1f2430;
  --ink-2: #5a6172;
  --muted: #8b91a0;
  --grid: #ebe8e2;
  --axis: #d3cfc7;
  --ring: rgba(31, 36, 48, 0.09);
  --brand: #f26b1d;
  --brand-ink: #b84a0c;
  --brand-soft: #fff1e8;
  --focus: #f26b1d;
  --good: #1f8a4c;
  --good-soft: #e4f4ea;
  --good-text: #0f6b36;
  --warn: #f2b01d;
  --warn-soft: #fff4d6;
  --warn-text: #8a5a00;
  --bad: #e34948;
  --bad-soft: #fdeaea;
  --bad-text: #b3261e;
  --lock: #a9aeb9;
  --lock-soft: #eef0f3;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 12px;
  --shadow: 0 1px 2px var(--ring), 0 8px 24px -12px var(--ring);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0f141d; --surface: #171d29; --surface-2: #1f2634; --ink: #f2f4f8; --ink-2: #b7bfcf; --muted: #8a93a6;
  --grid: #263044; --axis: #37425a; --ring: rgba(255,255,255,0.10); --brand-ink: #ff9a5c; --brand-soft: #2a1d14;
  --good-soft: #14331a; --good-text: #8fd39a; --warn-soft: #3a2d0a; --warn-text: #f3c85a;
  --bad-soft: #4a1d1d; --bad-text: #f0a0a0; --lock: #4a5263; --lock-soft: #1a2030;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body); color: var(--ink); background: var(--plane);
  font-size: 15px; line-height: 1.45; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.1; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand-ink); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-ink); }
.lede { color: var(--ink-2); max-width: 56ch; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* ---- top bar ---- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; border-bottom: 1px solid var(--grid); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; }
.brand .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
.brand .sep { color: var(--axis); }
.brand .sub { font-weight: 500; color: var(--ink-2); }
.top-right { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; font-size: 0.85rem; }
.chip .avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--axis); background: var(--plane); font-weight: 600; line-height: 1;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #dd5f16; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.good:hover { background: #187a41; }
.btn.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-text); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn.sm { padding: 6px 10px; font-size: 0.85rem; border-radius: 8px; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand-ink); text-decoration: underline; font-weight: 600; }

/* ---- gate screens (email / captcha / admin login) ---- */
.gate { min-height: calc(100vh - 61px); display: grid; place-items: center; padding: 32px 16px; background:
  radial-gradient(60% 50% at 80% 0%, var(--brand-soft), transparent 70%), var(--plane); }
.gate-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--grid); border-radius: 18px; padding: 32px 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.gate-card h1 { font-size: 1.7rem; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
input[type=email], input[type=text], input[type=password], select {
  font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--axis); background: var(--plane); color: var(--ink); width: 100%;
}
input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.field-error { color: var(--bad-text); font-size: 0.85rem; font-weight: 600; }
.hint { color: var(--muted); font-size: 0.82rem; }
.steps { display: flex; gap: 6px; }
.steps span { height: 4px; flex: 1; border-radius: 2px; background: var(--grid); }
.steps span.on { background: var(--brand); }

/* captcha */
.captcha { border: 1px solid var(--axis); border-radius: 12px; background: var(--plane); padding: 14px; display: grid; gap: 12px; }
.captcha-row { display: flex; align-items: center; gap: 12px; }
.cbox { width: 28px; height: 28px; border-radius: 6px; border: 2px solid var(--axis); background: var(--plane); display: grid; place-items: center; flex: none; padding: 0; }
.cbox.spin { border-color: var(--grid); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.cbox.ok { border-color: var(--good); background: var(--good); color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.captcha .logo { margin-left: auto; text-align: right; font-size: 0.68rem; color: var(--muted); line-height: 1.2; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile { aspect-ratio: 1; font-size: 2rem; border-radius: 8px; border: 2px solid var(--grid); background: var(--surface-2); display: grid; place-items: center; transition: transform .08s, border-color .1s; }
.tile[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); transform: scale(.94); }
.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }

/* ---- dashboard ---- */
main.dash { max-width: 1280px; margin: 0 auto; padding: 24px 24px 120px; display: grid; gap: 20px; }
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { min-width: 118px; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--grid); background: var(--surface); display: grid; gap: 2px; }
.stat b { font-family: var(--display); font-size: 1.5rem; line-height: 1; }
.stat span { font-size: 0.75rem; color: var(--ink-2); font-weight: 600; }
.stat.pending { border-left: 4px solid var(--brand); }
.stat.confirmed { border-left: 4px solid var(--good); }
.stat.cancelled { border-left: 4px solid var(--warn); }
.stat.cancelled.max { border-left-color: var(--bad); }

.banner { border-radius: var(--r); padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; font-weight: 500; }
.banner.bad { background: var(--bad-soft); color: var(--bad-text); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.banner.warn { background: var(--warn-soft); color: var(--warn-text); border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent); }
.banner.ok { background: var(--good-soft); color: var(--good-text); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); }
.banner .ico { font-size: 1.2rem; line-height: 1; }
.banner .pill { margin-left: auto; white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--grid); border-radius: 16px; box-shadow: var(--shadow); }

/* asignaciones: pestanas + tarjetas */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--grid); }
.tab {
  border: 0; background: transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--ink-2);
  border-bottom: 2px solid transparent; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.offers-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.offers-head h2 { font-size: 1.2rem; }
#offers { display: grid; gap: 12px; }
.offer { padding: 16px 18px; display: grid; gap: 6px; border-left: 4px solid var(--brand); }
.offer.accepted { border-left-color: var(--good); }
.offer.declined { border-left-color: var(--warn); }
.offer.expired { border-left-color: var(--axis); background: var(--surface-2); color: var(--muted); }
.offer .school { font-size: 0.72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }
.offer h3 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.offer .sep { color: var(--axis); font-weight: 400; }
.offer .tag { font-size: 0.66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.offer .meta { font-size: 0.86rem; color: var(--ink-2); }
.offer-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 4px; }
.clock {
  justify-self: start; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.84rem;
  padding: 4px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn-text);
}
.clock.urgent { background: var(--bad-soft); color: var(--bad-text); }
.empty.card { padding: 32px 16px; text-align: center; color: var(--muted); display: grid; gap: 8px; }
.empty .big { font-size: 2rem; }
.policy-late {
  font-size: 0.84rem; color: var(--ink-2); border: 1px dashed var(--axis); border-radius: var(--r);
  padding: 12px 14px; background: var(--plane);
}
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.badge.draft { background: var(--surface-2); color: var(--ink-2); border: 1px dashed var(--axis); }
.badge.pending { background: var(--brand-soft); color: var(--brand-ink); }
.badge.confirmed, .badge.ok { background: var(--good-soft); color: var(--good-text); }
.badge.cancelled { background: var(--warn-soft); color: var(--warn-text); }
.badge.locked { background: var(--lock-soft); color: var(--ink-2); }
.badge.littera-cancelled, .badge.past { background: var(--surface-2); color: var(--muted); }
.badge.bad { background: var(--bad-soft); color: var(--bad-text); }
.note { font-size: 0.82rem; color: var(--ink-2); }
.note.ok { color: var(--good-text); }
.note.warn { color: var(--warn-text); }
.note.bad { color: var(--bad-text); }

/* save bar */
.savebar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 14px;
  background: var(--ink); color: var(--plane); box-shadow: 0 12px 32px -8px rgba(0,0,0,.4); animation: rise .25s ease-out;
}
:root[data-theme="dark"] .savebar { background: #f2f4f8; color: #0f141d; }
.savebar .btn.ghost { color: inherit; opacity: .8; }
.savebar .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
@keyframes rise { from { transform: translate(-50%, 16px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 40; background: var(--good); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); animation: rise .25s ease-out; }
.toast.info { background: var(--ink); color: var(--plane); }

/* dialog */
dialog { border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); max-width: 480px; width: calc(100% - 32px); box-shadow: 0 24px 64px -16px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(15, 20, 29, .55); }
.dlg { padding: 24px; display: grid; gap: 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.counter { display: flex; gap: 6px; }
.counter i { width: 34px; height: 8px; border-radius: 4px; background: var(--grid); }
.counter i.on { background: var(--warn); }
.counter i.last { background: var(--bad); }

/* ---- admin ---- */
main.admin { max-width: 1400px; margin: 0 auto; padding: 24px 24px 60px; display: grid; gap: 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--grid); background: var(--surface); display: grid; gap: 4px; }
.kpi b { font-family: var(--display); font-size: 1.7rem; line-height: 1; }
.kpi span { font-size: 0.78rem; color: var(--ink-2); font-weight: 600; }
.kpi small { color: var(--muted); font-size: 0.74rem; }
.kpi.confirmed b { color: var(--good-text); }
.kpi.cancelled b { color: var(--warn-text); }
.kpi.suspended b { color: var(--bad-text); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; }
.toolbar input, .toolbar select { width: auto; padding: 8px 10px; }
.toolbar .spacer { flex: 1; }
.tablewrap { overflow-x: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 9px 12px; text-align: left; border-top: 1px solid var(--grid); vertical-align: top; white-space: nowrap; }
th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-top: 0; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: var(--surface-2); }
td .sub { display: block; color: var(--muted); font-size: 0.76rem; }
.tfoot { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--grid); flex-wrap: wrap; gap: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rank { padding: 18px; display: grid; gap: 12px; align-content: start; }
.rank ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; }
.rank .pos { font-family: var(--display); color: var(--muted); font-weight: 700; }
.rank .who { display: grid; gap: 4px; min-width: 0; }
.rank .who span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.rank.cancel .bar i { background: var(--warn); }
.rank.confirm .bar i { background: var(--good); }
.rank .val { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.rank .val small { display: block; color: var(--muted); font-weight: 500; font-size: 0.72rem; font-family: var(--body); }
.flow { display: grid; gap: 8px; }
.flow .step { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.flow .step.on { color: var(--ink); }
.flow .step.done { color: var(--good-text); }
.flow .step .st { width: 20px; text-align: center; }
code { font-size: 0.82em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
pre { margin: 0; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; font-size: 0.78rem; overflow-x: auto; white-space: pre-wrap; }
.sheetlink { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--good-soft); color: var(--good-text); font-weight: 600; word-break: break-all; }

@media (max-width: 960px) {
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  .brand .sub, .brand .sep { display: none; }
  .chip { padding: 2px; }
  .chip .name { display: none; }
  main.dash, main.admin { padding: 16px 16px 120px; }
  .tabs { overflow-x: auto; }
  .offer h3 { font-size: 1.05rem; }
  .offer-actions { justify-content: stretch; }
  .offer-actions .btn { flex: 1; justify-content: center; }
  .savebar { width: calc(100% - 24px); justify-content: space-between; padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- app real: código por mail, login con Google, estados de carga ---- */
.code-input { font: 700 2rem var(--display); letter-spacing: 0.4em; text-align: center; padding: 12px; }
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--axis); background: var(--plane); font-weight: 600; text-decoration: none; color: var(--ink); }
.gbtn:hover { background: var(--surface-2); }
.gbtn .g { font-family: var(--display); font-weight: 700; color: var(--brand); }
.recaptcha-box { min-height: 78px; display: flex; justify-content: center; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--grid); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.rejected { display: grid; gap: 4px; font-size: 0.85rem; }
.sync-info { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 0.82rem; flex-wrap: wrap; }
.sync-info .ok { color: var(--good-text); font-weight: 600; }
.sync-info .failed { color: var(--bad-text); font-weight: 600; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- requisitos operativos: banner de política, pill de ventana, alertas, liberadas, invitaciones ---- */
.policy { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 24px; background: var(--brand-soft); color: var(--brand-ink); border-bottom: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); font-size: 0.9rem; }
.policy .ico { font-size: 1.1rem; }
.policy > div { flex: 1; min-width: 240px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
.pill.open { background: var(--good-soft); color: var(--good-text); }
.pill.closed { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--axis); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.expired { background: var(--bad-soft); color: var(--bad-text); }
.alerts li.alert { grid-template-columns: 28px 1fr auto; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--grid); }
.alerts li.alert.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.alerts li.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.alerts .action { color: var(--ink-2); font-weight: 600; }
.alerts .who span { white-space: normal; }
.invite-form { display: grid; gap: 10px; }
.invite-form textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--axis); background: var(--plane); color: var(--ink); width: 100%; resize: vertical; }
select.sm { width: auto; padding: 6px 10px; font-size: 0.85rem; }
.btn:disabled.good { background: var(--lock); border-color: var(--lock); }
@media (max-width: 640px) { .policy { padding: 10px 16px; font-size: 0.82rem; } .pill { white-space: normal; } }
/* el banner de la ventana es persistente: queda pegado bajo la barra superior */
.policy { position: sticky; top: 61px; z-index: 19; }
@media (max-width: 640px) { .policy { position: static; } }
