/* ═══════════════════════════════════════════════════════════════════════════
 * People & Keepsakes — private memory containers under You → About
 * Calm, editorial, minimal. Reuses existing modal/list/btn patterns.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* About-tab destination cards (entry points). Library-style — these are
 * doorways into People / Keepsakes, not settings rows. */
.you-pk-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}
.you-pk-card,
#youPkPageModal button,
#youPkPageModal [role="button"],
#youPkSheetModal button,
#youPkSheetModal [role="button"],
#youPkSheetModal .you-pk-picker-row {
    -webkit-tap-highlight-color: transparent;
}
.you-pk-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(82%, 420px);
    padding: 16px 16px;
    background: transparent;
    border: 1px solid var(--border-subtle, rgba(0,0,0,0.07));
    border-radius: 14px;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
@media (hover: hover) {
    .you-pk-card:hover {
        background: rgba(0,0,0,0.018);
        border-color: var(--border-subtle, rgba(0,0,0,0.1));
    }
}
.you-pk-card:active {
    transform: scale(0.997);
}
.you-pk-card__title {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 500;
}
.you-pk-card__chev {
    flex: 0 0 auto;
    opacity: 0.34;
    font-size: 1rem;
    margin-left: 12px;
}

html.yrh-shell-phone .you-pk-cards {
    gap: 12px;
}

html.yrh-shell-phone .you-pk-card {
    width: min(91%, 420px);
    padding: 18px 18px;
}

/* Sub-page header (back + title + add). Acts as the destination page header
 * Subpage container for list/detail content rendered inside #youPkPageModal. */
.you-pk-subpage {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.you-pk-subpage--detail {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
}

.you-pk-detail-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 20px var(--panel-space-6, 24px) calc(var(--panel-space-6, 24px) + env(safe-area-inset-bottom, 0px));
}

.you-pk-list-shell {
    display: flex;
    flex-direction: column;
    margin-top: calc(-1 * var(--panel-space-6, 24px));
    margin-left: calc(-1 * var(--panel-space-6, 24px));
    margin-right: calc(-1 * var(--panel-space-6, 24px));
}

.you-pk-list-shell .you-pk-list {
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
}

.you-pk-subpage--library .you-pk-list {
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
}

/* + add affordance shown in the page modal's header actions area. */
.you-pk-page-add-btn {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
    padding: 6px 8px;
    opacity: 0.85;
    font-size: 0.95rem;
}
.you-pk-page-add-btn:hover { opacity: 1; }
.you-pk-page-header-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-8, 8px);
    min-width: 0;
}

.you-pk-library-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-right: 44px;
    white-space: nowrap;
}

.you-pk-library-header-actions--search-only {
    justify-content: flex-end;
}

.you-pk-library-header-search-host {
    flex: 0 1 auto;
    min-width: 0;
}

.you-pk-library-header-search-input {
    min-width: 188px;
    width: clamp(188px, 21vw, 224px);
    padding: 6px 10px;
    font-size: 0.84rem;
    line-height: 1.25;
    border-radius: 9px;
}

.you-pk-library-header-segmented {
    flex: 0 0 auto;
}

.you-pk-list-toolbar {
    display: none;
}

.you-pk-inline-search-host {
    flex: 1 1 auto;
    min-width: 0;
}

.you-pk-inline-search-host .search-input-wrapper {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    background: var(--color-bg-primary, #ffffff);
    border: 1px solid rgba(120, 132, 152, 0.24);
    border-radius: 12px;
    overflow: hidden;
}

.you-pk-inline-search-host #youPkPullSearchInput {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 10px 38px 10px 12px;
    border: 0;
    background: transparent;
    color: var(--color-text-primary, inherit);
    font: inherit;
    font-size: 0.95rem;
    outline: none;
    box-shadow: none;
}

.you-pk-inline-search-host #youPkPullSearchInput::placeholder {
    color: var(--color-text-muted, var(--color-text-secondary));
    opacity: 0.68;
}

.you-pk-inline-search-host .search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: rgba(120, 132, 152, 0.22);
    color: rgba(72, 82, 98, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    user-select: none;
}

.you-pk-inline-search-host .search-clear-btn:hover {
    color: var(--color-text-primary, inherit);
}

#youPkPageModal.you-pk-page-modal--form .modal-content {
    width: min(760px, calc(100vw - 32px));
    max-width: 760px;
    max-height: min(900px, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    padding: 0;
}

#youPkPageModal.you-pk-page-modal--form .c-modal-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#youPkPageModal.you-pk-page-modal--detail .c-modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#youPkPageModal .c-modal-header {
    margin-bottom: 0;
}

#youPkPageModal .you-pk-page-cancel-btn,
#youPkPageModal .you-pk-page-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    margin: 0;
    min-width: 44px;
    min-height: 36px;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 0.95rem;
    border-radius: 8px;
    white-space: nowrap;
}

#youPkPageModal .you-pk-page-cancel-btn[disabled],
#youPkPageModal .you-pk-page-save-btn[disabled] {
    opacity: 0.38;
    cursor: default;
    pointer-events: none;
}

/* List */
.you-pk-list {
    display: flex;
    flex-direction: column;
    margin-top: calc(-1 * var(--panel-space-6, 24px));
    margin-left: calc(-1 * var(--panel-space-6, 24px));
    margin-right: calc(-1 * var(--panel-space-6, 24px));
}
.you-pk-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px var(--panel-space-6, 24px);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
    box-sizing: border-box;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.you-pk-list-row:hover { opacity: 0.7; }
.you-pk-list-row__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.you-pk-list-row__name {
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.you-pk-list-row__sub {
    font-size: 0.85rem;
    opacity: 0.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.you-pk-list-row__chev {
    opacity: 0.4;
    margin-left: 8px;
}

/* Leading icon (hero photo or generic SVG fallback) on every list row. */
.you-pk-list-row__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background-color: var(--color-bg-muted, rgba(0,0,0,0.04));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid var(--color-border-lighter, rgba(0,0,0,0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted, var(--color-text-secondary));
    overflow: hidden;
}
.you-pk-list-row__icon--fallback .you-pk-hero-fallback-svg {
    width: 60%;
    height: 60%;
    opacity: 0.55;
}
.you-pk-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    padding: 48px 16px;
    color: inherit;
    opacity: 0.6;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Detail page hero header — mirrors the You About layout: centered hero
   photo, name, date+age line, and a small relationship/type subtitle. */
.you-pk-detail-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px var(--panel-space-6, 24px) 20px;
    border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
    margin-left: calc(-1 * var(--panel-space-6, 24px));
    margin-right: calc(-1 * var(--panel-space-6, 24px));
    margin-bottom: 0;
    box-sizing: border-box;
    text-align: center;
}
.you-pk-detail-hero-photo-wrap {
    flex: 0 0 auto;
}
.you-pk-hero-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background-color: var(--color-bg-muted, rgba(0,0,0,0.04));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid var(--color-border-lighter, rgba(0,0,0,0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted, var(--color-text-secondary));
    overflow: hidden;
}
.you-pk-hero-photo--fallback .you-pk-hero-fallback-svg {
    width: 56%;
    height: 56%;
    opacity: 0.5;
}
.you-pk-detail-hero-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
}
.you-pk-detail-hero-name {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text-primary, inherit);
    word-wrap: break-word;
}
.you-pk-detail-hero-date {
    font-size: 0.95rem;
    color: var(--color-text-muted, var(--color-text-secondary));
    line-height: 1.3;
}
.you-pk-detail-hero-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-muted, var(--color-text-secondary));
    line-height: 1.3;
    opacity: 0.85;
}

/* Header "edit" link (mirrors event-card top-right edit affordance). */
.you-pk-page-edit-btn {
    background: transparent;
    border: 0;
    padding: 8px 4px;
    color: var(--color-text-primary, inherit);
    font: inherit;
    cursor: pointer;
}
.you-pk-page-edit-btn:active {
    opacity: 0.6;
}

#youPkPageModal .you-pk-page-title-edit-wrap {
    overflow: hidden;
    font-size: 1.15em;
    font-weight: var(--panel-font-title-weight, 600);
    line-height: 1.2;
    color: var(--panel-text, var(--color-text-primary));
    align-items: center;
    min-height: calc(1.2em + 20px);
    padding: 10px 16px;
}

#youPkPageModal .you-pk-page-title-input {
    display: block;
    text-align: left;
    line-height: 1.2;
    min-height: 1.2em;
}

/* On detail frames the inline hero replaces the centered modal title; hide
   the chrome title so we don't render the name twice. */
#youPkPageModal:has(.you-pk-detail-hero) #youPkPageTitle {
    visibility: visible;
}

/* About-tab hero photo block (centered above the field rows). */
.you-pk-about-hero {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
}
.you-pk-about-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}
.you-pk-about-summary-primary {
    font-size: 1rem;
    line-height: 1.35;
    font-weight: 700;
    color: var(--color-text-primary, inherit);
}
.you-pk-about-summary-secondary {
    font-size: 0.95rem;
    line-height: 1.35;
    color: var(--color-text-muted, var(--color-text-secondary));
}

/* Edit-form hero photo control (parallel to .you-about-photo on the You page). */
.you-pk-form-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 4px 0 16px;
}
.you-pk-form-hero-photo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 110px;
}
.you-pk-form-hero-stage {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
}
.you-pk-form-hero-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.you-pk-form-hero-label--readonly {
    cursor: default;
}
.you-pk-form-hero-label .you-pk-hero-photo {
    transition: none;
}
.you-pk-form-hero-label:hover .you-pk-hero-photo {
    opacity: 1;
    box-shadow: none;
}
.you-pk-form-hero-remove {
    position: absolute;
    left: calc(100% + 16px);
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
    background: transparent;
    border: none;
    color: var(--panel-text-muted, var(--color-text-muted));
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    white-space: nowrap;
}
.you-pk-form-hero-remove:hover {
    color: var(--panel-text, var(--color-text-primary));
}

/* Detail page sub-tabs (About | Artifacts). Shared modal tab sizing lives in modal-tabs.css. */
.you-pk-subtabs {
    display: flex;
    gap: 1px;
    padding: 0 var(--panel-space-6, 24px);
    border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
    margin-left: calc(-1 * var(--panel-space-6, 24px));
    margin-right: calc(-1 * var(--panel-space-6, 24px));
    margin-bottom: 16px;
    box-sizing: border-box;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.you-pk-subtabs::-webkit-scrollbar {
    display: none;
}
.you-pk-subtab-btn {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: var(--panel-space-3, 12px) var(--panel-space-4, 16px);
    color: var(--color-text-muted, var(--color-text-secondary));
    font-size: var(--panel-font-body-size, 1rem);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    margin-bottom: -1px;
    border-radius: var(--panel-radius-sm, 6px) var(--panel-radius-sm, 6px) 0 0;
    white-space: nowrap;
    flex: 0 0 auto;
    -webkit-tap-highlight-color: transparent;
}
.you-pk-subtab-btn.active {
    color: var(--color-text-primary, inherit);
    border-bottom-color: var(--color-primary, #3b82f6);
}

.you-pk-subtab-btn.disabled,
.you-pk-subtab-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.you-pk-subtab-btn.disabled:hover,
.you-pk-subtab-btn:disabled:hover {
    background: none;
    color: var(--color-text-muted, var(--color-text-secondary));
}

/* Destructive remove footer inside the edit form. */
.you-pk-form-remove {
    display: flex;
    justify-content: center;
    padding: 24px 0 12px 0;
}
.you-pk-form-remove-btn {
    background: transparent;
    border: 0;
    padding: 8px 12px;
    color: var(--color-danger, #c0392b);
    font: inherit;
    cursor: pointer;
}
.you-pk-form-remove-btn:active {
    opacity: 0.6;
}

/* Detail About read mode */
.you-pk-about-read {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0 24px 0;
}
.you-pk-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.you-pk-field-label {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0.01em;
    opacity: 0.5;
}
.you-pk-field-value {
    font-size: 1rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.you-pk-field-value--placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}
.you-pk-name-display {
    font-size: 1.4rem;
    font-weight: 500;
    margin: 0;
}
.you-pk-relationship-display {
    font-size: 0.95rem;
    opacity: 0.75;
    margin-top: 2px;
}
.you-pk-detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
}

/* Form */
.you-pk-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 0;
}
.you-pk-form-page {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: 24px;
}

.you-pk-form-page--tabbed {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding-bottom: 0;
}

.you-pk-form-page-static {
    flex: 0 0 auto;
}

.you-pk-form-page-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 24px 28px calc(32px + env(safe-area-inset-bottom, 0px));
}

.you-pk-form-page-content {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.you-pk-form-page--phone-title {
    padding-top: 0;
}
.you-pk-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.you-pk-form-label {
    font-size: 0.8rem;
    opacity: 0.7;
}
.modal-content form input.you-pk-form-input,
.modal-content form textarea.you-pk-form-textarea,
.modal-content form select.you-pk-form-select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--color-border-light, #ddd);
    border-radius: 6px;
    font: inherit;
    font-size: 1rem;
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
    color: inherit;
    transition: background-color 140ms ease, border-color 140ms ease;
}
.modal-content form textarea.you-pk-form-textarea {
    min-height: 132px;
    resize: vertical;
    line-height: 1.5;
}
.modal-content form input.you-pk-form-input.you-pk-form-control--filled,
.modal-content form select.you-pk-form-select.you-pk-form-control--filled {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
    border-color: var(--color-border-light, #ddd);
}
.modal-content form input.you-pk-form-input:focus,
.modal-content form select.you-pk-form-select:focus,
.modal-content form textarea.you-pk-form-textarea:focus {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
    border-color: var(--color-primary);
    outline: none;
    box-shadow: none;
}
.modal-content form input.you-pk-form-input.you-pk-form-control--empty,
.modal-content form select.you-pk-form-select.you-pk-form-control--empty {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
}
.you-pk-form-field--description .edc-about-description-panel {
    gap: 0;
}
.you-pk-description-card {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
    border-color: var(--color-border-light, #ddd);
}
.you-pk-description-card.you-pk-form-control--filled {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
}
.you-pk-description-card.you-pk-form-control--empty .edc-description-textarea {
    color: var(--color-text-tertiary, #6b7280);
}
.you-pk-description-card:focus-visible,
.you-pk-description-card:focus-within {
    border-color: var(--color-primary);
    box-shadow: none;
    outline: none;
}
.you-pk-form-error {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--color-status-error-bg, rgba(179, 38, 30, 0.08));
    color: var(--color-status-error, #b3261e);
    font-size: 0.92rem;
    line-height: 1.4;
}
.you-pk-form-error[hidden] {
    display: none;
}
.you-pk-form-field--date .edc-date-inputs {
    flex-wrap: nowrap !important;
    align-items: center;
}
.modal-content form .you-pk-form-field--date .edc-select,
.modal-content form .you-pk-form-field--date .edc-input {
    width: auto !important;
    flex: 0 0 auto !important;
    box-sizing: border-box;
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
    border-color: var(--color-border-light, #ddd);
    transition: background-color 140ms ease, border-color 140ms ease;
}
.modal-content form .you-pk-form-field--date .edc-select,
.modal-content form .you-pk-form-field--date .edc-input {
    min-height: 40px;
    line-height: 1.2;
}
.modal-content form .you-pk-form-field--date .edc-select.you-pk-form-control--filled,
.modal-content form .you-pk-form-field--date .edc-input.you-pk-form-control--filled {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
    border-color: var(--color-border-light, #ddd);
}
.modal-content form .you-pk-form-field--date .edc-select:focus,
.modal-content form .you-pk-form-field--date .edc-input:focus {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
    border-color: var(--color-primary);
    outline: none;
    box-shadow: none;
}
.modal-content form .you-pk-form-field--date .edc-select.you-pk-form-control--empty,
.modal-content form .you-pk-form-field--date .edc-input.you-pk-form-control--empty {
    background: var(--color-bg-secondary, var(--color-surface-2, #f9f9f9));
}
.modal-content form .you-pk-form-field--date .edc-date-year {
    width: 80px !important;
    min-width: 80px;
    flex: 0 0 80px !important;
}
.you-pk-form-date-row {
    display: flex;
    gap: 8px;
}
.you-pk-form-date-row > * { flex: 1; min-width: 0; }
.you-pk-form-disclosure {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px 0;
    color: inherit;
    font: inherit;
    opacity: 0.7;
    text-align: left;
    font-size: 0.9rem;
}
.you-pk-form-disclosure:hover { opacity: 1; }
.you-pk-form-extra {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.you-pk-form-extra[hidden] { display: none; }

/* Picker / confirm overlays. The actual modal sheet markup is rendered
 * dynamically in 19A and uses the youPkSheetModal element in index.html. */
#youPkSheetModal .modal-content {
    max-width: 480px;
}
.you-pk-sheet-body {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.you-pk-sheet-title {
    font-size: 1.05rem;
    font-weight: 500;
    margin: 0 0 4px 0;
}
.you-pk-sheet-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
}

/* Artifact picker grid */
.you-pk-picker-search-wrap {
    padding: 0 20px;
}
.you-pk-picker-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid var(--border-subtle, rgba(0,0,0,0.15));
    border-radius: 6px;
    font: inherit;
    font-size: 0.95rem;
    background: var(--bg-input, #fff);
}
.you-pk-picker-list {
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.you-pk-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8.8px 4px;
    border-radius: 4px;
    cursor: pointer;
}
@media (hover: hover) {
    .you-pk-picker-row:hover { background: rgba(0,0,0,0.04); }
}
.you-pk-picker-row__thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: rgba(0,0,0,0.06);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0.65;
    text-transform: uppercase;
}
.you-pk-picker-row__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
}
.you-pk-picker-row__check {
    width: 20px;
    height: 20px;
    border: 1px solid rgba(0,0,0,0.3);
    border-radius: 3px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    line-height: 1;
}
.you-pk-picker-row.is-selected .you-pk-picker-row__check {
    background: currentColor;
    border-color: currentColor;
    color: #fff;
}
.you-pk-picker-row.is-selected .you-pk-picker-row__check::after {
    content: '✓';
    color: var(--bg-modal, #fff);
}

/* Linked-artifact grid (detail Artifacts sub-tab) */
.you-pk-artifacts-grid .you-pk-artifact-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 4;
}

.you-pk-artifacts-grid .you-pk-artifact-remove-btn:hover {
    background: var(--color-error, #e53e3e);
}

.you-pk-artifacts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    position: relative;
    z-index: 6;
}

/* iPhone bottom-sheet variant for sheet modal (form + picker).
 * Activated when body has class yrh-shell-phone (existing convention). */
.yrh-shell-phone #youPkSheetModal .modal-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 14px 14px 0 0;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}
.yrh-shell-phone #youPkSheetModal .you-pk-picker-list {
    max-height: 60vh;
}

/* Confirm dialog (delete) */
.you-pk-confirm-text {
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

/* ───────────────────────────────────────────────────────────────────────
 * Tablet + Desktop sizing contract
 *
 * Without these rules the People/Keepsakes page + sheet modals fall back
 * to the default `.modal-content` (max-width 550px, content-driven height),
 * which produces a small, dynamic-height card that does not match
 * accountModal / youModal / libraryModal on iPad and desktop.
 *
 * Mirrors the centered-modal contract used by youModal/accountModal:
 *   - Tablet: --yrh-centered-modal-height (capped at 640px)
 *   - Desktop: 760px tall, matching youModal/accountModal desktop sizing
 * The list/detail body becomes the scroll owner so the shell stays static.
 * ─────────────────────────────────────────────────────────────────────── */

/* Tablet — page modal (people / keepsakes lists + detail pages) */
html.yrh-tier-tablet #youPkPageModal .modal-content,
html.yrh-tier-tablet #youPkSheetModal .modal-content {
    height: var(--yrh-centered-modal-height, min(640px, calc(100dvh - (96px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)))));
    max-height: var(--yrh-centered-modal-height, min(640px, calc(100dvh - (96px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)))));
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

html.yrh-tier-tablet #youPkPageModal .modal-content {
    width: min(620px, 95vw);
    max-width: 660px;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--library-list .modal-content {
    width: min(720px, calc(100vw - 96px));
    max-width: 720px;
}

html.yrh-tier-tablet #youPkSheetModal .modal-content {
    width: min(560px, calc(100vw - 96px));
    max-width: 560px;
}

/* Tablet — keep edit/create width aligned with the view shell */
html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--form .modal-content {
    width: min(620px, 95vw);
    max-width: 660px;
}

/* Desktop — page modal */
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .modal-content,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkSheetModal .modal-content,
html.yrh-tier-desktop #youPkPageModal .modal-content,
html.yrh-tier-desktop #youPkSheetModal .modal-content {
    height: min(760px, calc(100dvh - (104px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px))));
    max-height: min(760px, calc(100dvh - (104px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px))));
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .modal-content,
html.yrh-tier-desktop #youPkPageModal .modal-content {
    width: min(620px, 95vw);
    max-width: 660px;
}

html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--library-list .modal-content,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--library-list .modal-content {
    width: min(760px, calc(100vw - 88px));
    max-width: 760px;
}

html.yrh-tier-desktop[data-layout-input="touch"] #youPkSheetModal .modal-content,
html.yrh-tier-desktop #youPkSheetModal .modal-content {
    width: min(620px, calc(100vw - 88px));
    max-width: 620px;
}

html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--form .modal-content,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--form .modal-content {
    width: min(620px, 95vw);
    max-width: 660px;
}

/* Tablet + Desktop — body is the scroll owner; header stays pinned */
html.yrh-tier-tablet #youPkPageModal .c-modal-body,
html.yrh-tier-tablet #youPkSheetModal .c-modal-body,
html.yrh-tier-desktop #youPkPageModal .c-modal-body,
html.yrh-tier-desktop #youPkSheetModal .c-modal-body,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .c-modal-body,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkSheetModal .c-modal-body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 24px 24px;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--detail .c-modal-body,
html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--form .c-modal-body,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--detail .c-modal-body,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--form .c-modal-body,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--detail .c-modal-body,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--form .c-modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--list-toolbar .c-modal-body,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--list-toolbar .c-modal-body,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--list-toolbar .c-modal-body {
    padding: 0;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--detail .c-modal-body,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--detail .c-modal-body,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--detail .c-modal-body {
    padding: 0;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--list-toolbar .c-modal-header,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--list-toolbar .c-modal-header,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--list-toolbar .c-modal-header {
    margin-bottom: 0;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--library-list .c-modal-header,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--library-list .c-modal-header,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--library-list .c-modal-header {
    margin-bottom: 0;
    border-bottom: 1px solid var(--panel-border-subtle, var(--color-border-lighter, rgba(0, 0, 0, 0.08)));
}

html.yrh-tier-tablet #youPkPageModal .you-pk-list-toolbar,
html.yrh-tier-desktop #youPkPageModal .you-pk-list-toolbar,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .you-pk-list-toolbar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 24px;
    background: var(--panel-surface, var(--color-bg-primary, #ffffff));
    border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
}

html.yrh-tier-tablet #youPkPageModal .you-pk-list-toolbar-main,
html.yrh-tier-desktop #youPkPageModal .you-pk-list-toolbar-main,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .you-pk-list-toolbar-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

html.yrh-tier-tablet #youPkPageModal .you-pk-list-toolbar-segmented,
html.yrh-tier-desktop #youPkPageModal .you-pk-list-toolbar-segmented,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .you-pk-list-toolbar-segmented {
    flex: 0 0 auto;
}

html.yrh-tier-tablet #youPkPageFooter,
html.yrh-tier-desktop #youPkPageFooter,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageFooter {
    flex: 0 0 auto;
}

html.yrh-tier-tablet #youPkPageFooter .c-modal-footer-actions,
html.yrh-tier-desktop #youPkPageFooter .c-modal-footer-actions,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageFooter .c-modal-footer-actions {
    width: 100%;
    justify-content: flex-end;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--detail #youPkPageFooter .c-modal-footer-actions,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--detail #youPkPageFooter .c-modal-footer-actions,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--detail #youPkPageFooter .c-modal-footer-actions {
    width: auto;
    flex: 0 0 auto;
}

html.yrh-tier-tablet #youPkPageFooter .you-pk-page-footer-btn,
html.yrh-tier-desktop #youPkPageFooter .you-pk-page-footer-btn,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageFooter .you-pk-page-footer-btn {
    min-width: 92px;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-list-shell,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-list-shell,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-list-shell {
    margin: 0;
    min-height: 100%;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-list,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-list,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-list {
    margin: 0;
}

html.yrh-tier-tablet #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-empty,
html.yrh-tier-desktop #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-empty,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal.you-pk-page-modal--list-toolbar .you-pk-empty {
    padding-left: 24px;
    padding-right: 24px;
}

/* Tablet + Desktop — list shell needs to extend full-bleed inside the
 * static body (offset the body padding so rows align with the header). */
html.yrh-tier-tablet #youPkPageModal .you-pk-list-shell,
html.yrh-tier-desktop #youPkPageModal .you-pk-list-shell,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .you-pk-list-shell {
    margin-left: -24px;
    margin-right: -24px;
}

html.yrh-tier-tablet #youPkPageModal .you-pk-list-shell .you-pk-list,
html.yrh-tier-desktop #youPkPageModal .you-pk-list-shell .you-pk-list,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .you-pk-list-shell .you-pk-list {
    margin: 0;
}

html.yrh-tier-tablet #youPkPageModal .you-pk-list-row,
html.yrh-tier-desktop #youPkPageModal .you-pk-list-row,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkPageModal .you-pk-list-row {
    padding-left: 24px;
    padding-right: 24px;
}

/* Tablet + Desktop — picker list inside sheet is bounded by the static
 * shell height, not its own viewport-relative cap. */
html.yrh-tier-tablet #youPkSheetModal .you-pk-picker-list,
html.yrh-tier-desktop #youPkSheetModal .you-pk-picker-list,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkSheetModal .you-pk-picker-list {
    max-height: none;
    flex: 1 1 0;
    min-height: 0;
}

/* Tablet + Desktop — sheet footer stays pinned */
html.yrh-tier-tablet #youPkSheetModal .c-modal-sticky-footer,
html.yrh-tier-desktop #youPkSheetModal .c-modal-sticky-footer,
html.yrh-tier-desktop[data-layout-input="touch"] #youPkSheetModal .c-modal-sticky-footer {
    flex: 0 0 auto;
}
