/* Shared secondary pages: quiet lists, focused forms and warm side panels. */
:root { --line: #eee2da; --radius: 16px; --shadow: 0 2px 10px #73503904; }
.page-content { padding-top: 30px; }
.page-heading { margin-bottom: 24px; gap: 18px; }
.page-heading h1 { font-size: 26px; letter-spacing: 0; }
.page-heading p { max-width: 620px; }
.card { border-color: #f0e6df; box-shadow: none; }
.card h2 { font-size: 19px; }
.button { border-radius: 11px; min-height: 42px; }
.button.ghost { background: transparent; }
.icon-button { flex-shrink: 0; }
.topbar { height: 68px; background: #fffcf9; border-bottom-color: #f1e6df; }
.child-switch { margin-left: 0; padding-left: 0; border-left: 0; gap: 10px; }
.child-switch > .icon { width: 30px; height: 30px; padding: 5px; border-radius: 10px; background: var(--soft); }
.child-switch select { background: transparent; border-color: transparent; border-radius: 10px; padding: 8px 26px 8px 8px; max-width: 260px; font-size: 16px; }
.child-switch select:hover { background: var(--softest); }
.sidebar { background: #fffaf5; border-right-color: #f0e3d9; }
.navigation a { border-radius: 12px; }
.navigation a.active { background: var(--soft); color: var(--accent-dark); }
.nav-backdrop { display: none; }
.page-tabs { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 24px; }
.page-tabs .tab { border-radius: 10px; background: transparent; color: var(--muted); border-color: transparent; }
.page-tabs .tab.active { background: var(--soft); color: var(--accent-dark); font-weight: 600; }
.note { font-size: 13px; line-height: 1.75; }
.note > .icon { flex-shrink: 0; }
.empty { padding: 40px 24px; }
.empty .warm-art { transform: scale(.72); margin: -12px auto -8px; }
.empty h3 { font-size: 18px; }
.empty p { max-width: 420px; }
.field input, .field select, .field textarea { border-color: #e8dbd2; border-radius: 10px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.secret-field { display: flex; position: relative; min-width: 0; align-items: center; }
.secret-field input { width: 100%; padding-right: 48px; }
.secret-field .icon-button { position: absolute; right: 3px; width: 40px; height: 40px; color: var(--muted); background: transparent; }
.secret-field:has(input:disabled) .icon-button { opacity: .45; cursor: default; }
details > summary { cursor: pointer; color: var(--ink); }
details > summary::marker { color: #bda698; }

/* Keep headers and actions reachable; only the body scrolls on normal screens. */
body:has(dialog[open]) { overflow: hidden; }
.dialog[open] { display: flex; flex-direction: column; max-height: calc(100dvh - 40px); border: 1px solid #eadbd0; overflow: hidden; background: var(--bg); box-shadow: 0 20px 70px #48342d26; }
.dialog-heading { position: static; flex-shrink: 0; padding: 18px 24px; border-bottom-color: #f0e4dc; background: var(--bg); }
.dialog-heading h2 { font-size: 20px; overflow-wrap: anywhere; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 24px; gap: 18px; }
.dialog-footer { flex-shrink: 0; background: var(--bg); border-top-color: #f0e4dc; padding: 16px 24px; }
.dialog-footer:empty { display: none; }
.dialog::backdrop { background: #30241e59; }
.dialog.drawer[open] { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(540px, 100vw); max-width: none; height: 100dvh; max-height: 100dvh; border-radius: 22px 0 0 22px; border-width: 0 0 0 1px; }
.dialog.drawer.wide { width: min(720px, 100vw); }
.drawer .dialog-body > .card { padding: 18px; }
.viewer.dialog[open] { height: calc(100dvh - 32px); max-height: none; background: #241e1a; }
.viewer .dialog-heading { background: #241e1a; border-bottom: 0; }
.viewer .dialog-body { padding: 0 20px 16px; min-height: 0; gap: 12px; overflow: hidden; }
.viewer-stage { flex: 1 1 auto; height: auto; min-height: 0; }
.viewer-meta { flex-shrink: 0; max-height: 25dvh; }
.viewer-help { margin-left: auto; font-size: 12px; color: #bca99b; }
.viewer-photo-stage { position: relative; min-width: 0; overflow: hidden; touch-action: none; user-select: none; cursor: zoom-in; }
.viewer-photo-stage .viewer-photo { flex: none; max-width: none; max-height: none; transform-origin: center; transition: none; will-change: transform; user-select: none; -webkit-user-drag: none; cursor: zoom-in; }
.viewer-photo-stage.is-zoomed, .viewer-photo-stage.is-zoomed .viewer-photo { cursor: grab; }
.viewer-photo-stage.is-grabbing, .viewer-photo-stage.is-grabbing .viewer-photo { cursor: grabbing; }
.viewer-photo-stage:focus-visible { outline: 1px solid #d4a48b; outline-offset: -2px; }
.viewer-zoom-controls { display: flex; align-items: center; flex: none; gap: 3px; padding: 3px; border: 1px solid #ffffff20; border-radius: 12px; background: #ffffff08; }
.viewer-zoom-controls .icon-button { width: 36px; height: 36px; color: #fff5eb; border-radius: 8px; }
.viewer-zoom-controls .viewer-fit { min-height: 36px; padding: 6px 12px; margin-left: 3px; border: 0; border-left: 1px solid #ffffff20; border-radius: 0 8px 8px 0; background: transparent; color: #fff5eb; font-size: 12px; white-space: nowrap; }
.viewer-zoom-controls button:hover:not(:disabled) { background: #ffffff15; }
.viewer-zoom-controls button:disabled { opacity: .35; cursor: default; }
.viewer-scale { min-width: 46px; text-align: center; white-space: nowrap; color: #e9d7c9; font-size: 12px; font-variant-numeric: tabular-nums; }
.viewer-counter { white-space: nowrap; font-variant-numeric: tabular-nums; }
.viewer-caption { overflow-wrap: anywhere; }

/* Babies and family: a roster first, occasional management behind an entry. */
.family-content { max-width: 1000px; }
.family-child-list { padding: 0 22px; background: var(--paper); border: 1px solid #f0e6df; border-radius: 16px; }
.family-child-row { display: flex; align-items: center; gap: 16px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.family-child-row:last-child { border-bottom: 0; }
.family-child-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.family-child-copy h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 17px; }
.family-child-copy p, .family-child-copy small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.family-child-portrait { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 18px; background: var(--soft); color: var(--accent); flex-shrink: 0; overflow: hidden; }
.family-child-portrait img { width: 100%; height: 100%; object-fit: cover; }
.family-child-portrait > .icon { width: 26px; height: 26px; }
.family-child-portrait.large { width: 88px; height: 88px; border-radius: 50%; }
.family-child-portrait.large > .icon { width: 38px; height: 38px; }
.child-choice .family-child-portrait { width: 32px; height: 32px; border-radius: 50%; }
.family-secondary-nav { margin-top: 14px; }
.family-detail-identity { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; }
.family-avatar-group { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.family-avatar-editor { align-self: center; }
.family-entry { display: flex; align-items: center; gap: 14px; width: 100%; padding: 17px 0; text-align: left; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.family-entry:last-child { border-bottom: 0; }
.family-entry:hover { color: var(--accent-dark); }
.family-entry > .icon:first-child { color: var(--accent); width: 24px; height: 24px; }
.family-entry > span { flex: 1; min-width: 0; }
.family-entry strong, .family-entry small { display: block; }
.family-entry small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.family-entry > .icon:last-child { width: 16px; height: 16px; }
.family-layout.family-members-layout, .family-members-layout { display: flex; flex-direction: column; gap: 16px; }
.family-fold { padding: 15px 20px; background: var(--paper); border: 1px solid #f0e6df; border-radius: 14px; }
.family-fold summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.family-fold summary > span { color: var(--muted); font-size: 12px; }
.family-fold p { margin-top: 12px; }
.family-invite-dialog, .family-invite-dialog .invitation-panel { position: static; padding: 0; width: 100%; margin: 0; border: 0; box-shadow: none; }
.family-code-field input { font-size: 18px; font-variant-numeric: tabular-nums; }
.family-code-field input.numeric-code, .numeric-code-field input { font-size: 26px; letter-spacing: .16em; }

/* Storage and settings are shared by the family, not duplicated per baby. */
.storage-list-page { max-width: 1000px; }
.hosted-space { padding: clamp(18px, 3vw, 30px); }
.hosted-space h2, .hosted-space p { margin: 0; }
.hosted-space .warm-art { flex: none; }
.storage-location-list { padding: 0 22px; }
.storage-location-row { display: flex; align-items: center; gap: 18px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.storage-location-row:last-child { border-bottom: 0; }
.storage-location-row > .warm-art { flex-shrink: 0; width: 66px; height: 66px; margin: -7px 0; transform: scale(.7); transform-origin: center; }
.storage-location-row .storage-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.storage-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.storage-title h2 { font-size: 17px; }
.storage-copy p { font-size: 13px; margin: 4px 0; }
.storage-copy small { font-size: 12px; }
.storage-type-list { display: flex; flex-direction: column; gap: 8px; }
.storage-type-list > .button { justify-content: flex-start; text-align: left; padding: 17px; background: var(--paper); border-color: #efe1d7; }
.storage-type-list > .button:hover { background: var(--softest); border-color: #dcb49d; }
.storage-type-list > .provider-choice { border: 1px solid #efe1d7; border-radius: 12px; padding: 16px; background: var(--paper); gap: 14px; }
.storage-type-list > .provider-choice:hover { background: var(--softest); border-color: #dcb49d; }
.storage-type-list .provider-choice strong, .storage-type-list .provider-choice small { display: block; }
.storage-type-list .provider-choice small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.storage-type-list .provider-choice > .icon:first-child { color: var(--accent); width: 27px; height: 27px; }
.storage-type-list .provider-choice > .icon:last-child { width: 16px; height: 16px; }
.storage-detail-summary { display: flex; align-items: center; gap: 16px; }
.storage-detail-summary h3 { font-size: 19px; }
.storage-advanced { border-top: 1px solid var(--line); padding-top: 16px; }
.storage-advanced > summary { color: var(--accent-dark); font-size: 14px; }
.storage-advanced[open] > summary { margin-bottom: 16px; }
.storage-advanced .stack { gap: 16px; }
.settings-sections { display: flex; flex-direction: column; gap: 20px; max-width: 920px; }
.settings-row { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.settings-row:last-child { border-bottom: 0; }
.settings-row > .icon { color: var(--accent); flex-shrink: 0; }
.settings-row > div { flex: 1; min-width: 0; }
.settings-row small, .settings-row p { font-size: 12px; color: var(--muted); }
.settings-about { display: flex; align-items: center; gap: 18px; }
.settings-about img { width: 62px; height: 62px; border-radius: 16px; }
.settings-about h2 { font-size: 20px; }
.settings-about p { color: var(--muted); margin-top: 5px; font-size: 13px; }

/* Let the photographs occupy the page; details remain one click away. */
.overview-storage-quiet { display: flex; align-items: flex-start; flex-direction: column; text-align: left; gap: 12px; }
.overview-attention { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 15px 18px; background: var(--softest); border-radius: 13px; }
.media-filters.media-filters-quiet { display: flex; align-items: stretch; flex-direction: column; padding: 0 0 18px; gap: 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.media-search-row { display: flex; align-items: flex-end; gap: 10px; }
.media-search-row > .field { flex: 1; max-width: 550px; }
.media-advanced { align-self: flex-start; width: 100%; }
.media-advanced > summary { font-size: 13px; color: var(--accent-dark); padding: 6px 0; width: fit-content; }
.media-advanced-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 14px 0 0; max-width: 850px; }
.media-filter-summary { color: var(--muted); font-size: 12px; }
.tile-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tile-title strong { min-width: 0; overflow-wrap: anywhere; }
.media-info { min-width: 44px; min-height: 36px; width: auto; height: 36px; padding: 5px 7px; color: var(--muted); border-radius: 10px; font-size: 12px; }
.media-info .icon { width: 17px; height: 17px; }
.media-detail-preview { height: 260px; width: 100%; overflow: hidden; border-radius: 12px; background: var(--softest); }
.media-detail-preview .photo { height: 100%; aspect-ratio: auto; background: var(--softest); }
.media-detail-preview .photo img { object-fit: contain; }
.media-metadata { margin: 0; display: flex; flex-direction: column; }
.media-metadata > div { display: flex; align-items: flex-start; gap: 24px; border-bottom: 1px solid var(--line); padding: 13px 0; }
.media-metadata dt { color: var(--muted); flex-shrink: 0; }
.media-metadata dd { margin: 0 0 0 auto; text-align: right; overflow-wrap: anywhere; }
.media-story p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; }
.selection-bar { border-color: #ead6c8; box-shadow: 0 5px 24px #73503916; }

/* Import source first. Task controls continue to reflect actual server state. */
.import-source-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.import-source-options > div { display: flex; flex-direction: column; gap: 8px; }
.import-source-options p { margin-left: 3px; font-size: 12px; color: var(--muted); }
.import-source-card { min-height: 76px; justify-content: flex-start; gap: 14px; text-align: left; padding: 18px 22px; background: var(--paper); border-color: #eadbd0; }
.import-source-card .icon { width: 27px; height: 27px; color: var(--accent); }
.import-source-card[aria-pressed="true"], .import-source-card[aria-expanded="true"] { background: var(--softest); border-color: #d7aa90; color: var(--accent-dark); }
.import-computer { margin-bottom: 24px; }
.drop-zone.drop-zone-quiet { gap: 18px; padding: 24px; text-align: left; }
.drop-zone-quiet > .icon { width: 40px; height: 40px; padding: 8px; border-radius: 12px; background: var(--soft); color: var(--accent); flex-shrink: 0; }
.drop-zone-quiet h2 { font-size: 18px; }
.drop-zone-quiet p { font-size: 13px; }
.task-row.task-row-quiet { padding: 20px; background: var(--paper); border-color: #efe5dd; box-shadow: none; align-items: flex-start; }
.task-type-icon { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; color: var(--accent); border-radius: 13px; background: var(--softest); flex-shrink: 0; }
.task-main-result { color: var(--ink); font-size: 14px; margin: 8px 0; }
.task-next-step { font-size: 12px; color: var(--muted); margin-top: 6px; }
.task-summary-details { margin-top: 10px; font-size: 12px; color: var(--muted); }
.task-summary-details summary { color: var(--accent-dark); width: fit-content; }
.task-summary-details[open] summary { margin-bottom: 8px; }
.task-summary-details p { font-size: 12px; margin-top: 4px; }

@media (min-width: 1100px) { .page-content { padding-left: 36px; padding-right: 36px; } }
@media (max-width: 900px) {
  .viewer-meta { flex-wrap: wrap; gap: 10px 14px; }
  .viewer-meta > .viewer-caption { flex-basis: 100%; }
  .viewer-zoom-controls { margin-right: auto; }
  .media-advanced-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .family-child-row { gap: 12px; }
  .storage-location-row { gap: 12px; }
  .overview-storage-quiet { display: flex; }
}
@media (max-width: 720px) {
  .sidebar { visibility: hidden; }
  .shell.nav-open .sidebar { visibility: visible; }
  .shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 19; border: 0; background: #30241e59; }
  .topbar { height: 62px; }
  .child-switch { border: 0; gap: 5px; padding: 0; }
  .child-switch > span { display: none; }
  .child-switch select { max-width: 160px; min-width: 90px; font-size: 15px; }
  .page-content { padding-top: 22px; }
  .page-heading { gap: 12px; }
  .page-heading h1 { font-size: 23px; }
  .dialog.drawer[open], .dialog.drawer.wide { width: 100vw; border: 0; border-radius: 0; }
  .dialog-heading { padding: 15px 18px; }
  .dialog-body { padding: 18px; }
  .dialog-footer { padding: 14px 18px; }
  .viewer.dialog[open] { width: 100vw; height: 100dvh; border-radius: 0; }
  .viewer .dialog-body { padding: 0 10px 12px; }
  .viewer-help { display: none; }
  .viewer-meta > .viewer-caption { flex-basis: 100%; }
  .viewer-zoom-controls { gap: 0; padding: 2px; }
  .viewer-zoom-controls .icon-button { width: 36px; height: 36px; }
  .viewer-zoom-controls .viewer-fit { padding-left: 8px; padding-right: 8px; }
  .viewer-scale { min-width: 39px; }
  .family-child-list { padding: 0 15px; }
  .family-child-portrait { width: 42px; height: 42px; border-radius: 13px; }
  .family-child-row { gap: 10px; padding: 16px 0; flex-wrap: wrap; }
  .family-child-copy { min-width: 130px; }
  .family-child-row > .actions { margin-left: auto; }
  .family-child-copy h3 { font-size: 16px; }
  .family-child-row .button { font-size: 13px; padding: 8px 11px; min-height: 42px; }
  .family-entry { gap: 12px; }
  .storage-location-list { padding: 0 15px; }
  .storage-location-row { flex-wrap: wrap; }
  .storage-location-row > .warm-art { width: 44px; margin-right: 7px; transform: scale(.6); }
  .storage-location-row > .button { margin-left: auto; }
  .settings-row { gap: 10px; flex-wrap: wrap; }
  .settings-row .button { margin-left: auto; }
  .media-search-row { flex-wrap: wrap; }
  .media-search-row > .field { min-width: 170px; }
  .media-advanced-fields { grid-template-columns: 1fr; gap: 12px; }
  .media-filters-quiet .field input, .media-filters-quiet .field select { font-size: 14px; min-height: 42px; }
  .import-source-options { grid-template-columns: 1fr; gap: 12px; }
  .import-source-card { min-height: 65px; padding: 15px 18px; }
  .drop-zone.drop-zone-quiet { flex-direction: row; align-items: flex-start; padding: 18px; }
  .drop-zone-quiet .actions { justify-content: flex-start; }
  .task-row.task-row-quiet { padding: 16px; gap: 11px; }
  .task-type-icon { width: 34px; height: 34px; }
  .task-main-result { font-size: 13px; }
}
@media (max-height: 430px) {
  .dialog[open] { display: block; overflow: auto; max-height: calc(100dvh - 16px); }
  .dialog.drawer[open] { max-height: 100dvh; }
  .dialog .dialog-body { overflow: visible; }
  .viewer.dialog[open] { display: flex; }
  .viewer .dialog-body { overflow: hidden; }
}
