/* Locked shell chrome regions (E1.M2) */

body.shell-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    text-align: left;
    background: #e5e7eb;
}

#shell {
    display: grid;
    grid-template-rows: auto auto 1fr var(--shell-bottom-height, 9.5rem);
    min-height: 100vh;
    max-height: 100vh;
    max-width: 100%;
    overflow: hidden;
    --shell-bottom-height: 9.5rem;
}

#shell-top-primary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #d1d5db;
}

#shell-top-primary .shell-brand {
    min-width: 0;
}

.shell-brand-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.shell-brand-heading #shell-brand-title {
    margin: 0;
}

.shell-brand-heading #shell-brand-title.shell-brand-title--interactive {
    cursor: pointer;
    border-radius: 0.25rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.shell-brand-heading #shell-brand-title.shell-brand-title--interactive:hover,
.shell-brand-heading #shell-brand-title.shell-brand-title--interactive:focus-visible {
    color: #1d4ed8;
    background-color: rgba(37, 99, 235, 0.08);
    outline: none;
}

.shell-test-mode {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.shell-test-mode.hidden,
.shell-test-mode[hidden] {
    display: none !important;
}

.shell-test-mode__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    line-height: 1.2;
}

.shell-test-mode__btn:hover {
    background: #fef3c7;
    border-color: #d97706;
}

.shell-test-mode-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: min(60vh, 24rem);
}

.shell-test-mode-modal__scroll {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 0;
    max-height: min(52vh, 20rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.15rem 0.35rem 0.75rem 0.1rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #d97706 #fef3c7;
}

.shell-test-mode-modal__scroll::-webkit-scrollbar {
    width: 0.65rem;
}

.shell-test-mode-modal__scroll::-webkit-scrollbar-track {
    background: #fef3c7;
    border-radius: 999px;
}

.shell-test-mode-modal__scroll::-webkit-scrollbar-thumb {
    background: #d97706;
    border-radius: 999px;
    border: 2px solid #fef3c7;
}

.shell-test-mode-modal.is-scrollable:not(.is-at-bottom)::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0.65rem;
    bottom: 1.55rem;
    height: 2.25rem;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 85%);
}

.shell-test-mode__scroll-hint {
    margin: 0;
    padding: 0.2rem 0.35rem 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #b45309;
    text-align: center;
}

.shell-test-mode__scroll-hint[hidden] {
    display: none !important;
}

.shell-test-mode__group {
    margin: 0;
}

.shell-test-mode__section {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    margin: 0 0 0.2rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.3rem;
    cursor: pointer;
}

.shell-test-mode__section:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

.shell-test-mode__section-label {
    flex: 1;
    min-width: 0;
}

.shell-test-mode__section-meta {
    font-size: 0.62rem;
    font-weight: 700;
    color: #b45309;
    background: #fde68a;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
}

.shell-test-mode__section-chevron::before {
    content: '▾';
    display: inline-block;
    font-size: 0.75rem;
    color: #b45309;
    transition: transform 0.15s ease;
}

.shell-test-mode__group.is-collapsed .shell-test-mode__section-chevron::before {
    transform: rotate(-90deg);
}

.shell-test-mode__group-items {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.shell-test-mode__group-items[hidden] {
    display: none !important;
}

.shell-test-mode__item {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: #fffbeb;
    color: #1f2937;
    border-radius: 0.35rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.shell-test-mode__item:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

.shell-test-mode__empty {
    margin: 0;
    padding: 0.35rem;
    font-size: 0.75rem;
    color: #6b7280;
}

body.is-test-mode #shell-brand-title::after {
    /* visual cue kept on the Test chip; reserved for future badge */
    content: none;
}

#shell-top-primary .shell-clock-cluster {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.shell-clock-cluster__chrome {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    width: 150px;
}

.shell-clock-cluster__drag {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 1.75rem;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    border-radius: 0.375rem;
    padding: 0.2rem 0.4rem;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.shell-clock-cluster__drag:active {
    cursor: grabbing;
}

.shell-top-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 1.75rem;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 0.375rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
}

.shell-top-collapse:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Lean timer (mobile super-collapsed) — hidden on desktop */
.shell-lean-pause {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 1.75rem;
    border: 1px solid #93c5fd;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 0.375rem;
    padding: 0.2rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    line-height: 1.2;
    flex: 1 1 auto;
    min-width: 0;
}

.shell-lean-pause:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

.shell-lean-pause.is-paused {
    border-color: #fbbf24;
    background: #fffbeb;
    color: #92400e;
}

.shell-lean-pause.is-iced {
    border-color: #38bdf8;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 45%, #f0f9ff 100%);
    color: #0c4a6e;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.shell-lean-pause__icon {
    flex-shrink: 0;
    color: #2563eb;
}

.shell-lean-pause.is-paused .shell-lean-pause__icon {
    color: #d97706;
}

.shell-lean-pause.is-iced .shell-lean-pause__icon {
    color: #0284c7;
}

.shell-lean-pause__time {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shell-clock-display {
    position: relative;
    transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.shell-clock-display.is-iced {
    background: linear-gradient(160deg, #e0f2fe 0%, #bae6fd 42%, #f0f9ff 100%);
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.35), 0 8px 18px rgba(14, 165, 233, 0.18);
    color: #0c4a6e;
}

.shell-clock-display.is-iced .shell-clock-display__icon {
    color: #0284c7;
}

.shell-clock-display__row {
    position: relative;
    min-width: 0;
}

.shell-clock-iced {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 0.15rem;
    position: relative;
    left: -0.4rem;
    padding: 0.12rem 0.3rem 0.12rem 0.18rem;
    border-radius: 0.35rem;
    border: 1px solid rgba(14, 165, 233, 0.45);
    background: rgba(240, 249, 255, 0.96);
    color: #0369a1;
    line-height: 1;
    animation: shell-clock-iced-float 1.8s ease-in-out infinite;
}

.shell-clock-iced[hidden] {
    display: none !important;
}

.shell-clock-iced__cube {
    display: block;
    flex-shrink: 0;
    overflow: visible;
}

.shell-clock-iced__body {
    transform-origin: 20px 20px;
    animation: shell-clock-iced-cube-tilt 2.4s ease-in-out infinite;
}

.shell-clock-iced__glaze {
    transform-box: fill-box;
    transform-origin: top center;
    animation: shell-clock-iced-glaze 2.2s ease-in-out infinite;
}

.shell-clock-iced__drip {
    stroke-dasharray: 18;
    stroke-dashoffset: 18;
    opacity: 0.85;
    animation: shell-clock-iced-drip 2.2s ease-in-out infinite;
}

.shell-clock-iced__drip--delay {
    animation-delay: 0.35s;
}

.shell-clock-iced__sparkle {
    transform-origin: center;
    transform-box: fill-box;
    animation: shell-clock-iced-sparkle 1.4s ease-in-out infinite;
}

.shell-clock-iced__sparkle--delay {
    animation-delay: 0.45s;
}

.shell-clock-iced__sparkle--delay-2 {
    animation-delay: 0.9s;
}

.shell-clock-iced__label {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-shadow: 0 0 8px rgba(125, 211, 252, 0.85);
}

.shell-lean-pause .shell-clock-iced {
    margin-left: 0;
    margin-right: 0.1rem;
    left: -0.25rem;
    flex-shrink: 0;
    gap: 0.12rem;
    padding: 0.06rem 0.22rem 0.06rem 0.12rem;
}

.shell-lean-pause .shell-clock-iced__cube {
    width: 15px;
    height: 15px;
}

.shell-lean-pause .shell-clock-iced__label {
    font-size: 0.5rem;
}

.shell-clock-display.is-flash-yellow,
.shell-lean-pause.is-flash-yellow {
    animation: shell-clock-flash-yellow 1.1s ease-out 1;
}

.shell-clock-display.is-flash-red,
.shell-lean-pause.is-flash-red {
    animation: shell-clock-flash-red 1.25s ease-out 1;
}

@keyframes shell-clock-iced-float {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.25);
    }
    50% {
        transform: translateY(-1px);
        box-shadow: 0 0 10px 1px rgba(125, 211, 252, 0.5);
    }
}

@keyframes shell-clock-iced-cube-tilt {
    0%, 100% {
        transform: rotate(-3deg) translateY(0);
    }
    50% {
        transform: rotate(3deg) translateY(-0.5px);
    }
}

@keyframes shell-clock-iced-glaze {
    0% {
        transform: translateY(-110%);
        opacity: 0.2;
    }
    35%, 60% {
        transform: translateY(0);
        opacity: 0.95;
    }
    100% {
        transform: translateY(18%);
        opacity: 0.35;
    }
}

@keyframes shell-clock-iced-drip {
    0%, 20% {
        stroke-dashoffset: 18;
        opacity: 0;
    }
    45%, 70% {
        stroke-dashoffset: 0;
        opacity: 0.9;
    }
    100% {
        stroke-dashoffset: -6;
        opacity: 0.15;
    }
}

@keyframes shell-clock-iced-sparkle {
    0%, 100% {
        opacity: 0.15;
        transform: scale(0.7);
    }
    50% {
        opacity: 1;
        transform: scale(1.25);
    }
}

@keyframes shell-clock-flash-yellow {
    0%, 100% {
        background-color: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
        color: inherit;
    }
    20%, 55% {
        background-color: #fef08a;
        box-shadow: 0 0 0 2px #facc15, 0 0 18px rgba(250, 204, 21, 0.65);
        color: #854d0e;
    }
}

@keyframes shell-clock-flash-red {
    0%, 100% {
        background-color: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
        color: inherit;
    }
    18%, 52% {
        background-color: #fecaca;
        box-shadow: 0 0 0 2px #ef4444, 0 0 20px rgba(239, 68, 68, 0.7);
        color: #991b1b;
    }
}

.shell-disclaimers {
    margin-top: 0.25rem;
    margin-bottom: 0.55rem;
    color: #9ca3af;
    font-size: 0.75rem;
    line-height: 1.35;
}

.shell-disclaimers__summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: #9ca3af;
}

.shell-disclaimers__summary::-webkit-details-marker {
    display: none;
}

.shell-disclaimers__summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 0.35rem;
    color: #9ca3af;
    transition: transform 0.12s ease;
}

.shell-disclaimers[open] > .shell-disclaimers__summary::before {
    transform: rotate(90deg);
}

.shell-disclaimers__body {
    margin-top: 0.25rem;
    color: #9ca3af;
}

.scenario-pack-title {
    margin-top: 0;
    max-width: 36rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    color: #374151;
}

.scenario-pack-objectives {
    max-width: 36rem;
}

.scenario-pack-objectives__heading {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 400;
    color: #9ca3af;
}

.scenario-pack-objectives__list {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.shell-brand-read-more {
    display: none;
    margin-top: 0.35rem;
    border: 0;
    background: transparent;
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.shell-brand-read-more:hover {
    color: #1e40af;
}

/* Orders / Tools / Delegate accordion (desktop = always open labels) */
.rail-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.rail-accordion__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0 0 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    cursor: default;
    text-align: left;
}

.rail-accordion__section + .rail-accordion__section .rail-accordion__toggle {
    margin-top: 0.45rem;
}

.rail-accordion__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.15rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.65rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    text-transform: none;
}

.rail-accordion__badge.is-zero {
    opacity: 0.55;
}

.rail-accordion__panel[hidden] {
    display: none;
}

.shell-slots-toggle,
.shell-log-toggle {
    display: none;
}

#shell-top-primary.is-collapsed {
    position: relative;
    padding: 0;
    border-bottom: none;
    background: transparent;
    min-height: 0;
    z-index: 55;
}

#shell-top-primary.is-collapsed .shell-brand {
    display: none;
}

#shell-top-primary.is-collapsed .shell-clock-cluster {
    position: fixed;
    z-index: 60;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.5rem;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

/* Default dock: bottom-right, above the slot queue / #shell-bottom. */
#shell-top-primary.is-collapsed .shell-clock-cluster.is-docked-default {
    left: auto;
    top: auto;
    right: 8px;
    bottom: calc(var(--shell-bottom-height, 9.5rem) + 8px);
}

#shell-top-primary.is-collapsed .shell-clock-cluster__chrome {
    width: 100%;
}

#shell-top-primary.is-collapsed .shell-clock-cluster__drag {
    display: inline-flex;
}

#shell-top-primary.is-collapsed .shell-top-collapse {
    flex-shrink: 0;
}

#shell-top-primary.is-collapsed .shell-docs-control {
    align-self: center;
}

body.shell-clock-dragging {
    cursor: grabbing;
    user-select: none;
}

body.shell-clock-dragging #shell-clock-cluster {
    cursor: grabbing;
}

/* Challenge-level boosters (next to clock / pause) */
.shell-boosters {
    position: relative;
    width: 150px;
    border: 1px solid #ddd6fe;
    background: #f5f3ff;
    border-radius: 0.5rem;
    color: #4c1d95;
    font-size: 0.75rem;
}

.shell-boosters--empty {
    opacity: 0.72;
}

.shell-boosters--ready {
    border-color: #a78bfa;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.shell-boosters--freezing {
    border-color: #38bdf8;
    background: #e0f2fe;
    color: #0c4a6e;
}

.shell-boosters__summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    font-weight: 700;
    user-select: none;
}

.shell-boosters__summary::-webkit-details-marker {
    display: none;
}

.shell-boosters__label {
    flex: 1;
    text-align: left;
}

.shell-boosters__count {
    min-width: 1.25rem;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    background: #7c3aed;
    color: #fff;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.shell-boosters--freezing .shell-boosters__count {
    background: #0284c7;
}

.shell-boosters__chevron {
    font-size: 0.65rem;
    opacity: 0.75;
    transition: transform 160ms ease;
}

.shell-boosters[open] .shell-boosters__chevron {
    transform: rotate(180deg);
}

.shell-boosters__menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0 0.45rem 0.5rem;
    border-top: 1px solid rgba(124, 58, 237, 0.2);
}

.shell-boosters__status {
    margin: 0.35rem 0 0;
    font-size: 0.65rem;
    font-weight: 600;
    color: #0369a1;
}

.shell-boosters__action {
    width: 100%;
    border: 1px solid #c4b5fd;
    background: #fff;
    color: #5b21b6;
    border-radius: 0.375rem;
    padding: 0.35rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.shell-boosters__action:hover:not(:disabled) {
    background: #ede9fe;
}

.shell-boosters__action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.shell-sound-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 150px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 0.5rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.shell-sound-toggle:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.shell-sound-toggle.is-muted {
    background: #f3f4f6;
    color: #6b7280;
    border-style: dashed;
}

#shell-top-primary .shell-docs-control {
    align-self: flex-end;
}

#shell-top-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
}

#shell-hour-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.shell-hour-tab {
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    color: #374151;
    border-radius: 0.375rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.shell-hour-tab.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.shell-hour-tab.has-events {
    border-color: #f59e0b;
    box-shadow: inset 0 -2px 0 #f59e0b;
}

/* Hour peek: hover truncated popover */
.hour-peek-popover {
    position: absolute;
    z-index: 60;
    max-width: 280px;
    padding: 0.55rem 0.7rem;
    background: #111827;
    color: #f9fafb;
    border-radius: 0.375rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    font-size: 0.75rem;
    line-height: 1.35;
    pointer-events: auto;
}

.hour-peek-popover.hidden {
    display: none;
}

.hour-peek-popover__title {
    margin: 0 0 0.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #e5e7eb;
}

.hour-peek-popover__list {
    margin: 0;
    padding-left: 1rem;
}

.hour-peek-popover__list li {
    margin: 0.15rem 0;
}

.hour-peek-popover__empty,
.hour-peek-popover__more {
    margin: 0.25rem 0 0;
    color: #d1d5db;
}

.hour-peek-popover__hint {
    margin: 0.45rem 0 0;
    padding-top: 0.35rem;
    border-top: 1px solid #374151;
    color: #93c5fd;
    font-size: 0.7rem;
}

.hour-peek-modal__list {
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
    max-height: 16rem;
    overflow-y: auto;
    font-size: 0.875rem;
}

.hour-peek-modal__list li {
    margin: 0.2rem 0;
}

/* E3.M5 — emergent incident tabs (no clock time on label) */
.incident-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.incident-tab {
    text-align: left;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #92400e;
    border-radius: 0.375rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.incident-tab.is-overdue {
    border-color: #f87171;
    background: #fef2f2;
    color: #991b1b;
}

.incident-tab.is-resolved {
    opacity: 0.55;
    border-color: #d1d5db;
    background: #f9fafb;
    color: #6b7280;
}

.shell-hour-tab:disabled {
    opacity: 0.45;
    cursor: default;
}

#shell-body {
    display: grid;
    grid-template-columns: 12rem 1fr 12rem;
    gap: 0;
    min-height: 0;
    /* Keep census/incidents/panels from painting over #shell-bottom */
    overflow: hidden;
}

#shell-left-menu,
#shell-right-menu {
    background: #f3f4f6;
    border-color: #d1d5db;
    padding: 0.75rem;
    font-size: 0.85rem;
    color: #4b5563;
    min-height: 0;
    overflow-y: auto;
}

#shell-left-menu {
    border-right: 1px solid #d1d5db;
}

#shell-right-menu {
    border-left: 1px solid #d1d5db;
}

#shell-main {
    padding: 1rem;
    min-height: 0;
    overflow: auto;
    background: #e5e7eb;
}

#shell-bottom {
    position: relative;
    display: grid;
    grid-template-columns: 1fr minmax(12rem, auto);
    grid-template-rows: minmax(0, 1fr);
    gap: 0.5rem 1rem;
    padding: 0.65rem 1rem 0.75rem;
    background: #f9fafb;
    border-top: 1px solid #d1d5db;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

#shell-bottom-resize {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0.45rem;
    margin-top: -0.2rem;
    cursor: ns-resize;
    z-index: 2;
    touch-action: none;
}

#shell-bottom-resize::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 0.2rem;
    margin: 0.12rem auto 0;
    border-radius: 999px;
    background: #9ca3af;
}

#shell-bottom-resize:hover::before,
#shell-bottom-resize:focus-visible::before,
body.shell-bottom-resizing #shell-bottom-resize::before {
    background: #2563eb;
}

body.shell-bottom-resizing {
    cursor: ns-resize;
    user-select: none;
}

#shift-history-log {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    min-height: 0;
    max-height: none;
    height: 100%;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    color: #374151;
}

#shift-history-log .shift-log-empty {
    color: #9ca3af;
    margin: 0;
}

#shift-history-log .shift-log-entry {
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    gap: 0.5rem;
    padding: 0.15rem 0;
    border-bottom: 1px solid #f3f4f6;
}

#shift-history-log .shift-log-entry:last-child {
    border-bottom: 0;
}

#shift-history-log .shift-log-time {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.slot-cluster {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    align-self: stretch;
    justify-self: end;
    min-height: 0;
    overflow: auto;
}

#task-queue-bar {
    position: static;
    transform: none;
    left: auto;
    bottom: auto;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Slot / media placeholder preview (slide-up, dismissible) */
.media-ph-preview {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

.media-ph-preview[hidden] {
    display: none !important;
}

.media-ph-preview.is-open {
    pointer-events: auto;
}

.media-ph-preview__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.media-ph-preview.is-open .media-ph-preview__backdrop {
    opacity: 1;
}

.media-ph-preview__panel {
    position: relative;
    z-index: 1;
    width: min(32rem, calc(100vw - 1.5rem));
    max-height: min(78vh, 28rem);
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem 0.75rem;
    border-radius: 0.75rem 0.75rem 0.5rem 0.5rem;
    background: #0f172a;
    color: #e2e8f0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.35);
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    outline: none;
}

.media-ph-preview.is-open .media-ph-preview__panel {
    transform: translateY(0);
}

.media-ph-preview__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.media-ph-preview__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}

.media-ph-preview__close {
    border: 0;
    background: rgba(148, 163, 184, 0.2);
    color: #f8fafc;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.media-ph-preview__close:hover,
.media-ph-preview__close:focus-visible {
    background: rgba(148, 163, 184, 0.35);
    outline: none;
}

.media-ph-preview__body {
    border-radius: 0.45rem;
    overflow: hidden;
    background: #0b1220;
    min-height: 10rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-ph-preview__media {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(60vh, 22rem);
    object-fit: contain;
    object-position: center;
    margin: 0 auto;
}

.media-ph-preview__hint {
    margin: 0;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* Critical lab placeholder still (mediaPlaceholders.mounts.criticalLab) */
.shell-critical-lab-media {
    position: fixed;
    right: 1rem;
    bottom: 5.5rem;
    z-index: 35;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: min(14rem, calc(100vw - 2rem));
    padding: 0.4rem;
    padding-top: 1.65rem;
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.88);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
    color: #e2e8f0;
}

.shell-critical-lab-media[hidden] {
    display: none !important;
}

.shell-critical-lab-media__dismiss {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    z-index: 2;
    border: 0;
    background: rgba(148, 163, 184, 0.22);
    color: #f8fafc;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.shell-critical-lab-media__dismiss:hover,
.shell-critical-lab-media__dismiss:focus-visible {
    background: rgba(148, 163, 184, 0.4);
    outline: none;
}

.shell-critical-lab-media__preview-btn {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 0.35rem;
}

.shell-critical-lab-media__preview-btn:hover .shell-critical-lab-media__img,
.shell-critical-lab-media__preview-btn:focus-visible .shell-critical-lab-media__img {
    outline: 2px solid rgba(148, 163, 184, 0.55);
    outline-offset: 1px;
}

.shell-critical-lab-media__preview-btn:focus-visible {
    outline: none;
}

.shell-critical-lab-media__img {
    width: 100%;
    height: auto;
    border-radius: 0.35rem;
    display: block;
}

.shell-critical-lab-media__caption {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    padding: 0 0.15rem 0.1rem;
}

/* Temporary “Dr will call back” after paging MD on a critical lab */
.shell-awaiting-toast {
    position: fixed;
    left: 50%;
    top: 4.75rem;
    transform: translateX(-50%) translateY(-0.35rem);
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.shell-awaiting-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.shell-awaiting-toast.is-clickable {
    pointer-events: auto;
    cursor: pointer;
}

.shell-awaiting-toast.is-clickable:focus-visible .shell-awaiting-toast__card {
    outline: 2px solid #a7f3d0;
    outline-offset: 3px;
}

.shell-awaiting-toast.is-clickable:hover .shell-awaiting-toast__card {
    filter: brightness(1.06);
}

.shell-awaiting-toast[hidden] {
    display: none !important;
}

.shell-awaiting-toast.is-visible[hidden] {
    display: block !important;
}

.shell-awaiting-toast__card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 16rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: 0.85rem 1.1rem;
    border-radius: 0.65rem;
    background: linear-gradient(145deg, #0f766e 0%, #115e59 55%, #134e4a 100%);
    color: #ecfdf5;
    box-shadow: 0 10px 28px rgba(15, 118, 110, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.shell-awaiting-toast__icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    color: #a7f3d0;
    font-size: 0.95rem;
}

.shell-awaiting-toast__copy {
    min-width: 0;
}

.shell-awaiting-toast__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.25;
}

.shell-awaiting-toast__detail {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: #99f6e4;
    line-height: 1.3;
}

.shell-awaiting-toast__detail:empty {
    display: none;
}


.shell-menu-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    margin: 0 0 0.5rem;
}

.shell-menu-label--spaced {
    margin-top: 1rem;
}

.shell-menu-placeholder {
    margin: 0;
    color: #9ca3af;
    font-size: 0.75rem;
}

/* E10 — Orders / Tools right rail */
#shell-right-menu {
    overflow: auto;
    min-height: 0;
}

.orders-rail,
.tools-rail,
.delegate-rail {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.rail-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    text-align: left;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 0.375rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.25;
}

.rail-item__title {
    display: block;
    width: 100%;
}

.rail-item__meta {
    display: block;
    width: 100%;
    font-size: 0.65rem;
    font-weight: 500;
    color: #6b7280;
}

.rail-item.is-current-hour {
    border-color: #6366f1;
    background: #eef2ff;
}

.rail-item.is-injected {
    border-color: #a5b4fc;
    background: #f5f3ff;
}

.rail-item.is-awaiting-md {
    border-color: #fbbf24;
    background: #fffbeb;
    color: #92400e;
}

.rail-item.is-iv {
    border-color: #5eead4;
    background: #f0fdfa;
    color: #115e59;
}

.rail-item.is-admit {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}

.rail-item.is-delegate {
    border-color: #c4b5fd;
    background: #f5f3ff;
    color: #5b21b6;
    cursor: pointer;
}

.rail-item.is-delegate.is-available {
    border-color: #34d399;
    background: #ecfdf5;
    color: #065f46;
}

.rail-item.is-delegate.is-away {
    opacity: 0.72;
    border-color: #d1d5db;
    background: #f9fafb;
    color: #6b7280;
    cursor: default;
}

.rail-item.is-delegate.is-selected {
    box-shadow: 0 0 0 2px #059669, 0 0 0 4px rgba(5, 150, 105, 0.25);
    border-color: #059669;
}

.delegate-legend {
    margin: 0 0 0.25rem;
    font-size: 0.62rem;
    font-weight: 600;
    color: #6b7280;
    line-height: 1.3;
}

/* Soft deny / mode toast */
.shell-delegate-hint {
    position: fixed;
    left: 50%;
    bottom: 5.5rem;
    transform: translateX(-50%) translateY(0.25rem);
    z-index: 45;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.shell-delegate-hint.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.shell-delegate-hint[hidden] {
    display: none !important;
}

.shell-delegate-hint.is-visible[hidden] {
    display: block !important;
}

.shell-delegate-hint__text {
    margin: 0;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.92);
    color: #f9fafb;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

[data-task-type].delegate-eligible-team {
    outline: 2px solid #0d9488;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

[data-task-type].delegate-eligible-solo {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.delegate-mode-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    vertical-align: middle;
}

.delegate-mode-badge--team {
    background: #ccfbf1;
    color: #0f766e;
}

.delegate-mode-badge--solo {
    background: #ede9fe;
    color: #5b21b6;
}

.rail-item.status-active {
    border-color: #34d399;
}

.rail-item.status-overdue,
.rail-item.status-missed {
    border-color: #f87171;
    background: #fef2f2;
}

.rail-item.status-completed {
    opacity: 0.55;
}

.rail-focus-pulse {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    transition: outline-color 200ms ease;
}

/* Tall modals (debrief, quizzes): scroll the panel itself (not a nested body).
   Nested #modal-content scroll + panel overflow:hidden clipped content when the
   flex scrollport failed or the pointer was outside the content box.
   Prefer svh/dvh — 100vh alone is taller than the visible area on mobile chrome. */
#modal {
    align-items: flex-start;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#modal .modal-panel {
    /* Block layout (not flex): flex + max-height + overflow can report a tiny
       scrollHeight and leave most debrief content unreachable. */
    position: relative;
    box-sizing: border-box;
    width: 100%;
    margin-top: auto;
    margin-bottom: auto;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    max-height: calc(100svh - 2rem);
    display: block;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #9ca3af #f3f4f6;
}

#modal .modal-panel::-webkit-scrollbar {
    width: 10px;
}

#modal .modal-panel::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 999px;
}

#modal .modal-panel::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 999px;
    border: 2px solid #f3f4f6;
}

/* Challenge modals: compact corner cue that the shift clock is paused */
#modal .modal-panel.modal-panel--timer-paused #modal-title {
    padding-right: 6.5rem;
}

.challenge-timer-paused {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    pointer-events: none;
}

.challenge-timer-paused i {
    font-size: 0.85rem;
}

.challenge-failure-note {
    margin: 0;
}

.challenge-level-control summary {
    color: #1f2937;
}

#modal-content {
    overflow: visible;
}

#modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 0.75rem;
    background: #fff;
    box-shadow: 0 -10px 16px -12px rgba(15, 23, 42, 0.35);
}

@media (max-width: 900px) {
    #modal {
        padding: 0.5rem;
    }

    #modal .modal-panel {
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
        max-height: calc(100svh - 1rem);
        padding: 1rem;
    }

    #modal-title {
        margin-bottom: 0.75rem;
    }

    #modal-content {
        margin-bottom: 0.5rem;
    }

    #modal-footer {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }

    #shell {
        --shell-bottom-height: 0px;
        min-height: 100dvh;
        max-height: 100dvh;
    }

    #shell-top-primary {
        padding: 0.5rem 0.65rem;
        gap: 0.5rem;
    }

    #shell-top-primary .shell-brand {
        flex: 1;
        min-width: 0;
    }

    #shell-brand-title {
        font-size: 1.1rem;
    }

    /* Expanded mobile: pack title stays visible; disclaimers stay collapsed in <details> */
    #shell-top-primary:not(.is-collapsed) #scenario-pack-title {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 0.15rem;
    }

    #shell-top-primary:not(.is-collapsed) [data-scenario-objectives] {
        display: none;
    }

    #shell-top-primary:not(.is-collapsed) .shell-brand-read-more {
        display: inline-block;
    }

    /* Super-collapsed floating clock — timer chip only; top-right keeps bottom FABs clear */
    #shell-top-primary.is-collapsed .shell-clock-cluster {
        gap: 0;
        padding: 0.25rem;
        max-width: min(14.5rem, calc(100vw - 1rem));
        background: rgba(249, 250, 251, 0.92);
        backdrop-filter: blur(8px);
    }

    #shell-top-primary.is-collapsed .shell-clock-cluster.is-docked-default {
        /* Below hour-peek strip; leaves bottom-left log + bottom-right slots FABs clear */
        top: 3.1rem;
        right: 0.45rem;
        bottom: auto;
        left: auto;
    }

    #shell-top-primary.is-collapsed .shell-clock-cluster__chrome {
        width: 100%;
        justify-content: flex-start;
        gap: 0.25rem;
    }

    #shell-top-primary.is-collapsed .shell-lean-pause {
        display: inline-flex;
    }

    #shell-top-primary.is-collapsed .shell-clock-display,
    #shell-top-primary.is-collapsed .shell-pause-btn,
    #shell-top-primary.is-collapsed .shell-boosters,
    #shell-top-primary.is-collapsed .shell-sound-toggle,
    #shell-top-primary.is-collapsed .shell-docs-control {
        display: none !important;
    }

    #shell-top-primary.is-collapsed .shell-clock-cluster__drag {
        flex: 0 0 auto;
        min-width: 1.75rem;
        padding: 0.2rem;
    }

    #shell-top-primary.is-collapsed .shell-top-collapse {
        flex-shrink: 0;
        min-width: 1.75rem;
        padding: 0.2rem 0.35rem;
    }

    #shell-top-primary.is-collapsed .shell-top-collapse [data-collapse-label] {
        display: none;
    }

    /* Expanded mobile clock cluster stays compact */
    #shell-top-primary:not(.is-collapsed) .shell-clock-cluster {
        gap: 0.3rem;
    }

    #shell-top-primary:not(.is-collapsed) .shell-lean-pause {
        display: none;
    }

    #shell-top-primary:not(.is-collapsed) .shell-clock-display {
        width: 100% !important;
        max-width: 9.5rem;
        padding: 0.35rem 0.45rem;
        font-size: 1rem;
        gap: 0.25rem;
    }

    #shell-top-primary:not(.is-collapsed) .shell-pause-btn {
        width: 100% !important;
        max-width: 9.5rem;
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }

    #shell-top-primary:not(.is-collapsed) .shell-boosters,
    #shell-top-primary:not(.is-collapsed) .shell-sound-toggle {
        width: 100%;
        max-width: 9.5rem;
        font-size: 0.68rem;
    }

    #shell-top-primary:not(.is-collapsed) .shell-sound-toggle [data-sound-label],
    #shell-top-primary:not(.is-collapsed) .shell-top-collapse [data-collapse-label] {
        display: none;
    }

    #shell-top-secondary {
        padding: 0.3rem 0.5rem;
        gap: 0.35rem;
    }

    .shell-hour-tab {
        padding: 0.2rem 0.45rem;
        font-size: 0.72rem;
    }

    #shell-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }

    #shell-left-menu {
        order: 1;
        border-right: 0;
        border-bottom: 1px solid #d1d5db;
        padding: 0.4rem 0.5rem;
        max-height: none;
        overflow: visible;
    }

    #shell-left-menu > .shell-menu-label,
    #shell-left-menu .incident-tabs-wrap {
        display: none;
    }

    /* E10.M6: Orders/Tools accordion above main */
    #shell-right-menu {
        order: 2;
        display: block;
        border-left: 0;
        border-bottom: 1px solid #d1d5db;
        border-top: 0;
        max-height: none;
        overflow: visible;
        padding: 0.4rem 0.5rem;
    }

    .rail-accordion {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
        align-items: flex-start;
    }

    .rail-accordion__section {
        flex: 1 1 auto;
        min-width: 5.5rem;
    }

    .rail-accordion__section.is-open {
        flex: 1 1 100%;
    }

    .rail-accordion__toggle {
        cursor: pointer;
        border: 1px solid #d1d5db;
        background: #fff;
        border-radius: 0.45rem;
        padding: 0.4rem 0.5rem;
        margin: 0;
        font-size: 0.68rem;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

    .rail-accordion__section + .rail-accordion__section .rail-accordion__toggle {
        margin-top: 0;
    }

    .rail-accordion__section.is-open .rail-accordion__toggle {
        border-color: #93c5fd;
        background: #eff6ff;
        color: #1e3a8a;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .rail-accordion__panel {
        border: 1px solid #93c5fd;
        border-top: 0;
        border-radius: 0 0 0.45rem 0.45rem;
        background: #f8fafc;
        padding: 0.35rem;
    }

    .rail-accordion__panel[hidden] {
        display: none !important;
    }

    #shell-right-menu .orders-rail,
    #shell-right-menu .tools-rail,
    #shell-right-menu .delegate-rail {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.3rem;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        -webkit-overflow-scrolling: touch;
    }

    #shell-right-menu .rail-item {
        min-width: 6.75rem;
        max-width: 9rem;
        flex: 0 0 auto;
        padding: 0.3rem 0.4rem;
        font-size: 0.68rem;
    }

    #shell-main {
        order: 3;
        padding: 0.55rem;
        min-height: 0;
    }

    /* Collapse footer strip; keep overflow visible so fixed log/slots panels still paint */
    #shell-bottom {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 0;
        padding: 0;
        border: 0;
        background: transparent;
        height: 0;
        min-height: 0;
        overflow: visible;
        pointer-events: none;
    }

    #shell-bottom-resize {
        display: none;
    }

    /* Event log collapses to a bottom-left FAB; panel floats when open */
    #shift-history-log {
        display: none;
        grid-column: unset;
        grid-row: unset;
        position: fixed;
        left: 0.5rem;
        right: 3.25rem;
        bottom: calc(var(--shell-bottom-height, 0px) + max(0.25rem, env(safe-area-inset-bottom, 0px)) + 2.9rem);
        z-index: 46;
        max-height: min(40vh, 14rem);
        height: auto;
        padding: 0.4rem 0.5rem;
        font-size: 0.72rem;
        border-radius: 0.65rem;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
        pointer-events: auto;
    }

    body.shell-log-visible #shift-history-log {
        display: block;
    }

    /* Slots float when pinned or busy; otherwise hidden (beats declarative-tasks.css) */
    #shell .slot-cluster,
    .slot-cluster {
        display: none !important;
        grid-column: unset;
        grid-row: unset;
    }

    body.shell-slots-visible #shell .slot-cluster,
    body.shell-slots-visible .slot-cluster {
        display: flex !important;
        flex-direction: column;
        gap: 0.25rem;
        position: fixed;
        left: 0.5rem;
        right: 3.25rem;
        bottom: calc(var(--shell-bottom-height, 0px) + max(0.25rem, env(safe-area-inset-bottom, 0px)) + 2.9rem);
        z-index: 45;
        justify-self: stretch;
        align-self: start;
        padding: 0.35rem;
        border-radius: 0.65rem;
        border: 1px solid rgba(209, 213, 219, 0.65);
        background: rgba(255, 255, 255, 0.72);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
        pointer-events: auto;
    }

    body.shell-slots-visible .slot-cluster .task-queue-bar {
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    body.shell-slots-visible .slot-cluster .task-slot {
        background: rgba(249, 250, 251, 0.88);
    }

    body.shell-slots-visible .slot-cluster .task-slot--busy {
        background: rgba(239, 246, 255, 0.92);
    }

    /* Hide empty waiting-queue copy while floating */
    body.shell-slots-visible .slot-waiting-queue[data-count="0"] {
        display: none;
    }

    #task-queue-bar {
        justify-content: center;
        gap: 0.3rem;
        padding: 0.3rem;
    }

    .shell-slots-toggle,
    .shell-log-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        position: fixed;
        left: auto;
        top: auto;
        /* Visual viewport bottom (FABs live outside #shell). */
        bottom: 0;
        margin: 0;
        margin-bottom: max(0.25rem, env(safe-area-inset-bottom, 0px));
        z-index: 55;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 999px;
        border: 1px solid #d1d5db;
        background: rgba(255, 255, 255, 0.94);
        color: #374151;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
        cursor: pointer;
        pointer-events: auto;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .shell-slots-toggle {
        right: 0.55rem;
    }

    .shell-log-toggle {
        left: 0.55rem;
    }

    .shell-slots-toggle__label,
    .shell-log-toggle__label {
        display: none;
    }

    .shell-slots-toggle.is-active,
    .shell-slots-toggle[aria-pressed="true"],
    .shell-log-toggle.is-active,
    .shell-log-toggle[aria-pressed="true"] {
        border-color: #93c5fd;
        background: #eff6ff;
        color: #1d4ed8;
    }

    .incident-tabs-wrap {
        margin-top: 0.35rem;
    }
}

@media (max-width: 480px) {
    #shell-top-primary.is-collapsed .shell-clock-cluster.is-docked-default {
        top: 2.85rem;
        right: 0.35rem;
        bottom: auto;
    }

    #shell-right-menu .rail-item {
        min-width: 5.75rem;
        font-size: 0.64rem;
    }

    body.shell-slots-visible .slot-cluster,
    body.shell-log-visible #shift-history-log {
        right: 3rem;
        left: 0.35rem;
    }
}
