:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #182230;
  --muted: #5c6b7a;
  --subtle: #8693a3;
  --line: #d9e2ec;
  --line-strong: #b9c7d6;
  --brand: #1f5f8b;
  --brand-dark: #17476b;
  --brand-soft: #e7f1f8;
  --green: #28795a;
  --green-soft: #e7f4ee;
  --amber: #a96616;
  --amber-soft: #fff1dd;
  --red: #b13c3c;
  --red-soft: #fbeaea;
  --shadow: 0 18px 45px rgba(24, 34, 48, .10);
  --shadow-soft: 0 8px 24px rgba(24, 34, 48, .07);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(31, 95, 139, .14), transparent 32%),
    linear-gradient(320deg, rgba(40, 121, 90, .10), transparent 28%),
    var(--bg);
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button { border: 0; }
input, select, textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 11px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 95, 139, .15);
}
select { cursor: pointer; }
textarea { line-height: 1.45; }

.app { min-height: 100vh; }
.screen { display: none; }
.screen.active { display: block; }

.login-wrap {
  width: min(460px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px;
  position: relative;
  top: 7vh;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(217, 226, 236, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 1.5rem; }
.brand-mark { width: 38px; height: 38px; font-size: 18px; }
.topbar-mark { width: 28px; height: 28px; }
.login-hint { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.login-wrap > div:first-child {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.login-title { font-size: 23px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 0; }
.login-wrap p { color: var(--muted) !important; }

.ti {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  vertical-align: middle;
  font-style: normal;
}
.ti::before { content: "•"; font-weight: 800; line-height: 1; }
.ti-shield-check::before { content: "✓"; }
.ti-user-check::before { content: "U"; font-size: 11px; }
.ti-school::before { content: "A"; font-size: 11px; }
.ti-login::before { content: "→"; }
.ti-logout::before { content: "←"; }
.ti-layout-dashboard::before { content: "▦"; font-size: 13px; }
.ti-alert-triangle::before { content: "!"; }
.ti-id-badge::before { content: "ID"; font-size: 9px; }
.ti-urgent::before { content: "!"; }
.ti-users::before { content: "G"; font-size: 10px; }
.ti-calendar-stats::before { content: "M"; font-size: 10px; }
.ti-clock::before { content: "◷"; }
.ti-check::before { content: "✓"; }
.ti-device-floppy::before { content: "S"; font-size: 10px; }
.ti-send::before { content: "→"; }

.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.role-card {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  background: linear-gradient(180deg, #fff, var(--surface-soft));
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.role-card:hover { transform: translateY(-1px); border-color: var(--brand); box-shadow: var(--shadow-soft); }
.role-card.selected { border: 2px solid var(--brand); background: var(--brand-soft); }
.role-icon { display: flex; justify-content: center; margin-bottom: 9px; }
.role-icon .ti { width: 34px; height: 34px; border-radius: 8px; }
.role-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.role-desc { font-size: 11px; color: var(--muted); margin-top: 4px; }

.field-group { margin-bottom: 13px; }
.field-label, .form-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: block; font-weight: 650; }
.field-group input, .field-group select { width: 100%; font-size: 14px; }
.btn-primary, .btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  border-radius: 8px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn-primary {
  width: 100%;
  padding: 11px 14px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  margin-top: 6px;
  box-shadow: 0 10px 22px rgba(31, 95, 139, .23);
}
.btn-primary .ti, .btn-accent .ti { background: rgba(255,255,255,.18); color: #fff; }
.btn-primary:hover, .btn-accent:hover { background: var(--brand-dark); transform: translateY(-1px); }

.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-logo { font-size: 15px; font-weight: 800; color: var(--brand-dark); }
.topbar-user { font-size: 13px; color: var(--ink); margin-left: auto; font-weight: 650; }
.topbar-role { font-size: 12px; color: var(--brand-dark); background: var(--brand-soft); padding: 5px 10px; border-radius: 999px; font-weight: 700; }
.btn-logout { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; cursor: pointer; }
.btn-logout:hover { border-color: var(--brand); color: var(--brand-dark); }

.main-layout { display: flex; min-height: calc(100vh - 62px); }
.sidebar {
  width: 244px;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  background: rgba(255,255,255,.76);
  flex-shrink: 0;
}
.nav-section { font-size: 11px; color: var(--subtle); padding: 12px 10px 6px; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s ease, color .12s ease, transform .12s ease;
}
.nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 750; }
.nav-item.active .ti { background: #fff; color: var(--brand-dark); }

.content { flex: 1; padding: 24px; overflow: auto; }
.panel { display: none; }
.panel.active { display: block; }
.page-title { font-size: 22px; font-weight: 800; color: var(--ink); margin-bottom: 5px; }
.page-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.guide-card {
  background: #f7f9fd;
  border: 1px solid #dfe7f3;
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 11px 13px;
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.guide-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
  margin-bottom: 3px;
}
.guide-title .ti { color: var(--brand); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 650; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--ink); }
.stat-badge { font-size: 11px; padding: 4px 8px; border-radius: 999px; display: inline-block; margin-top: 8px; font-weight: 750; }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-alert { background: var(--red-soft); color: var(--red); }

.indicator-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 12px;
  margin-bottom: 14px;
}
.indicator-list {
  display: grid;
  gap: 8px;
}
.indicator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.indicator-row strong {
  min-width: 28px;
  text-align: center;
  color: var(--ink);
  font-size: 14px;
}

.jefe-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  border: 1px solid #cdddea;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef6fb 100%);
  box-shadow: var(--shadow-soft);
}
.jefe-hero .page-title {
  margin-bottom: 6px;
}
.jefe-hero .page-sub {
  margin-bottom: 0;
}
.jefe-hero .toolbar-actions {
  margin: 0;
  justify-content: flex-end;
}
.jefe-panel .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.jefe-panel .stat-card {
  min-height: 118px;
  border-top: 3px solid var(--brand);
}
.jefe-panel .stat-value {
  line-height: 1;
}
.jefe-card,
.jefe-alert-card,
.jefe-user-card {
  border-color: #d7e3ef;
}
.jefe-card .table-wrap,
.jefe-panel > .table-wrap {
  box-shadow: var(--shadow-soft);
}
.jefe-alert-card {
  border-left: 4px solid var(--red);
  background: #fffdfd;
}
.jefe-user-card {
  background: #fbfdff;
  box-shadow: var(--shadow-soft);
}
.jefe-user-card .form-section-title {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef6fb;
  color: var(--ink);
  font-weight: 850;
}
.jefe-panel .table-wrap {
  margin-bottom: 14px;
}
.jefe-panel th {
  background: #eef5fa;
  color: var(--ink);
}
.jefe-panel tr:hover td {
  background: #f7fbff;
}
.jefe-panel .tutor-chip {
  background: #f7fbff;
  border-color: #cdddea;
}
.jefe-panel .caso-card {
  position: relative;
  border-left: 4px solid var(--brand);
  box-shadow: var(--shadow-soft);
}
.jefe-panel .caso-card[data-urgencia="urgente"] {
  border-left-color: var(--red);
  background: #fffdfd;
}
.jefe-panel .caso-card[data-urgencia="importante"] {
  border-left-color: #d29222;
}
.jefe-panel .caso-card[data-estado="atendido"],
.jefe-panel .caso-card[data-estado="cerrado"] {
  border-left-color: var(--green);
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.quick-action {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid #cdddea;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.quick-action:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: #eef6fb;
}
.quick-action .ti {
  width: 18px;
  height: 18px;
  color: var(--brand);
}
.quick-action.is-active {
  border-color: #e8b1aa;
  background: var(--red-soft);
  color: var(--red);
}
.quick-action.is-active .ti {
  color: var(--red);
}
.quick-action.is-close {
  border-color: #c6e1d2;
  background: #f4fbf7;
}
.quick-action.is-close .ti {
  color: var(--green);
}
.analysis-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
  padding: 12px 14px;
  border: 1px solid #cdddea;
  border-radius: 8px;
  background: #fbfdff;
}
.analysis-section-title strong,
.analysis-section-title span {
  display: block;
}
.analysis-section-title strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
}
.analysis-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.analysis-card {
  min-height: 300px;
  border-color: #d7e3ef;
  box-shadow: var(--shadow-soft);
}
.analysis-card .card-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.analysis-bars {
  display: grid;
  gap: 12px;
}
.analysis-bar-row {
  display: grid;
  gap: 6px;
}
.analysis-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.analysis-bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analysis-bar-label strong {
  color: var(--ink);
  font-size: 13px;
}
.analysis-bar-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #eaf1f7;
}
.analysis-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}
.analysis-bar-fill.is-ok { background: var(--green); }
.analysis-bar-fill.is-warn { background: #d29222; }
.analysis-bar-fill.is-alert { background: var(--red); }
.analysis-donut-wrap {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 18px;
  min-height: 220px;
}
.analysis-donut {
  position: relative;
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.analysis-donut::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px #edf2f7;
}
.analysis-donut span,
.analysis-donut small {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}
.analysis-donut span {
  color: var(--ink);
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
}
.analysis-donut small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}
.analysis-legend {
  display: grid;
  gap: 9px;
}
.analysis-legend div {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.analysis-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.analysis-legend strong {
  color: var(--ink);
}
.empty-state.compact {
  min-height: 190px;
  display: grid;
  place-content: center;
}

.tutor-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid #cdddea;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef6fb 100%);
  box-shadow: var(--shadow-soft);
}
.tutor-hero .page-sub { margin-bottom: 8px; }
.tutor-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.tutor-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.tutor-metric {
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.tutor-metric span,
.tutor-metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.tutor-metric strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}
.tutor-metric.is-ok { border-top: 3px solid var(--green); }
.tutor-metric.is-warn { border-top: 3px solid #d29222; }
.tutor-metric.is-alert { border-top: 3px solid var(--red); }
.tutor-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tutor-action {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 96px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.tutor-action:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: #fbfdff;
}
.tutor-action .ti {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
}
.tutor-action strong,
.tutor-action small {
  display: block;
}
.tutor-action strong {
  margin-bottom: 5px;
  font-size: 13px;
}
.tutor-action small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.tutor-action.is-primary {
  border-color: #b8d2e4;
  background: #f1f8fc;
}
.tutor-action.is-primary .ti {
  background: var(--brand);
  color: #fff;
}

.tutor-form-card {
  border-color: #cdddea;
  background: linear-gradient(180deg, #fff, #fbfdff);
  padding: 20px;
}
.tutor-form-card .form-section-title {
  display: flex;
  align-items: center;
  min-height: 36px;
  margin: 20px 0 14px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: #eef6fb;
  color: var(--brand-dark);
}
.tutor-form-card .form-section-title:first-child {
  margin-top: 0;
}
.tutor-form-card .form-grid {
  gap: 14px 16px;
}
.tutor-form-card input,
.tutor-form-card select,
.tutor-form-card textarea {
  min-height: 41px;
  border-color: #cbd8e4;
  background: #fff;
}
.tutor-form-card input[readonly] {
  background: #f1f6fa;
  font-weight: 700;
  color: #334155;
}
.tutor-form-card .form-actions {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.case-report-card .check-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.case-report-card .check-item {
  min-height: 52px;
  align-items: center;
  border-color: #d8e4ee;
  background: #fbfdff;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.case-report-card .check-item:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: #f1f8fc;
}
.tutor-student-card {
  border-left: 4px solid var(--green);
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.tutor-student-card .card-header {
  align-items: flex-start;
}
.tutor-student-card .guide-card {
  margin-bottom: 0;
}

#panel-tf01 .page-title,
#panel-tf02 .page-title,
#panel-tf03 .page-title,
#panel-tf04 .page-title {
  padding: 16px 18px 0;
  border: 1px solid #cdddea;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(135deg, #ffffff 0%, #eef6fb 100%);
}
#panel-tf01 > .page-sub,
#panel-tf02 > .page-sub,
#panel-tf03 > .page-sub,
#panel-tf04 > .page-sub {
  margin-bottom: 0;
  padding: 4px 18px 16px;
  border: 1px solid #cdddea;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef6fb 100%);
}
#panel-tf01 > .guide-card,
#panel-tf02 > .guide-card,
#panel-tf03 > .guide-card,
#panel-tf04 > .guide-card {
  margin-top: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.btn-sm { font-size: 12px; padding: 7px 11px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font-weight: 700; }
.btn-sm:hover { background: var(--surface-soft); border-color: var(--brand); }
.btn-sm:disabled,
.btn-sm:disabled:hover {
  opacity: .55;
  cursor: not-allowed;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--subtle);
}
.btn-accent { background: var(--brand); color: #fff; border-color: var(--brand); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-section-title {
  margin: 16px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}
.form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.form-group { margin-bottom: 11px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; font-size: 13px; }
.form-group textarea { resize: vertical; min-height: 86px; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; flex-wrap: wrap; }
.toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: -6px 0 14px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-bottom: 12px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}
.check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  margin: 0;
  flex: 0 0 16px;
  border-radius: 4px;
  accent-color: var(--brand);
}
.check-item span { min-width: 0; }

.student-form-card {
  width: 100%;
  max-width: none;
  padding: 20px;
  border-color: #cdddea;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}
.student-form-card .form-section-title {
  display: flex;
  align-items: center;
  min-height: 38px;
  margin: 22px -4px 14px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: #eef6fb;
  color: var(--brand-dark);
  font-size: 13px;
  letter-spacing: 0;
}
.student-form-card .form-section-title:first-child {
  margin-top: 0;
  padding: 10px 12px;
}
.student-form-card .form-grid {
  gap: 14px 16px;
}
.student-form-card .form-span-2 {
  grid-column: 1 / -1;
}
.student-form-card .form-group {
  margin-bottom: 6px;
}
.student-form-card .form-label {
  color: #425466;
  font-size: 12px;
  font-weight: 750;
}
.student-form-card input,
.student-form-card select,
.student-form-card textarea {
  min-height: 42px;
  border-color: #cbd8e4;
  background: #fff;
  font-size: 14px;
}
.student-form-card textarea {
  min-height: 108px;
}
.student-form-card input[readonly] {
  background: #f1f6fa;
  color: #334155;
  border-color: #d8e4ee;
  font-weight: 700;
}
.student-form-card input::placeholder,
.student-form-card textarea::placeholder {
  color: #9aa8b6;
}
.student-form-card .form-actions {
  position: sticky;
  bottom: 0;
  margin: 18px -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
}
.student-form-card .form-actions .btn-sm {
  min-height: 40px;
  padding: 9px 16px;
}
.consent-box {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  margin-top: 14px;
  padding: 14px 16px;
  border-color: #b9d7c8;
  background: #f2fbf6;
  color: #1f5f46;
  font-weight: 650;
}
.consent-box input {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}
.consent-box span {
  line-height: 1.45;
}

.student-form-hero {
  width: 100%;
  max-width: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 18px 20px;
  border: 1px solid #cdddea;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef6fb 100%);
  box-shadow: var(--shadow-soft);
}
.student-form-hero .page-sub {
  margin-bottom: 0;
}
.student-form-status {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e7f4ee;
  color: #28795a;
  font-size: 12px;
  font-weight: 800;
}

#panel-ef03 .guide-card,
#panel-ef03 .success-msg,
#panel-ef03 .form-error-box {
  width: 100%;
  max-width: none;
}

.form-error-box {
  display: block;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #e6ac00;
  border-left: 4px solid #b77900;
  border-radius: 8px;
  background: #fff4cc;
  color: #6f4c00;
  box-shadow: var(--shadow-soft);
}
.form-error-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 14px;
}
.form-error-title .ti {
  background: #ffe7a3;
  color: #8a5a00;
  flex: 0 0 22px;
}
.form-error-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 18px;
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  font-weight: 650;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--surface-soft); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fbfdff; }
.alert-row { background: var(--red-soft); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 9px; font-size: 13px; color: #6d2020; border: 1px solid #f2c5c5; }
.case-updated {
  border-left: 3px solid var(--amber);
}
.success-msg { background: var(--green-soft); border: 1px solid #b9dfcc; border-radius: var(--radius); padding: 11px 13px; font-size: 13px; color: var(--green); margin-bottom: 12px; display: none; font-weight: 650; }
.case-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 14px;
}
.case-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.case-step strong {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  flex-shrink: 0;
}
.case-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.case-filter-bar .form-group,
.case-filter-bar .form-actions { margin: 0; }
.case-filter-msg {
  min-height: 18px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.tutor-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tutor-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.expediente-card {
  margin-top: 12px;
  box-shadow: none;
}
.expediente-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.expediente-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--surface-soft);
}
.expediente-grid strong {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.expediente-grid span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.case-history {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px 12px;
  margin-top: 10px;
}
.case-history-item {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.case-history-item:first-child { padding-top: 0; }
.case-history-item:last-child { border-bottom: 0; padding-bottom: 0; }
.case-history-item strong { color: var(--ink); }
.case-history-item span { color: var(--muted); }

.hora-grid { display: grid; grid-template-columns: 68px repeat(5, minmax(54px, 1fr)); gap: 6px; margin-top: 8px; font-size: 11px; }
.hora-slot { border: 1px solid var(--line); border-radius: 8px; min-height: 34px; display: grid; place-items: center; cursor: pointer; color: var(--muted); background: #fff; }
.hora-slot:hover { border-color: var(--brand); background: var(--brand-soft); }
.hora-slot.selected { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 800; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.empty-state { text-align: center; padding: 2rem; color: var(--subtle); font-size: 13px; }
.empty-state .ti { width: 36px; height: 36px; margin: 0 auto 9px; }

@media (max-width: 820px) {
  .login-wrap { top: 24px; padding: 24px; }
  .role-cards { grid-template-columns: 1fr; }
  .main-layout { display: block; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); display: flex; gap: 6px; overflow-x: auto; padding: 10px; }
  .nav-section { display: none; }
  .nav-item { white-space: nowrap; margin-bottom: 0; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .expediente-grid { grid-template-columns: 1fr; }
  .case-steps { grid-template-columns: 1fr 1fr; }
  .case-filter-bar { grid-template-columns: 1fr; }
  .student-form-card { padding: 16px; }
  .student-form-card .form-span-2 { grid-column: auto; }
  .student-form-card .form-section-title { margin-left: 0; margin-right: 0; }
  .student-form-card .form-actions { position: static; margin: 18px 0 0; padding: 12px 0 0; background: transparent; backdrop-filter: none; }
  .student-form-card .form-actions .btn-sm { width: 100%; }
  .student-form-hero { display: block; padding: 16px; }
  .student-form-status { display: inline-flex; margin-top: 10px; }
  .jefe-hero { display: block; padding: 16px; }
  .jefe-hero .toolbar-actions { margin-top: 12px; justify-content: flex-start; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-section-title { align-items: flex-start; }
  .analysis-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .tutor-hero { display: block; padding: 16px; }
  .tutor-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tutor-action-grid { grid-template-columns: 1fr; }
  .tutor-form-card { padding: 16px; }
  .case-report-card .check-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .topbar-user { margin-left: 0; }
}

@media print {
  .sidebar,
  .topbar,
  .toolbar-actions,
  .btn-sm,
  .btn-primary,
  .btn-logout { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card,
  .stat-card,
  .table-wrap { box-shadow: none; }
}

@media (max-width: 520px) {
  .login-wrap { width: calc(100% - 20px); padding: 18px; }
  .page-title { font-size: 19px; }
  .stats-grid { grid-template-columns: 1fr; }
  .indicator-grid { grid-template-columns: 1fr; }
  .tutor-metrics { grid-template-columns: 1fr; }
  .hora-grid { grid-template-columns: 58px repeat(5, 48px); overflow-x: auto; }
}


.role-card.disabled {
  opacity: .46;
  cursor: not-allowed;
  filter: grayscale(.2);
  background: #f1f5f9;
  box-shadow: none;
}
.role-card.disabled:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}
.access-msg {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.access-msg.ok { color: var(--green); font-weight: 700; }
.access-msg.bad { color: var(--red); font-weight: 700; }

/* ── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  pointer-events: all;
  cursor: pointer;
  animation: toast-in .25s ease;
  transition: opacity .3s ease, transform .3s ease;
}
.toast.toast-out {
  opacity: 0;
  transform: translateX(20px);
}
.toast i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-success { background: #EDFAF1; color: #1A6B35; border-left: 4px solid #27AE60; }
.toast-error   { background: #FDEDEC; color: #922B21; border-left: 4px solid #E74C3C; }
.toast-warning { background: #FEF9E7; color: #7D6608; border-left: 4px solid #F1C40F; }
.toast-info    { background: #EBF5FB; color: #1A5276; border-left: 4px solid #2E86C1; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
