/* School branding: keep the existing 60px header and dashboard card sizes. */
:root {
  --school-credit: #87551c;
  --school-credit-label: #515b73;
  --school-contact-focus: #172c46;
}
html[data-theme="dark"], html:has(body.darkmode) {
  --school-credit: #f0c77d;
  --school-credit-label: #cbd5e1;
  --school-contact-focus: #ffffff;
}
.school-developer-credit {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 1px;
  width: 208px;
  text-align: center;
  color: var(--school-credit);
  white-space: nowrap;
  pointer-events: none;
}
.header .school-developer-credit .school-developer-credit-label {
  color: var(--school-credit-label);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: .08em;
}
.header .school-developer-credit .school-developer-credit-name {
  color: var(--school-credit);
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  font-style: normal;
}
/* Reserve the center without changing the 60px header or its controls. */
@media (min-width: 992px) {
  .header:has(.school-developer-credit) .top-nav-search {
    width: clamp(88px, calc(50vw - 430px), 298px);
  }
  .header:has(.school-developer-credit) .top-nav-search form { width: 100%; }
  .header:has(.school-developer-credit) .top-year {
    font-size: 12px;
    padding-inline: 8px !important;
  }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .header:has(.school-developer-credit) .search-addon { display: none; }
  .header:has(.school-developer-credit) .searchinputs input { padding-inline-end: 12px; }
}
[data-topbar="dark"] .school-developer-credit,
[data-topbar="primary"] .school-developer-credit {
  --school-credit: #ffe1a6;
  --school-credit-label: #ffffff;
}
@media (min-width: 1400px) and (max-width: 1499.98px) {
  .header:has(.school-developer-credit) .header-user .user-menu > .d-flex.align-items-center { gap: 4px; }
}
.header .header-left :is(.logo, .dark-logo, .logo-small) img {
  transform-origin: center;
  animation: school-logo-welcome 900ms cubic-bezier(.22, 1, .36, 1) backwards;
  transition: transform 220ms ease;
}
.header .header-left :is(.logo, .dark-logo, .logo-small):is(:hover, :focus-visible) img {
  transform: translateY(-2px);
}
/* Teacher assistant uses the platform's semantic surfaces in both themes. */
.school-agent-launcher, .school-agent-panel {
  --agent-surface: var(--surface, #fff);
  --agent-soft: var(--surface-soft, #f6f7fb);
  --agent-text: var(--heading, #111827);
  --agent-muted: var(--muted, #6b7280);
  --agent-border: var(--border-soft, #e7eaf1);
  --agent-action: var(--bs-primary, #3d5ee1);
  --agent-focus: var(--school-contact-focus);
  color: var(--agent-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  text-align: start;
  box-sizing: border-box;
}
.school-agent-launcher {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 1000;
  width: 68px;
  height: 68px;
  padding: 2px;
  border: 2px solid var(--agent-surface);
  border-radius: 50%;
  background: var(--agent-action);
  box-shadow: 0 5px 22px rgb(26 42 100 / 24%);
  cursor: pointer;
  transition: transform 160ms ease;
}
.school-agent-avatar { display: block; width: 100%; height: 100%; }
.school-agent-teacher { transform-origin: 40px 60px; }
.school-agent-badge { position: absolute; right: -2px; bottom: -1px; border: 2px solid var(--agent-surface); border-radius: 8px; padding: 1px 5px; background: #25334f; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.school-agent-tooltip { position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%); padding: 9px 12px; background: var(--agent-text); color: var(--agent-surface); border-radius: 9px; font-size: 12px; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; }
.school-agent-launcher:focus-visible .school-agent-tooltip { opacity: 1; visibility: visible; }
@media (hover: hover) {
  .school-agent-launcher:hover { transform: translateY(-2px); }
  .school-agent-launcher:hover .school-agent-tooltip { opacity: 1; visibility: visible; }
}
.school-agent-launcher:active { transform: scale(.97); }
body.modal-open .school-agent-launcher, body:has(.offcanvas.show) .school-agent-launcher { visibility: hidden; }
.school-agent-panel {
  position: fixed;
  inset: auto 22px 22px auto;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 690px;
  max-height: calc(100dvh - 88px);
  margin: 0;
  padding: 0;
  border: 1px solid var(--agent-border);
  border-radius: 20px;
  background: var(--agent-surface);
  box-shadow: 0 18px 64px rgb(17 24 39 / 24%);
  overflow: hidden;
}
.school-agent-panel[open] { display: flex; flex-direction: column; animation: school-agent-reveal 240ms cubic-bezier(.16,1,.3,1); }
.school-agent-panel::backdrop { background: rgb(13 22 43 / 22%); }
.school-agent-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 18px 18px; border-bottom: 1px solid var(--agent-border); flex-shrink: 0; }
.school-agent-identity { display: flex; gap: 12px; align-items: center; min-width: 0; }
.school-agent-identity .school-agent-avatar { width: 52px; height: 52px; flex-shrink: 0; }
.school-agent-eyebrow { display: block; font-size: 10px; font-weight: 700; letter-spacing: .11em; color: var(--agent-muted); }
.school-agent-header h2 { margin: 2px 0; font-size: 20px; font-weight: 700; line-height: 1.25; color: var(--agent-text); }
.school-agent-header p { margin: 0; font-size: 12px; color: var(--agent-muted); }
.school-agent-icon-button { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; padding: 8px; border: 1px solid var(--agent-border); border-radius: 12px; background: var(--agent-soft); color: var(--agent-text); cursor: pointer; }
.school-agent-panel button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.school-agent-preview { display: flex; flex-wrap: wrap; gap: 4px 7px; align-items: center; padding: 10px 18px; font-size: 11px; color: var(--agent-muted); background: var(--agent-soft); flex-shrink: 0; }
.school-agent-preview > span:last-child { margin-inline-start: auto; }
.school-agent-preview-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--agent-muted); }
.school-agent-messages { flex: 1 1 auto; min-height: 70px; overflow: auto; overscroll-behavior: contain; padding: 24px 18px 16px; scrollbar-width: thin; }
.school-agent-welcome { margin-bottom: 20px; }
.school-agent-welcome h3 { margin: 8px 0 0; color: var(--agent-text); font-size: 25px; line-height: 1.25; font-weight: 700; letter-spacing: -.6px; max-width: 240px; }
.school-agent-message { width: fit-content; max-width: 94%; padding: 13px 15px; margin-bottom: 14px; border: 1px solid var(--agent-border); border-radius: 3px 15px 15px; background: var(--agent-soft); overflow-wrap: anywhere; }
.school-agent-sender { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; color: var(--agent-muted); }
.school-agent-message p { margin: 0; font-size: 13px; line-height: 1.75; white-space: pre-wrap; color: inherit; }
.school-agent-user { margin-inline-start: auto; border-color: var(--agent-action); background: var(--agent-action); color: #fff; border-radius: 15px 3px 15px 15px; }
.school-agent-user .school-agent-sender { color: #fff; }
.school-agent-prompts { display: flex; flex-wrap: wrap; gap: 7px; padding: 6px 18px 14px; flex-shrink: 0; }
.school-agent-prompts button { min-height: 36px; padding: 7px 11px; border: 1px solid var(--agent-border); border-radius: 9px; background: var(--agent-surface); color: var(--agent-text); font-size: 12px; cursor: pointer; }
.school-agent-prompts button:hover, .school-agent-icon-button:hover { border-color: var(--agent-action); background: var(--agent-soft); }
.school-agent-form { padding: 0 18px 16px; flex-shrink: 0; }
.school-agent-form label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 600; }
.school-agent-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border: 1px solid var(--agent-border); border-radius: 13px; background: var(--agent-soft); }
.school-agent-composer:focus-within { border-color: var(--agent-action); }
.school-agent-composer textarea { width: 100%; min-width: 0; resize: none; padding: 2px; border: 0; background: transparent; color: var(--agent-text); font: inherit; line-height: 1.5; max-height: 84px; }
.school-agent-composer textarea::placeholder { color: var(--agent-muted); }
.school-agent-send { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; padding: 8px; border: 0; border-radius: 10px; background: var(--agent-action); color: #fff; cursor: pointer; }
.school-agent-send:disabled { background: var(--agent-border); color: var(--agent-muted); cursor: default; }
.school-agent-form > p { margin: 8px 0 0; font-size: 10px; color: var(--agent-muted); }
.school-agent-launcher:focus-visible, .school-agent-panel :is(button, textarea, [tabindex]):focus-visible { outline: 2px solid var(--agent-focus); outline-offset: 3px; }
@keyframes school-agent-reveal { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes school-logo-welcome { from { opacity: .6; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 991.98px) { .school-developer-credit { display: none !important; } }
@media (max-width: 575.98px) {
  .school-agent-launcher { width: 62px; height: 62px; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
  .school-agent-panel { inset: auto 8px max(8px, env(safe-area-inset-bottom)) auto; width: calc(100vw - 16px); max-width: none; height: 690px; max-height: calc(100dvh - 16px); border-radius: 16px; }
  .school-agent-header { padding: 16px 14px; }
  .school-agent-messages { padding-inline: 14px; }
  .school-agent-form, .school-agent-prompts { padding-inline: 14px; }
  .school-agent-composer textarea { font-size: 16px; }
}
@media (max-height: 550px) { .school-agent-panel { max-height: calc(100dvh - 16px); bottom: 8px; overflow-y: auto; } .school-agent-messages { flex: 1 0 100px; } .school-agent-header { padding-block: 8px; } .school-agent-identity .school-agent-avatar { width: 36px; height: 36px; } .school-agent-welcome { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .school-agent-teacher, .school-agent-panel, .school-agent-launcher,
  .header .header-left :is(.logo, .dark-logo, .logo-small) img { animation: none !important; transition: none !important; transform: none !important; }
}
@media print { .school-agent-launcher, .school-agent-panel { display: none !important; } }

.school-whatsapp {
  position: fixed;
  direction: ltr;
  inset-inline-end: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 1000;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff !important;
  background: #087f52;
  box-shadow: 0 4px 16px rgb(0 50 30 / 22%);
  text-decoration: none;
  isolation: isolate;
  animation: school-contact-enter 550ms 300ms cubic-bezier(.22, 1, .36, 1) backwards;
  transition: transform 180ms ease, background-color 180ms ease;
}
.school-whatsapp svg { width: 29px; height: 29px; fill: currentColor; }
.school-whatsapp::before {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid #087f52;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  animation: school-contact-ring 1600ms 1s ease-out 2;
}
.school-whatsapp-label {
  position: absolute;
  right: calc(100% + 12px);
  padding: 8px 12px;
  border-radius: 8px;
  background: #173c2d;
  color: #ffffff;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 150ms ease;
  pointer-events: none;
}
.school-whatsapp:focus-visible {
  outline: 3px solid var(--school-contact-focus);
  outline-offset: 4px;
}
.school-whatsapp:focus-visible .school-whatsapp-label { opacity: 1; visibility: visible; }
@media (hover: hover) {
  .school-whatsapp:hover { transform: translateY(-3px); background: #066741; }
  .school-whatsapp:hover .school-whatsapp-label { opacity: 1; visibility: visible; }
}
.school-whatsapp:active { transform: scale(.96); }
/* Keep contact behind dialogs, and out of the way while an overlay is open. */
body.modal-open .school-whatsapp,
body:has(.offcanvas.show) .school-whatsapp { visibility: hidden; }

.school-agent-launcher { width: 56px; height: 56px; right: max(24px, env(safe-area-inset-right)); bottom: calc(max(24px, env(safe-area-inset-bottom)) + 70px); }
@media (max-width: 991.98px) {
  .school-whatsapp { width: 52px; height: 52px; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
  .school-agent-launcher { width: 52px; height: 52px; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 66px); }
}
@media (prefers-reduced-motion: reduce) { .school-whatsapp, .school-whatsapp::before, .school-whatsapp-label { animation: none !important; transition: none !important; transform: none !important; } }
@media print { .school-whatsapp { display: none; } }

/* Supplied square crest: reserve its aspect ratio in every logo context. */
img.sunrise-school-logo { width: 96px; height: 96px; object-fit: contain; }
.header .header-left :is(.logo, .dark-logo, .logo-small) img.sunrise-school-logo {
  width: 52px; height: 52px; max-width: 52px; max-height: 52px;
}
.header .header-left .logo-small img.sunrise-school-logo {
  width: 40px; height: 40px; max-width: 40px; max-height: 40px;
}
/* Center the crest independently of the sidebar toggle. */
.header .header-left:has(img.sunrise-school-logo),
body.mini-sidebar.expand-menu .header .header-left:has(img.sunrise-school-logo) {
  justify-content: center;
}
@media (min-width: 992px) {
  .header .header-left:has(img.sunrise-school-logo) #toggle_btn {
    position: absolute;
    right: 12px;
    top: 0;
    bottom: 0;
    margin-block: auto;
    height: 32px;
  }
  body.mini-sidebar:not(.expand-menu) .header .header-left:has(img.sunrise-school-logo) .logo-small {
    padding: 0;
    line-height: 0;
  }
  body.mini-sidebar:not(.expand-menu) .header .header-left:has(img.sunrise-school-logo) #toggle_btn {
    right: 0;
    width: 18px;
    padding: 0;
  }
}
