/* Tutorsify — estilos */
:root {
  --cream: #f7f6f2;
  --navy: #0b2545;
  --navy-soft: #1d3a5f;
  --green: #00c853;
  --green-ink: #00873a; /* verde oscuro para texto legible sobre claro */
  --amber: #ffab48;
  --amber-ink: #9a5a00;
  --red: #c62828;
  --ink: #0b2545;
  --muted: #5d6b7e;
  --line: #e4e1d8;
  --card: #ffffff;
  --radius: 12px;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 0.5rem; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; margin-top: 0.75rem; }
a { color: var(--navy); text-underline-offset: 3px; }
a:hover { color: var(--green-ink); }
p { margin: 0 0 0.75rem; }
code.secret {
  font-size: 1.2rem; background: var(--cream); padding: 0.25rem 0.5rem;
  border-radius: 6px; border: 1px dashed var(--navy); user-select: all;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.warn { color: var(--red); font-weight: 600; }
.multiline { white-space: pre-wrap; }
.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.empty { color: var(--muted); font-style: italic; padding: 0.5rem 0; }
.notice { background: #fff7ea; border-left: 3px solid var(--amber); padding: 0.5rem 0.75rem; border-radius: 6px; }

.brand { font-family: var(--serif); font-size: 1.7rem; color: var(--navy); }
.brand-dot { color: var(--green); }

/* ───── Formularios ───── */
.field { display: flex; flex-direction: column; gap: 0.3rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field-label { font-weight: 600; font-size: 0.9rem; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  padding: 0.6rem 0.75rem; border: 1px solid #cfcabd; border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(0, 200, 83, 0.35); outline-offset: 1px; border-color: var(--green-ink);
}
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled textarea, fieldset:disabled input { background: #f1efe9; }
.check { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.check input { width: auto; }
.check.big { font-size: 1.05rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: 0.55rem 1rem; border-radius: 999px; border: 1px solid var(--navy);
  background: #fff; color: var(--navy); white-space: nowrap;
}
.btn:hover { background: var(--cream); color: var(--navy); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-soft); color: #fff; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-block { width: 100%; padding: 0.8rem 1rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; }
.link-button.danger { color: var(--red); margin-left: 0.5rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: #e3f8eb; color: #0b5d2c; border: 1px solid #b6ebc9; }
.flash-error { background: #fdecea; color: #8a1c1c; border: 1px solid #f5c2bd; }
.flash-warn { background: #fff4e3; color: #7a4600; border: 1px solid #ffd9a8; }

/* ───── Badges de estado ───── */
.badge {
  display: inline-block; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.78rem;
  font-weight: 600; background: #eceae3; color: var(--muted); margin-left: 0.25rem; white-space: nowrap;
}
.badge-entregado { background: #dcf7e6; color: var(--green-ink); }
.badge-pendiente { background: #fff0db; color: var(--amber-ink); }
.badge-vencido { background: #fde3e0; color: var(--red); }
.badge-programada { background: #e5ecf5; color: var(--navy); }
.badge-no_aplica { background: #eceae3; color: var(--muted); text-decoration: line-through; }

/* ───── Tarjetas, tablas, listas ───── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: #fbfaf7; }
.table tr:last-child td { border-bottom: 0; }
.card .table { border: 0; }
.list { list-style: none; padding: 0; margin: 0 0 1rem; }
.list li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: 0.9rem; }
.dl dd { margin: 0; }

.grid-2, .grid-3 { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + section { margin-top: 1rem; }

/* ───── Página pública (login) ───── */
body.public { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 2rem; }
.auth-card .brand { display: block; margin-bottom: 1.5rem; }

/* ───── Consola admin (escritorio) ───── */
body.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy); color: #fff; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 1.5rem;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { text-decoration: none; display: flex; flex-direction: column; padding: 0 0.5rem; }
.sidebar-brand .brand { color: #fff; }
.sidebar-brand small { color: var(--amber); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.7rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar nav a { color: #d5deea; text-decoration: none; padding: 0.55rem 0.75rem; border-radius: 8px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar nav a.active { background: rgba(0, 200, 83, 0.16); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.sidebar-user { margin-top: auto; display: flex; flex-direction: column; gap: 0.3rem; padding: 0 0.5rem; font-size: 0.85rem; }
.sidebar-user span { font-weight: 600; }
.sidebar-user a, .sidebar-user .link-button { color: #b8c5d6; text-align: left; }
.admin-main { padding: 2rem 2.5rem 4rem; max-width: 1200px; width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header p { margin: 0.25rem 0 0; }
.form-narrow { max-width: 720px; }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type='search'] { min-width: 260px; }
.inline-label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.75rem; }
.inline-form input, .inline-form select { width: auto; }
.tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: 0.6rem 1rem; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--green); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; text-decoration: none; display: flex; flex-direction: column; }
.stat strong { font-family: var(--serif); font-size: 2.6rem; font-weight: 400; line-height: 1; }
.stat span { color: var(--muted); font-size: 0.9rem; }
.stat-vencido { border-top: 4px solid var(--red); }
.stat-pendiente { border-top: 4px solid var(--amber); }
.danger-zone { margin-top: 2rem; }
tr.muted a { color: var(--muted); }

/* ───── Portal del tutor (celular primero) ───── */
body.tutor { padding-bottom: 72px; }
.tutor-top {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 1rem; background: var(--cream); border-bottom: 1px solid var(--line);
}
.tutor-top a { text-decoration: none; }
.tutor-top .brand { font-size: 1.5rem; }
.tutor-menu { position: relative; }
.tutor-menu summary { list-style: none; cursor: pointer; font-weight: 600; padding: 0.4rem 0.6rem; }
.tutor-menu summary::-webkit-details-marker { display: none; }
.tutor-menu > div {
  position: absolute; right: 0; top: 2.4rem; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; min-width: 200px;
  box-shadow: 0 8px 24px rgba(11, 37, 69, 0.12);
}
.tutor-main { padding: 1rem; max-width: 640px; margin: 0 auto; }
.tutor-main h1 { font-size: 2rem; }
.tutor-main section { margin-bottom: 1.5rem; }
.tutor-nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--navy); padding-bottom: env(safe-area-inset-bottom);
}
.tutor-nav a { color: #c9d4e3; text-align: center; padding: 0.9rem 0.25rem; text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.tutor-nav a.active { color: #fff; box-shadow: inset 0 3px 0 var(--green); }
.session-card {
  display: flex; flex-direction: column; gap: 0.3rem; background: #fff; border: 1px solid var(--line);
  border-left: 4px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; margin-bottom: 0.75rem;
  text-decoration: none; color: var(--ink);
}
a.session-card:hover { color: var(--ink); border-color: #cfcabd; }
.session-card .btn { margin-top: 0.5rem; }
.session-card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.state-vencido { border-left-color: var(--red); }
.state-pendiente { border-left-color: var(--amber); }
.state-entregado { border-left-color: var(--green); }
.state-programada { border-left-color: var(--navy); }
.report-snippet { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 0.6rem; }
.tutor input, .tutor select, .tutor textarea { font-size: 16px; } /* evita zoom automático en iPhone */

/* ───── Pantallas pequeñas ───── */
@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .admin-main { padding: 1.25rem 1rem 3rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}
@media (max-width: 600px) {
  .grid-2.keep { grid-template-columns: 1fr 1fr; }
  .grid-2:not(.keep) { grid-template-columns: 1fr; }
}
