/*
 * Sprint 6.6.5 — uzun Türkçe metin ve dar ekran dayanıklılığı.
 * Baskı kâğıdı (.s47-paper) bilinçli olarak kapsam dışıdır; A4 ölçüsü korunur.
 */
:where(
  .app-shell,
  .s47-output-drawer,
  .s48-time-drawer,
  .s49-academic-drawer,
  .s51-modal,
  .s61-shell,
  .s62-shell,
  .s643-shell,
  .s644-window,
  .s646-shell,
  .s410-constraint-drawer,
  .s411-rule-drawer
) :where(section, article, header, footer, main, aside, nav, div, form, label, dl, ul, li) {
  min-width: 0;
}

:where(
  .app-shell,
  .s47-output-controls,
  .s48-time-drawer,
  .s49-academic-drawer,
  .s51-modal,
  .s61-shell,
  .s62-shell,
  .s643-shell,
  .s644-window,
  .s646-shell,
  .s410-constraint-drawer,
  .s411-rule-drawer
) :where(h1, h2, h3, h4, p, strong, small, span, em, dd, dt, label, li, td, th, a, button) {
  overflow-wrap: anywhere;
  word-break: normal;
}

:where(
  .app-shell,
  .s47-output-controls,
  .s48-time-drawer,
  .s49-academic-drawer,
  .s51-modal,
  .s61-shell,
  .s62-shell,
  .s643-shell,
  .s644-window,
  .s646-shell,
  .s410-constraint-drawer,
  .s411-rule-drawer
) :where(input, select, textarea) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

:where(
  .s47-output-controls,
  .s48-time-drawer,
  .s49-academic-drawer,
  .s51-modal,
  .s61-shell,
  .s62-shell,
  .s643-shell,
  .s644-window,
  .s646-shell,
  .s410-constraint-drawer,
  .s411-rule-drawer
) button:not([aria-label="Kapat"]):not([aria-label="Close"]) {
  max-width: 100%;
  min-height: 36px;
  height: auto;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}

:where(.s644-header, .s644-notice, .s644-panel-title, .s644-footer, .s646-header, .s646-trust, .s646-footer) {
  flex-wrap: wrap;
}

.s644-header > div,
.s644-notice > :not(.s644-pill),
.s644-panel-title > :first-child,
.s646-header > div,
.s646-trust > span,
.s646-footer > span {
  flex: 1 1 260px;
  min-width: 0;
}

.s644-pill,
.s646-trust em {
  flex: 0 1 auto;
  margin-left: auto;
  white-space: normal;
  text-align: center;
}

.s649-readiness-copy,
.s649-readiness-hero dl,
.s650-database-grid > *,
.s651-shadow-summary,
.s651-shadow-scopes {
  min-width: 0;
}

.s649-readiness-copy h2,
.s649-readiness-copy p,
.s650-db-state > strong,
.s650-db-check > strong,
.s651-shadow-summary > strong,
.s651-shadow-scopes strong,
.s651-shadow-scopes small {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.s651-database-actions {
  align-items: stretch;
}

.s651-database-actions > :where(button, a) {
  flex: 0 1 auto;
  max-width: 100%;
}

.s644-panel :where(th, td) {
  max-width: 280px;
  white-space: normal;
  line-height: 1.4;
  vertical-align: top;
}

.s644-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.s644-metric,
.summary-card,
.school-overview-summary article {
  overflow: hidden;
}

.s644-metric small,
.summary-card :where(span, small),
.school-overview-summary article :where(span, small) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.s646-footer > div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.s646-footer a {
  padding: 8px 10px;
  border: 1px solid #cbd7e8;
  border-radius: 8px;
  color: #18345e;
  text-decoration: none;
}

@media (max-width: 900px) {
  .s649-readiness-hero dl,
  .s650-database-grid,
  .s651-shadow-scopes {
    width: 100%;
  }

  .s644-panel-title,
  .s646-footer {
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .s644-header h1,
  .s646-header h1 {
    font-size: clamp(20px, 7vw, 27px);
  }

  .s644-content,
  .s646-content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .s649-readiness-hero dl {
    grid-template-columns: 1fr;
  }

  .s651-database-actions,
  .s646-footer > div {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .s651-database-actions > :where(button, a),
  .s646-footer :where(button, a) {
    width: 100%;
  }
}

/*
 * Program görünümü, genel düğme sarma kuralının bilinçli istisnasıdır.
 * Bu dosya program CSS'inden sonra yüklendiği için seçici özgüllüğü burada
 * açıkça korunur; Türkçe görünüm etiketleri hiçbir genişlikte harf bazında
 * bölünmez.
 */
.s51-modal .s51-viewbar .s51-segment button {
  flex: 0 0 auto;
  min-width: 112px;
  min-height: 32px;
  height: 32px;
  line-height: 1;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

/*
 * Tam ekran program katmanında her flex halkasının küçülebilmesi gerekir.
 * Böylece iç program, modalın altına taşmak yerine kalan viewport yüksekliğini
 * kullanır ve tek kaydırma alanı olarak davranır.
 */
.s51-modal.s638-editor-mode {
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
}

.s51-modal.s638-editor-mode .s51-body,
.s51-modal.s638-editor-mode .s51-main,
.s51-modal.s638-editor-mode .s51-tab-content,
.s51-modal.s638-editor-mode .s638-editor-workspace {
  min-height: 0;
}

.s51-modal.s638-editor-mode .s51-tab-content,
.s51-modal.s638-editor-mode .s638-editor-workspace,
.s51-modal.s638-editor-mode .s51-preview-scroll {
  flex: 1 1 0;
}

.s51-modal.s638-editor-mode .s51-tab-content,
.s51-modal.s638-editor-mode .s638-editor-workspace {
  overflow: hidden;
}

.s51-modal.s638-editor-mode .s51-preview-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.s51-modal.s638-editor-mode .s51-schedule-grid {
  min-height: 100%;
  grid-auto-rows: minmax(42px, 1fr);
}
