/* Shared working controls. Printed labels retain their physical layouts. */
@media screen {
    :root { --sg-font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
    .modal-overlay .modal,
    .ready-check-page,
    .checklist-builder-page,
    .checklist-sheet-page,
    .ready-check-runner { font-family: var(--sg-font-body); }

    .modal-overlay .modal .btn,
    .gear-form-actions .btn,
    .locker-tunnel-hub .btn,
    .gear-page-actions .btn,
    .ready-check-page .btn,
    .checklist-builder-page .btn,
    .ready-check-runner .btn,
    .checklist-sheet-page .btn {
        min-height: 42px;
        border-radius: 8px;
        border-width: 1px;
        font-family: var(--sg-font-body);
        font-size: var(--sg-text-small);
        font-weight: 650;
        font-style: normal;
        letter-spacing: 0;
        text-transform: none;
        transform: none;
        clip-path: none;
        box-shadow: none;
        white-space: normal;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }
    .modal-overlay .modal .btn:hover:not(:disabled),
    .gear-form-actions .btn:hover:not(:disabled),
    .ready-check-page .btn:hover:not(:disabled),
    .checklist-builder-page .btn:hover:not(:disabled) { transform: none; box-shadow: 0 2px 8px #0f172a12; }
    .modal-overlay .modal .btn-secondary,
    .gear-form-actions .btn-secondary,
    .locker-tunnel-hub .btn-secondary,
    .gear-page-actions .btn-secondary,
    .ready-check-page .btn-secondary { border-color: var(--sg-line-strong); background: var(--sg-paper); color: var(--sg-ink-950); }
    .gear-form-actions .btn { min-width: 0; }
    body:has(#equipment-form) .sendgear-ai-fab { display: none !important; }
    .dashboard-studio-shell .service-board-hero-actions { max-width: 420px; }
    .dashboard-home-header { flex-wrap: wrap; }
    .dashboard-home-header > div:first-child { flex: 1 1 auto; min-width: min(100%, 16rem); }
    .dashboard-home-actions { flex-wrap: wrap; }
    .main .dashboard-destinations { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
    .dashboard-destinations :is(strong, small) { overflow-wrap: anywhere; }
    /* Enlarged text can move timeline controls onto another line. Hidden
       tooltips must not contribute to Firefox's document scroll width. */
    .fishbone-controls, .fishbone-toggles { flex-wrap: wrap; }
    .fishbone-toggles { max-width: 100%; margin-left: 0 !important; }
    .timeline-toggle { flex-shrink: 0; width: auto; height: auto; min-width: 42px; min-height: 42px; padding: 6px 10px; }
    .timeline-toggle--label { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
    .timeline-toggle::before, .timeline-toggle::after { display: none; }
    .timeline-toggle:is(:hover, :focus-visible)::before,
    .timeline-toggle:is(:hover, :focus-visible)::after { display: block; visibility: visible; opacity: 1; }
    .fishbone-toggles .timeline-toggle:last-child::after { left: auto; right: 0; transform: none; }
    .modal-overlay .modal .form-label,
    .modal-overlay .modal .section-label,
    .modal-overlay .modal .circle-modal-kicker { font-size: var(--sg-text-small); font-weight: 650; letter-spacing: 0; text-transform: none; }
    .modal-overlay .modal .form-label { line-height: 1.4; }
    .modal-overlay .modal .form-input,
    .modal-overlay .modal .form-select,
    .modal-overlay .modal .form-textarea { font-family: var(--sg-font-body); font-weight: 400; }
    .modal-overlay .modal .modal-title { font-weight: 700; letter-spacing: -.02em; }
    .modal-overlay .modal .modal-footer { gap: 10px; }
    .modal-overlay .modal .photo-upload-actions { min-width: 0; }
    .modal-overlay .modal .photo-upload-actions .btn { min-width: 0; width: 100%; justify-content: center; }

    /* Activity authoring: compact choices, usable photo controls, clear saving. */
    .modal-overlay .adventure-composer { max-width: 1000px; }
    .adventure-composer .adventure-composer-intro { grid-template-columns: minmax(0, 1fr) minmax(290px, .85fr); gap: 24px; background: var(--sg-paper-muted); }
    .adventure-composer .adventure-type-picker label { min-height: 54px; border-radius: 8px; border-width: 1px; gap: 3px; }
    .adventure-composer .adventure-type-picker strong { font-size: var(--sg-text-small); font-weight: 650; text-transform: none; }
    .adventure-composer .adventure-type-picker label:focus-within { outline: 2px solid var(--sg-cyan-dark); outline-offset: 3px; }
    .adventure-composer .adventure-cover-editor .photo-upload-container { grid-template-columns: 108px minmax(0, 1fr); align-items: start; }
    .adventure-composer .adventure-cover-editor .photo-preview { width: 108px !important; height: 108px !important; border-radius: 8px; }
    .adventure-composer .adventure-cover-editor .photo-upload-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .adventure-composer .adventure-cover-editor .photo-upload-hint { grid-column: 1 / -1; }
    .adventure-composer .adventure-composer-intro > div > span,
    .adventure-composer .adventure-cover-editor > span,
    .adventure-composer .adventure-composer-section > header span { color: var(--sg-ink-950); font-size: var(--sg-text-body); font-weight: 650; letter-spacing: 0; text-transform: none; }
    .adventure-composer .adventure-composer-section { padding: 20px; }
    .adventure-composer .adventure-composer-actions { align-items: center; }
    .adventure-composer .adventure-composer-actions > span { font-size: var(--sg-text-caption); font-weight: 400; }

    /* Checklist controls follow the gear workspace instead of poster styling. */
    .main .ready-check-page .ready-check-hero.ready-check-overview { padding: 0 0 20px; border: 0; border-radius: 0; background: none; box-shadow: none; clip-path: none; }
    .main .ready-check-page .ready-check-overview::after { display: none; }
    .ready-check-page .section-label { padding: 0; border: 0; background: none; letter-spacing: .025em; font-weight: 600; text-transform: none; color: var(--sg-ink-600); }
    .ready-check-page .ready-check-workspace { grid-template-columns: minmax(340px, .85fr) minmax(0, 1.65fr); gap: 20px; }
    .ready-check-page .ready-check-panel-heading { background: var(--sg-paper); padding: 16px; }
    .ready-check-page .checklist-search { margin: 12px; }
    .ready-check-page .ready-check-routine { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-radius: 8px; }
    .ready-check-page .ready-check-routine-select { padding: 12px 10px; min-width: 0; gap: 10px; }
    .ready-check-page .ready-check-routine-state,
    .ready-check-page .ready-check-routine-arrow { display: none; }
    .ready-check-page .checklist-quick-run { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; margin: 8px; padding: 8px 10px; border: 1px solid var(--sg-line); border-radius: 7px; background: var(--sg-paper); color: var(--sg-ink-950); font: 600 var(--sg-text-small)/1.35 var(--sg-font-body); cursor: pointer; }
    .ready-check-page .ready-check-routine-copy small { margin-top: 4px; }
    .ready-check-page .ready-check-detail-header { padding: 20px; align-items: flex-start; flex-wrap: wrap; }
    .ready-check-page .ready-check-detail-header h2 { font-size: var(--sg-text-title); line-height: 1.3; }
    .ready-check-page .ready-check-detail-title { min-width: 0; }
    .ready-check-page .ready-check-detail-meta { padding: 12px 20px; background: var(--sg-paper); }
    .ready-check-page .ready-check-detail-actions { display: flex; flex-wrap: wrap; }
    .ready-check-page .ready-check-detail-actions > .btn { width: auto; }
    .ready-check-page .ready-check-selected-history > header { padding: 16px 20px 0; }
    .ready-check-page .ready-check-selected-history .ready-check-list { margin: 0; padding: 12px 20px 20px; }
    .ready-check-page .ready-check-row { box-shadow: none; border-radius: 8px; }
    .checklist-more-actions { position: relative; margin-left: auto; }
    .checklist-more-actions summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
    .checklist-more-actions[open] { z-index: 6; }
    .checklist-more-menu { position: absolute; right: 0; top: calc(100% + 4px); width: 200px; padding: 6px; border: 1px solid var(--sg-line); border-radius: 8px; background: var(--sg-paper); box-shadow: 0 8px 24px #0f172a18; }
    .checklist-more-menu button { width: 100%; text-align: left; padding: 10px; border: 0; background: none; color: var(--sg-ink-950); font: inherit; cursor: pointer; }
    .checklist-more-menu button:hover { background: var(--sg-paper-muted); }
    .ready-check-page .ready-check-routine[hidden] { display: none; }
    .ready-check-page .ready-check-detail { overflow: visible; scroll-margin-top: 90px; }
    .main .checklist-builder-page .checklist-builder-hero { padding: 0 0 20px; border: 0; background: none; border-radius: 0; }
    .checklist-builder-page .checklist-builder-workspace { grid-template-columns: minmax(0, 1fr); }
    .checklist-builder-page .checklist-builder-guide { position: static; order: 2; padding: 14px 18px; }
    .checklist-builder-page .checklist-builder-guide summary { cursor: pointer; font-size: var(--sg-text-small); font-weight: 600; }
    .checklist-builder-page .checklist-builder-guide ol { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
    .checklist-builder-page .checklist-builder-guide li:not(:last-child)::after { display: none; }
    .checklist-builder-page .checklist-builder-back { min-height: 36px; margin-bottom: 8px; font-size: var(--sg-text-small); font-weight: 600; }
    .checklist-builder-page .checklist-builder-hero .section-label,
    .checklist-builder-page .checklist-builder-structure .section-label { display: none; }
    .checklist-builder-page .checklist-builder-field > span,
    .checklist-builder-page .checklist-builder-row-field > span { font-size: var(--sg-text-small); text-transform: none; letter-spacing: 0; font-weight: 650; }
    .checklist-builder-page .checklist-builder-field input,
    .checklist-builder-page .checklist-builder-row-field input,
    .checklist-builder-page .checklist-builder-row-field select { width: 100%; min-width: 0; box-sizing: border-box; font-family: var(--sg-font-body); font-weight: 400; }
    body:has(.checklist-builder-page) #quick-add-fab,
    body:has(.checklist-builder-page) .sendgear-ai-fab { display: none; }

    .quick-custom-test { min-width: 0; padding: 16px; margin: 0 0 16px; border: 1px solid var(--sg-line); border-radius: 10px; background: var(--sg-paper-muted); }
    .quick-custom-test legend { padding: 0 6px; font-weight: 650; font-size: var(--sg-text-small); }
    .quick-custom-test .form-group:last-of-type { margin-bottom: 8px; }
    .quick-table-columns { margin: 0 0 16px; }
    .quick-table-columns summary { padding: 12px 0; cursor: pointer; font-weight: 650; }
    .quick-table-columns .service-builder-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .quick-table-columns .service-builder-options label { display: flex; align-items: start; gap: 8px; padding: 8px; border: 1px solid var(--sg-line); border-radius: 6px; font-size: var(--sg-text-small); }
    .quick-table-columns .service-builder-options input { flex-shrink: 0; margin-top: 3px; }

    /* A locker keeps its identity and its next trip in both entry points. */
    .gear-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--text-secondary); font-size: var(--sg-text-small); }
    .gear-breadcrumb a { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; color: var(--sg-ink-950); text-decoration: none; font-weight: 600; }
    .gear-breadcrumb a:hover { text-decoration: underline; }
    .locker-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--sg-line); border-radius: 12px; overflow: hidden; background: var(--sg-paper); }
    .locker-tunnel-hub .locker-card .locker-tunnel-door { width: 100%; border: 0; border-radius: 0; margin: 0; transform: none; }
    .locker-tunnel-hub .locker-card .locker-tunnel-door:hover { transform: none; }
    .locker-tunnel-hub .locker-tunnel-image { transform: none; }
    .locker-next-trip { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--sg-line); border-radius: 10px; background: var(--sg-paper); color: var(--sg-ink-950); text-decoration: none; }
    .locker-next-trip > span { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
    .locker-next-trip small { font-size: var(--sg-text-caption); color: var(--sg-ink-600); }
    .locker-next-trip strong { font-size: var(--sg-text-small); font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
    .locker-next-trip > i { flex-shrink: 0; color: var(--sg-cyan-dark); }
    .locker-next-trip:hover { border-color: var(--sg-cyan-dark); }
    .locker-next-trip.is-empty { font-size: var(--sg-text-caption); color: var(--sg-ink-600); }
    .locker-next-trip.is-compact { flex: 1; margin: 0; padding: 12px; border: 0; border-top: 1px solid var(--sg-line); border-radius: 0; align-items: flex-start; }
    .locker-next-trip.is-compact > i:last-child { display: none; }
    .gear-field-header.is-locker-view .gear-field-summary { display: none; }
    .gear-field-header.is-locker-view { margin-bottom: 12px; }
    .gear-field-header.is-locker-view .section-label { display: none; }
    .gear-field-header.is-locker-view .gear-field-heading p { display: none; }

    @media (max-width: 900px) {
        .ready-check-page .ready-check-detail-actions { width: 100%; }
        .service-board-dialog .service-builder-preview { grid-row: auto; }
        .adventure-composer .adventure-composer-intro { grid-template-columns: minmax(0, 1fr); gap: 16px; }
        .ready-check-page .ready-check-workspace { grid-template-columns: minmax(0, 1fr); }
        .ready-check-page .ready-check-routines,
        .ready-check-page .ready-check-detail { width: 100%; }
        .ready-check-page .ready-check-routine-list { max-height: none; }
    }
    @media (max-width: 640px) {
        .checklist-builder-page .checklist-builder-guide ol { grid-template-columns: minmax(0, 1fr); }
        .main .ready-check-page .ready-check-overview .ready-check-actions { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; width: 100%; }
        .main .ready-check-page .ready-check-overview .ready-check-actions .btn { white-space: normal; }
        .main:has(.is-locker-view) .gear-command-panel { padding: 12px; }
        .main:has(.is-locker-view) .gear-filter-strip { gap: 6px; }
        .ready-check-page .ready-check-detail-header { padding: 16px; }
        .ready-check-page .ready-check-detail-actions { gap: 8px; width: 100%; }
        .ready-check-page .ready-check-detail-actions > .btn { flex: 1; }
        .adventure-composer .adventure-composer-intro,
        .adventure-composer .adventure-composer-section { padding: 16px; }
        .adventure-composer .adventure-cover-editor .photo-upload-container { grid-template-columns: 88px minmax(0, 1fr); }
        .adventure-composer .adventure-cover-editor .photo-preview { width: 88px !important; height: 88px !important; }
        .adventure-composer .adventure-composer-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .adventure-composer .adventure-composer-actions .btn { padding: 10px; font-size: var(--sg-text-small); }
        .adventure-composer .adventure-composer-section > header { flex-wrap: wrap; }
        .locker-tunnel-hub .locker-card .locker-tunnel-door { min-height: 190px; height: 190px; }
        .locker-next-trip.is-compact { gap: 6px; padding: 10px; }
        .gear-breadcrumb { margin-bottom: 6px; }
    }
}
