/* Shared bottom-sheet shell. Page styles own only the content inside the body. */
.ui-sheet {
    position: fixed;
    top: auto;
    right: 0;
    bottom: var(--sheet-viewport-bottom, 0px);
    left: 0;
    width: 100%;
    max-width: var(--sheet-max-width);
    max-height: calc(var(--sheet-viewport-height, var(--viewport-height)) - var(--sheet-top-clearance));
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: var(--dialog-radius) var(--dialog-radius) 0 0;
    background: var(--dialog-surface);
    color: var(--text-primary);
    box-shadow: none;
    transform: none;
    overflow: hidden;
}
.ui-sheet[open] {
    display: flex;
    flex-direction: column;
    animation: ui-sheet-enter var(--sheet-enter-duration) var(--sheet-enter-easing);
}
.ui-sheet-grip {
    display: grid;
    place-items: center;
    height: var(--sheet-grip-height);
    flex: none;
    touch-action: none;
}
.ui-sheet-grip span {
    width: 32px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
}
.ui-sheet-header {
    position: relative;
    top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: none;
    gap: var(--space-md);
    min-height: calc(var(--sheet-close-size) + var(--section-title-gap));
    margin: 0;
    padding: 0 var(--sheet-gutter) var(--section-title-gap);
    border: 0;
    background: var(--dialog-surface);
}
.ui-sheet-heading { flex: 1; min-width: 0; }
.ui-sheet-header .ui-sheet-title {
    margin: 0;
    min-width: 0;
    font-family: var(--site-font);
    font-size: var(--font-size-20);
    font-weight: 500;
    line-height: 28px;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}
.ui-sheet-subtitle {
    display: block;
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: var(--caption-font-size);
    line-height: 18px;
}
.ui-sheet-close {
    --button-bg: var(--bg-card);
    --button-ink: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: var(--sheet-close-size);
    height: var(--sheet-close-size);
    min-width: var(--sheet-close-size);
    min-height: var(--sheet-close-size);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--button-bg);
    color: var(--button-ink);
    box-shadow: none;
}
.ui-sheet-close svg {
    display: block;
    width: var(--sheet-close-icon-size);
    height: var(--sheet-close-icon-size);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ui-sheet-body {
    flex: 0 1 auto;
    min-height: 0;
    padding: 0 var(--sheet-gutter) calc(var(--sheet-bottom-padding) + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.no-flex-gap .ui-sheet-header { gap: 0; }
.no-flex-gap .ui-sheet-header > :not(:last-child) { margin-right: var(--space-md); }
@keyframes ui-sheet-enter {
    from { opacity: .4; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .ui-sheet[open] { animation: none; }
}
