/* Scoped responsive repairs: existing colors, typography and authentication are retained. */
:root { --public-mobile-nav-space: calc(5rem + env(safe-area-inset-bottom, 0px)); }
.mastaba-app-header { min-width: 0; flex-wrap: wrap; gap: 1rem; }
.mastaba-app-header > * { min-width: 0; max-width: 100%; }
.mastaba-header-tools { min-width: 0; max-width: 100%; flex-wrap: wrap; gap: .75rem; }
.mastaba-header-tools > * { flex-shrink: 0; max-width: 100%; }
.mastaba-header-tools input { max-width: 100%; }
.content-admin-header-row, .content-admin-actions { min-width: 0; flex-wrap: wrap; gap: .75rem; }
.content-admin-header-row > *, .content-admin-actions > * { min-width: 0; max-width: 100%; }
.content-admin-actions > button, .contact-inbox-nav-link { min-height: 44px; }
.contact-inbox-nav-link { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: .5rem 1rem; border: 1px solid #ffffff50; border-radius: .75rem; background: #047857; color: #fff; font: inherit; font-size: .75rem; font-weight: 700; text-decoration: none; }
.contact-inbox-nav-link:focus-visible { outline: 2px solid #d4a045; outline-offset: 3px; }
.myf-admin-sidebar { height: auto; max-height: none; min-height: 0; overflow: hidden; }
.myf-admin-sidebar > nav { flex: 1 1 0%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.myf-admin-sidebar > :first-child, .myf-admin-sidebar > :last-child { flex-shrink: 0; }
.myf-finance-filters { min-width: 0; flex-wrap: wrap; overflow-x: visible; }
.myf-finance-filters > select { min-width: 0; max-width: 100%; }
@media (max-width: 1023px) {
  .mastaba-app-header { flex-direction: column; align-items: stretch; gap: .75rem; padding: 1rem; }
  .mastaba-header-tools { width: 100%; justify-content: flex-start; gap: .5rem; }
  .mastaba-header-tools > button { width: 44px; height: 44px; flex-shrink: 0; }
  .mastaba-header-tools > div:last-child { padding-inline: 0; }
  .mastaba-support-widget { bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px)); left: 1rem; }
  .mastaba-support-widget > div { max-width: calc(100vw - 2rem); max-height: calc(100dvh - 9rem); }
}
@media (max-width: 767px) {
  .article-font-controls { bottom: var(--public-mobile-nav-space); }
  .article-font-controls > button { width: 44px; height: 44px; }
  .mastaba-web-surface .min-h-screen.flex.items-center.justify-center { padding-bottom: calc(var(--public-mobile-nav-space) + 1rem); }
  .mastaba-report-heading { flex-direction: column; align-items: stretch; gap: 1rem; }
  .mastaba-report-actions { min-width: 0; max-width: 100%; flex-wrap: wrap; }
  .mastaba-report-actions > button { flex: 1 1 7rem; justify-content: center; min-height: 44px; }
  .content-admin-header-row { flex-direction: column; align-items: stretch; }
  .content-admin-actions { width: 100%; }
}
@media (max-width: 639px) {
  .myf-finance-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .myf-finance-filters > select { width: 100%; min-height: 44px; font-size: 16px; }
}

/* Mastaba phone repairs: scoped to the authenticated application and its portals. */
.mastaba-app-shell > main { min-width: 0; min-height: 0; }
.mastaba-app-shell #main-content { min-width: 0; min-height: 0; }
.mastaba-page-heading, .mastaba-toolbar, .mastaba-card-heading, .mastaba-action-group { min-width: 0; max-width: 100%; flex-wrap: wrap; gap: .75rem; }
.mastaba-page-heading > *, .mastaba-toolbar > *, .mastaba-card-heading > * { min-width: 0; max-width: 100%; }
.mastaba-page-heading h2, .mastaba-card-heading h3 { overflow-wrap: anywhere; }
.mastaba-action-group > button, .mastaba-toolbar > button { flex-shrink: 0; max-width: 100%; }
.mastaba-table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.mastaba-table-scroll table { width: 100%; min-width: 40rem; }
.mastaba-table-scroll td:last-child { white-space: nowrap; }
.mastaba-table-scroll:focus-visible { outline: 2px solid #d4a045; outline-offset: 2px; }
.mastaba-message-composer-row, .mastaba-message-input, .mastaba-messages-layout { min-width: 0; max-width: 100%; }
.mastaba-message-input { flex: 1 1 0%; width: 0; }
.mastaba-message-tools, .mastaba-message-send { flex-shrink: 0; }
.mastaba-modal-layer { position: fixed; inset: 0; z-index: 10000; isolation: isolate; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; padding: 1rem; }
.mastaba-modal-layer > div:not(.absolute) { min-width: 0; min-height: 0; max-width: 100%; max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; flex-shrink: 1; }
.mastaba-modal-layer input, .mastaba-modal-layer select, .mastaba-modal-layer textarea { max-width: 100%; min-width: 0; }
.mastaba-modal-layer .mastaba-action-group { flex-shrink: 0; }
.mastaba-conversation-drawer { z-index: 10000; height: 100dvh; max-height: 100dvh; max-width: calc(100vw - 1rem); padding-bottom: env(safe-area-inset-bottom, 0px); }
.mastaba-support-panel { position: fixed !important; left: 1rem !important; top: auto !important; bottom: 6rem !important; z-index: 11000; margin: 0 !important; width: 25rem; max-width: calc(100vw - 2rem) !important; height: min(31.25rem, calc(100dvh - 7rem)) !important; max-height: calc(100dvh - 7rem) !important; }
body[data-mastaba-modal-open] .mastaba-support-panel { display: none; }
@media (max-width: 1279px) {
  .mastaba-app-shell { height: 100dvh; }
  .mastaba-app-shell #main-content { padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); scroll-padding-block: 1rem calc(5rem + env(safe-area-inset-bottom, 0px)); }
  .mastaba-mobile-navigation { height: calc(4rem + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .mastaba-mobile-nav-item { flex: 1 1 0%; min-width: 0; min-height: 3.5rem; padding-inline: .125rem; }
  .mastaba-mobile-nav-item > svg, .mastaba-mobile-nav-item > div { flex-shrink: 0; }
  .mastaba-mobile-nav-item > span:not(.bg-red-500) { max-width: 100%; white-space: nowrap; font-size: 9px; }
  .mastaba-header-tools .mastaba-support-widget { position: static; inset: auto; z-index: auto; flex-shrink: 0; }
  .mastaba-header-tools .mastaba-support-widget > button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; transform: none; }
  .mastaba-header-tools .mastaba-support-widget > button > svg { width: 21px; height: 21px; }
  .mastaba-player-root { height: auto; min-height: 0; }
  .mastaba-player-layout { min-height: 0; align-items: stretch; }
  .mastaba-player-sidebar { height: auto; max-height: none; flex-shrink: 0; min-width: 0; }
  .mastaba-player-lessons { flex: 0 1 auto; min-height: 0; }
  .mastaba-player-lessons > div:last-child { flex: 0 1 auto; min-height: 4rem; max-height: 22rem; overflow-y: auto; scroll-padding-block: .75rem; }
  .mastaba-player-video-area { min-width: 0; min-height: 0; }
}
@media (max-width: 767px) {
  .mastaba-page-heading { flex-direction: column; align-items: stretch; gap: .75rem; }
  .mastaba-page-heading > .mastaba-action-group { width: 100%; }
  .mastaba-page-heading button, .mastaba-toolbar button, .mastaba-action-group button { min-height: 44px; }
  .mastaba-player-sidebar { width: 100%; max-width: 100%; }
  .mastaba-modal-layer .mastaba-page-heading, .mastaba-modal-layer .mastaba-card-heading { flex-direction: row; align-items: flex-start; }
}
@media (max-width: 639px) {
  .mastaba-message-composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .5rem; }
  .mastaba-message-input { grid-column: 1 / -1; grid-row: 1; width: 100%; font-size: 16px; }
  .mastaba-message-tools { grid-column: 1; grid-row: 2; justify-self: start; }
  .mastaba-message-send { grid-column: 2; grid-row: 2; min-width: 44px; min-height: 44px; }
}
@media (min-width: 768px) and (max-width: 1279px) {
  .mastaba-player-sidebar { width: 18rem; max-width: 42%; }
}
@media (max-width: 1279px) and (max-height: 500px) {
  .mastaba-app-header { flex-direction: row; align-items: center; flex-wrap: wrap; padding: .5rem 1rem; gap: .5rem; }
  .mastaba-app-header > div:first-child p { display: none; }
  .mastaba-app-header h2 { font-size: 1.125rem; margin: 0; }
  .mastaba-header-tools { width: auto; justify-content: flex-start; gap: .5rem; }
  .mastaba-modal-layer { padding: .5rem; }
  .mastaba-modal-layer > div:not(.absolute) { max-height: calc(100dvh - 1rem); }
}
@media (max-width: 1023px) { .mastaba-app-shell .mastaba-settings-tabs { position: static; top: auto; } }
.mastaba-table-scroll .mastaba-action-group { flex-wrap: nowrap; max-width: none; gap: .5rem; }
.mastaba-table-scroll button { min-width: 44px; min-height: 44px; }
.mastaba-student-detail-header { min-width: 0; flex-wrap: wrap; gap: .75rem; }
.mastaba-student-detail-header > * { min-width: 0; max-width: 100%; }
.mastaba-student-detail-header > div:first-child { flex: 1 1 12rem; }
.mastaba-student-detail-header > div:first-child > div { min-width: 0; overflow-wrap: anywhere; }
.mastaba-student-detail-header img { flex-shrink: 0; }
@media (max-width: 1279px) {
 .mastaba-student-detail-panel { display: block; }
 .mastaba-student-detail-content { overflow: visible; }
 .mastaba-student-detail-tabs { position: static; }
}
.mastaba-table-scroll { overflow-y: auto; }
@media (max-width: 1279px) {
 .mastaba-student-table-container { height: auto; max-height: none; }
 .mastaba-student-table-container > .mastaba-table-scroll { flex: 0 1 auto; }
}
