/* Keep wide calendars/tables inside their own scrollers, including on iOS. */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body { width:100%; min-width:0; }
main,.tab-panel { min-width:0; }
#calendar-scroll { width:100%; max-width:100%; min-width:0; }
#toast-container { width:calc(100% - 32px); }
.context-shift { display:block; width:100%; overflow-wrap:anywhere; text-align:left; white-space:pre-line; padding:12px 0; font-size:14px; line-height:1.6; border-radius:8px; }
.context-shift:hover { background:#f8fafc; }
.calendar-scroll-fade { position:absolute; top:1px; bottom:1px; right:1px; width:24px; border-radius:0 12px 12px 0; background:linear-gradient(to right, transparent, #cbd5e1b3); pointer-events:none; }
.refresh-status { padding:10px 16px; border-bottom:1px solid #e2e8f0; font-size:13px; background:#eff6ff; color:#1e40af; }
.refresh-status[data-state="success"] { background:#ecfdf5; color:#047857; }
.refresh-status[data-state="error"] { background:#fff1f2; color:#be123c; }
.is-refreshing svg { animation:refreshSpin 1s linear infinite; }
[data-refresh-button]:disabled { opacity:.6; cursor:wait; }
@keyframes refreshSpin { to { transform:rotate(360deg); } }
[data-shift-id] { -webkit-touch-callout:none; user-select:none; }
.touch-drag-source { opacity:.45; }
.touch-drop-valid { outline:3px solid #10b981; outline-offset:-3px; background:#ecfdf5 !important; }
.touch-drop-blocked { outline:3px solid #f43f5e; outline-offset:-3px; background:#fff1f2 !important; }
.touch-shift-preview { position:fixed; top:0; left:0; pointer-events:none; z-index:90; padding:8px 12px; border-radius:8px; background:#0f172a; color:white; font-size:12px; font-weight:600; box-shadow:0 6px 20px #0f172a33; }
.mobile-actions-toggle { display:flex; align-items:center; justify-content:center; width:44px; height:44px; border:1px solid #e2e8f0; border-radius:10px; color:#334155; cursor:pointer; list-style:none; }
.mobile-actions-toggle::-webkit-details-marker { display:none; }
.mobile-actions-toggle:focus-visible { outline:3px solid #2563eb; outline-offset:2px; }
.mobile-actions-panel { position:absolute; right:0; top:calc(100% + 8px); width:220px; max-width:calc(100vw - 32px); padding:6px; background:white; border:1px solid #e2e8f0; border-radius:12px; box-shadow:0 12px 32px #0f172a26; }
.mobile-actions-panel button { display:flex; align-items:center; gap:10px; width:100%; min-height:44px; padding:10px 12px; font-size:13px; font-weight:600; text-align:left; border-radius:8px; color:#334155; }
.mobile-actions-panel button:hover { background:#f1f5f9; }
.mobile-actions-panel .mobile-actions-logout { border-top:1px solid #e2e8f0; border-radius:0 0 8px 8px; color:#be123c; }
button:focus-visible, [data-calendar-date]:focus-visible { outline:3px solid #2563eb; outline-offset:2px; }
.dtab.active,.mtab.active,.subtab.active { background:#e2e8f0; color:#0f172a; border-radius:8px; font-weight:700; }
.mobile-sections { display:flex; gap:6px; padding:8px 12px; border-bottom:1px solid #e2e8f0; }
.mobile-sections[hidden] { display:none; }
.mobile-sections button { flex:1; min-height:36px; font-size:12px; color:#475569; }
@media(min-width:768px) { #assignment-modal { align-items:stretch; justify-content:flex-end; padding:0; } #assignment-modal>div { max-height:100dvh; height:100dvh; max-width:460px; border-radius:0; box-shadow:-12px 0 36px #0f172a26; } }
@media(max-width:767px) { main { padding-bottom:150px !important; } #assignment-modal>div { padding-bottom:env(safe-area-inset-bottom); } nav.fixed { padding-bottom:env(safe-area-inset-bottom); } }
@media(max-width:639px) {
  header>div { gap:8px; }
  header>div>div:first-child { flex:1; min-width:0; }
  header>div>div:first-child>div:first-child { flex-shrink:0; }
  #operation-context { max-width:100%; }
  #tab-matrix>div:first-child>div:last-child { flex-wrap:wrap; }
  #tab-calendar .calendar-month-controls { display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; width:100%; gap:6px; }
  #calendar-month-label { min-width:0; font-size:13px; }
  .calendar-month-controls button { flex-shrink:0; }
  .calendar-month-controls button[onclick="goToToday()"] { padding-left:8px; padding-right:8px; font-size:12px; }
  nav.fixed .mtab,.mobile-sections button { min-width:0; }
  nav.fixed .mtab { padding-left:4px; padding-right:4px; }
  nav.fixed .mtab span { font-size:12px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }
