:root {
  --brand-navy: #0b2c4d;
  --brand-navy-2: #123f6d;
  --brand-red: #b91c1c;
  --brand-red-2: #dc2626;
  --brand-gold: #f59e0b;
  --ui-bg: #f6f8fb;
  --ui-surface: rgba(255,255,255,.96);
  --ui-surface-solid: #ffffff;
  --ui-border: #dbe3ef;
  --ui-border-strong: #b8c5d8;
  --ui-text: #0f172a;
  --ui-muted: #64748b;
  --ui-soft: #f1f5f9;
  --ui-focus: #2563eb;
  --ui-danger: #b91c1c;
  --ui-warning: #a16207;
  --ui-success: #047857;
  --ui-radius-xs: .5rem;
  --ui-radius-sm: .75rem;
  --ui-radius-md: 1rem;
  --ui-radius-lg: 1.25rem;
  --ui-radius-xl: 1.75rem;
  --ui-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --ui-shadow-md: 0 12px 30px rgba(15, 23, 42, .10);
  --ui-shadow-lg: 0 24px 70px rgba(15, 23, 42, .18);
  --ui-ring: 0 0 0 4px rgba(37, 99, 235, .18);
}

/*
  Production UI layer, safe version.
  This file is intentionally scoped to .ui-* and data-ui-* classes so it does
  not override Tailwind utility classes such as .hidden, .flex, .grid, md:flex,
  lg:flex, etc. The previous package used a global .hidden rule and shell-level
  selectors; this version removes those overrides to restore the public pages,
  login access and authenticated sidebar behavior.
*/

.ui-sr-only {
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.ui-stack { display: grid; gap: 1rem; }
.ui-stack--lg { gap: 1.5rem; }
.ui-grid { display: grid; gap: 1rem; }
.ui-grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ui-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.ui-actions-row { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }

.ui-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: clamp(1.1rem, 2.2vw, 1.5rem);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: var(--ui-radius-xl);
  background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.92));
  box-shadow: var(--ui-shadow-md);
  overflow: hidden;
  position: relative;
}
.ui-page-header::after {
  content: '';
  position: absolute;
  right: -4rem;
  top: -5rem;
  width: 14rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(185,28,28,.13), transparent 68%);
  pointer-events: none;
}
.ui-page-header__copy,
.ui-page-header__actions { position: relative; z-index: 1; }
.ui-page-header__actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: flex-end; }
.ui-eyebrow { margin: 0 0 .35rem; color: var(--brand-red); text-transform: uppercase; letter-spacing: .16em; font-weight: 900; font-size: .72rem; }
.ui-page-title { margin: 0; color: var(--ui-text); font-size: clamp(1.65rem, 3vw, 2.5rem); line-height: 1.05; font-weight: 950; letter-spacing: -.04em; }
.ui-page-description { margin: .65rem 0 0; color: var(--ui-muted); max-width: 68ch; line-height: 1.6; }

.ui-card {
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  border-radius: var(--ui-radius-xl);
  box-shadow: var(--ui-shadow-sm);
  overflow: hidden;
}
.ui-card--elevated { box-shadow: var(--ui-shadow-md); }
.ui-card__header { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--ui-border); display: flex; align-items: flex-start; gap: .85rem; }
.ui-card__icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 1rem; background: linear-gradient(135deg, rgba(11,44,77,.10), rgba(185,28,28,.10)); }
.ui-card__title { margin: 0; font-size: 1.05rem; font-weight: 900; color: var(--ui-text); }
.ui-card__description { margin: .25rem 0 0; color: var(--ui-muted); font-size: .925rem; line-height: 1.5; }
.ui-card__body { padding: 1.25rem; }
.ui-card__footer { padding: 1rem 1.25rem; border-top: 1px solid var(--ui-border); background: #f8fafc; }

.ui-btn {
  --btn-bg: var(--brand-navy);
  --btn-color: #fff;
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 2.65rem;
  border-radius: .9rem;
  padding: .7rem 1rem;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-color);
  font-weight: 850;
  text-decoration: none;
  line-height: 1.1;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease;
  box-shadow: var(--ui-shadow-sm);
}
.ui-btn:hover { transform: translateY(-1px); box-shadow: var(--ui-shadow-md); }
.ui-btn:active { transform: translateY(0); }
.ui-btn:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
.ui-btn[disabled], .ui-btn[aria-disabled="true"] { opacity: .58; pointer-events: none; }
.ui-btn--secondary { --btn-bg: #fff; --btn-color: var(--brand-navy); --btn-border: var(--ui-border); }
.ui-btn--danger { --btn-bg: var(--brand-red); --btn-color: #fff; }
.ui-btn--ghost { --btn-bg: transparent; --btn-color: var(--ui-text); --btn-border: transparent; box-shadow: none; }
.ui-btn--soft { --btn-bg: #eef4fb; --btn-color: var(--brand-navy); --btn-border: #d6e4f2; }
.ui-btn--sm { min-height: 2.2rem; padding: .5rem .75rem; border-radius: .75rem; font-size: .9rem; }
.ui-btn--lg { min-height: 3rem; padding: .85rem 1.2rem; border-radius: 1rem; }
.ui-btn.is-loading { position: relative; color: transparent; }
.ui-btn.is-loading::after { content: ''; width: 1.05rem; height: 1.05rem; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; position: absolute; color: #fff; animation: ui-spin .8s linear infinite; }

.ui-badge { display: inline-flex; align-items: center; gap: .4rem; min-height: 1.65rem; padding: .25rem .6rem; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: .78rem; font-weight: 850; }
.ui-badge--success { background: #ecfdf5; color: #047857; }
.ui-badge--warning { background: #fffbeb; color: #a16207; }
.ui-badge--danger { background: #fef2f2; color: #b91c1c; }
.ui-badge--neutral { background: #f1f5f9; color: #475569; }

.ui-stat { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.05rem; border-radius: var(--ui-radius-lg); border: 1px solid var(--ui-border); background: #fff; box-shadow: var(--ui-shadow-sm); }
.ui-stat__label { margin: 0; color: var(--ui-muted); font-weight: 800; font-size: .86rem; }
.ui-stat__value { margin: .25rem 0 0; color: var(--ui-text); font-size: clamp(1.35rem, 2vw, 2rem); line-height: 1; font-weight: 950; }
.ui-stat__meta { margin: .35rem 0 0; color: var(--ui-muted); font-size: .82rem; }
.ui-stat__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 1rem; background: #f1f5f9; font-size: 1.35rem; }
.ui-stat--success .ui-stat__icon { background: #ecfdf5; }
.ui-stat--warning .ui-stat__icon { background: #fffbeb; }
.ui-stat--danger .ui-stat__icon { background: #fef2f2; }

.ui-empty { display: grid; place-items: center; text-align: center; padding: clamp(2rem, 5vw, 4rem) 1rem; border: 1px dashed var(--ui-border-strong); border-radius: var(--ui-radius-xl); background: rgba(255,255,255,.78); }
.ui-empty__icon { font-size: 2rem; margin-bottom: .75rem; }
.ui-empty__title { margin: 0; color: var(--ui-text); font-size: 1.25rem; font-weight: 900; }
.ui-empty__description { margin: .45rem 0 0; color: var(--ui-muted); max-width: 40rem; line-height: 1.6; }
.ui-empty__actions { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }

.ui-alert { display: flex; gap: .75rem; align-items: flex-start; border: 1px solid var(--ui-border); border-radius: 1rem; padding: .875rem 1rem; box-shadow: var(--ui-shadow-sm); background: #eff6ff; color: #1e3a8a; }
.ui-alert--success { background: #ecfdf5; color: #065f46; border-color: #bbf7d0; }
.ui-alert--warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.ui-alert--danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.ui-alert__body { min-width: 0; flex: 1; }
.ui-alert__title { margin: 0; font-weight: 900; }
.ui-alert__message { margin: .15rem 0 0; line-height: 1.5; }
.ui-alert__close { margin-left: auto; border: 0; background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1; color: currentColor; opacity: .7; }

.ui-field { display: grid; gap: .45rem; }
.ui-label { color: var(--ui-text); font-weight: 850; font-size: .93rem; }
.ui-label__required { color: var(--ui-danger); }
.ui-control {
  width: 100%;
  min-height: 2.8rem;
  border-radius: .9rem;
  border: 1px solid var(--ui-border);
  background: #fff;
  color: var(--ui-text);
  padding: .72rem .85rem;
  box-shadow: var(--ui-shadow-sm);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.ui-control:focus { border-color: var(--ui-focus); box-shadow: var(--ui-ring); }
.ui-control[aria-invalid="true"] { border-color: var(--ui-danger); }
.ui-help { color: var(--ui-muted); font-size: .82rem; line-height: 1.4; }
.ui-error { color: var(--ui-danger); font-size: .82rem; font-weight: 750; }

.ui-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .85rem; padding: .9rem; border: 1px solid var(--ui-border); background: rgba(255,255,255,.94); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm); margin-bottom: 1rem; }
.ui-toolbar__main { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; min-width: 0; flex: 1; }
.ui-toolbar__actions { display: flex; flex-wrap: wrap; gap: .65rem; justify-content: flex-end; }
.ui-toolbar__search { flex: 1 1 18rem; max-width: 32rem; }

.ui-skeleton { position: relative; overflow: hidden; border-radius: 1rem; background: #e2e8f0; min-height: 1rem; }
.ui-skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: ui-shimmer 1.35s infinite; }
.ui-skeleton--line { height: 1rem; }
.ui-skeleton--title { height: 1.6rem; width: min(22rem, 80%); }
.ui-skeleton--card { min-height: 8rem; }

#bt-toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 10000; display: grid; gap: .75rem; width: min(28rem, calc(100vw - 2rem)); pointer-events: none; }
.bt-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .7rem; border-radius: 1rem; padding: .85rem 1rem; background: #fff; color: var(--ui-text); border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow-lg); transition: opacity .18s ease, transform .18s ease; }
.bt-toast--success { border-color: #bbf7d0; background: #ecfdf5; color: #065f46; }
.bt-toast--warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.bt-toast--danger,
.bt-toast--error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }


/* Loading overlay override
   Mantém os IDs/classes existentes do projeto, mas corrige o layout para modal centralizado.
   O CSS é carregado depois do generated/base_1.css, por isso esta regra vence o painel lateral antigo. */
html body .betoni-loading-modal,
html body #page-loading {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100vw !important;
  max-width: none !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: clamp(1rem, 4vw, 2.5rem) !important;
  background:
    radial-gradient(circle at 50% 35%, rgba(37, 99, 235, .22), transparent 34rem),
    rgba(2, 8, 23, .58) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: none !important;
  overflow: hidden !important;
  backdrop-filter: blur(8px) saturate(118%);
  -webkit-backdrop-filter: blur(8px) saturate(118%);
}

html body .betoni-loading-modal.is-visible,
html body .betoni-loading-modal[aria-hidden="false"],
html body #page-loading.is-visible,
html body #page-loading[aria-hidden="false"] {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

html body .betoni-loading-card,
html body #page-loading .page-loading-card {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  display: grid !important;
  justify-items: center !important;
  gap: .75rem !important;
  width: min(100%, 26rem) !important;
  max-width: calc(100vw - 2rem) !important;
  min-height: auto !important;
  margin: 0 !important;
  padding: clamp(1.35rem, 4vw, 2rem) !important;
  color: #0f172a !important;
  text-align: center !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96)) !important;
  border: 1px solid rgba(148, 163, 184, .35) !important;
  border-radius: 1.5rem !important;
  box-shadow: 0 28px 80px rgba(2, 8, 23, .34), 0 0 0 1px rgba(255,255,255,.7) inset !important;
  transform: translate(-50%, -50%) !important;
}


html body .betoni-loading-spinner,
html body #page-loading .page-loading-spinner {
  width: 3rem !important;
  height: 3rem !important;
  border-radius: 999px !important;
  border: 4px solid #dbeafe !important;
  border-top-color: #dc2626 !important;
  border-right-color: #1d4ed8 !important;
  background: transparent !important;
  box-shadow: 0 0 0 .45rem rgba(219, 234, 254, .38) !important;
  animation: betoni-loading-spin .85s linear infinite !important;
}

html body .betoni-loading-title,
html body #page-loading .page-loading-title {
  margin: .35rem 0 0 !important;
  color: #0f172a !important;
  font-size: clamp(1.1rem, 2vw, 1.35rem) !important;
  font-weight: 900 !important;
  letter-spacing: -.02em !important;
  line-height: 1.15 !important;
}

html body .betoni-loading-message,
html body #page-loading .page-loading-message {
  max-width: 21rem !important;
  margin: 0 !important;
  color: #475569 !important;
  font-size: .95rem !important;
  line-height: 1.55 !important;
}

html body .betoni-loading-hint {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 2rem !important;
  margin-top: .35rem !important;
  padding: .42rem .75rem !important;
  border-radius: 999px !important;
  background: #eff6ff !important;
  color: #1e3a8a !important;
  font-size: .78rem !important;
  font-weight: 800 !important;
}

html body .betoni-loading-card::after,
html body #page-loading .page-loading-card::after {
  content: '' !important;
  display: block !important;
  width: min(14rem, 74%) !important;
  height: .28rem !important;
  margin-top: .35rem !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #dc2626, #1d4ed8, #dc2626) !important;
  background-size: 220% 100% !important;
  animation: betoni-loading-progress 1.25s ease-in-out infinite !important;
}

html body .betoni-loading-modal button,
html body #page-loading button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@keyframes betoni-loading-spin { to { transform: rotate(360deg); } }
@keyframes betoni-loading-progress { 0% { background-position: 0% 50%; } 100% { background-position: 220% 50%; } }

@keyframes ui-spin { to { transform: rotate(360deg); } }
@keyframes ui-shimmer { 100% { transform: translateX(100%); } }

@media (max-width: 1023px) {
  .ui-grid--stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .ui-page-header { display: grid; }
  .ui-page-header__actions { justify-content: flex-start; }
  .ui-form-grid, .ui-grid--stats { grid-template-columns: 1fr; }
  .ui-toolbar, .ui-toolbar__main, .ui-toolbar__actions { display: grid; justify-content: stretch; }
  .ui-toolbar__search { max-width: none; flex-basis: auto; }
  .ui-btn { width: 100%; }
  #bt-toast-region { right: .75rem; bottom: .75rem; width: calc(100vw - 1.5rem); }
}
@media (prefers-reduced-motion: reduce) {
  .ui-btn,
  .ui-skeleton::after,
  .bt-toast { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .ui-card,
  .ui-btn,
  .ui-control,
  .ui-alert,
  .ui-empty { border: 1px solid CanvasText; }
}


/* FIX4 hardened loading overlay */
html body #betoni-loading-modal[aria-hidden="false"],
html body #betoni-loading-modal.is-visible,
html body #betoni-loading-modal.bt-loading-visible { display:flex !important; opacity:1 !important; pointer-events:auto !important; }
html body #betoni-loading-modal, html body .betoni-loading-modal { left:0 !important; right:0 !important; top:0 !important; bottom:0 !important; width:100vw !important; max-width:none !important; transform:none !important; }

/* FIX5 — shell, mobile and student editor hardening */
html body .quick-actions,
html body .quick-actions__backdrop,
html body .quick-actions__panel,
html body .quick-actions__fab {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (min-width: 1024px) {
  html.bt-sidebar-collapsed .sidebar,
  body.bt-sidebar-collapsed .sidebar {
    width: 5.25rem !important;
    min-width: 5.25rem !important;
    max-width: 5.25rem !important;
  }

  html.bt-sidebar-collapsed .sb-hide-on-collapse,
  body.bt-sidebar-collapsed .sb-hide-on-collapse {
    display: none !important;
  }

  html.bt-sidebar-collapsed .sb-brand,
  body.bt-sidebar-collapsed .sb-brand,
  html.bt-sidebar-collapsed .sidebar .navlink,
  body.bt-sidebar-collapsed .sidebar .navlink {
    justify-content: center !important;
  }

  html.bt-sidebar-collapsed .sidebar .navlink,
  body.bt-sidebar-collapsed .sidebar .navlink {
    padding-inline: .75rem !important;
  }
}

@media (max-width: 1023px) {
  html body .mobile-drawer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(88vw, 22rem) !important;
    max-width: 22rem !important;
    height: 100dvh !important;
    z-index: 1002 !important;
    transform: translateX(-105%) !important;
    transition: transform .22s ease !important;
    overflow-y: auto !important;
    background: rgba(255,255,255,.98) !important;
    box-shadow: 24px 0 60px rgba(15,23,42,.28) !important;
  }

  html body .mobile-drawer.is-open {
    transform: translateX(0) !important;
  }

  html body .mobile-drawer-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1001 !important;
    background: rgba(2,8,23,.54) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .2s ease !important;
  }

  html body .mobile-drawer-backdrop.is-open {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

#modalEditStudent.student-edit-modal:not(.hidden) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.student-edit-modal {
  padding: clamp(.5rem, 2vw, 1.5rem) !important;
}

.student-edit-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 23, .62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.student-edit-modal__panel {
  position: relative;
  z-index: 1;
  width: min(1120px, 96vw);
  max-height: min(92dvh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, .32);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 30px 90px rgba(2, 8, 23, .34);
}

.student-edit-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid rgba(226, 232, 240, .95);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}

.student-edit-modal__eyebrow {
  margin: 0 0 .15rem;
  color: #64748b;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.student-edit-modal__title {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 900;
  line-height: 1.15;
}

.student-edit-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .9rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 1.1rem;
  font-weight: 900;
  transition: transform .15s ease, background .15s ease;
}

.student-edit-modal__close:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.student-edit-form {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.15rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.student-edit-hero {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.student-edit-photo-card,
.student-edit-summary {
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.student-edit-photo-card {
  padding: 1rem;
  display: grid;
  gap: .8rem;
  justify-items: center;
  text-align: center;
}

.student-edit-photo-frame {
  position: relative;
  width: min(100%, 180px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 1.35rem;
  border: 1px solid #cbd5e1;
  background: #eff6ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}

.student-edit-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.student-edit-photo-frame.is-placeholder img {
  object-fit: contain;
  padding: 1.25rem;
  opacity: .42;
}

.student-edit-initials {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #0b2c4d;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -.05em;
  background: radial-gradient(circle at 30% 20%, #dbeafe, #f8fafc 64%);
}

.student-edit-photo-frame.is-initials img {
  display: none;
}

.student-edit-photo-frame.is-initials .student-edit-initials {
  display: flex;
}

.student-photo-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.45rem;
  padding: .65rem .9rem;
  border-radius: .9rem;
  background: #0b2c4d;
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  cursor: pointer;
}

.student-photo-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.student-edit-summary {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.student-edit-summary__label {
  margin: 0;
  color: #64748b;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.student-edit-summary__name {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 900;
  line-height: 1.1;
}

.student-edit-summary__email {
  margin: .25rem 0 0;
  color: #475569;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.student-edit-badges,
.student-edit-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.student-edit-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: .78rem;
  font-weight: 800;
}

.student-edit-toggle-card {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
  font-size: .88rem;
  font-weight: 750;
}

.student-edit-fieldset-title {
  grid-column: 1 / -1;
  margin: .6rem 0 -.15rem;
  padding-top: .85rem;
  border-top: 1px solid #e2e8f0;
}

.student-edit-fieldset-title h4 {
  margin: 0;
  color: #0f172a;
  font-size: .95rem;
  font-weight: 900;
}

.student-edit-fieldset-title p {
  margin: .2rem 0 0;
  color: #64748b;
  font-size: .76rem;
}

#modalEditStudent input,
#modalEditStudent select,
#modalEditStudent textarea {
  min-height: 2.55rem;
}

@media (max-width: 767px) {
  .admin-mobile-stack {
    padding-right: 0 !important;
  }

  .admin-actions-grid > *,
  .admin-search-actions > * {
    width: 100%;
  }

  .student-edit-modal {
    padding: 0 !important;
  }

  .student-edit-modal__panel {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .student-edit-modal__header {
    padding: .9rem 1rem;
  }

  .student-edit-form {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: .85rem;
  }

  .student-edit-hero {
    grid-template-columns: 1fr;
  }

  .student-edit-photo-frame {
    width: 150px;
  }

  #modalEditStudent .sticky.bottom-0 {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    padding: .85rem 0 0 !important;
  }

  #modalEditStudent .sticky.bottom-0 button {
    width: 100%;
  }
}

.student-edit-form > .md\:col-span-2 {
  grid-column: 1 / -1;
}

/* FIX7 — modal real de tela cheia, sem depender do contexto transformado do conteúdo. */
html body #modalEditStudent.student-edit-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147482000 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  transform: none !important;
}
html body #modalEditStudent.student-edit-modal:not(.hidden) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
html body #modalEditStudent .student-edit-modal__panel {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}
html body #modalEditStudent .student-edit-modal__backdrop {
  z-index: 0 !important;
}
html body #modalEditStudent .student-edit-modal__panel {
  z-index: 1 !important;
}

/* FIX7 — remove definitivamente UI lateral/quick actions e loaders antigos, mesmo se scripts legados ainda existirem no servidor. */
html body .quick-actions,
html body .quick-actions__backdrop,
html body .quick-actions__panel,
html body .quick-actions__fab,
html body #quick-actions-panel,
html body #quick-actions-toggle {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* FIX7 — padrão visual da seleção de unidade alinhado com o restante do site. */
.bt-unit-page {
  min-height: calc(100dvh - 5rem);
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 3rem);
  background:
    radial-gradient(circle at 12% 12%, rgba(220, 38, 38, .20), transparent 26rem),
    radial-gradient(circle at 86% 16%, rgba(37, 99, 235, .24), transparent 28rem),
    linear-gradient(135deg, #06192e 0%, #0b2c4d 55%, #071827 100%);
}
.bt-unit-panel {
  width: min(1120px, 100%);
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid rgba(226, 232, 240, .22);
  border-radius: clamp(1.25rem, 3vw, 2rem);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 32px 90px rgba(2, 8, 23, .34), inset 0 1px 0 rgba(255,255,255,.85);
}
.bt-unit-header {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: .75rem;
  max-width: 760px;
  margin: 0 auto clamp(1.25rem, 3vw, 2rem);
}
.bt-unit-logo {
  width: min(220px, 60vw);
  padding: .65rem 1rem;
  border-radius: 1.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .12);
}
.bt-unit-logo img { width: 100%; height: auto; display: block; object-fit: contain; }
.bt-unit-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 2rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .02em;
}
.bt-unit-title {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.9rem, 5vw, 3.5rem);
  font-weight: 950;
  letter-spacing: -.05em;
  line-height: .95;
}
.bt-unit-subtitle {
  margin: 0;
  color: #475569;
  font-size: clamp(.98rem, 2vw, 1.12rem);
  line-height: 1.65;
}
.bt-unit-values {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
}
.bt-unit-value {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  font-size: .78rem;
  font-weight: 850;
}
.bt-unit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
}
.bt-unit-form { min-width: 0; }
.plain-button.bt-unit-card {
  width: 100%;
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  align-items: stretch;
  gap: 1rem;
  padding: .9rem;
  border: 1px solid #dbe3ef;
  border-radius: 1.5rem;
  background: linear-gradient(180deg, #fff, #f8fafc);
  color: #0f172a;
  text-align: left;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .12);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  overflow: hidden;
}
.plain-button.bt-unit-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: .35rem;
  background: linear-gradient(90deg, #dc2626, #1d4ed8);
}
.plain-button.bt-unit-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 70px rgba(15, 23, 42, .18);
  border-color: #bfdbfe;
}
.plain-button.bt-unit-card:focus-visible {
  outline: 4px solid rgba(37, 99, 235, .30);
  outline-offset: 4px;
}
.bt-unit-image {
  min-height: 210px;
  border-radius: 1.15rem;
  overflow: hidden;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
}
.bt-unit-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bt-unit-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .35rem;
  padding: .45rem .35rem;
}
.bt-unit-label {
  color: #64748b;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.bt-unit-name {
  color: #0b2c4d;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  font-weight: 950;
  letter-spacing: -.04em;
  line-height: 1;
}
.bt-unit-desc {
  color: #475569;
  font-size: .94rem;
  line-height: 1.5;
  max-width: 24rem;
}
.bt-unit-action {
  margin-top: .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: fit-content;
  min-height: 2.55rem;
  padding: .62rem .95rem;
  border-radius: 999px;
  background: #0b2c4d;
  color: #fff;
  font-size: .88rem;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(11, 44, 77, .22);
}
.bt-unit-card--duquesa .bt-unit-action { background: #991b1b; }
.bt-unit-action-arrow { font-size: 1rem; }
.bt-unit-note {
  margin: clamp(1rem, 3vw, 1.5rem) 0 0;
  text-align: center;
  color: #64748b;
  font-size: .9rem;
}
@media (max-width: 860px) {
  .bt-unit-grid { grid-template-columns: 1fr; }
  .plain-button.bt-unit-card { grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .bt-unit-page { padding: 1rem; align-items: start; }
  .bt-unit-panel { border-radius: 1.25rem; padding: 1rem; }
  .plain-button.bt-unit-card { grid-template-columns: 1fr; }
  .bt-unit-image { min-height: 190px; }
  .bt-unit-action { width: 100%; }
}


/* FIX7 final student modal hardening */
html body #modalEditStudent.student-edit-modal {
  padding: clamp(.5rem, 2vw, 1.25rem) !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
}
html body #modalEditStudent .student-edit-modal__backdrop {
  z-index: 1 !important;
  pointer-events: auto !important;
}
html body #modalEditStudent .student-edit-modal__panel {
  z-index: 20 !important;
  pointer-events: auto !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
html body #modalEditStudent .student-edit-form {
  padding-bottom: 1rem !important;
}
html body #modalEditStudent .student-edit-actions {
  grid-column: 1 / -1 !important;
  position: static !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: .75rem !important;
  margin-top: .5rem !important;
  padding: 1rem 0 0 !important;
  border-top: 1px solid #e2e8f0 !important;
  background: #fff !important;
  z-index: 2 !important;
}
html body #modalEditStudent .student-edit-actions button {
  min-width: 8.5rem;
}
html body #modalEditStudent .student-edit-photo-frame.has-photo img {
  display: block !important;
  object-fit: cover !important;
  padding: 0 !important;
  opacity: 1 !important;
}
html body #modalEditStudent .student-edit-photo-frame.has-photo .student-edit-initials {
  display: none !important;
}
html body #modalEditStudent .student-edit-photo-frame.is-initials img {
  display: none !important;
}
@media (max-width: 767px) {
  html body #modalEditStudent.student-edit-modal { padding: 0 !important; }
  html body #modalEditStudent .student-edit-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: .6rem !important;
  }
  html body #modalEditStudent .student-edit-actions button { min-width: 0; width: 100%; }
}

/* FIX7 select-unit standalone page spacing; base header/footer are hidden by template condition. */
.bt-public-standalone-main {
  min-height: 100dvh !important;
}
.bt-public-standalone-main .bt-unit-page {
  min-height: 100dvh !important;
}


/* FIX8: edição de aluno — botão claro não deve parecer desativado. */
html body .student-row-edit-btn {
  background: #0b2c4d !important;
  color: #ffffff !important;
  border: 1px solid rgba(11, 44, 77, .35) !important;
  box-shadow: 0 12px 26px rgba(11, 44, 77, .18) !important;
  font-weight: 900 !important;
}
html body .student-row-edit-btn:hover {
  filter: brightness(1.04) !important;
  transform: translateY(-1px) !important;
}
html body .student-row-edit-btn:disabled,
html body .student-row-edit-btn[aria-disabled="true"] {
  opacity: .55 !important;
  cursor: not-allowed !important;
}

/* FIX8: modal de edição de aluno — footer separado e sem sobrepor campos. */
html body #modalEditStudent .student-edit-modal__panel {
  width: min(1120px, calc(100vw - 2rem)) !important;
  max-height: calc(100dvh - 2rem) !important;
}
html body #modalEditStudent .student-edit-form {
  overflow-y: auto !important;
  padding: 1.15rem 1.15rem 0 !important;
  scrollbar-gutter: stable !important;
}
html body #modalEditStudent .student-edit-actions {
  position: static !important;
  grid-column: 1 / -1 !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: .75rem !important;
  margin: 1rem -1.15rem 0 !important;
  padding: 1rem 1.15rem !important;
  border-top: 1px solid #dbe4ef !important;
  background: #f8fafc !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8) !important;
}
html body #modalEditStudent .student-edit-actions button {
  min-width: 9rem !important;
  min-height: 2.8rem !important;
  font-weight: 900 !important;
}
html body #modalEditStudent .student-edit-actions button[type="submit"] {
  background: #0b2c4d !important;
  color: #fff !important;
}
html body #modalEditStudent .student-edit-actions button[type="button"] {
  background: #b91c1c !important;
  color: #fff !important;
  border-color: rgba(185,28,28,.35) !important;
}
html body #modalEditStudent .student-edit-photo-frame.has-photo {
  background: #0f172a !important;
}
html body #modalEditStudent .student-edit-photo-frame.has-photo img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  padding: 0 !important;
  opacity: 1 !important;
}
@media (max-width: 767px) {
  html body #modalEditStudent .student-edit-modal__panel {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }
  html body #modalEditStudent .student-edit-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    margin-inline: -1rem !important;
    padding-inline: 1rem !important;
  }
}

/* FIX8: remover efeitos de cortina que pareciam tela bugada. */
html body #curtain-enter,
html body #betoni-page-curtain,
html body .betoni-page-curtain {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}


/* FIX9: manter o botão Editar sempre com aparência ativa na tela de alunos. */
html body .student-row-edit-btn,
html body .student-row-edit-btn.is-active {
  background: #0b2c4d !important;
  color: #ffffff !important;
  border-color: rgba(11,44,77,.35) !important;
  opacity: 1 !important;
  filter: none !important;
  pointer-events: auto !important;
}
html body .student-row-edit-btn:hover,
html body .student-row-edit-btn.is-active:hover {
  background: #123f6a !important;
}

/* FIX9: foto inexistente não deve virar bloco escuro vazio; mostra iniciais limpas. */
html body #modalEditStudent .student-edit-photo-frame.is-initials {
  background: radial-gradient(circle at 30% 20%, #dbeafe, #f8fafc 68%) !important;
}
html body #modalEditStudent .student-edit-photo-frame.is-initials .student-edit-initials {
  display: flex !important;
}

/* FIX9: equalização visual extra para cards de unidade caso CSS externo interfira. */
html body .unit-standalone-grid > form { display:flex; min-width:0; height:100%; }
html body .unit-standalone-card { height:100%; }


/* FIX11: ao trocar de aluno na edição, não mostrar a foto anterior enquanto a nova carrega. */
html body #modalEditStudent .student-edit-photo-frame.is-loading {
  background: radial-gradient(circle at 30% 20%, #dbeafe, #f8fafc 68%) !important;
}
html body #modalEditStudent .student-edit-photo-frame.is-loading img {
  opacity: 0 !important;
  visibility: hidden !important;
}
html body #modalEditStudent .student-edit-photo-frame.is-loading .student-edit-initials {
  display: flex !important;
}
html body #modalEditStudent .student-edit-photo-frame.is-loading::after {
  content: "";
  position: absolute;
  right: .75rem;
  bottom: .75rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 3px solid rgba(11, 44, 77, .14);
  border-top-color: #0b2c4d;
  animation: betoni-photo-spin .8s linear infinite;
}
@keyframes betoni-photo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html body #modalEditStudent .student-edit-photo-frame.is-loading::after { animation: none; }
}
