:root {
  --paper: #f3f0e7;
  --paper-deep: #eae4d7;
  --card: #fffdf8;
  --card-muted: #faf7ef;
  --ink: #1d2823;
  --ink-soft: #3c4a43;
  --muted: #6e7a73;
  --muted-2: #8b948e;
  --line: #e5dfd2;
  --line-strong: #d7d0bf;
  --green: #1f5a4a;
  --green-dark: #143a31;
  --green-deep: #102d27;
  --green-soft: #e3efe9;
  --green-bright: #2f7a63;
  --amber: #c47a2c;
  --amber-soft: #fbf0dd;
  --red: #b54a3f;
  --red-soft: #f8e8e5;
  --blue: #4d6f9e;
  --blue-soft: #e8eef8;
  --plum: #7a668f;
  --plum-soft: #f0eaf5;
  --shadow-sm: 0 2px 10px rgba(33, 49, 41, 0.04);
  --shadow-md: 0 14px 34px rgba(32, 48, 40, 0.08);
  --shadow-lg: 0 28px 80px rgba(20, 43, 35, 0.2);
  --radius: 20px;
  --radius-sm: 13px;
  --sidebar-w: 278px;
  --font-sans: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(circle at 85% 0%, rgba(196, 122, 44, 0.08), transparent 34rem),
    radial-gradient(circle at 12% 22%, rgba(47, 122, 99, 0.07), transparent 30rem),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

body.dialog-open,
body.sidebar-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.15;
}

::selection {
  background: rgba(47, 122, 99, 0.22);
}

:focus-visible {
  outline: 3px solid rgba(47, 122, 99, 0.35);
  outline-offset: 2px;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ------------------------------------------------------------------ */
/* Estructura                                                          */
/* ------------------------------------------------------------------ */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 110;
  display: flex;
  width: var(--sidebar-w);
  flex-direction: column;
  padding: 28px 20px 18px;
  overflow-y: auto;
  color: #f5f1e7;
  background:
    radial-gradient(circle at 8% 3%, rgba(255, 255, 255, 0.12), transparent 16rem),
    linear-gradient(165deg, #1c4a3f 0%, #163a32 46%, #112e28 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.2) 0.7px, transparent 0.8px);
  background-size: 19px 19px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--green-deep);
  background: #e8c987;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.18);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-copy span {
  margin-top: 4px;
  color: rgba(245, 241, 231, 0.62);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.side-label {
  padding: 0 12px 9px;
  color: rgba(245, 241, 231, 0.45);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.side-label-spaced {
  margin-top: 25px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  color: rgba(245, 241, 231, 0.72);
  font-weight: 500;
  text-align: left;
  border-radius: 12px;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.is-active {
  color: #fffaf0;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #e8c987;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: rgba(245, 241, 231, 0.62);
}

.nav-item.is-active .nav-icon,
.nav-item:hover .nav-icon {
  color: #e8c987;
}

.sidebar-note {
  display: flex;
  gap: 10px;
  margin: auto 4px 18px;
  padding: 15px;
  color: rgba(245, 241, 231, 0.65);
  font-size: 11.5px;
  line-height: 1.5;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.sidebar-note .icon {
  width: 18px;
  height: 18px;
  color: #e8c987;
}

.sidebar-note strong {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 250, 240, 0.9);
  font-weight: 600;
}

.teacher-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px;
  color: #f7f2e8;
  text-align: left;
  border-radius: 14px;
  transition: background 160ms ease;
}

.teacher-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 50%;
  background: #2f7a63;
}

.avatar.sm {
  width: 34px;
  height: 34px;
  font-size: 10px;
}

.avatar-tone-0 { background: #356b5d; }
.avatar-tone-1 { background: #8a6440; }
.avatar-tone-2 { background: #596c94; }
.avatar-tone-3 { background: #7d5e7d; }
.avatar-tone-4 { background: #657342; }

.teacher-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.teacher-copy strong {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-copy span {
  margin-top: 2px;
  color: rgba(245, 241, 231, 0.52);
  font-size: 11.5px;
}

.teacher-edit {
  color: rgba(245, 241, 231, 0.4);
}

.main-wrap {
  display: flex;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 0 38px;
  border-bottom: 1px solid rgba(215, 208, 191, 0.66);
  background: rgba(243, 240, 231, 0.86);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right,
.topbar-context,
.save-state,
.today-chip {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 12px;
}

.topbar-right {
  gap: 14px;
}

.topbar-context {
  gap: 9px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.topbar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 0 4px rgba(47, 122, 99, 0.12);
}

.save-state {
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-bright);
}

.save-state.has-error {
  color: var(--red);
}

.save-state.has-error .save-dot {
  background: var(--red);
}

.today-chip {
  gap: 6px;
  padding: 7px 11px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 253, 248, 0.7);
}

.mobile-menu {
  display: none;
}

.main-content {
  width: 100%;
  max-width: 1510px;
  flex: 1;
  padding: 38px 38px 60px;
  margin: 0 auto;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 38px 28px;
  color: var(--muted-2);
  font-size: 11px;
  border-top: 1px solid rgba(215, 208, 191, 0.55);
}

/* ------------------------------------------------------------------ */
/* Botones y etiquetas                                                 */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 11px;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fffaf0;
  background: var(--green);
  box-shadow: 0 7px 17px rgba(31, 90, 74, 0.2);
}

.btn-primary:hover {
  background: #256c59;
  box-shadow: 0 9px 22px rgba(31, 90, 74, 0.26);
}

.btn-secondary {
  color: var(--green);
  border-color: #cbdcd4;
  background: #f1f7f3;
}

.btn-secondary:hover {
  border-color: #a9c8ba;
  background: #e8f2ed;
}

.btn-ghost {
  color: var(--ink-soft);
  border-color: var(--line);
  background: rgba(255, 253, 248, 0.66);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  background: var(--card);
}

.btn-danger {
  color: #fff;
  background: var(--red);
  box-shadow: 0 7px 17px rgba(181, 74, 63, 0.18);
}

.btn-danger:hover {
  background: #a13d33;
}

.btn-danger-ghost {
  color: var(--red);
  border-color: #eccbc6;
  background: #fdf2f0;
}

.btn-danger-ghost:hover {
  background: var(--red-soft);
}

.btn-sm {
  min-height: 35px;
  padding: 0 12px;
  font-size: 11.5px;
  border-radius: 9px;
}

.btn-sm .icon {
  width: 15px;
  height: 15px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--muted);
  border-radius: 9px;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.icon-btn.bordered {
  border: 1px solid var(--line);
  background: var(--card);
}

.icon-btn.subtle {
  width: 29px;
  height: 29px;
  color: var(--muted-2);
}

.icon-btn.tiny {
  width: 24px;
  height: 24px;
}

.icon-btn.tiny .icon {
  width: 13px;
  height: 13px;
}

.icon-btn.danger-hover:hover {
  color: var(--red);
  background: var(--red-soft);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.soft-tag,
.soft-badge,
.count-chip,
.marked-pill,
.autosave-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: max-content;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--card-muted);
}

.count-chip {
  min-width: 28px;
  padding: 3px 8px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.soft-badge {
  color: var(--green);
  border-color: #d8e6df;
  background: #edf5f1;
}

.marked-pill,
.autosave-pill {
  color: var(--green);
  border-color: #cfe3d9;
  background: #eef7f2;
}

.autosave-pill .icon {
  width: 14px;
  height: 14px;
}

/* ------------------------------------------------------------------ */
/* Encabezados de página                                               */
/* ------------------------------------------------------------------ */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.page-head-copy {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--amber);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-head h1 {
  max-width: 760px;
  font-family: var(--font-display);
  font-size: clamp(31px, 3.4vw, 45px);
  font-weight: 600;
  letter-spacing: -1.2px;
  color: var(--ink);
}

.page-sub {
  max-width: 700px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13.5px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 3px;
}

.section-block {
  margin-top: 35px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.section-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ */
/* Panel                                                               */
/* ------------------------------------------------------------------ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 118px;
  padding: 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--stat-soft, var(--green-soft));
  opacity: 0.55;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--stat-color, var(--green));
  border-radius: 13px;
  background: var(--stat-soft, var(--green-soft));
}

.stat-icon .icon {
  width: 20px;
  height: 20px;
}

.stat-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.8px;
}

.stat-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.stat-foot {
  grid-column: 2;
  margin-top: -7px;
  color: var(--muted-2);
  font-size: 10px;
}

.tone-green { --stat-color: var(--green); --stat-soft: var(--green-soft); }
.tone-blue { --stat-color: var(--blue); --stat-soft: var(--blue-soft); }
.tone-amber { --stat-color: var(--amber); --stat-soft: var(--amber-soft); }
.tone-plum { --stat-color: var(--plum); --stat-soft: var(--plum-soft); }

.stats-grid-compact {
  margin-top: 18px;
}

.stats-grid-compact .stat-card {
  min-height: 104px;
  padding: 16px 18px;
}

.stats-grid-compact .stat-value {
  font-size: 23px;
}

.school-group {
  margin-top: 25px;
}

.school-group:first-of-type {
  margin-top: 19px;
}

.school-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 11px;
  padding: 0 3px;
}

.school-group-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.school-group-title h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.school-group-meta {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
}

.school-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--dot, var(--green));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--green)) 15%, transparent);
}

.school-dot.large {
  width: 10px;
  height: 10px;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.assignment-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--card)), var(--card) 46%);
  box-shadow: var(--shadow-sm);
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

.assignment-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  box-shadow: var(--shadow-md);
}

.assignment-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.subject-chip {
  display: inline-flex;
  max-width: calc(100% - 35px);
  padding: 4px 9px;
  overflow: hidden;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 17%, transparent);
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 7%, white);
}

.assignment-body {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 15px;
}

.assignment-body h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.6px;
}

.assignment-shift {
  color: var(--muted);
  font-size: 11px;
}

.assignment-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10.5px;
}

.assignment-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-meta .icon {
  width: 13px;
  height: 13px;
  color: var(--muted-2);
}

.assignment-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  margin-top: 12px;
}

.done-badge,
.pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 600;
}

.done-badge {
  color: var(--green);
}

.done-badge .icon {
  width: 12px;
  height: 12px;
}

.pending-badge {
  color: var(--muted-2);
}

.exam-count {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 9.5px;
}

.assignment-actions {
  display: flex;
  gap: 7px;
  margin-top: auto;
  padding-top: 14px;
}

.assignment-actions .btn {
  flex: 1;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  margin-top: 26px;
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.panel-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding: 19px 21px 15px;
}

.panel-card-head h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.panel-card-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.panel-card-head > .icon {
  width: 19px;
  height: 19px;
  color: var(--muted-2);
}

.activity-list,
.exam-list {
  padding: 0 12px 12px;
  margin: 0;
  list-style: none;
}

.activity-item,
.exam-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 9px;
  border-top: 1px solid var(--line);
}

.activity-item:first-child,
.exam-item:first-child {
  border-top: 0;
}

.activity-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--dot);
}

.activity-copy,
.exam-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.activity-copy strong,
.exam-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-copy span,
.exam-copy span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-number {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.activity-number strong {
  color: var(--green);
  font-size: 12.5px;
}

.activity-number span {
  color: var(--muted-2);
  font-size: 9px;
}

.date-block {
  display: flex;
  width: 39px;
  height: 43px;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--dot) 22%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--dot) 7%, white);
}

.date-block strong {
  font-size: 14px;
  line-height: 1;
}

.date-block span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.mini-empty {
  padding: 26px 22px 30px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

/* ------------------------------------------------------------------ */
/* Estado vacío                                                        */
/* ------------------------------------------------------------------ */

.empty-state {
  display: flex;
  max-width: 560px;
  flex-direction: column;
  align-items: center;
  padding: 58px 34px;
  margin: 28px auto 0;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.56);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 17px;
  color: var(--green);
  border-radius: 17px;
  background: var(--green-soft);
}

.empty-icon .icon {
  width: 25px;
  height: 25px;
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.empty-state p {
  max-width: 430px;
  margin: 8px 0 19px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

/* ------------------------------------------------------------------ */
/* Contexto de cátedra                                                 */
/* ------------------------------------------------------------------ */

.context-panel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 19px 21px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--accent) 7%, var(--card)) 0%, var(--card) 55%);
  box-shadow: var(--shadow-sm);
}

.context-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}

.context-mark {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  flex: none;
  color: var(--accent);
  border-radius: 15px;
  background: color-mix(in srgb, var(--accent) 11%, white);
}

.context-mark .icon {
  width: 23px;
  height: 23px;
}

.context-copy {
  min-width: 0;
  flex: 1;
}

.context-tags {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.school-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.context-copy h2 {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-meta .icon {
  width: 13px;
  height: 13px;
}

.meta-sep {
  width: 1px;
  height: 11px;
  margin: 0 4px;
  background: var(--line-strong);
}

.context-picker {
  display: flex;
  width: 235px;
  flex: none;
  flex-direction: column;
  gap: 4px;
}

.context-picker > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.context-picker select {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
}

select,
input,
textarea {
  accent-color: var(--green);
}

select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="date"],
textarea {
  width: 100%;
  color: var(--ink);
  font-size: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="date"] {
  height: 41px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  outline: 0;
  border-color: var(--green-bright);
  box-shadow: 0 0 0 3px rgba(47, 122, 99, 0.12);
}

/* ------------------------------------------------------------------ */
/* Asistencia                                                          */
/* ------------------------------------------------------------------ */

.date-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 16px;
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 7px;
}

.date-field {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card-muted);
}

.date-field .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.date-field input {
  width: 125px;
  height: 32px;
  padding: 0;
  font-size: 11.5px;
  font-weight: 600;
  border: 0;
  background: transparent;
}

.date-field input:focus {
  box-shadow: none;
}

.date-toolbar-right {
  display: flex;
  align-items: center;
  gap: 13px;
}

.date-long {
  color: var(--muted);
  font-size: 11px;
}

.attendance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 0.62fr)) minmax(190px, 1.2fr);
  gap: 9px;
  margin-top: 13px;
}

.summary-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
}

.summary-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--status);
}

.summary-box > div {
  display: flex;
  flex-direction: column;
}

.summary-box strong {
  font-size: 18px;
  line-height: 1;
}

.summary-box span:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.status-presente { --status: var(--green-bright); }
.status-ausente { --status: var(--red); }
.status-tarde { --status: var(--amber); }
.status-justificado { --status: var(--blue); }

.summary-progress {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9.5px;
}

.progress-copy strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.progress-track {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--paper-deep);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-bright), #5a9f7e);
  transition: width 220ms ease;
}

.roster-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 3px 10px;
}

.roster-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.roster-hint .icon {
  width: 14px;
  height: 14px;
}

.roster-actions {
  display: flex;
  gap: 7px;
}

.roster-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.roster-head,
.roster-row {
  display: grid;
  grid-template-columns: 43px minmax(180px, 0.9fr) minmax(380px, 1.25fr) 112px;
  align-items: center;
  gap: 13px;
}

.roster-head {
  padding: 10px 18px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: var(--card-muted);
}

.roster-row {
  position: relative;
  min-height: 67px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 150ms ease;
}

.roster-row:last-child {
  border-bottom: 0;
}

.roster-row:hover {
  background: #fcfaf4;
}

.roster-row:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: -2px;
  background: #fbf8f0;
}

.roster-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}

.roster-row.is-presente::before { background: var(--green-bright); }
.roster-row.is-ausente::before { background: var(--red); }
.roster-row.is-tarde::before { background: var(--amber); }
.roster-row.is-justificado::before { background: var(--blue); }

.row-number {
  color: var(--muted-2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.student-cell,
.student-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.student-name {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.student-name strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-name span {
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 9px;
}

.status-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-muted);
}

.status-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  border-radius: 7px;
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.status-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
}

.status-letter {
  display: none;
  font-size: 10px;
  font-weight: 700;
}

.status-btn.presente.active {
  color: #185d47;
  background: #dff1e7;
  box-shadow: inset 0 0 0 1px #b9dcc9;
}

.status-btn.ausente.active {
  color: #9e3d34;
  background: #fae5e1;
  box-shadow: inset 0 0 0 1px #ecc6c0;
}

.status-btn.tarde.active {
  color: #9c611e;
  background: #f9edd6;
  box-shadow: inset 0 0 0 1px #ecd5ab;
}

.status-btn.justificado.active {
  color: #42638f;
  background: #e6eef9;
  box-shadow: inset 0 0 0 1px #c8d8ee;
}

.current-status {
  justify-self: end;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  text-align: right;
}

.current-status.status-presente { color: var(--green); }
.current-status.status-ausente { color: var(--red); }
.current-status.status-tarde { color: var(--amber); }
.current-status.status-justificado { color: var(--blue); }

/* ------------------------------------------------------------------ */
/* Notas                                                               */
/* ------------------------------------------------------------------ */

.grades-card {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.grades-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.grades-toolbar h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.grades-toolbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.grades-scroll {
  overflow: auto;
}

.grades-table {
  width: 100%;
  min-width: 700px;
  border-collapse: separate;
  border-spacing: 0;
}

.grades-table th,
.grades-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.grades-table th:last-child,
.grades-table td:last-child {
  border-right: 0;
}

.grades-table tbody tr:last-child td {
  border-bottom: 0;
}

.grades-table thead th {
  padding: 11px 12px;
  vertical-align: top;
  text-align: left;
  background: var(--card-muted);
}

.grades-table .student-col {
  width: 240px;
  min-width: 220px;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
}

.grades-table thead .sticky-col {
  z-index: 3;
  background: var(--card-muted);
}

.exam-col {
  min-width: 150px;
}

.exam-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 25px;
}

.exam-type {
  max-width: 90px;
  overflow: hidden;
  color: var(--amber);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.exam-name {
  display: block;
  max-width: 148px;
  margin-top: 3px;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-date {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.exam-average {
  display: block;
  margin-top: 5px;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}

.average-col {
  width: 83px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center !important;
  text-transform: uppercase;
}

.grades-table tbody td {
  height: 57px;
  padding: 8px 10px;
}

.grades-table tbody tr:hover td {
  background: #fcfaf4;
}

.grades-table tbody tr:hover .sticky-col {
  background: #fcfaf4;
}

.grades-table tbody .student-col {
  padding-left: 13px;
}

.grade-cell {
  text-align: center;
}

.grade-input {
  width: 69px;
  height: 35px;
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  -moz-appearance: textfield;
}

.grade-input::-webkit-outer-spin-button,
.grade-input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.grade-input:hover {
  border-color: var(--line-strong);
}

.grade-input.low {
  color: var(--red);
  border-color: #ecc9c4;
  background: #fdf4f2;
}

.average-cell {
  text-align: center;
}

.avg-pill {
  display: inline-flex;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 99px;
  background: var(--card-muted);
}

.avg-pill.approved {
  color: var(--green);
  background: var(--green-soft);
}

.avg-pill.failed {
  color: var(--red);
  background: var(--red-soft);
}

.grades-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 20px;
  color: var(--muted);
  font-size: 9.5px;
  border-top: 1px solid var(--line);
  background: var(--card-muted);
}

.grades-footer span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
}

.grades-footer .icon {
  width: 13px;
  height: 13px;
}

/* ------------------------------------------------------------------ */
/* Gestión                                                             */
/* ------------------------------------------------------------------ */

.manage-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.62);
}

.manage-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 9px;
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.manage-tab .icon {
  width: 15px;
  height: 15px;
}

.manage-tab:hover {
  color: var(--ink);
}

.manage-tab.active {
  color: var(--green);
  background: var(--card);
  box-shadow: 0 2px 8px rgba(35, 50, 43, 0.08), inset 0 0 0 1px var(--line);
}

.table-panel {
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 10px 17px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--card-muted);
}

.data-table thead th:last-child {
  width: 90px;
}

.data-table tbody td {
  padding: 12px 17px;
  color: var(--ink-soft);
  font-size: 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fcfaf4;
}

.entity-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-cell.compact {
  gap: 9px;
}

.entity-cell > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.entity-cell strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-cell span:not(.school-swatch):not(.course-badge):not(.subject-dot) {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9.5px;
}

.school-swatch {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--dot) 14%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dot) 28%, transparent);
}

.school-swatch::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 8px;
  border-radius: 50%;
  background: var(--dot);
}

.subject-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 12%, transparent);
}

.course-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 37px;
  height: 31px;
  padding: 0 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid #d3e4dc;
  border-radius: 9px;
  background: var(--green-soft);
}

.table-school {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.table-muted {
  color: var(--muted);
  font-size: 10.5px;
}

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 45px 25px;
  color: var(--muted);
  text-align: center;
}

.table-empty .icon {
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  color: var(--muted-2);
}

.table-empty p {
  margin-bottom: 14px;
  font-size: 11.5px;
}

.students-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 19px 21px;
  border-bottom: 1px solid var(--line);
}

.students-toolbar-copy h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.4px;
}

.students-toolbar-copy p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.students-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 230px;
  height: 39px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
}

.search-field .icon {
  width: 15px;
  height: 15px;
  color: var(--muted-2);
}

.search-field input {
  height: 35px;
  padding: 0;
  font-size: 11px;
  border: 0;
  background: transparent;
}

.search-field input:focus {
  box-shadow: none;
}

.students-filters select {
  width: 190px;
  height: 39px;
  font-size: 10.5px;
}

/* ------------------------------------------------------------------ */
/* Datos                                                               */
/* ------------------------------------------------------------------ */

.data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.form-card {
  overflow: hidden;
}

.page-form {
  padding: 0 21px 21px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span:first-child {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  font-size: 11.5px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 41px;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
}

.color-field input[type="color"] {
  width: 29px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.color-field span {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.backup-info {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 0 21px;
}

.backup-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 11px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-muted);
}

.backup-stat strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.backup-stat span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
}

.backup-actions,
.danger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 15px 21px 0;
}

.storage-note {
  display: flex;
  gap: 7px;
  padding: 14px 21px 20px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.storage-note .icon {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 1px;
  color: var(--green);
}

.danger-card {
  grid-column: 1 / -1;
  border-color: #ecd8d3;
  background: #fffcf9;
}

.danger-card .panel-card-head .icon {
  color: var(--red);
}

.danger-actions {
  padding-bottom: 20px;
}

/* ------------------------------------------------------------------ */
/* Listas de hoy y atajos                                              */
/* ------------------------------------------------------------------ */

.today-card {
  overflow: hidden;
}

.today-list {
  padding: 0 12px 12px;
  margin: 0;
  list-style: none;
}

.today-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 9px;
  border-top: 1px solid var(--line);
}

.today-item:first-child {
  border-top: 0;
}

.today-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.today-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-copy span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.today-tag {
  padding: 3px 9px;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 99px;
}

.today-tag.ok {
  color: var(--green);
  background: var(--green-soft);
}

.today-tag.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.today-tag.pending {
  color: var(--red);
  background: var(--red-soft);
}

.today-tag.muted {
  color: var(--muted);
  background: var(--paper-deep);
}

.shortcut-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.shortcut-list li {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.shortcut-list li:last-child {
  border-bottom: 0;
}

.shortcut-list kbd {
  display: inline-flex;
  min-width: 74px;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: var(--card-muted);
}

.shortcut-list span {
  color: var(--muted);
  font-size: 11.5px;
}

.checkbox-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
}

.checkbox-field input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.checkbox-field span {
  color: var(--ink-soft);
  font-size: 11.5px;
}

.cloud-card {
  grid-column: 1 / -1;
}

.cloud-card .panel-card-head .icon {
  color: var(--blue);
}

.period-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.period-row-edit {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 140px 140px;
  align-items: end;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card-muted);
}

.period-mid {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9.5px;
}

.scale-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scale-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 110px;
  align-items: end;
  gap: 9px;
}

.scale-code .field input {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.scale-row .checkbox-field {
  height: 41px;
  padding-bottom: 8px;
}

/* ------------------------------------------------------------------ */
/* Cuatrimestres y escala cualitativa                                 */
/* ------------------------------------------------------------------ */

.period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 13px;
}

.period-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.period-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--line);
  background: var(--card-muted);
}

.period-card-head span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.period-card-head .icon {
  width: 14px;
  height: 14px;
}

.period-card-head small {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
}

.period-card-body {
  display: flex;
  gap: 26px;
  padding: 14px 15px 16px;
}

.period-metric {
  display: flex;
  flex-direction: column;
}

.period-metric strong {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1;
}

.period-metric span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9.5px;
}

.grades-table .group-row th {
  position: sticky;
  top: 0;
  z-index: 3;
  text-align: center;
  background: var(--green-soft);
}

.grades-table .group-row .period-group {
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.grades-table .group-row .sticky-col {
  z-index: 4;
  vertical-align: bottom;
  background: var(--card-muted);
}

.grades-table .exam-col.qual-col {
  background: var(--amber-soft);
}

.grades-table thead tr:nth-child(2) th {
  position: sticky;
  top: 29px;
  z-index: 3;
}

.grade-select {
  width: 78px;
  height: 35px;
  padding: 0 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border: 1px solid #e6d5b3;
  border-radius: 8px;
  background: #fdf6e8;
}

.grade-select:hover {
  border-color: var(--amber);
}

/* Fichas de trayectoria (TEA / TEP / TED) */

.trajectory-row {
  display: flex;
  gap: 6px;
  padding: 0 15px 15px;
}

.trajectory-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--card-muted);
  opacity: 0.55;
}

.trajectory-chip strong {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.trajectory-chip.has {
  opacity: 1;
}

.trajectory-chip.t-tea {
  color: var(--green);
  border-color: #c6dfd3;
  background: var(--green-soft);
}

.trajectory-chip.t-tep {
  color: var(--amber);
  border-color: #ecd5ab;
  background: var(--amber-soft);
}

.trajectory-chip.t-ted {
  color: var(--red);
  border-color: #eccbc6;
  background: var(--red-soft);
}

.scale-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 13px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card-muted);
}

.scale-legend-title {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scale-legend-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 10px;
  line-height: 1.5;
}

.scale-legend-item strong {
  flex: none;
  min-width: 30px;
  font-size: 10.5px;
  font-weight: 800;
}

.scale-legend-item span {
  color: var(--muted);
}

.scale-legend-item.t-tea strong { color: var(--green); }
.scale-legend-item.t-tep strong { color: var(--amber); }
.scale-legend-item.t-ted strong { color: var(--red); }

/* ------------------------------------------------------------------ */
/* Informes                                                            */
/* ------------------------------------------------------------------ */

.report-filters {
  display: flex;
  align-items: flex-end;
  gap: 11px;
  padding: 15px 17px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.report-filters .field {
  min-width: 190px;
}

.report-filters .field select,
.report-filters .field input {
  height: 38px;
  font-size: 11px;
}

.report-filters .btn {
  margin-bottom: 1px;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.report-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.count-chip.good {
  color: var(--green);
  border-color: #cfe3d9;
  background: var(--green-soft);
}

.count-chip.bad {
  color: var(--red);
  border-color: #eccbc6;
  background: var(--red-soft);
}

.count-chip.warn {
  color: var(--amber);
  border-color: #ecd5ab;
  background: var(--amber-soft);
}

.avg-pill.ok {
  color: var(--green);
  background: var(--green-soft);
}

.avg-pill.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.avg-pill.bad {
  color: var(--red);
  background: var(--red-soft);
}

/* ------------------------------------------------------------------ */
/* Impresión                                                           */
/* ------------------------------------------------------------------ */

#printRoot {
  display: none;
}

@media print {
  body.is-printing > .app-shell,
  body.is-printing > .toast-stack,
  body.is-printing > dialog,
  body.is-printing > .sidebar-overlay {
    display: none !important;
  }

  body.is-printing {
    background: #fff;
  }

  #printRoot.printing {
    display: block;
    padding: 0;
  }

  .print-sheet {
    color: #111;
    font-family: "DM Sans", Arial, sans-serif;
    font-size: 12px;
  }

  .print-sheet h1 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    font-family: "Fraunces", Georgia, serif;
    font-size: 19px;
    border-bottom: 2px solid #1f5a4a;
  }

  .print-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;
    margin-bottom: 14px;
    font-size: 11px;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
  }

  .print-table th,
  .print-table td {
    padding: 5px 7px;
    border: 1px solid #999;
  }

  .print-table th {
    background: #eee;
    font-size: 10px;
    text-align: left;
  }

  .print-table .num {
    width: 32px;
    text-align: center;
  }

  .print-table .center {
    text-align: center;
  }

  .print-sub {
    display: block;
    color: #666;
    font-size: 8.5px;
    font-weight: 400;
  }

  .print-signatures {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-top: 46px;
    font-size: 10px;
  }

  .print-signatures div {
    flex: 1;
    padding-top: 5px;
    text-align: center;
    border-top: 1px solid #333;
  }

  @page {
    margin: 14mm;
  }
}

/* ------------------------------------------------------------------ */
/* Diálogos                                                            */
/* ------------------------------------------------------------------ */

.app-dialog {
  width: min(690px, calc(100vw - 30px));
  max-width: 690px;
  max-height: calc(100vh - 30px);
  padding: 0;
  overflow: visible;
  color: var(--ink);
  border: 0;
  border-radius: 22px;
  background: transparent;
}

.app-dialog::backdrop {
  background: rgba(12, 29, 24, 0.64);
  backdrop-filter: blur(4px);
}

.dialog-card {
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.dialog-card.dialog-small {
  max-width: 480px;
  margin: 0 auto;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 23px 24px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #faf7ef, var(--card));
}

.dialog-head .eyebrow {
  margin-bottom: 6px;
}

.dialog-head h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.7px;
}

.dialog-sub {
  max-width: 500px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.dialog-body {
  padding: 20px 24px 6px;
}

.dialog-hint {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
  border: 1px solid #e8dcc4;
  border-radius: 10px;
  background: #fdf8ec;
}

.dialog-hint .icon {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
  color: var(--amber);
}

.dialog-actions {
  padding: 0 24px 23px;
  margin-top: 21px;
}

.dialog-card form .form-grid {
  gap: 14px;
}

.form-error {
  padding: 0 24px 20px;
  margin: 0;
  color: var(--red);
  font-size: 11px;
  font-weight: 500;
}

.confirm-box {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 15px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid #eed9d4;
  border-radius: 13px;
  background: #fdf4f2;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--red);
  border-radius: 10px;
  background: #f8e4e0;
}

.confirm-icon .icon {
  width: 18px;
  height: 18px;
}

/* ------------------------------------------------------------------ */
/* Toasts                                                              */
/* ------------------------------------------------------------------ */

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  width: min(360px, calc(100vw - 44px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  color: #f9f6ee;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: #1e4037;
  box-shadow: 0 14px 34px rgba(15, 34, 28, 0.26);
  opacity: 0;
  transform: translateY(9px) scale(0.98);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.error {
  background: #7d352e;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: none;
  color: #d7ebdf;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.toast.error .toast-icon {
  color: #f9ddd8;
}

.toast-icon .icon {
  width: 14px;
  height: 14px;
}

/* ------------------------------------------------------------------ */
/* Overlay móvil                                                       */
/* ------------------------------------------------------------------ */

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(10, 28, 22, 0.5);
  backdrop-filter: blur(3px);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1280px) {
  .assignment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attendance-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .summary-progress {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1080px) {
  :root {
    --sidebar-w: 250px;
  }

  .sidebar {
    padding-inline: 16px;
  }

  .main-content,
  .topbar {
    padding-inline: 28px;
  }

  .app-footer {
    padding-inline: 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-grid {
    grid-template-columns: 1fr;
  }

  .roster-head,
  .roster-row {
    grid-template-columns: 40px minmax(170px, 0.8fr) minmax(330px, 1.2fr) 92px;
    gap: 10px;
  }

  .data-grid {
    grid-template-columns: 1fr;
  }

  .danger-card {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
    box-shadow: 20px 0 60px rgba(8, 24, 19, 0.24);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-wrap {
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    min-height: 62px;
  }

  .topbar-context {
    display: none;
  }

  .context-panel {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .context-picker {
    width: 100%;
    margin-top: 3px;
    padding-top: 12px;
    border-top: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line));
  }

  .context-picker select {
    height: 42px;
  }

  .roster-head {
    display: none;
  }

  .roster-row {
    grid-template-columns: 32px 1fr;
    gap: 8px 10px;
    padding: 14px 16px;
  }

  .row-number {
    grid-row: 1 / 3;
    align-self: start;
    padding-top: 8px;
  }

  .status-buttons {
    grid-column: 2;
  }

  .current-status {
    display: none;
  }

  .roster-row::before {
    top: 10px;
    bottom: 10px;
  }

  .status-long {
    display: inline;
  }

  .date-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .date-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .grades-table .student-col {
    width: 200px;
    min-width: 190px;
  }

  .students-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .students-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field,
  .students-filters select {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .main-content {
    padding: 25px 17px 46px;
  }

  .topbar {
    padding: 0 17px;
  }

  .app-footer {
    padding: 18px 17px 24px;
    flex-direction: column;
    gap: 4px;
  }

  .topbar-right {
    gap: 8px;
  }

  .save-state {
    display: none;
  }

  .hide-mobile {
    display: none;
  }

  .btn-sm span:not(.icon) {
    display: inline;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 17px;
    margin-bottom: 22px;
  }

  .page-head h1 {
    font-size: 34px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .stats-grid,
  .stats-grid-compact {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .stat-card {
    grid-template-columns: 36px 1fr;
    min-height: 104px;
    padding: 14px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .stat-value {
    font-size: 23px;
  }

  .stat-label {
    font-size: 9.5px;
  }

  .stat-foot {
    font-size: 8.5px;
  }

  .assignment-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .school-group-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .context-panel {
    padding: 16px;
  }

  .context-mark {
    width: 42px;
    height: 42px;
  }

  .context-copy h2 {
    font-size: 22px;
  }

  .context-meta {
    flex-wrap: wrap;
    white-space: normal;
  }

  .meta-sep {
    display: none;
  }

  .date-nav {
    width: 100%;
    flex-wrap: wrap;
  }

  .date-field {
    flex: 1;
  }

  .date-field input {
    width: 100%;
  }

  .date-long {
    display: none;
  }

  .attendance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-progress {
    grid-column: 1 / -1;
  }

  .roster-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .roster-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .status-long {
    display: none;
  }

  .status-letter {
    display: inline;
  }

  .status-btn {
    min-height: 34px;
  }

  .status-buttons {
    gap: 3px;
    padding: 3px;
  }

  .grades-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .grades-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .manage-tabs {
    margin-right: -17px;
    margin-left: -17px;
    padding: 5px 17px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .backup-info {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .backup-actions .btn {
    flex: 1;
  }

  .data-table thead th,
  .data-table tbody td {
    padding-inline: 13px;
  }

  .app-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .dialog-card {
    max-height: calc(100vh - 16px);
    border-radius: 18px;
  }

  .dialog-head {
    padding: 20px 18px 15px;
  }

  .dialog-head h2 {
    font-size: 24px;
  }

  .dialog-body {
    padding: 17px 18px 4px;
  }

  .dialog-actions {
    padding: 0 18px 18px;
  }

  .form-error {
    padding: 0 18px 18px;
  }

  .today-chip {
    display: none;
  }
}

@media (max-width: 420px) {
  .stats-grid,
  .stats-grid-compact {
    grid-template-columns: 1fr;
  }

  .date-toolbar-right {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .backup-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
