/* Local family appearance. Themes change presentation, never permissions.
   Loaded last so the same readable palette follows every view and dialog. */
body[data-family-theme] {
  --appearance-bg:#f6f2e8;
  --appearance-paper:#fffdf6;
  --appearance-soft:#e9eddd;
  --appearance-ink:#343c2e;
  --appearance-muted:#626650;
  --appearance-accent:#59613b;
  --appearance-hover:#444c2b;
  --appearance-line:#c9cbb8;
  --appearance-radius:14px;
  --appearance-heading:Georgia, 'Times New Roman', serif;
  --appearance-text:16px;
  --appearance-secondary:14px;
  --appearance-label:12px;
  --mobile-bg:var(--appearance-bg);
  --mobile-card:var(--appearance-paper);
  --mobile-ink:var(--appearance-ink);
  --mobile-muted:var(--appearance-muted);
  --mobile-line:var(--appearance-line);
  --mobile-accent:var(--appearance-accent);
  --family-ink:var(--appearance-ink);
  --family-muted:var(--appearance-muted);
  --family-olive:var(--appearance-accent);
  --family-line:var(--appearance-line);
  --family-paper:var(--appearance-paper);
  --family-terra:var(--appearance-accent);
  color:var(--appearance-ink);
  background:var(--appearance-bg);
  font-size:var(--appearance-text);
  line-height:1.65;
  color-scheme:light;
}
body[data-family-theme=discovery] {
  --appearance-bg:#fff7e6; --appearance-paper:#fffdf6; --appearance-soft:#e3efd7;
  --appearance-ink:#2e4030; --appearance-muted:#536349; --appearance-accent:#2f6145;
  --appearance-hover:#224b34; --appearance-line:#b9cba5; --appearance-radius:24px;
  --appearance-heading:Arial, Helvetica, sans-serif;
}
body[data-family-theme=bridge] {
  --appearance-bg:#f0f8ed; --appearance-paper:#fcfffa; --appearance-soft:#daeee8;
  --appearance-ink:#294441; --appearance-muted:#526762; --appearance-accent:#28665e;
  --appearance-hover:#1d504a; --appearance-line:#afcdc3; --appearance-radius:22px;
  --appearance-heading:Arial, Helvetica, sans-serif;
}
body[data-family-theme=club] {
  --appearance-bg:#eef5ff; --appearance-paper:#fcfdff; --appearance-soft:#dceafa;
  --appearance-ink:#263d58; --appearance-muted:#52667d; --appearance-accent:#255d9a;
  --appearance-hover:#194779; --appearance-line:#b6cbe1; --appearance-radius:20px;
  --appearance-heading:Arial, Helvetica, sans-serif;
}
body[data-family-theme=territory] {
  --appearance-bg:#f4effa; --appearance-paper:#fefcff; --appearance-soft:#e9dff4;
  --appearance-ink:#42324e; --appearance-muted:#695773; --appearance-accent:#67458f;
  --appearance-hover:#50326f; --appearance-line:#ccb9df; --appearance-radius:18px;
  --appearance-heading:Arial, Helvetica, sans-serif;
}
body[data-family-theme=route] {
  --appearance-bg:#eff4e9; --appearance-paper:#fefff9; --appearance-soft:#dbe9cc;
  --appearance-ink:#273c2b; --appearance-muted:#52634a; --appearance-accent:#24563a;
  --appearance-hover:#17432a; --appearance-line:#b4c8a2; --appearance-radius:8px;
  --appearance-heading:Arial, Helvetica, sans-serif;
}
body[data-family-theme=motion] {
  --appearance-bg:#eef2f5; --appearance-paper:#fcfdff; --appearance-soft:#dfe8ef;
  --appearance-ink:#2c3d4b; --appearance-muted:#526574; --appearance-accent:#405d75;
  --appearance-hover:#2e485f; --appearance-line:#bacad5; --appearance-radius:12px;
  --appearance-heading:Arial, Helvetica, sans-serif;
}
body[data-family-theme=balance] {
  --appearance-bg:#fbf2ec; --appearance-paper:#fffcf8; --appearance-soft:#f2e1d6;
  --appearance-ink:#4a362f; --appearance-muted:#765c50; --appearance-accent:#8a4935;
  --appearance-hover:#703824; --appearance-line:#d6bbab; --appearance-radius:16px;
}
body[data-family-theme=comfort] {
  --appearance-bg:#f0f6f2; --appearance-paper:#fdfffb; --appearance-soft:#dfede7;
  --appearance-ink:#2c413c; --appearance-muted:#51675f; --appearance-accent:#24645d;
  --appearance-hover:#184e48; --appearance-line:#b7cdc2; --appearance-radius:18px;
}
body[data-family-theme=close] {
  --appearance-bg:#f7f1f6; --appearance-paper:#fffdfd; --appearance-soft:#ecdfe9;
  --appearance-ink:#392b38; --appearance-muted:#665164; --appearance-accent:#6a3d62;
  --appearance-hover:#512c4b; --appearance-line:#baa4b7; --appearance-radius:18px;
  --appearance-heading:Arial, Helvetica, sans-serif;
}
body[data-family-text=large] { --appearance-text:18px; --appearance-secondary:16px; --appearance-label:13px; }
body[data-family-text=largest] { --appearance-text:20px; --appearance-secondary:18px; --appearance-label:14px; }

/* Type: preserve hierarchy, while removing the original 8–11px body copy. */
body[data-family-theme] :is(main,dialog) :is(p,li,dd) { font-size:var(--appearance-text); color:var(--appearance-ink); line-height:1.75; }
body[data-family-theme] :is(main,dialog) :is(small,dt,legend) { font-size:var(--appearance-secondary); color:var(--appearance-muted); line-height:1.55; }
body[data-family-theme] :is(main,dialog) :is(h1,h2,h3) { color:var(--appearance-ink); font-family:var(--appearance-heading); overflow-wrap:anywhere; }
body[data-family-theme] :is(main,dialog) h1 { font-size:clamp(30px,calc(var(--appearance-text) * 2.25),48px); line-height:1.18; letter-spacing:-.5px; }
body[data-family-theme] :is(main,dialog) h2 { font-size:calc(var(--appearance-text) * 1.65); line-height:1.28; letter-spacing:-.2px; }
body[data-family-theme] :is(main,dialog) h3 { font-size:calc(var(--appearance-text) * 1.3); line-height:1.35; }
body[data-family-theme] :is(.eyebrow,.muted,.hint,.empty,.list-empty,.growth-empty,.pets-empty,.rc-kind,.community-empty,.community-book-permit,.community-draft-hint,.community-chat-note,.mobile-upcoming-label,.mobile-search-count,.mobile-chat-noresults,.growth-subtitle,.growth-status,.pets-note,.growth-note) {
  font-size:var(--appearance-secondary); color:var(--appearance-muted); line-height:1.65;
}
body[data-family-theme] .eyebrow { letter-spacing:1px; }
body[data-family-theme] :is(main,dialog) :is(.community-task b,.pets-check b,.event strong,.scene b,.community-post-head b,.community-menu b,.mobile-event b,.mobile-family-pulse b,.mobile-shortcut b,.mobile-create-grid b,.community-chat-list b,.community-comment>b,.growth-checks label>span) {
  font-size:var(--appearance-text); color:var(--appearance-ink); line-height:1.5;
}
body[data-family-theme] :is(.budget-label,.stat-chips span,.financial-grid .card small,.expense-row,.check-row,.trip-detail b,.scene span,.archive-stats,.review-item strong,.budget-total small,.family-device-menu,.family-demo-banner,.family-demo-banner span,.community-audience,.community-location b,.community-location small,.community-thread-preview,.community-message>b,.community-message>small,.growth-stats span,.growth-tag,.growth-facts,.growth-facts dt,.growth-access legend,.growth-health-note,.growth-checks b,.growth-checks small,.growth-day-row legend,.growth-settings summary span,.growth-day-row>summary>span,.pets-small-stats,.pets-tag,.pets-hero-meta,.pets-amount span,.pets-care-progress,.pets-care-note,.pets-demo,.pets-supply-top small,.pets-task-footer label,.pets-expense-line,.rc-note,.rc-vault [role=status],.rc-dialog [role=status],.profile-picker small,.book-pagination span,.book-page .book-source,.queue-steps span,.phone-preview>small,.phone-preview>span,.memory-copy p,.memory-copy small,.mobile-panel>summary small,.mobile-personal-head .eyebrow,.mobile-personal-head p:not(.eyebrow),.mobile-privacy-line) {
  font-size:var(--appearance-secondary); color:var(--appearance-muted); line-height:1.6;
}
body[data-family-theme] :is(.community-message>p,.community-comment>p,.community-post-body p,.diary-entry p,.private-entry p,.book-page p,.growth-steps p) {
  font-size:var(--appearance-text); color:var(--appearance-ink);
}
/* These three legacy notes use !important in their module styles. */
body[data-family-theme] :is(.growth-note,.pets-note,.mobile-disclosure p) { font-size:var(--appearance-secondary)!important; color:var(--appearance-muted); }

/* Shared surfaces include the modules which predate the palette variables. */
body[data-family-theme] :is(.sidebar,.community-chat-list) { background:var(--appearance-soft); border-color:var(--appearance-line); }
body[data-family-theme] :is(.topbar,.family-bottom-nav) { background:var(--appearance-paper); border-color:var(--appearance-line); }
body[data-family-theme] :is(.card,.memory,.life-photo-card,.occasion,.rc-choice,.community-chat,.community-menu>button,.mobile-panel,.mobile-shortcut,.mobile-create-grid>button,.community-capture-strip button,.mobile-capture-row button,.mobile-personal-actions button,.community-short-grid>button,.pets-picker>button,.growth-person,.profile-picker button,.book-page,.contact-example) {
  background:var(--appearance-paper); border-color:var(--appearance-line); color:var(--appearance-ink); border-radius:var(--appearance-radius);
}
body[data-family-theme] :is(.inbox,.date-box,.stat-chips span,.pill,.review-item,.scenario-banner,.cinema-note,.life-promise,.cinema-invitation,.queue-state,.reminder-example,.private-entry,.book-hero,.community-local-note,.community-private-note,.community-audience,.community-location,.community-message,.mobile-privacy-line,.mobile-disclosure,.mobile-install,.growth-banner,.growth-overview,.growth-proposal,.growth-health-note,.growth-tag,.growth-day-art,.pets-demo,.pets-hero,.pets-care-progress,.pets-care-note,.pets-tag,.rc-note) {
  background:var(--appearance-soft); border-color:var(--appearance-line); color:var(--appearance-ink);
}
body[data-family-theme] :is(.community-message.mine,.pets-checked,.growth-done,.day.selected) { background:var(--appearance-soft); border-color:var(--appearance-accent); }
body[data-family-theme] :is(.community-messages,.pets-task-footer select) { background:var(--appearance-bg); }
body[data-family-theme] :is(.phone-preview,.phone-notch,.queue-steps b) { background:var(--appearance-soft); border-color:var(--appearance-line); color:var(--appearance-muted); }
body[data-family-theme] .queue-steps .reached b { background:var(--appearance-accent); border-color:var(--appearance-accent); color:#fff; }
body[data-family-theme] :is(.family-switch,.back-link,.demo-footer,.event,.day,.expense-row,.check-row,.scene,.section-title,.rhythm-strip,.community-task,.community-comment,.community-comments,.community-memory-row,.community-conversation-head,.community-chat-note,.growth-tip,.growth-facts>div,.growth-steps li,.growth-checks>label,.growth-settings,.growth-day-row,.growth-access,.growth-recipients label,.growth-edit-step,.pets-task-footer,.pets-expense-line,.pets-archive-note,.pets-settings,.community-access,.community-generation>.eyebrow,.community-recipient-list,.circle-tabs,.diary-entry,.timeline-line,.rc-vault .card) { border-color:var(--appearance-line); }
body[data-family-theme] .avatar { background:var(--appearance-soft); color:var(--appearance-accent); }
body[data-family-theme] :is(.identity,.brand-symbol,.family-mobile-brand,.breadcrumb b) { color:var(--appearance-accent); }
body[data-family-theme] :is(.identity small,.family-switch,.family-switch small,.back-link,.breadcrumb,.side-note p,.side-note>span,.family-mobile-caption,.demo-pill,.demo-footer,.demo-footer button,#storage-note) { color:var(--appearance-muted); }
body[data-family-theme] .family-switch { font-size:var(--appearance-secondary); background:var(--appearance-paper); }
body[data-family-theme] .family-switch small { font-size:var(--appearance-label); }
body[data-family-theme] .back-link { font-size:var(--appearance-secondary); min-height:44px; }
body[data-family-theme] .sidebar nav button { font-size:var(--appearance-secondary); color:var(--appearance-muted); min-height:46px; white-space:normal; }
body[data-family-theme] .sidebar nav button>span { color:var(--appearance-accent); }
body[data-family-theme] :is(.sidebar nav button.active,.family-bottom-nav button[aria-current=page],.occasion[aria-pressed=true],.pets-picker>button[aria-pressed=true],.profile-picker button[aria-pressed=true],.community-chat-list>button[aria-pressed=true]) { background:var(--appearance-soft); color:var(--appearance-accent); border-color:var(--appearance-accent); }
body[data-family-theme] :is(.sidebar nav b,.sidebar nav i) { font-size:var(--appearance-label); background:var(--appearance-paper); color:var(--appearance-muted); }
body[data-family-theme] .family-bottom-nav button { color:var(--appearance-muted); font-size:var(--appearance-label); min-height:56px; line-height:1.3; overflow-wrap:anywhere; }
body[data-family-theme] .family-bottom-nav button[aria-current=page] { color:var(--appearance-accent); }
body[data-family-theme] .bar { background:var(--appearance-line); }
body[data-family-theme] .bar>span { background:var(--appearance-accent); }
body[data-family-theme] :is(progress,input[type=checkbox],input[type=radio]) { accent-color:var(--appearance-accent); }

/* Controls keep touch targets without enlarging decorative glyphs or photos. */
body[data-family-theme] :is(button,input,select,textarea) { font-size:var(--appearance-text); }
body[data-family-theme] button { min-height:44px; white-space:normal; overflow-wrap:anywhere; }
body[data-family-theme] :is(.primary,.secondary,.text-button,.archive-filter button,.growth-tabs button,.pets-tabs button,.circle-tabs button,.community-filters>button,.community-reactions button,.mobile-panel>summary,.mobile-disclosure>summary,.growth-settings summary,.pets-settings summary,.growth-day-row>summary) { font-size:var(--appearance-secondary); min-height:44px; line-height:1.5; }
body[data-family-theme] :is(.primary,.family-add-button,.community-comments form>button,#community-chat-form button,.archive-filter button.active,.growth-tabs button[aria-pressed=true],.pets-tabs button[aria-pressed=true],.community-filters>button[aria-pressed=true],.day .today-number) { color:#fff; background:var(--appearance-accent); border-color:var(--appearance-accent); }
body[data-family-theme] .primary:hover { background:var(--appearance-hover); border-color:var(--appearance-hover); }
body[data-family-theme] :is(.secondary,.archive-filter button,.growth-tabs button,.pets-tabs button,.community-filters>button,.calendar-controls button,.icon-button,.mobile-show-more) { border-color:var(--appearance-line); background:var(--appearance-paper); color:var(--appearance-accent); }
body[data-family-theme] :is(.secondary:hover,.rc-choice:hover,.mobile-shortcut:hover,.appearance-entry:hover) { background:var(--appearance-soft); }
body[data-family-theme] :is(.text-button,.circle-tabs button,.mobile-panel>summary i,.growth-symbol,.growth-steps li>span,.growth-stats b,.pets-small-stats b,.pets-amount,.rc-choice>span,.rc-choice b,.assistant-symbol,.book-year,.ritual-seal,.memory-art.sound,.community-menu>button>span,.community-reactions button,.mobile-show-more) { color:var(--appearance-accent); }
body[data-family-theme] :is(.circle-tabs button[aria-pressed=true],.community-reactions button[aria-pressed=true]) { border-color:var(--appearance-accent); background:var(--appearance-soft); color:var(--appearance-accent); }
body[data-family-theme] :is(.day b,.week span,.day .event-mark) { font-size:var(--appearance-label); color:var(--appearance-muted); }
body[data-family-theme] .day .event-mark { background:var(--appearance-soft); }
body[data-family-theme] .day .today-number { color:#fff; }
body[data-family-theme] :is(input,select,textarea) { background:var(--appearance-paper); border-color:var(--appearance-line); color:var(--appearance-ink); min-width:0; max-width:100%; min-height:46px; }
body[data-family-theme] :is(#community-message,#family-chat-search,#family-section-search) { font-size:var(--appearance-text); }
body[data-family-theme] :is(input,textarea)::placeholder { color:var(--appearance-muted); opacity:1; }
body[data-family-theme] :is(label,legend) { font-size:var(--appearance-secondary); color:var(--appearance-muted); }
body[data-family-theme] :is(.family-profile-bar select,.growth-person select,.pets-task-footer select,dialog input,dialog select,dialog textarea) { font-size:var(--appearance-text); background:var(--appearance-paper); color:var(--appearance-ink); }
body[data-family-theme] :is(input[type=checkbox],input[type=radio]) { min-height:22px; width:22px; height:22px; flex-shrink:0; }
body[data-family-theme] :is(.check-row,.community-task,.pets-check,.growth-checks>label,.community-recipient-list label,.mobile-favorite-picker>label) { min-height:48px; }
body[data-family-theme] :is(button,a,input,select,textarea,summary):focus-visible { outline:3px solid var(--appearance-accent); outline-offset:3px; }
body[data-family-theme] :is(.close,.rc-close,.icon-button,.family-add-button,.community-edit,.community-memory-row button) { min-width:44px; min-height:44px; }
body[data-family-theme] :is(.close,.rc-close) { color:var(--appearance-accent); }
body[data-family-theme] :is(.growth-form-actions,.pets-form-actions,.growth-root form>.growth-actions,#community-chat-form) { background:var(--appearance-paper); }
body[data-family-theme] :is(dialog,#editor.book-dialog) { background:var(--appearance-paper); border-color:var(--appearance-line); color:var(--appearance-ink); }
body[data-family-theme] .toast { background:var(--appearance-accent); color:#fff; font-size:var(--appearance-secondary); }
body[data-family-theme] .rc-dialog input[type=file]::file-selector-button { background:var(--appearance-soft); color:var(--appearance-ink); font:inherit; min-height:44px; white-space:normal; }

/* Photographic storytelling keeps a consistently dark readable overlay. */
body[data-family-theme] :is(.hero,.warm-hero,.community-home-hero,.mobile-welcome,.film-hero) { border-radius:var(--appearance-radius); }
body[data-family-theme] :is(.hero,.warm-hero,.community-home-hero,.mobile-welcome):after { background:linear-gradient(90deg,#17291fe8,#17291f91 58%,#17291f25); }
body[data-family-theme] :is(.hero,.warm-hero,.community-home-hero,.mobile-welcome,.film-hero,.film-words) :is(h2,p,small,.eyebrow) { color:#fffdf4; }
body[data-family-theme] :is(.hero,.warm-hero,.community-home-hero,.mobile-welcome) :is(.primary,button) { background:#fffdf4; border-color:#fffdf4; color:#293c2d; }
body[data-family-theme] :is(.hero,.warm-hero) p { font-size:var(--appearance-text); }
body[data-family-theme] .photo-credit { color:#fffdf4; background:#17291fba; padding:3px 6px; font-size:11px; }
body[data-family-theme] #player { background:#1c2923; color:#fffdf4; border-color:#728578; }
body[data-family-theme] #player :is(h2,p,small,.player-note,.player-controls span) { color:#fffdf4; }
body[data-family-theme] #player .player-note { font-size:var(--appearance-secondary)!important; }
body[data-family-theme] #player .player-controls button { color:#fffdf4; border-color:#b5c2b3; font-size:var(--appearance-secondary); }
body[data-family-theme] #player .close { background:#1c2923; color:#fffdf4; }
body[data-family-theme] .book-cover { background:var(--appearance-accent); border-color:var(--appearance-accent); }
body[data-family-theme] .book-cover :is(span,i,small) { color:#fffdf4; }

/* The optional home is a different starting point; navigation stays available. */
.appearance-home { max-width:1100px; margin-inline:auto; }
.appearance-hero { padding:26px; border:1px solid var(--appearance-line); border-radius:var(--appearance-radius); background:var(--appearance-soft); margin-bottom:18px; }
.appearance-hero>small { display:block; margin-bottom:12px; }
.appearance-hero h2 { margin:0 0 10px; }
.appearance-hero p { margin-bottom:0; max-width:680px; }
.appearance-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:18px 0; }
.appearance-actions>button { min-height:76px; display:flex; align-items:center; justify-content:center; gap:10px; text-align:left; border:1px solid var(--appearance-line); border-radius:var(--appearance-radius); background:var(--appearance-paper); color:var(--appearance-ink); padding:15px; }
.appearance-actions>button>svg { width:24px; height:24px; flex:0 0 24px; color:var(--appearance-accent); }
.appearance-actions>button>span { font-size:var(--appearance-secondary); line-height:1.45; }
.appearance-actions>button:hover { background:var(--appearance-soft); border-color:var(--appearance-accent); }
body[data-family-theme] .appearance-actions>button.primary { background:var(--appearance-accent); color:#fff; border-color:var(--appearance-accent); }
body[data-family-theme] .appearance-actions>button.primary>svg { color:#fff; }
body[data-family-home=simple] .appearance-actions { grid-template-columns:1fr; }
body[data-family-home=simple] .appearance-actions>button { min-height:90px; padding:20px; justify-content:flex-start; gap:16px; }
body[data-family-home=simple] .appearance-actions>button>span { font-size:var(--appearance-text); }
.appearance-today { margin-block:24px; }
.appearance-shortcuts { margin:20px 0; }
.appearance-note { padding:15px 18px; border-left:3px solid var(--appearance-accent); background:var(--appearance-soft); color:var(--appearance-muted); margin:24px 0; }
.appearance-customize { display:inline-flex; align-items:center; gap:8px; border:1px solid var(--appearance-line); background:var(--appearance-paper); color:var(--appearance-accent); border-radius:10px; padding:10px 13px; min-height:44px; text-align:left; }
.appearance-customize>svg { width:18px; height:18px; flex:0 0 18px; }
.appearance-entry { display:flex; align-items:center; gap:16px; width:100%; text-align:left; padding:18px; border:1px solid var(--appearance-line); border-radius:var(--appearance-radius); background:var(--appearance-paper); color:var(--appearance-ink); margin:18px 0; }
.appearance-entry>svg { width:24px; height:24px; flex:0 0 24px; color:var(--appearance-accent); }
.appearance-entry>span { min-width:0; font-size:var(--appearance-text); }
.appearance-entry>span:nth-child(2) { flex:1; }
.appearance-entry>span:last-child { color:var(--appearance-accent); }
.appearance-entry b { display:block; }
.appearance-entry small { display:block; font-size:var(--appearance-secondary); margin-top:4px; color:var(--appearance-muted); }

/* Picker is deliberately a form: changing a radio does not change the page. */
.appearance-settings { min-width:0; }
.appearance-panel { border:1px solid var(--appearance-line); border-radius:var(--appearance-radius); padding:0 16px; margin:20px 0; }
.appearance-panel>summary { min-height:52px; display:flex; align-items:center; cursor:pointer; padding:12px 0; font-size:var(--appearance-text); color:var(--appearance-ink); }
.appearance-panel[open] { padding-bottom:18px; }
.appearance-panel[open]>summary { border-bottom:1px solid var(--appearance-line); margin-bottom:15px; }
.appearance-themes { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:18px 0; }
body[data-family-theme] .appearance-choice { position:relative; display:grid; grid-template-columns:22px 1fr; gap:5px 10px; align-content:start; margin:0; padding:14px 12px; border:1px solid var(--appearance-line); border-radius:12px; min-height:112px; color:var(--appearance-ink); background:var(--appearance-paper); cursor:pointer; }
body[data-family-theme] .appearance-choice input { grid-row:1/4; margin:2px 0 0; width:22px; height:22px; min-height:22px; }
.appearance-choice strong,.appearance-choice small,.appearance-swatches { grid-column:2; min-width:0; }
.appearance-choice strong { font-size:var(--appearance-secondary); line-height:1.4; }
body[data-family-theme] .appearance-choice small { font-size:var(--appearance-label); }
.appearance-choice:has(input:checked) { border-color:var(--appearance-accent); box-shadow:inset 0 0 0 2px var(--appearance-accent); background:var(--appearance-soft); }
.appearance-choice:has(input:focus-visible) { outline:3px solid var(--appearance-accent); outline-offset:3px; }
.appearance-swatches { display:flex; gap:4px; margin-bottom:5px; }
.appearance-swatches i { display:block; width:23px; height:13px; border:1px solid #26372b45; border-radius:4px; }
.appearance-form-row { display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:16px; margin:18px 0; }
.appearance-form-row>label { margin:0; min-width:0; }
.appearance-form-row select { width:100%; }
.appearance-form-row input[type=checkbox] { margin:0; }
.appearance-form-row label:has(input[type=checkbox]) { display:flex; gap:12px; align-items:center; min-height:48px; }
.appearance-sample { --preview-size:16px; padding:20px; margin:20px 0; border:1px solid var(--appearance-preview-accent,var(--appearance-line)); border-radius:var(--appearance-radius); background:var(--appearance-preview-bg,var(--appearance-paper)); color:var(--appearance-preview-accent,var(--appearance-ink)); overflow-wrap:anywhere; }
.appearance-sample[data-preview-text=large] { --preview-size:18px; }
.appearance-sample[data-preview-text=largest] { --preview-size:20px; }
.appearance-sample>strong { display:block; margin:12px 0 8px; font-size:calc(var(--preview-size) * 1.3); line-height:1.4; }
.appearance-sample>span { display:block; padding:10px 12px; background:var(--appearance-preview-soft,var(--appearance-soft)); font-size:var(--preview-size); line-height:1.6; border-radius:8px; }
body[data-family-theme] .appearance-sample>small { color:inherit; font-size:calc(var(--preview-size) - 2px); }
.appearance-sample p:last-child { margin-bottom:0; }
#family-appearance-form .form-actions { flex-wrap:wrap; }
#family-appearance-form .form-actions>button { flex:1 1 170px; }
body[data-family-theme=close] :is(.primary,.secondary,.text-button,.appearance-customize,.appearance-shortcuts>button,.family-bottom-nav button,summary,.family-profile-bar select) { min-height:52px; }
body[data-family-theme=close] :is(.card,.rc-choice,.appearance-actions>button,.appearance-choice) { border-width:2px; }
body[data-family-theme=route] .appearance-actions>button { border-left:5px solid var(--appearance-accent); }

@media(max-width:1000px) and (min-width:761px) {
  body[data-family-theme] .topbar { flex-wrap:wrap; height:auto; min-height:84px; gap:12px; padding-block:14px; }
  body[data-family-theme] .topbar .breadcrumb { white-space:normal; }
  body[data-family-theme] .top-actions { flex-wrap:wrap; }
}
@media(max-width:760px) {
  body[data-family-theme] { padding-bottom:calc(94px + env(safe-area-inset-bottom)); }
  body[data-family-theme] .topbar { padding:8px 12px; }
  body[data-family-theme] .top-actions { gap:8px; }
  body[data-family-theme] .family-profile-bar { flex:1 1 120px; min-width:0; }
  body[data-family-theme] .family-mobile-brand { font-size:27px; }
  body[data-family-theme] .family-add-button { width:44px; min-width:44px; }
  body[data-family-theme] .family-profile-bar select { padding-inline:7px 20px; font-size:var(--appearance-secondary); }
  body[data-family-theme] main { padding-inline:14px; }
  body[data-family-theme] .page-heading { align-items:flex-start; flex-wrap:wrap; }
  body[data-family-theme] .family-demo-banner { flex-wrap:nowrap; gap:6px; padding:7px 14px; justify-content:space-between; font-size:12px; line-height:1.45; }
  body[data-family-theme] .family-demo-banner span { font-size:12px; line-height:1.45; }
  body[data-family-theme][data-family-text=largest] .family-demo-banner,
  body[data-family-theme][data-family-text=largest] .family-demo-banner span { font-size:13px; }
  body[data-family-theme] .family-bottom-nav { padding-inline:4px; }
  body[data-family-theme] .family-bottom-nav button { padding-inline:2px; gap:6px; min-height:66px; }
  body[data-family-theme] .mobile-welcome { height:auto; min-height:215px; }
  body[data-family-theme] .mobile-welcome>div { padding:23px; }
  body[data-family-theme] .mobile-welcome h2 { max-width:75%; font-size:calc(var(--appearance-text) * 1.65); }
  body[data-family-theme] .mobile-welcome small { font-size:var(--appearance-secondary); }
  body[data-family-theme] :is(.hero,.warm-hero,.community-home-hero,.mobile-welcome):after { background:linear-gradient(0deg,#17291fe8,#17291f80 70%,#17291f25); }
  body[data-family-theme] .community-home-hero { min-height:360px; }
  body[data-family-theme] .community-home-hero>div { position:relative; }
  body[data-family-theme] :is(.mobile-favorite-grid,.community-capture-strip,.mobile-capture-row,.mobile-create-grid) { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body[data-family-theme] .mobile-capture-row>button:last-child:nth-child(odd) { grid-column:1/-1; }
  body[data-family-theme] :is(.community-capture-strip button,.mobile-capture-row button,.mobile-shortcut.compact,.mobile-create-grid>button) { min-height:76px; padding:12px 8px; font-size:var(--appearance-secondary); }
  body[data-family-theme] .mobile-shortcut.compact b { font-size:var(--appearance-secondary); }
  body[data-family-theme] :is(.mobile-section-head,.card-head,.section-title,.calendar-toolbar) { flex-wrap:wrap; gap:8px; }
  body[data-family-theme] .mobile-menu-grid .mobile-shortcut { grid-template-columns:1fr; padding:15px; }
  body[data-family-theme] .mobile-menu-grid .mobile-shortcut>span { display:block; }
  body[data-family-theme] .mobile-menu-grid .mobile-shortcut>small { font-size:var(--appearance-secondary); }
  body[data-family-theme] .mobile-personal-actions { grid-template-columns:repeat(3,minmax(0,1fr)); }
  body[data-family-theme] .mobile-personal-actions button>span { font-size:var(--appearance-label); }
  body[data-family-theme] .community-people-grid { grid-template-columns:1fr; }
  body[data-family-theme] .community-task input { min-height:22px; }
  body[data-family-theme] .community-message { max-width:94%; }
  body[data-family-theme] :is(.community-conversation-head summary,.community-chat-note summary,.community-comments summary) { min-height:44px; font-size:var(--appearance-secondary); }
  body[data-family-theme] :is(.community-conversation-head details,.community-conversation-head small) { font-size:var(--appearance-secondary); }
  body[data-family-theme] .community-messages { min-height:220px; }
  body[data-family-theme] .circle-tabs { flex-wrap:wrap; gap:6px 18px; white-space:normal; }
  body[data-family-theme] :is(.occasion-grid,.memory-grid,.rc-gallery,.community-recipient-list,.two-fields,.growth-fields,.ritual-card form) { grid-template-columns:1fr; }
  body[data-family-theme] .occasion { min-height:90px; }
  body[data-family-theme] .memory-grid>.memory:last-child:nth-child(odd) { grid-column:auto; }
  body[data-family-theme] :is(.expense-row,.pets-expense-line,.pets-task-footer,.book-pagination,.trip-detail,.financial-grid .card) { flex-wrap:wrap; }
  body[data-family-theme] .growth-facts>div { grid-template-columns:1fr; gap:3px; }
  body[data-family-theme] .growth-edit-step { grid-template-columns:1fr; }
  body[data-family-theme] .growth-stats { grid-template-columns:1fr; }
  body[data-family-theme] .growth-day-row .growth-fields { grid-template-columns:1fr; }
  body[data-family-theme] .pets-hero { flex-wrap:wrap; }
  body[data-family-theme] .pets-task-footer label { flex-basis:100%; max-width:none; }
  body[data-family-theme] .demo-footer { flex-wrap:wrap; }
  body[data-family-theme] .demo-footer>#storage-note { max-width:100%; font-size:var(--appearance-secondary); }
  body[data-family-theme] .family-device-menu summary { font-size:var(--appearance-secondary); min-height:44px; }
  body[data-family-theme] .family-device-menu button { max-width:none; font-size:var(--appearance-secondary)!important; }
  body[data-family-theme] dialog[open] { padding-inline:18px; }
  body[data-family-theme] dialog h2 { padding-right:32px; }
  body[data-family-theme] #editor.book-dialog { padding-inline:18px; }
  body[data-family-theme] .form-actions { flex-wrap:wrap; }
  body[data-family-theme] .form-actions>button { flex:1 1 145px; }
  body[data-family-theme] .toast { bottom:calc(100px + env(safe-area-inset-bottom)); }
  body[data-family-theme].mobile-keyboard-open { padding-bottom:10px; }
  body[data-family-theme].mobile-keyboard-open .toast { bottom:20px; }
  .appearance-hero { padding:22px; }
  body[data-family-theme][data-family-home=simple] .mobile-greeting { margin-bottom:12px; }
  body[data-family-theme][data-family-home=simple] .mobile-greeting h1 { font-size:calc(var(--appearance-text) * 1.7); margin:5px 0 8px; line-height:1.2; }
  body[data-family-theme][data-family-home=simple] .appearance-customize { font-size:14px; min-height:44px; padding:8px 0; }
  .appearance-actions { gap:7px; }
  .appearance-actions>button { flex-direction:column; text-align:center; padding:12px 6px; min-height:80px; gap:7px; }
  .appearance-actions>button>span { font-size:var(--appearance-label); }
  body[data-family-home=simple] .appearance-actions>button { flex-direction:row; text-align:left; }
  .appearance-form-row { grid-template-columns:1fr; gap:10px; }
}
@media(max-width:380px) {
  .appearance-themes { grid-template-columns:1fr; }
  body[data-family-theme] .appearance-choice { min-height:88px; }
  body[data-family-theme] .family-mobile-brand { font-size:25px; }
  body[data-family-theme] .top-actions { gap:6px; }
  body[data-family-theme] .family-profile-bar { flex-basis:105px; max-width:none; }
  body[data-family-theme] .family-bottom-nav button { font-size:12px; overflow-wrap:normal; white-space:nowrap; }
  body[data-family-theme] .mobile-menu-grid { grid-template-columns:1fr; }
  body[data-family-theme] .mobile-personal-actions { grid-template-columns:1fr; }
  body[data-family-theme] .day { padding:4px 2px; }
  body[data-family-theme] .day b { font-size:var(--appearance-secondary); }
  body[data-family-theme] .day .event-mark { font-size:11px; padding:3px 1px; }
  body[data-family-theme] .week span { font-size:12px; }
  body[data-family-theme] .book-page>div { padding:20px; }
  body[data-family-theme] .book-pagination { justify-content:flex-start; }
}
@media(prefers-reduced-motion:reduce) {
  .appearance-choice,.appearance-actions>button { transition:none; }
}

/* Six shortcuts fit in two rows; larger text retains spacious two-column cards. */
@media(max-width:760px){body[data-family-theme][data-family-text=standard] .mobile-favorite-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}body[data-family-theme][data-family-text=standard] .mobile-shortcut.compact{padding:10px 5px;min-height:80px}body[data-family-theme][data-family-text=standard] .mobile-shortcut.compact b{font-size:12px;line-height:1.3}}

/* Labels on filled controls inherit their control foreground, not body muted ink. */
body[data-family-theme] :is(main,dialog) button.primary :is(small,span,strong,b,p){color:inherit;opacity:1}
body[data-family-theme] :is(main,dialog) button:disabled{opacity:1;color:var(--appearance-muted);background:var(--appearance-soft);border-color:var(--appearance-line);cursor:not-allowed}
body[data-family-theme] :is(main,dialog) button:disabled :is(small,span,strong,b,p){color:inherit;opacity:1}
body[data-family-theme] :is(main,dialog) :is(input,textarea)::placeholder{color:var(--appearance-muted);opacity:1}

/* Телефон: убрать декоративный герой, действия компактнее. */
@media(max-width:760px){
  .appearance-hero{display:none}
  .appearance-actions{gap:8px;margin:10px 0 14px}
  .appearance-actions>button{min-height:62px;padding:9px 8px;flex-direction:column;justify-content:center;gap:6px;text-align:center}
  .appearance-actions>button>svg{width:22px;height:22px;flex:0 0 22px}
  body:not([data-family-text=large]):not([data-family-text=largest]) .appearance-actions>button>span{font-size:12px;line-height:1.3}
  .appearance-note{margin:14px 0;padding:11px 13px}
}
