/* SchoolDay v207: unified admin shell with responsive work area and contained calendar warning. */
:root {
  --admin-sidebar-width-v206: 248px;
  --admin-sidebar-gap-v206: 18px;
}

.admin-shell-v206-ready #adminWorkspaceV206 {
  display: grid;
  grid-template-columns: var(--admin-sidebar-width-v206) minmax(0, 1fr);
  gap: var(--admin-sidebar-gap-v206);
  align-items: start;
  width: 100%;
  min-width: 0;
}

.admin-shell-v206-ready #adminContentV206 {
  min-width: 0;
}

.admin-shell-v206-ready #tabNav,
.admin-shell-v206-ready #adminFunctionsMenu,
.admin-shell-v206-ready #adminFunctionsDropdown {
  display: none !important;
}

.admin-sidebar-v206 {
  position: sticky;
  top: calc(var(--admin-header-sticky-height, 82px) + 12px);
  max-height: calc(100vh - var(--admin-header-sticky-height, 82px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 12px !important;
  border-radius: 16px !important;
}

.admin-sidebar-title-v206 {
  display: grid;
  gap: 2px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--admin-tab-border, #b8d4ef);
  margin-bottom: 8px;
}

.admin-sidebar-title-v206 span {
  color: #64748b;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-sidebar-title-v206 strong {
  color: #0f172a;
  font-size: 1.03rem;
}

.admin-sidebar-group-v206 {
  display: grid;
  gap: 5px;
  padding: 9px 0 7px;
  border-bottom: 1px solid rgba(148, 163, 184, .23);
}

.admin-sidebar-group-v206:last-child { border-bottom: 0; }

.admin-sidebar-group-v206 h3 {
  margin: 0 6px 3px;
  color: #64748b;
  font-size: .72rem;
  line-height: 1.2;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.admin-sidebar-group-v206 > div {
  display: grid;
  gap: 4px;
}

.admin-body .admin-sidebar-v206 button[data-sidebar-tab] {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #1f2937 !important;
  font-size: .91rem;
  font-weight: 720;
  box-shadow: none !important;
  opacity: 1 !important;
}

.admin-body .admin-sidebar-v206 button[data-sidebar-tab]:hover,
.admin-body .admin-sidebar-v206 button[data-sidebar-tab]:focus-visible {
  background: var(--admin-tab-bg, #dceffc) !important;
  border-color: var(--admin-tab-border, #b8d4ef) !important;
  color: var(--admin-tab-text, #111827) !important;
}

.admin-body .admin-sidebar-v206 button[data-sidebar-tab].active {
  background: var(--admin-selected-high-menu-bg, #f5c542) !important;
  border-color: var(--admin-selected-high-menu-border, #d09a00) !important;
  color: var(--admin-selected-high-menu-text, #111827) !important;
  font-weight: 850;
}

.admin-body .admin-sidebar-v206 button[data-sidebar-tab].active::before {
  content: "";
  flex: 0 0 4px;
  width: 4px;
  height: 20px;
  margin-right: 7px;
  border-radius: 99px;
  background: currentColor;
  opacity: .72;
}

.admin-embedded-panel-v206 {
  padding: 0 !important;
  overflow: hidden;
  min-height: 720px;
}

.admin-module-frame-v206 {
  display: block;
  width: 100%;
  height: calc(100vh - var(--admin-header-sticky-height, 82px) - 118px);
  min-height: 720px;
  border: 0;
  background: var(--admin-page-bg, #f5f9ff);
}

.admin-embedded-active-v206 .admin-page-help-row {
  display: none !important;
}

@media (min-width: 901px) {
  .admin-shell-v206-ready #mobileTabHeader { display: none !important; }
}

@media (max-width: 900px) {
  .admin-shell-v206-ready #adminWorkspaceV206 {
    display: block;
  }
  .admin-sidebar-v206 {
    display: none !important;
  }
  .admin-shell-v206-ready #mobileTabHeader {
    display: block;
    margin-bottom: 10px;
  }
  .admin-module-frame-v206 {
    min-height: 780px;
    height: calc(100vh - 150px);
  }
}

/* Embedded Policies / Report Cards: keep their proven module logic, remove the second site shell. */
html[data-schoolday-embedded="true"] body {
  background: var(--admin-page-bg, #f5f9ff) !important;
  min-height: 100%;
}

html[data-schoolday-embedded="true"] .policies-header,
html[data-schoolday-embedded="true"] .reportcards-header,
html[data-schoolday-embedded="true"] .reportcards-admin-bar-v196,
html[data-schoolday-embedded="true"] [data-schoolday-admin-action],
html[data-schoolday-embedded="true"] [data-schoolday-admin-link] {
  display: none !important;
}

html[data-schoolday-embedded="true"] .policies-shell,
html[data-schoolday-embedded="true"] .reportcards-shell {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 10px !important;
  box-sizing: border-box;
}

html[data-schoolday-embedded="true"] .policies-topline,
html[data-schoolday-embedded="true"] .reportcards-intro {
  margin-top: 0 !important;
}

html[data-schoolday-embedded="true"] .policies-body.header-compact,
html[data-schoolday-embedded="true"] .reportcards-body.header-compact {
  padding-top: 0 !important;
}


/* v207: remove the sidebar title block and use the full sidebar height for functions. */
.admin-sidebar-title-v206 {
  display: none !important;
}


body.admin-body.admin-shell-v206-ready {
  overflow-x: hidden !important;
}

/* v207: every admin page must size itself to the remaining space beside the desktop sidebar. */
.admin-shell-v206-ready #adminWorkspaceV206,
.admin-shell-v206-ready #adminContentV206,
.admin-shell-v206-ready #adminContentV206 > *,
.admin-shell-v206-ready #adminContentV206 > .tab-panel,
.admin-shell-v206-ready #adminContentV206 > .tab-panel.active {
  min-width: 0 !important;
  max-width: 100% !important;
}

.admin-shell-v206-ready #adminContentV206 > .tab-panel,
.admin-shell-v206-ready #adminContentV206 > .wide-card,
.admin-shell-v206-ready #tab-school-calendars.wide-card,
.admin-shell-v206-ready #tab-class-calendars.wide-card {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.admin-shell-v206-ready #adminContentV206 .table-wrap,
.admin-shell-v206-ready #adminContentV206 .calendar-page-table-wrap {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

/* v152 intentionally made this table page-width. In the sidebar shell it must instead be content-width. */
.admin-shell-v206-ready #tab-school-calendars .calendar-page-table-wrap {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  max-height: 72vh !important;
  overflow: auto !important;
}

.admin-shell-v206-ready #tab-school-calendars .calendar-page-table-wrap .data-table,
.admin-shell-v206-ready #tab-class-calendars .data-table {
  min-width: 100% !important;
  max-width: none !important;
}

.admin-shell-v206-ready #tab-school-calendars .calendar-page-table-wrap .data-table th,
.admin-shell-v206-ready #tab-class-calendars .table-wrap .data-table th {
  top: 0 !important;
}

.admin-shell-v206-ready #adminContentV206 .grid-form,
.admin-shell-v206-ready #adminContentV206 .two-column,
.admin-shell-v206-ready #adminContentV206 .weekday-routine-grid,
.admin-shell-v206-ready #adminContentV206 .bulk-manager-layout,
.admin-shell-v206-ready #adminContentV206 fieldset,
.admin-shell-v206-ready #adminContentV206 form {
  min-width: 0;
  max-width: 100%;
}

/* v207: class-calendar safeguarding notice belongs to the content column, never across/over the sidebar. */
.admin-shell-v206-ready #adminContentV206 #calendarSafetyWarning.global-safeguarding-warning:not(.hidden) {
  position: sticky !important;
  top: calc(var(--admin-header-sticky-height, 82px) + 12px) !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 0 .75rem !important;
  border-radius: .8rem !important;
  z-index: 40 !important;
  box-shadow: 0 6px 18px rgba(180,35,24,.16) !important;
}

@media (max-width: 900px) {
  .admin-shell-v206-ready #adminContentV206 #calendarSafetyWarning.global-safeguarding-warning:not(.hidden) {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 1200 !important;
  }
}
