/* Calendario — estilos.
   Diseño "sin scroll de página": la ventana nunca se desplaza verticalmente. Cada pantalla
   ocupa el alto disponible y, si el contenido no cabe, solo se desplaza la lista o tarjeta
   que lo contiene. En móvil, los tableros (inicio, tareas, horario, semana) se recorren
   deslizando en horizontal. Escritorio a partir de 900px. */
@font-face {
  font-family: "DM Serif Display";
  src: url("../fonts/dm-serif-display-latin-400.c27d5a47c09e.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/nunito-sans-latin-wght.e010923d59d4.woff2") format("woff2");
  font-weight: 200 1000; font-style: normal; font-display: swap;
}

:root {
  --ivory: #FFF9F2;
  --lilac: #DCC7E8;
  --lilac-soft: #EFE5F4;
  --rose: #F2D5DF;
  --rose-soft: #FAE8EE;
  --butter: #F8E7B5;
  --butter-soft: #FCF1D6;
  --sage: #DDE5CF;
  --sage-soft: #EDF1E5;
  --plum: #44223F;
  --plum-soft: #6B4A66;
  --plum-muted: #7A5C75;
  --violet: #835191;      /* día seleccionado (texto blanco 6.3:1) */
  --white: #FFFFFF;
  --line: #EADCE6;
  --danger: #A3324A;
  --danger-bg: #FBE3E8;
  --ok: #3F6B3A;
  --focus: #7B3FA0;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 2px 12px rgba(68, 34, 63, .07);
  --shadow-row: 0 1px 4px rgba(68, 34, 63, .08);
  --font-title: "DM Serif Display", Georgia, "Times New Roman", serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --gap: clamp(.6rem, 1.4vw, 1rem);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; overflow: hidden; }
body {
  margin: 0; overflow: hidden; color: var(--plum); background: var(--ivory);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.45;
  background-image:
    radial-gradient(circle at 12px 12px, rgba(220, 199, 232, .4) 1.4px, transparent 2px),
    radial-gradient(circle at 52px 44px, rgba(242, 213, 223, .5) 1.4px, transparent 2px);
  background-size: 80px 80px;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-family: var(--font-title); font-weight: 400; font-size: clamp(1.6rem, 3vw, 2.4rem); }
h2 { font-size: 1.08rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .7rem; }
a { color: var(--plum); }
img, svg { max-width: 100%; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--plum-muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.pre { white-space: pre-line; }
.is-hidden { display: none !important; }
.no-js-only { display: inline-flex; }
.js .no-js-only { display: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.skip-link { position: absolute; left: .5rem; top: -100px; background: var(--plum); color: var(--white);
  padding: .6rem 1rem; border-radius: 10px; z-index: 100; }
.skip-link:focus { top: .5rem; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.icon.tiny { width: 1em; height: 1em; vertical-align: -.15em; }

/* Barras de desplazamiento internas discretas */
.page-body, .dcard-scroll, .col-scroll, .events-pane, .month-list, .agenda, .board, .dash {
  scrollbar-width: thin; scrollbar-color: #D9C5DF transparent;
}

/* ================= Estructura ================= */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.sidebar { display: none; }
.topbar {
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: .25rem;
  padding: .35rem .6rem; background: linear-gradient(180deg, #F3EAF6, #F7EFF5);
  border-bottom: 1px solid var(--line);
}
.topbar .logo { justify-self: center; }
.logo { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none;
  font-family: var(--font-title); font-size: 1.55rem; line-height: 1; }
.main { position: relative; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  padding: .75rem .9rem calc(.6rem + env(safe-area-inset-bottom)); }
.main:focus { outline: none; }

/* Menú lateral (escritorio) */
@media (min-width: 900px) {
  .app { grid-template-columns: clamp(210px, 19vw, 260px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .topbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; align-items: stretch; gap: 1.6rem; position: relative; overflow: hidden;
    padding: 1.6rem 1rem 0; background: linear-gradient(180deg, #F1E7F5 0%, #EADDF0 100%);
    border-right: 1px solid var(--line); border-radius: 0 28px 28px 0;
  }
  .sidebar .logo { flex-direction: column; gap: .2rem; font-size: 2.1rem; align-self: center; }
  .sidebar .logo img { width: 62px; height: 62px; }
  .nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; position: relative; z-index: 1; }
  .nav-list a { display: flex; align-items: center; gap: .9rem; padding: .75rem 1.1rem; border-radius: 18px;
    text-decoration: none; font-size: 1.08rem; font-weight: 600; min-height: 48px; }
  .nav-list a .icon { width: 1.5rem; height: 1.5rem; }
  .nav-list a:hover { background: rgba(255, 255, 255, .55); }
  .nav-list a[aria-current="page"] { background: var(--lilac); font-weight: 800; }
  .sidebar-flowers { position: absolute; left: -10px; bottom: -6px; width: 115%; max-width: none; pointer-events: none;
    opacity: .95; }
  .main { padding: 1.4rem clamp(1rem, 2.2vw, 2rem) 1.2rem; }
  .page-head, .hero-text { padding-right: 84px; }
}
@media (min-width: 900px) and (max-height: 760px) { .sidebar-flowers { width: 80%; left: 10%; } }

/* Menú móvil (hamburguesa) */
.drawer { position: relative; }
.drawer summary, .user-menu summary { list-style: none; cursor: pointer; }
.drawer summary::-webkit-details-marker, .user-menu summary::-webkit-details-marker { display: none; }
.drawer summary { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.drawer summary .icon { width: 1.6rem; height: 1.6rem; }
.drawer[open] summary { background: var(--lilac); }
.drawer-panel { position: absolute; left: 0; top: calc(100% + .4rem); z-index: 50; width: min(78vw, 280px);
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: .5rem; }
.drawer-panel a { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem; border-radius: 12px;
  text-decoration: none; font-weight: 700; min-height: 48px; }
.drawer-panel a[aria-current="page"] { background: var(--lilac); }

/* Avatar y menú de usuario */
.user-menu { position: fixed; z-index: 60; top: .4rem; right: .6rem; }
.user-menu summary { display: flex; align-items: center; gap: .3rem; min-height: 44px; padding: 0 .2rem; border-radius: 999px; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--lilac);
  font-weight: 800; font-size: 1.1rem; }
.chevron { display: none; }
.user-panel { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 230px; background: var(--white);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: .5rem; }
.user-panel a, .menu-button { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border-radius: 10px;
  text-decoration: none; font: inherit; font-weight: 700; color: inherit; min-height: 44px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left; }
.user-panel a:hover, .menu-button:hover { background: var(--rose-soft); }
.user-panel form { margin: 0; }
.user-name { margin: 0; padding: .4rem .8rem; color: var(--plum-muted); font-weight: 700; }
@media (min-width: 900px) {
  .user-menu { top: 1.3rem; right: clamp(1rem, 2.2vw, 2rem); }
  .avatar { width: 48px; height: 48px; font-size: 1.25rem; }
  .chevron { display: inline-block; }
}

/* ================= Páginas ================= */
.page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .7rem; }
.page-head { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .6rem; margin: 0; }
.page-head h1 { margin: 0; }
.page-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 2px .4rem; }
.page-body > .card:last-child { margin-bottom: 0; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px;
  padding: .5rem 1.05rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--white);
  color: var(--plum); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--rose-soft); }
.btn-primary { background: var(--plum); border-color: var(--plum); color: var(--white); }
.btn-primary:hover { background: #5A2E54; }
.btn-ghost { background: transparent; border-color: transparent; text-decoration: underline; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--white); }
.btn-danger:hover { background: #87283C; }
.btn-danger-soft { background: var(--danger-bg); border-color: #F1C4CF; color: var(--danger); }
.btn-small { min-height: 40px; padding: .3rem .85rem; font-size: .9rem; }
.btn-icon { width: 44px; padding: 0; }
.btn-block { width: 100%; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }
.round-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex: none;
  background: var(--white); border: 1.5px solid var(--line); text-decoration: none; }
.round-btn:hover { background: var(--lilac-soft); }
.round-btn.small { width: 38px; height: 38px; border-radius: 12px; }

.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px;
  background: var(--lilac); color: var(--plum); }
.tag-ok { background: var(--sage); color: #2F4F2B; }
.tag-off { background: #EEE4EA; color: var(--plum-muted); }
.tag-today { background: var(--butter); }
.badge-overdue { font-size: .72rem; font-weight: 800; color: var(--white); background: var(--danger);
  padding: .02rem .45rem; border-radius: 999px; white-space: nowrap; }
.count { font-size: .85rem; background: var(--ivory); border-radius: 999px; padding: 0 .5rem; font-weight: 700; }
.warning { background: var(--butter); padding: .6rem .8rem; border-radius: var(--radius-sm); }
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .84rem; font-weight: 700; white-space: nowrap;
  background: var(--sage-soft); border-radius: 999px; padding: .25rem .65rem; }

/* Mensajes */
.messages { flex: none; display: grid; gap: .4rem; margin-bottom: .6rem; }
.message { margin: 0; padding: .55rem .9rem; border-radius: var(--radius-sm); background: var(--sage);
  border-left: 5px solid #8FAE7A; font-weight: 600; }
.message-error { background: var(--danger-bg); border-color: var(--danger); }
.message-info { background: var(--lilac); border-color: #9B74B4; }
@media (min-width: 900px) { .messages { margin-right: 84px; } }

/* ================= Formularios ================= */
.form-card { max-width: 880px; }
.form-grid { display: grid; gap: 0 1.1rem; }
@media (min-width: 700px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: 1 / -1; }
}
.field { margin: 0 0 .9rem; border: 0; padding: 0; min-width: 0; }
.field > label, .field legend { display: block; font-weight: 700; margin-bottom: .3rem; padding: 0; }
.req { color: var(--danger); }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="email"],
input[type="number"], select, textarea {
  width: 100%; min-height: 46px; padding: .55rem .8rem; font: inherit; color: var(--plum);
  background: var(--ivory); border: 1.5px solid #D8C3D2; border-radius: var(--radius-sm);
}
textarea { min-height: 70px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); background: #FFF6F8; }
.field-error { color: var(--danger); font-weight: 700; font-size: .9rem; margin: .3rem 0 0; }
.field-error::before { content: "⚠ "; }
.help { font-size: .85rem; color: var(--plum-muted); margin: .25rem 0 0; }
.form-errors { background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-sm);
  padding: .6rem 1rem; margin-bottom: 1rem; font-weight: 700; }
.form-errors p { margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; align-items: center; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; min-height: 44px; }
.check input { width: 1.3rem; height: 1.3rem; accent-color: var(--plum); flex: none; }
.color-input { width: 64px; height: 46px; padding: 3px; border: 1.5px solid #D8C3D2; border-radius: var(--radius-sm);
  background: var(--white); cursor: pointer; vertical-align: middle; }
.swatches { display: inline-flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 0 .4rem; vertical-align: middle; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--white); background: var(--c);
  box-shadow: 0 0 0 1.5px #D8C3D2; cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--plum); }
#id_category { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
#id_category > div > label { display: flex; align-items: center; gap: .55rem; width: 100%; height: 100%;
  padding: .55rem .8rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; min-height: 46px; background: var(--ivory); }
#id_category input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--plum); }
#id_category > div > label:has(input:checked) { background: var(--lilac); border-color: #9B74B4; }
@media (min-width: 700px) { #id_category { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ================= Entradas genéricas ================= */
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; align-content: start; }
.plain-list li { display: flex; gap: .5rem; align-items: center; min-width: 0; }
.entry { flex: 1; min-width: 0; display: flex; gap: .6rem; align-items: flex-start; text-decoration: none;
  padding: .55rem .7rem; border-radius: var(--radius-sm); border-left: 6px solid var(--c);
  background: color-mix(in srgb, var(--c) 15%, white); }
.entry:hover { background: color-mix(in srgb, var(--c) 25%, white); }
.entry-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; flex: none;
  background: color-mix(in srgb, var(--c) 35%, white); }
.entry-body { display: grid; min-width: 0; }
.entry-title { font-weight: 800; overflow-wrap: anywhere; }
.entry-meta { display: flex; flex-wrap: wrap; gap: .15rem .7rem; font-size: .84rem; color: var(--plum-soft); }
.entry-label { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: .7rem; align-self: center; }
.entry.is-done .entry-title, .task-row.is-done .task-title, .check-row.is-done .check-title { text-decoration: line-through; opacity: .75; }
.entry.is-overdue { border-left-style: dashed; }
.color-dot { display: inline-block; width: 1rem; height: 1rem; border-radius: 50%; background: var(--c); vertical-align: -.15em; }
.color-dot.big { width: 1.6rem; height: 1.6rem; }
.empty-mini { color: var(--plum-soft); }
.empty-mini p { margin-bottom: .6rem; }
.empty { text-align: center; padding: 2rem 1.2rem; }
.empty-icon { width: 3rem; height: 3rem; color: #B07CC6; margin-bottom: .5rem; }

/* ================= Inicio ================= */
.page-home { gap: clamp(.5rem, 1.6vh, 1rem); }
.hero { flex: none; position: relative; display: flex; align-items: flex-start; min-height: 0; }
.hero-text { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.75rem, 3.6vw, 3.1rem); margin: 0 0 .2rem; }
.subtitle { margin: 0; font-size: clamp(.95rem, 1.4vw, 1.2rem); color: var(--plum-soft); }
.first-steps { margin: .3rem 0 0; font-weight: 700; font-size: .9rem; }
.deco-sparks { width: .9em; height: .9em; vertical-align: top; }
.deco-star { width: 1.1em; height: 1.1em; vertical-align: -.15em; }
.hero-branch { position: absolute; top: -1.4rem; right: 96px; width: clamp(120px, 17vw, 240px); pointer-events: none;
  opacity: .9; }
@media (max-width: 899px) {
  .hero-branch { right: -.4rem; top: -.5rem; width: 84px; opacity: .8; }
  .hero-text { padding-right: 62px; }
  .hero h1 .deco-sparks { display: none; }
}

.weekbar { flex: none; display: grid; gap: .55rem; }
.weekbar-head { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; }
.weekbar-title { margin: 0; display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px;
  background: rgba(255, 255, 255, .75); border: 1.5px solid var(--line); border-radius: 14px; font-weight: 700;
  font-size: clamp(.9rem, 1.3vw, 1.08rem); text-align: center; padding: 0 .5rem; }
.week-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(.25rem, .9vw, .7rem); }
.wd { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 52px; padding: .3rem 0; border-radius: 14px; text-decoration: none; background: rgba(255, 255, 255, .8);
  border: 1.5px solid var(--line); line-height: 1.2; }
.wd:hover { background: var(--lilac-soft); }
.wd-name { font-weight: 700; font-size: .9rem; }
.wd-num { font-size: .92rem; }
.wd.is-today { border-color: var(--violet); }
.wd.is-selected { background: var(--violet); border-color: var(--violet); color: var(--white); font-weight: 800; }
.wd-dot { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: #C77D99; }
.wd.is-selected .wd-dot { background: var(--butter); }
@media (max-width: 599px) {
  .wd-mon { display: none; }
  .wd-name { font-size: .78rem; }
  .wd { min-height: 48px; border-radius: 12px; }
}

/* Tarjetas del panel */
.dash { flex: 1; min-height: 0; display: grid; gap: var(--gap); }
.dcard { position: relative; min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); padding: clamp(.75rem, 1.5vh, 1.1rem) clamp(.85rem, 1.4vw, 1.2rem);
  border: 1px solid rgba(68, 34, 63, .06); box-shadow: var(--shadow); }
.dcard-exam { background: linear-gradient(135deg, var(--butter-soft), #FBEBC4); }
.dcard-today { background: linear-gradient(135deg, var(--rose-soft), #F7DDE6); }
.dcard-schedule { background: linear-gradient(135deg, var(--sage-soft), #E3EAD8); }
.dcard-month, .dcard-events { background: linear-gradient(135deg, var(--lilac-soft), #EADDF1); }
.dcard-title { flex: none; display: flex; align-items: center; gap: .5rem; margin: 0 0 .6rem; font-size: clamp(1rem, 1.5vw, 1.2rem); }
.dcard-title .icon { width: 1.5rem; height: 1.5rem; }
.dcard-title .deco-sparks { margin-left: auto; width: 1.4rem; height: 1.4rem; }
.dcard-add { margin-left: auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255, 255, 255, .8); text-decoration: none; }
.dcard-body { position: relative; flex: 1; min-height: 0; }
.dcard-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
.dcard-foot { flex: none; margin: .5rem 0 0; font-weight: 700; font-size: .9rem; position: relative; z-index: 1; }

.exam-box { position: relative; z-index: 1; display: grid; gap: .35rem; max-width: 72%; padding: .8rem 1rem;
  background: rgba(255, 255, 255, .92); border-radius: 18px; text-decoration: none; box-shadow: var(--shadow-row);
  border-left: 6px solid var(--c); }
.exam-name { display: flex; align-items: center; gap: .55rem; }
.exam-name strong { font-size: clamp(1.15rem, 1.9vw, 1.55rem); overflow-wrap: anywhere; }
.exam-name .icon { width: 1.6rem; height: 1.6rem; color: var(--plum-soft); }
.exam-sub { color: var(--plum-soft); font-weight: 600; }
.exam-date { display: flex; align-items: center; gap: .55rem; font-size: 1.02rem; }
.exam-count { font-weight: 800; color: var(--violet); font-size: .92rem; }
.deco-books { position: absolute; right: -6px; bottom: -6px; width: clamp(90px, 30%, 170px); pointer-events: none; }
.dcard-exam .empty-mini { position: relative; z-index: 1; max-width: 70%; }

.mini-label { margin: .1rem 0 .35rem; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--plum-soft); }
.overdue-label { color: var(--danger); }
.check-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .4rem; position: relative; z-index: 1; }
.check-row { display: flex; align-items: center; gap: .55rem; padding: .25rem .7rem .25rem .35rem; border-radius: 14px;
  background: rgba(255, 255, 255, .93); box-shadow: var(--shadow-row); }
.check-row form { margin: 0; }
.round-check { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; padding: 0; cursor: pointer;
  background: transparent; border: 0; color: var(--ok); }
.round-check::before { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--plum-muted); }
.round-check { position: relative; }
.round-check:hover::before { background: var(--sage); }
.check-row.is-done .round-check::before { background: var(--sage); border-color: var(--ok); }
.round-check .icon { position: relative; width: 14px; height: 14px; }
.check-text { flex: 1; min-width: 0; display: grid; text-decoration: none; padding: .25rem 0; }
.check-title { font-weight: 600; overflow-wrap: anywhere; }
.check-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; font-size: .8rem; color: var(--plum-soft); }
.check-meta .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.deco-flower { position: absolute; right: -4px; bottom: -4px; width: 70px; pointer-events: none; opacity: .9; }

.class-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.class-row { display: flex; align-items: center; gap: .75rem; padding: .55rem .8rem; border-radius: 16px; text-decoration: none;
  background: rgba(255, 255, 255, .93); box-shadow: var(--shadow-row); }
.class-bar { flex: none; width: 6px; align-self: stretch; min-height: 2.2rem; border-radius: 4px; background: var(--c); }
.class-main { flex: 1; min-width: 0; display: grid; }
.class-main strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.class-main span { color: var(--plum-soft); font-size: .92rem; }

.dcard-month { flex-direction: row; gap: 1rem; }
.month-pane { flex: none; display: flex; flex-direction: column; min-height: 0; width: min(100%, 290px); }
.mini-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .2rem; }
.mini-head h2 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 1.15rem; text-align: center; }
.mini-cal { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; }
.mini-cal th { font-size: .7rem; font-weight: 700; color: var(--plum-muted); padding: .1rem 0; }
.mini-cal td { padding: 1px 0; height: clamp(1.45rem, 3.6vh, 1.95rem); }
.mini-cal a { position: relative; display: inline-grid; place-items: center; width: clamp(1.45rem, 3.6vh, 1.95rem);
  height: clamp(1.45rem, 3.6vh, 1.95rem); border-radius: 50%; text-decoration: none; font-size: .86rem; font-weight: 600; }
.mini-cal a:hover { background: rgba(255, 255, 255, .8); }
.mini-cal a.is-today { box-shadow: inset 0 0 0 2px var(--violet); }
.mini-cal a.is-selected { background: var(--violet); color: var(--white); }
.mini-cal a.has-events::after { content: ""; position: absolute; bottom: 1px; width: 4px; height: 4px; border-radius: 50%;
  background: #C77D99; }
.mini-cal a.is-selected.has-events::after { background: var(--butter); }
.events-pane { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding-left: 1rem; border-left: 1.5px dashed #D9C5DF; }
.mini-title { font-size: .95rem; margin: .4rem 0 .5rem; }
.up-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.up-row { display: flex; align-items: center; gap: .55rem; padding: .35rem .55rem; border-radius: 14px; text-decoration: none;
  background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-row); border-left: 5px solid var(--c); }
.up-date { flex: none; display: grid; text-align: center; width: 2.2rem; font-size: .72rem; line-height: 1.1; color: var(--plum-soft); }
.up-date strong { font-size: 1.05rem; color: var(--plum); }
.up-icon { flex: none; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 35%, white); }
.up-text { min-width: 0; display: grid; }
.up-title { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-meta { font-size: .76rem; color: var(--plum-soft); }

/* Distribución del panel según el ancho */
@media (min-width: 1200px) {
  .dash { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "exam today" "sched month"; }
  .dcard-exam { grid-area: exam; } .dcard-today { grid-area: today; }
  .dcard-schedule { grid-area: sched; } .dcard-month { grid-area: month; }
  .dcard-events { display: none; }
}
@media (min-width: 900px) and (max-width: 1199px) {
  .dash { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "exam today sched" "month events events"; }
  .dcard-exam { grid-area: exam; } .dcard-today { grid-area: today; }
  .dcard-schedule { grid-area: sched; } .dcard-month { grid-area: month; } .dcard-events { grid-area: events; }
  .events-pane { display: none; }
  .month-pane { width: 100%; }
}
/* Móvil y tableta: páginas de 2 tarjetas que se deslizan en horizontal */
@media (max-width: 899px) {
  .dash { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: 100%;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    scrollbar-width: none; }
  .dash::-webkit-scrollbar { display: none; }
  .dcard { scroll-snap-align: start; }
  .dcard-events { grid-row: span 2; }
  .events-pane { display: none; }
  .dcard-month { justify-content: center; }
  .month-pane { width: min(100%, 340px); }
  .exam-box { max-width: 78%; }
}
@media (max-width: 899px) and (max-height: 700px) {
  .subtitle, .first-steps { display: none; }
}

.pager-dots { flex: none; display: none; justify-content: center; gap: .45rem; }
.pager-dots i { width: 8px; height: 8px; border-radius: 50%; background: #D9C5DF; transition: width .2s; }
.pager-dots i.is-active { width: 22px; border-radius: 6px; background: var(--violet); }
@media (max-width: 899px) { .pager-dots { display: flex; } }
.pager-dots[hidden] { display: none !important; }

/* ================= Tableros (tareas, horario, semana) ================= */
.board-wrap { display: flex; flex-direction: column; gap: .5rem; overflow: hidden; }
.board { position: relative; flex: 1; min-height: 0; display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr); gap: var(--gap); overflow-x: auto; overflow-y: hidden; padding: 2px; }
.board-col { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; box-shadow: var(--shadow); }
.board-col > h2, .board-col > h3 { flex: none; display: flex; align-items: center; gap: .5rem; }
.board-col > .plain-list, .board-col > .col-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  align-content: start; padding: 2px; margin: -2px; }
.board-col.is-today { border: 2px solid var(--violet); }
.board-help { flex: none; margin: 0; }
@media (max-width: 899px) {
  .board { grid-auto-columns: 86%; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .board::-webkit-scrollbar { display: none; }
  .board-col { scroll-snap-align: start; }
}
.board-1 { grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 899px) { .board-1 { grid-auto-columns: 100%; } }

/* Tareas */
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; align-content: start; }
.task-row { display: flex; align-items: center; gap: .55rem; padding: .4rem .55rem; border-radius: var(--radius-sm);
  border-left: 6px solid var(--c); background: color-mix(in srgb, var(--c) 10%, white); }
.task-toggle { margin: 0; }
.check-btn { width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--plum-soft); background: var(--white);
  color: var(--ok); cursor: pointer; display: grid; place-items: center; flex: none; }
.check-btn:hover { background: var(--sage); }
.task-row.is-done .check-btn { background: var(--sage); border-color: var(--ok); }
.task-main { flex: 1; min-width: 0; text-decoration: none; display: grid; gap: .1rem; padding: .15rem 0; }
.task-title { font-weight: 800; overflow-wrap: anywhere; }
.prio { font-weight: 700; }
.prio-3 { color: var(--danger); }
.group-atrasadas { border-color: #F1C4CF; background: #FFFAFB; }
.group-atrasadas h2 { color: var(--danger); }
.group-hoy { background: #FFFDF6; }
.inline-filter { display: flex; gap: .5rem; align-items: center; }
.inline-filter select { min-width: 190px; min-height: 42px; }

/* Horario */
.schedule-day h2 { font-size: 1.05rem; }
.add-inline { flex: none; display: inline-flex; align-items: center; gap: .3rem; margin-top: .5rem; font-weight: 700;
  font-size: .9rem; min-height: 40px; }

/* ================= Calendario ================= */
.cal-toolbar { flex: none; display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
.segmented { display: inline-flex; background: var(--white); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 3px; flex-wrap: wrap; }
.segmented a { padding: .4rem .95rem; border-radius: 999px; text-decoration: none; font-weight: 700; min-height: 40px;
  display: inline-flex; align-items: center; }
.segmented a[aria-current="page"] { background: var(--violet); color: var(--white); }
.cal-nav { display: flex; gap: .4rem; align-items: center; }
.cal-title { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: clamp(1.2rem, 2vw, 1.55rem); }
.legend { flex: none; list-style: none; display: flex; flex-wrap: wrap; gap: .2rem .9rem; padding: 0; margin: 0;
  font-size: .8rem; color: var(--plum-soft); }
@media (max-width: 599px) { .legend { display: none; } }
.add-menu { position: relative; }
.add-panel { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 15; min-width: 220px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .4rem; }
.add-panel a { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: 10px;
  text-decoration: none; font-weight: 700; min-height: 44px; }
.add-panel a:hover { background: var(--rose-soft); }

.cal-body { display: flex; flex-direction: column; gap: .6rem; overflow: hidden; }
.page-cal-agenda .cal-body, .page-cal-dia .cal-body { overflow-y: auto; }
.month { flex: none; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.month-head, .month-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head span { text-align: center; font-weight: 800; font-size: .8rem; padding: .35rem 0; background: var(--rose-soft); }
.day { min-height: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: .15rem;
  display: flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 0; overflow: hidden; }
.month-week { height: clamp(2.7rem, 6.2vh, 3.2rem); }
.month-week .day:first-child { border-left: 0; }
.day.other-month { background: #FCF7F1; }
.day.other-month .day-num { color: #A58FA0; }
.day-num { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; flex: none; border-radius: 50%;
  text-decoration: none; font-weight: 700; }
.day.is-today .day-num { background: var(--violet); color: var(--white); }
.day-entries { display: none; }
.dots { display: flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(68, 34, 63, .25); }
.month-list { flex: 1; min-height: 0; overflow-y: auto; }
.month-list h3 { font-family: var(--font-title); font-weight: 400; font-size: 1.2rem; }
@media (min-width: 900px) {
  .month { flex: 1; min-height: 0; }
  .month-week { flex: 1; height: auto; min-height: 0; }
  .day { align-items: stretch; padding: .25rem; }
  .day-num { width: 1.85rem; height: 1.85rem; font-size: .88rem; }
  .day-entries { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; min-width: 0; width: 100%; min-height: 0; }
  .day-entries li { min-width: 0; }
  .dots { display: none; }
  .chip { display: flex; width: 100%; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 700; text-decoration: none;
    padding: .1rem .35rem; border-radius: 7px; background: color-mix(in srgb, var(--c) 22%, white);
    border-left: 4px solid var(--c); min-width: 0; }
  .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chip.is-done .chip-text { text-decoration: line-through; }
  .more { font-size: .74rem; font-weight: 800; }
  .month-list { display: none; }
}

.week-day h3 a { text-decoration: none; display: flex; gap: .4rem; align-items: baseline; }
.week .entry { padding: .45rem .55rem; }
@media (min-width: 900px) {
  .week { grid-auto-columns: minmax(150px, 1fr); }
  .week .entry { flex-direction: column; gap: .3rem; font-size: .88rem; }
  .week .entry-icon { width: 1.6rem; height: 1.6rem; }
}

.agenda-day { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: .8rem; }
.agenda-date { flex: none; width: 3.4rem; text-align: center; background: var(--white); border: 1px solid var(--line);
  border-radius: 14px; padding: .35rem 0; text-decoration: none; display: grid; box-shadow: var(--shadow); }
.agenda-date strong { font-size: 1.3rem; line-height: 1.1; }
.agenda-date span { font-size: .75rem; text-transform: uppercase; font-weight: 700; }
.agenda-date.is-today { background: var(--violet); color: var(--white); }
.agenda-day > .plain-list, .agenda-items { flex: 1; min-width: 0; }
.agenda-weekday { font-weight: 800; margin: 0 0 .35rem; color: var(--plum-soft); }

/* Detalle */
.detail { border-top: 8px solid var(--c); max-width: 880px; }
.detail-category { display: inline-flex; align-items: center; gap: .4rem; font-weight: 800;
  background: color-mix(in srgb, var(--c) 25%, white); padding: .3rem .8rem; border-radius: 999px; }
.detail-list { display: grid; gap: .55rem; margin: .5rem 0 1rem; }
.detail-list div { display: grid; grid-template-columns: 7rem 1fr; gap: .5rem; }
.detail-list dt { font-weight: 800; color: var(--plum-soft); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .detail-list div { grid-template-columns: 1fr; gap: 0; } }

/* Asignaturas */
.subject-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.subject-card { margin: 0; border-top: 8px solid var(--c); }
.subject-head { display: flex; gap: .6rem; align-items: center; }
.subject-head h2 { margin: 0; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.row-actions form { margin: 0; }

/* Usuarios */
.user-list { list-style: none; padding: 0; margin: 0; }
.user-row { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: space-between; align-items: center; }
.user-row.is-inactive { opacity: .85; background: #FCF7F1; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }

/* Acceso */
.auth-main { height: 100vh; height: 100dvh; overflow-y: auto; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; padding: 1.8rem; }
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: .3rem; }
.auth-brand h1 { margin: 0; }
.auth-brand img { width: 3rem; height: 3rem; }
body.auth { background-color: #F7E9F0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  html, body, .app, .main, .page, .page-body { height: auto; overflow: visible; }
  .sidebar, .topbar, .user-menu { display: none !important; }
}

/* Ajustes finos */
@media (min-width: 1200px) {
  .month-pane { width: clamp(220px, 17vw, 290px); }
  .events-pane .up-icon { display: none; }
  .events-pane { padding-left: .8rem; }
}
.weekbar-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .weekbar-title { font-size: .82rem; gap: .35rem; } }
.mini-head h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .weekbar-title .icon { display: none; } }
@media (min-width: 900px) { .week { grid-auto-columns: minmax(112px, 1fr); } }
/* Tableta vertical con altura suficiente: rejilla sin deslizar */
@media (min-width: 600px) and (max-width: 899px) and (min-height: 900px) {
  .dash { grid-auto-flow: row; grid-template-columns: 1fr 1fr; grid-auto-columns: auto; overflow: hidden;
    grid-template-rows: repeat(3, minmax(0, 1fr)); grid-template-areas: "exam today" "sched month" "events events"; }
  .dcard-exam { grid-area: exam; } .dcard-today { grid-area: today; }
  .dcard-schedule { grid-area: sched; } .dcard-month { grid-area: month; } .dcard-events { grid-area: events; grid-row: auto; }
  .mini-cal td { height: 1.55rem; }
  .mini-cal a { width: 1.55rem; height: 1.55rem; font-size: .8rem; }
  .mini-head { margin-bottom: 0; }
}
