#view[data-page="preferences"],
#view[data-page="settings"] { max-width: 850px; }
.preferences-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.preferences-appearance { padding: 16px 20px 8px; border-block: 1px solid var(--line); background: var(--panel); }
.preferences-appearance h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; color: var(--ink); font-size: 16px; }
.preferences-appearance h2 svg { width: 19px; height: 19px; color: var(--navigation-accent); }
.preference-row { min-height: 58px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.preference-row > span { color: var(--text); font-size: 14px; }
.preference-row .palette-switch { display: flex; gap: 12px; }
.preference-row .palette-swatch { width: 44px; height: 44px; }
.preference-row .palette-swatch[aria-pressed="true"] { outline: 2px solid var(--navigation-accent); outline-offset: 2px; }
.preference-modes { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.preference-modes button { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px; background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--muted); font-size: 13px; }
.preference-modes button svg { width: 18px; height: 18px; }
.preference-modes [aria-pressed="true"] { color: var(--navigation-accent); background: var(--panel); border-color: var(--line2); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent); font-weight: 650; }
.preferences-menu.account-menu { margin-top: 0; }
.preferences-menu .account-chevron { display: grid; place-items: center; margin-left: auto; color: var(--muted); }
.preferences-menu .account-chevron svg { width: 18px; height: 18px; }
.preferences-menu.account-menu button { padding: 10px 16px; min-height: 58px; font-size: 15px; background: var(--panel); }
.preferences-menu.account-menu button:hover { background: var(--soft); }
.preferences-menu.account-menu .nav-icon { display: grid; place-items: center; width: 28px; height: 32px; flex: 0 0 28px; color: var(--navigation-accent); }
.preferences-menu.account-menu .nav-icon svg { width: 20px; height: 20px; }
#view .provider-settings { display: grid; gap: 14px; min-width: 0; max-width: 850px; }
.settings-section { display: grid; align-content: start; gap: 14px; padding: 18px 20px; border-block: 1px solid var(--line); background: var(--panel); }
.settings-section h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 2px; font-size: 16px; color: var(--ink); }
.settings-section h2 svg { width: 19px; height: 19px; color: var(--navigation-accent); }
.settings-section .field > label { font-size: 14px; font-weight: 600; }
.provider-secret { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; background: var(--field-surface); }
#view .provider-secret .input { border: 0; background: transparent; min-width: 0; flex: 1; }
.provider-secret > button { display: grid; place-items: center; width: 44px; flex: none; border: 0; border-radius: 0 8px 8px 0; color: var(--muted); background: transparent; }
.provider-secret > button:hover,
.provider-secret > button[aria-pressed="true"] { background: var(--strong); color: var(--navigation-accent); }
.provider-secret svg { width: 20px; height: 20px; }
.provider-key-notice { margin: 0; padding: 10px 12px; border-left: 2px solid var(--section-amber); background: color-mix(in srgb, var(--section-amber) 5%, var(--panel)); color: var(--text); font-size: 12px; line-height: 1.75; }
.provider-settings .settings-actions { padding-block: 12px; border-top: 1px solid var(--line); justify-content: flex-end; flex-wrap: wrap; }
.provider-settings [data-provider-feedback] { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.provider-settings [data-provider-feedback]:empty { display: none; }
.provider-settings [data-state="success"] { color: var(--success); }
.provider-settings [data-state="error"] { color: var(--danger); }
@media (max-width: 820px) {
  #view[data-page="settings"] { padding-bottom: 86px; }
  .provider-settings .settings-actions { position: fixed; z-index: 24; left: 0; right: 0; bottom: var(--shell-nav-height, calc(var(--mobile-nav-height, 78px) + env(safe-area-inset-bottom))); padding: 12px 18px; background: var(--panel); box-shadow: 0 -3px 12px color-mix(in srgb, var(--ink) 4%, transparent); }
  .provider-settings .settings-actions > .button { flex: 1; }
}
@media (max-width: 600px) {
  .preferences-appearance { padding: 14px 16px 6px; }
  .preference-row { gap: 10px; }
  .preference-modes button { padding-inline: 10px; }
  .settings-section { padding: 16px; }
  .settings-section[aria-labelledby="providerModelsTitle"] .field { grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 10px; }
}
@media (max-width: 820px) and (max-height: 520px) {
  .provider-settings .settings-actions { position: static; padding: 12px 0; box-shadow: none; }
  #view[data-page="settings"] { padding-bottom: 0; }
}
@media (min-width: 1100px) {
  .preferences-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  #view .provider-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .provider-settings :is(.settings-actions, [data-provider-feedback]) { grid-column: 1 / -1; }
}
