/* Keep wide calendars/tables inside their own scrollers, including on iOS. */
.availability-toolbar,.availability-range { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; }
.availability-range { align-items:flex-end; }
.availability-guide { margin-top:12px; padding:12px; border-radius:8px; background:#eff6ff; color:#334155; font-size:12px; line-height:1.6; }
.availability-guide li+li { margin-top:4px; }
.availability-savebar { padding:12px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; }
#availability-feedback { flex:1 1 180px; }
#availability-save,#availability-confirm { background:#0f172a; color:white; font-weight:600; border-color:#0f172a; }
#availability-save:enabled:hover,#availability-confirm:enabled:hover { background:#334155; }
.availability-toolbar button,.availability-range button { min-height:36px; border:1px solid #cbd5e1; border-radius:8px; padding:6px 10px; font-size:12px; }
.availability-toolbar button:disabled { opacity:.45; }
.availability-range label { display:flex; flex-direction:column; gap:4px; font-size:11px; min-width:0; }
.availability-range input,.availability-range select { min-height:36px; max-width:100%; border:1px solid #cbd5e1; border-radius:6px; padding:4px; }
.availability-table { border-collapse:collapse; font-size:11px; }
.availability-table th,.availability-table td { border:1px solid #e2e8f0; padding:4px; white-space:nowrap; }
.availability-table th:first-child { position:sticky; left:0; background:#f8fafc; z-index:1; max-width:140px; white-space:normal; min-width:100px; }
.availability-table button { min-height:44px; min-width:44px; border-radius:6px; font-weight:700; background:#f1f5f9; color:#475569; }
.availability-table button[data-state="1"] { background:#d1fae5; color:#065f46; }
.availability-table button[data-state="0"] { background:#ffe4e6; color:#9f1239; }
.availability-table button.availability-draft { outline:2px solid #2563eb; outline-offset:-2px; }
#availability-review { width:calc(100% - 32px); max-width:540px; max-height:80dvh; padding:20px; border:1px solid #cbd5e1; border-radius:12px; }
#availability-review::backdrop { background:#0f172a99; }
#availability-review-list { max-height:45dvh; overflow:auto; font-size:12px; margin-top:12px; }
#availability-review-list li { margin-bottom:8px; }
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) {
  #availability-save { width:100%; }
  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>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; } }
/* Calendar colors: pale fills preserve workflow borders and readable dark text. */
.calendar-colors-trigger, .calendar-colors-dialog button, .shift-color-controls button { min-height: 40px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 12px; font-size: 12px; font-weight: 600; }
.calendar-colors-trigger { background: #fff; color: #334155; white-space: nowrap; }
.calendar-legend-actions { flex-wrap: wrap; max-width: 100%; }
.calendar-colors-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; color: #1e293b; }
.calendar-colors-dialog::backdrop { background: rgb(15 23 42 / 40%); }
.color-dialog-heading, .color-dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.color-dialog-heading h2 { font-weight: 700; font-size: 18px; }
.color-help { font-size: 12px; color: #475569; line-height: 1.6; margin: 10px 0; }
.color-date-fields { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.color-date-fields label { flex: 1; min-width: 120px; font-size: 12px; }
.color-date-fields input, .color-date-fields select { display: block; width: 100%; height: 44px; min-height: 44px; font-size: 16px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px; margin-top: 5px; background: #fff; }
.color-date-fields select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.color-swatches .color-swatch { width: 44px; height: 44px; padding: 0; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%); }
.color-swatches button[aria-pressed="true"] { outline: 2px solid #0f172a; outline-offset: 2px; }
.color-swatches button[aria-pressed="true"]::after { content: '✓'; background: #fff; color: #0f172a; border-radius: 50%; padding: 1px 4px; }
.color-custom { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.color-custom input { width: 52px; height: 44px; padding: 3px; border: 1px solid #cbd5e1; border-radius: 8px; }
.color-preview { padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 12px; line-height: 1.5; margin: 12px 0; color: #334155; }
.calendar-colors-dialog .color-primary, .shift-color-controls .color-primary { background: #0f172a; color: #fff; border-color: #0f172a; }
.color-import { margin-top: 20px; border-top: 1px solid #e2e8f0; padding-top: 14px; font-size: 12px; }
.color-import label { display: block; margin: 12px 0; }
.color-import input { max-width: 100%; display: block; margin-top: 8px; }
.calendar-colors-dialog button:disabled, .shift-color-controls button:disabled { opacity: .5; cursor: wait; }
.calendar-colors-dialog :focus-visible, .calendar-colors-trigger:focus-visible, .calendar-color-picker :focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
@media (max-width: 640px) { .calendar-colors-dialog { padding: 16px; } }

/* Send portal links dialog */
.invite-shortcut { min-height:32px; padding:4px 10px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; color:#334155; }
.invite-shortcut:hover { background:#f8fafc; }
.invite-list { margin:12px 20px; border:1px solid #e2e8f0; border-radius:10px; overflow-y:auto; min-height:120px; }
.invite-row { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; border-top:1px solid #f1f5f9; cursor:pointer; }
.invite-row:first-child { border-top:0; }
.invite-row input { width:18px; height:18px; margin-top:2px; flex-shrink:0; }
.invite-row input:disabled { cursor:not-allowed; }
.invite-row-body { flex:1; min-width:0; display:flex; flex-direction:column; }
.invite-row-name { font-size:13px; font-weight:600; color:#0f172a; overflow-wrap:anywhere; }
.invite-row-meta { font-size:11px; color:#64748b; overflow-wrap:anywhere; }
.invite-row-status { font-size:11px; font-weight:600; max-width:40%; text-align:right; overflow-wrap:anywhere; }
.invite-row-status[data-status="sent"] { color:#047857; }
.invite-row-status[data-status="failed"],.invite-row-status[data-status="unknown"] { color:#be123c; }
.invite-row-status[data-status="skipped"] { color:#92400e; }
