:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --border: #e4e4e0;
  --text: #1b1b19;
  --muted: #71716c;
  --accent: #355c4d;
  --accent-soft: #eaf1ed;
  --danger: #a63f3f;
  --warn: #9a7b3f;
  --radius: 10px;
  --sidebar: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; padding: 0 8px 22px; letter-spacing: .2px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.brand b { font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  padding: 9px 11px; border-radius: 8px; color: var(--muted); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: #f3f3f0; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; word-break: break-all; }

.content { flex: 1; margin-left: var(--sidebar); width: calc(100% - var(--sidebar)); }
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 26px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-date { font-weight: 600; margin-right: auto; }
.menu-btn { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
.main { padding: 26px; max-width: 1280px; margin: 0 auto; }

h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.3px; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 10px; font-weight: 600; }
.subtitle { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.section { margin-bottom: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { padding: 22px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

.btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 13px; cursor: pointer; font-weight: 500; transition: .15s;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: #c8c8c2; background: #fafaf8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2c4c40; }
.btn.danger { color: var(--danger); border-color: #e3caca; }
.btn.danger:hover { background: #fdf3f3; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 25px; font-weight: 650; margin-top: 3px; letter-spacing: -.5px; }
.stat.accent { background: var(--accent-soft); border-color: #d4e3da; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #efefec; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 74px; resize: vertical; }
.check-list { max-height: 190px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.check-list label { display: flex; gap: 8px; align-items: center; padding: 4px 2px; cursor: pointer; }
.check-list input { width: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .row, .row.three { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eee; }
.badge.impartida { background: var(--accent-soft); color: var(--accent); }
.badge.cancelada { background: #f6eaea; color: var(--danger); }
.badge.reprogramada { background: #f6f1e4; color: var(--warn); }
.badge.pendiente { background: #f6f1e4; color: var(--warn); }
.badge.revisada, .badge.completada { background: var(--accent-soft); color: var(--accent); }
.badge.presente { background: var(--accent-soft); color: var(--accent); }
.badge.ausente { background: #f6eaea; color: var(--danger); }
.badge.justificada { background: #f6f1e4; color: var(--warn); }
.badge.grupal { background: #eceaf4; color: #5a4f86; }
.badge.particular { background: #eef2f6; color: #435f78; }

.list { display: flex; flex-direction: column; }
.list-item { padding: 11px 0; border-bottom: 1px solid #efefec; display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item .title { font-weight: 550; }
.list-item .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: #fafaf8; padding: 8px; text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }
.cal-day { background: #fff; min-height: 104px; padding: 8px; cursor: pointer; }
.cal-day:hover { background: #fafcfb; }
.cal-day.today { background: var(--accent-soft); }
.cal-day.other { background: #fbfbfa; color: #a5a5a0; }
.cal-day .num { font-weight: 600; font-size: 12px; margin-bottom: 5px; }
.cal-chip { font-size: 11px; padding: 3px 5px; border-radius: 5px; margin-bottom: 3px; background: #f0f3f1; border-left: 2px solid var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.done { opacity: .55; border-left-color: #aaa; }
.cal-chip.task { background: #f8f3e8; border-left-color: var(--warn); }

.modal { border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(620px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.modal::backdrop { background: rgba(20,20,18,.35); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--border); }
.modal .btn.primary { order: 2; }

.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #242421; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.toast.error { background: var(--danger); }

.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .toast-wrap { display: none !important; }
  .content { margin: 0; width: 100%; }
  .main { padding: 0; max-width: none; }
  .print-only { display: block !important; }
  body { background: #fff; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 6px 0 24px rgba(0,0,0,.08); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; width: 100%; }
  .menu-btn { display: block; }
  .main { padding: 18px 14px; }
  .topbar { padding: 0 14px; }
}
