/* The settings page shares the pal's neutral canvas; color belongs to the character. */
body.pal-experience .pal-settings-page {
  width: 100%; max-width: none; margin: 0; padding: 0 !important;
  min-width: 0; min-height: 0; overflow: hidden; color: var(--pal-ink); background: var(--pal-paper);
}
/* The heading sits where Overview, Goals, Routine and People put theirs
   (14px view inset + 26px head padding, centred in the 90px head: 46px down,
   38px in), so switching to Settings does not jump the title up and over. */
.pal-settings-header { flex: 0 0 auto; padding: 46px 38px 24px; }
.pal-settings-page .pal-settings-header h1 { margin: 0; font-family: inherit; font-size: 25px; line-height: 1.3; font-weight: 650; letter-spacing: -.6px; }
.pal-settings-layout { display: grid; grid-template-columns: 176px minmax(0, 620px); gap: 48px; flex: 1; min-height: 0; padding: 0 38px 24px; }
.pal-settings-nav { display: flex; flex-direction: column; gap: 3px; padding-top: 3px; align-self: start; }
.pal-settings-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 39px; padding: 8px 11px; border: 0; border-radius: 7px; font-family: inherit; font-weight: 500; line-height: 1.45; font-size: 14px; color: var(--pal-muted); background: transparent; text-align: left; cursor: pointer; }
.pal-settings-nav-item .ic { width: 16px; height: 16px; font-size: 16px; flex: 0 0 auto; opacity: .8; }
.pal-settings-nav-item.is-active { color: var(--pal-ink); background: var(--pal-soft); font-weight: 650; }
.pal-settings-nav-item:hover:not(.is-active) { color: var(--pal-ink); background: color-mix(in srgb, var(--pal-soft) 45%, transparent); }
.pal-settings-nav-divider { height: 1px; background: var(--pal-line); margin: 16px 10px; }
.pal-settings-pane { overflow-y: auto; min-width: 0; min-height: 0; padding: 0 4px 20px; scrollbar-width: thin; }
.pal-settings-form { display: flex; flex-direction: column; gap: 0; margin: 0; max-width: 600px; }
.pal-settings-section-head { margin: 0 0 30px; }
.pal-settings-section-head h2 { margin: 0 0 7px; font-size: 20px; font-weight: 650; letter-spacing: -.4px; line-height: 1.4; }
.pal-settings-section-head p { font-size: 14px; color: var(--pal-muted); margin: 0; line-height: 1.6; }
.pal-settings-identity { display: flex; align-items: center; gap: 28px; padding: 0 0 25px; margin-bottom: 18px; border-bottom: 1px solid var(--pal-line); }
.pal-settings-avatar { flex: 0 0 124px; display: flex; align-items: center; justify-content: center; min-height: 128px; }
.pal-settings-avatar .pal-character { width: 118px; height: 118px; }
.pal-settings-identity .pal-settings-field { flex: 1; max-width: 320px; margin: 0; }
.pal-settings-field { display: flex; flex-direction: column; gap: 8px; margin: 0 0 22px; }
.pal-settings-label { font-size: 14px; font-weight: 600; line-height: 1.5; }
.pal-settings-help { font-size: 13px; font-weight: 400; color: var(--pal-muted); line-height: 1.6; margin: 0; }
.pal-settings-form input:not([type=checkbox]), .pal-settings-form textarea, .pal-settings-form select { width: 100%; border: 1px solid var(--pal-line); border-radius: 8px; background: var(--pal-paper); color: var(--pal-ink); font-family: inherit; font-size: 15px; line-height: 1.5; padding: 10px 12px; box-shadow: none; }
.pal-settings-form textarea { resize: vertical; min-height: 150px; max-height: 420px; }
.pal-settings-form select { max-width: 200px; }
.pal-settings-form input::placeholder, .pal-settings-form textarea::placeholder { color: var(--pal-muted); opacity: .85; }
.pal-settings-form input:focus-visible, .pal-settings-form textarea:focus-visible, .pal-settings-form select:focus-visible { outline: 2px solid var(--pal-ink); outline-offset: 2px; border-color: transparent; }
.pal-settings-choice { position: relative; border: 0; border-bottom: 1px solid var(--pal-line); min-width: 0; padding: 19px 0; margin: 0; }
.pal-settings-choice legend { float: left; width: 92px; font-size: 14px; font-weight: 600; line-height: 44px; padding: 0; }
.pal-settings-options { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pal-settings-options button { flex: 0 0 48px; height: 48px; border: 1.5px solid transparent; border-radius: 10px; background: transparent; display: inline-flex; align-items: center; justify-content: center; padding: 3px; cursor: pointer; }
.pal-settings-options button:hover { background: var(--pal-soft); }
.pal-settings-options button[aria-pressed=true] { border-color: var(--pal-ink); background: var(--pal-soft); }
.pal-settings-options .pal-character { width: 44px; height: 44px; }
.pal-settings-swatch { display: block; width: 27px; height: 27px; border-radius: 50%; box-shadow: inset 0 0 0 1px #00000005; }
.pal-settings-choice-color .pal-settings-options { gap: 6px; }
.pal-settings-choice-color .pal-settings-options button { flex-basis: 44px; height: 44px; border-radius: 50%; }
.pal-settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 25px 0 6px; margin-top: 5px; }
/* The primary button's own metrics (.btn.primary in pal-foundation.css), not
   a 42px one-off that stood a head taller than New goal or Find customers. */
.pal-settings-save { border: 1px solid var(--pal-ink); border-radius: var(--radius-btn); background: var(--pal-ink); color: var(--pal-paper); font: 600 13px/18px var(--font-ui); padding: 6px 12px; min-height: 32px; cursor: pointer; white-space: nowrap; }
.pal-settings-save:hover { opacity: .9; }
.pal-settings-save:disabled { opacity: .55; cursor: default; }
.pal-settings-save-status { font-size: 12px; color: var(--pal-muted); line-height: 1.5; }
.pal-settings-save-status[data-tone=error] { color: var(--ink-danger); }
.pal-settings-note-row { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.6; color: var(--pal-muted); }
.pal-settings-note-row .ic { margin-top: 3px; }
.pal-openai-key-saved { align-items: center; justify-content: space-between; gap: 16px; max-width: 600px; }
.pal-openai-key-saved + .pal-settings-help { margin-top: 6px; }
.pal-settings-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 0 25px; border-bottom: 1px solid var(--pal-line); margin-bottom: 25px; cursor: pointer; }
.pal-settings-switch-words { display: flex; flex-direction: column; gap: 5px; }
.pal-settings-switch-words strong { font-size: 14px; font-weight: 600; }
.pal-settings-switch-row input { width: 19px; height: 19px; margin: 0; accent-color: var(--pal-ink); flex-shrink: 0; }
.pal-settings-update-note { padding: 20px 0; border-bottom: 1px solid var(--pal-line); }
.pal-settings-form select.pal-settings-zone { max-width: 320px; }
.pal-settings-zone-here { align-items: center; flex-wrap: wrap; margin: -8px 0 22px; }
.pal-settings-zone-here .pal-button { font-size: 12px; padding: 6px 11px; }
.pal-settings-computer-section { padding: 4px 0 25px; border-bottom: 1px solid var(--pal-line); margin-bottom: 24px; }
.pal-settings-computer-section h3 { font-size: 14px; font-weight: 600; margin: 0 0 15px; }
.pal-settings-computer-section .run-where { width: min(100%, 340px); margin: 0; }
.pal-settings-computer-section .run-where-opt { min-height: 40px; font-size: 14px; }
.pal-settings-computer-section .run-where-sub { font-size: 12px; line-height: 1.5; margin-top: 10px; }
.pal-settings-retained[hidden] { display: none !important; }
@media (max-width: 1180px) {
  .pal-settings-layout { gap: 28px; grid-template-columns: 152px minmax(0, 1fr); padding: 0 28px 22px; }
  .pal-settings-header { padding: 20px 28px 24px; }
  .pal-settings-choice legend { width: 72px; }
  .pal-settings-choice-color .pal-settings-options { gap: 2px; }
}
@media (max-width: 960px) {
  .pal-settings-layout { display: flex; flex-direction: column; gap: 24px; padding: 0 26px 18px; }
  .pal-settings-nav { flex: 0 0 auto; align-self: stretch; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; border-bottom: 1px solid var(--pal-line); padding-bottom: 16px; }
  .pal-settings-nav-item { min-width: 0; justify-content: center; padding: 9px 5px; font-size: 12px; gap: 5px; }
  .pal-settings-nav-item .ic { width: 14px; height: 14px; }
  .pal-settings-nav-divider { display: none; }
  .pal-settings-pane { flex: 1; padding-right: 2px; }
  .pal-settings-identity { gap: 18px; }
  .pal-settings-section-head { margin-bottom: 23px; }
}
@media (max-width: 650px) {
  .pal-settings-header { padding: 18px 18px 20px; }
  .pal-settings-layout { padding: 0 16px 12px; gap: 20px; }
  .pal-settings-nav { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .pal-settings-nav-item { flex-direction: column; min-height: 52px; gap: 3px; font-size: 11px; }
  .pal-settings-nav-item .ic { width: 15px; height: 15px; }
  .pal-settings-choice legend { width: 100%; float: left; line-height: 1.5; margin-bottom: 9px; }
  .pal-settings-choice .pal-settings-options { clear: both; }
  .pal-settings-choice { padding: 15px 0; }
  .pal-settings-identity { gap: 12px; }
  .pal-settings-avatar { flex-basis: 90px; min-height: 100px; }
  .pal-settings-avatar .pal-character { width: 88px; height: 88px; }
  .pal-settings-footer { align-items: flex-start; }
  .pal-settings-help { font-size: 12px; }
}


/* Appearance: three cards, each a small window in the theme it names. The
   previews keep their own fixed colours (the pal's light and dark palettes),
   because a picture of Dark has to look dark while the page is light. */
.pal-theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 560px; }
.pal-theme-option {
  display: flex; flex-direction: column; gap: 11px; min-width: 0; padding: 9px 9px 12px;
  border: 1px solid var(--pal-line); border-radius: 12px; background: transparent; color: var(--pal-ink);
  font: inherit; text-align: left; cursor: pointer;
}
.pal-theme-option:hover { background: var(--pal-soft); }
.pal-theme-option[aria-checked=true] { border-color: var(--pal-ink); box-shadow: inset 0 0 0 1px var(--pal-ink); }
.pal-theme-option:focus-visible { outline: 2px solid var(--pal-focus); outline-offset: 2px; }
.pal-theme-preview { position: relative; display: flex; height: 76px; overflow: hidden; border-radius: 7px; }
/* The edge on top of both halves, so System's dark half cannot cover it. */
.pal-theme-preview::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pal-ink) 14%, transparent); pointer-events: none; }
.pal-theme-page { --page: #ffffff; --rail: #f7f7f7; --line: #e8e8e8; --ink: #242424; position: relative; display: flex; flex: 1; min-width: 0; background: var(--page); }
.pal-theme-page.is-dark { --page: #1c1c1e; --rail: #171719; --line: #363638; --ink: #f2f2f2; }
.pal-theme-rail { flex: 0 0 30%; background: var(--rail); border-right: 1px solid var(--line); }
.pal-theme-rail::before { content: ""; display: block; height: 9px; margin: 9px 7px 0; border-radius: 3px; background: var(--line); }
.pal-theme-lines { flex: 1; padding: 12px 10px; background: linear-gradient(var(--ink), var(--ink)) 10px 12px / 46% 6px no-repeat,
  linear-gradient(var(--line), var(--line)) 10px 26px / 70% 5px no-repeat,
  linear-gradient(var(--line), var(--line)) 10px 37px / 56% 5px no-repeat; opacity: .9; }
/* System: the same window, light on one side of a diagonal and dark on the other. */
.pal-theme-page.is-light + .pal-theme-page.is-dark { position: absolute; inset: 0; clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%); }
.pal-theme-words { display: flex; flex-direction: column; gap: 2px; padding: 0 3px; }
.pal-theme-words strong { font-size: 14px; font-weight: 650; }
.pal-theme-words span { font-size: 12px; color: var(--pal-muted); }
.pal-theme-note { margin-top: 14px; }
.pal-theme-note:empty { display: none; }
@media (max-width: 650px) {
  .pal-theme-options { gap: 8px; }
  .pal-theme-preview { height: 56px; }
  .pal-theme-words span { display: none; }
}

/* Settings → Updates: this app's version row, set apart from the morning update below it. */
.pal-settings-app-update { margin-bottom: 20px; }
