/* Settings (settings.js): a dialog over the whole page, never another page.
   docs/design-system.md: dialog r16 with the scrim, the settings segmented
   control, 34 px fields, 34×20 switches, pill buttons, rows of 16/20.
   Every class starts with lc-set (and .lc-btn-danger-quiet, the design's
   danger-quiet button); every color is a token from theme.css. Under 640 px
   it fills the screen and its sections become a row of tabs. */
.lc-set-scrim {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--scrim); color: var(--text); font: 400 var(--fs-body, 14px)/var(--lh-ui, 1.45) var(--font);
  -webkit-font-smoothing: antialiased; animation: lc-set-fade var(--dur-3) var(--ease-out);
}
.lc-set-scrim *, .lc-set-scrim *::before, .lc-set-scrim *::after { box-sizing: border-box; }
/* Zero specificity, like chat.css's reset: each control class sets its own color and font. */
:where(.lc-set-scrim) :is(button, select, input, textarea) { font: inherit; color: inherit; }
.lc-set-scrim [hidden] { display: none !important; }
.lc-set {
  position: relative; display: flex; flex-direction: column; width: min(780px, 100%); height: min(640px, 100%);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-pop, 16px); box-shadow: var(--shadow-dialog);
  overflow: hidden; animation: lc-set-in var(--dur-4) var(--ease-out);
}
.lc-set:focus { outline: none; }
.lc-set :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@keyframes lc-set-fade { from { opacity: 0; } }
@keyframes lc-set-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }

.lc-set-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 24px; border-bottom: 1px solid var(--line); }
.lc-set-title { flex: 1; min-width: 0; margin: 0; font: 400 var(--fs-h3, 26px)/1.15 var(--serif); letter-spacing: var(--track-serif, -.01em); }
.lc-set-body { flex: 1; min-height: 0; display: flex; }

/* the sections: the sidebar's nav items (DS §5.2) */
.lc-set-nav { flex: none; width: 200px; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-right: 1px solid var(--line); overflow-y: auto; }
.lc-set-tab {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-row, 10px);
  background: none; color: var(--dim); font: 500 var(--fs-ui, 13.5px)/1 var(--font); text-align: left; white-space: nowrap; cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.lc-set-tab .lc-icon { color: var(--label); transition: color var(--dur-1) var(--ease-out); }
.lc-set-tab:hover { background: var(--hover); color: var(--text); }
.lc-set-tab[aria-selected="true"] { background: var(--active); color: var(--text); }
.lc-set-tab:hover .lc-icon, .lc-set-tab[aria-selected="true"] .lc-icon { color: var(--text); }

.lc-set-panel { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 24px 28px; }
.lc-set-panel:focus { outline: none; }
.lc-set-h { margin: 14px 0 2px; font: 600 var(--fs-title, 17px)/1.3 var(--font); }

/* rows (DS §3.3: settings row 16/20): what it is on the left, its control on the right */
.lc-set-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.lc-set-h + .lc-set-row, .lc-set-h + .lc-set-who, .lc-set-h + .lc-set-group > .lc-set-row:first-child { border-top: 0; }
.lc-set-text { flex: 1 1 240px; min-width: 0; }
.lc-set-label { display: block; font: 500 var(--fs-ui, 13.5px)/1.4 var(--font); color: var(--text); }
.lc-set-desc { margin-top: 2px; font-size: var(--fs-sm, 12.5px); line-height: 1.45; color: var(--label); }
.lc-set-ctl { flex: none; display: flex; align-items: center; gap: 8px; max-width: 100%; }
.lc-set-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lc-set-stack { flex-direction: column; align-items: stretch; }
.lc-set-stack > .lc-set-text { flex: none; }
.lc-set-msg { flex-basis: 100%; margin: 0; font-size: var(--fs-xs, 12px); line-height: 1.4; }
.lc-set-msg-ok { color: var(--ok-text); }
.lc-set-msg-err { color: var(--danger-text); }
.lc-set-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; font-size: var(--fs-sm, 12.5px); color: var(--label); }

/* the settings segmented control (DS §6.1) */
.lc-set-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill, 999px); background: var(--field); border: 1px solid var(--line); }
.lc-set-seg button {
  height: 28px; padding: 0 14px; border: 0; border-radius: var(--r-pill, 999px); background: none; color: var(--dim);
  font: 500 13px/1 var(--font); white-space: nowrap; cursor: pointer; transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.lc-set-seg button:hover { color: var(--text); }
.lc-set-seg button[aria-checked="true"] { background: var(--primary-bg); color: var(--primary-fg); }

/* fields (DS §6.1): 34 px, r10, --field; the focus shows on the border */
.lc-set-pick { position: relative; display: inline-flex; max-width: 100%; }
.lc-set-chev { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--label); pointer-events: none; }
.lc-set-select, .lc-set-input {
  height: var(--h-md, 34px); padding: 0 12px; border-radius: var(--r-row, 10px); border: 1px solid var(--line);
  background: var(--field); color: var(--text); font-size: var(--fs-ui, 13.5px);
}
.lc-set-select { -webkit-appearance: none; appearance: none; width: 240px; max-width: 100%; padding-right: 32px; text-overflow: ellipsis; cursor: pointer; }
.lc-set-select:hover:not(:disabled) { background: var(--field-hover); }
.lc-set-select:disabled { opacity: .5; cursor: default; }
.lc-set-select option { background: var(--panel); color: var(--text); }
.lc-set-input { width: min(360px, 100%); }
.lc-set-area {
  display: block; width: 100%; min-height: 108px; max-height: 280px; padding: 10px 12px; resize: vertical;
  border-radius: var(--r-row, 10px); border: 1px solid var(--line); background: var(--field); color: var(--text);
  font: 400 var(--fs-ui, 13.5px)/1.5 var(--font);
}
.lc-set-area::placeholder, .lc-set-input::placeholder { color: var(--label); }
.lc-set-scrim :is(.lc-set-select, .lc-set-input, .lc-set-area):focus-visible { outline: none; border-color: var(--focus-ring); }
.lc-set-field { display: flex; flex-direction: column; gap: 8px; padding: 16px 0 12px; border-top: 1px solid var(--line); }
.lc-set-count { align-self: flex-end; font: 400 var(--fs-2xs, 11.5px)/1 var(--font); color: var(--label); font-variant-numeric: tabular-nums; }
.lc-set-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; padding-top: 4px; }
.lc-set-foot .lc-set-msg { flex: 1 1 auto; }
.lc-set-off .lc-set-area { opacity: .6; }
.lc-set .lc-switch:disabled { opacity: .5; cursor: default; }
.lc-set .lc-btn .lc-icon svg { width: 13px; height: 13px; }

/* the design's danger-quiet button (DS §6.1): delete rows, before their confirmation */
.lc-btn-danger-quiet { background: none; border-color: color-mix(in srgb, var(--danger-fill) 25%, transparent); color: var(--danger-text); }
.lc-btn-danger-quiet:hover:not(:disabled) { background: color-mix(in srgb, var(--danger-fill) 8%, transparent); }

/* Account */
.lc-set-who { display: flex; align-items: center; gap: 12px; padding: 14px 0 16px; }
.lc-set-avatar { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--accent); color: var(--on-accent); font: 650 17px var(--font); }
.lc-set-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lc-set-who-text { display: flex; flex-direction: column; min-width: 0; }
.lc-set-who-text b { font: 600 15px/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-set-who-text small { font-size: var(--fs-sm, 12.5px); color: var(--dim); overflow-wrap: anywhere; }
.lc-set-who-text small.lc-set-who-how { color: var(--label); }
/* Personalization's name box sits like the text boxes */
.lc-set-field > .lc-set-input { width: 100%; }

/* Devices: one row each, this one first with its badge */
.lc-set-devices { list-style: none; margin: 0; padding: 0; }
.lc-set-device { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.lc-set-h + .lc-set-devices > .lc-set-device:first-child { border-top: 0; }
.lc-set-device > .lc-set-text { flex: 1 1 auto; }
.lc-set-device-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--overlay-3); color: var(--dim); }
.lc-set-device .lc-set-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lc-set-here { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.lc-set-device .lc-set-msg { margin: 4px 0 0; }

/* Plan: every plan as a card, the person's own one marked */
.lc-set-plans { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lc-set-plancard { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card2); }
.lc-set-plancard-here { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.lc-set-plancard-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lc-set-plancard-name { font: 600 var(--fs-ui, 13.5px)/1.4 var(--font); color: var(--text); }
.lc-set-plancard .lc-set-desc { margin: 6px 0 0; }
.lc-set-plancard .lc-set-plancard-where { margin-top: 2px; color: var(--dim); }
.lc-set-plancard .lc-set-actions { margin-top: 10px; }
.lc-set-danger { gap: 10px; }
.lc-set-danger .lc-set-label { color: var(--danger-text); }

/* a confirmation inside the dialog (chat.css's .lc-dialog on its own scrim) */
.lc-set-confirm { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--scrim); animation: lc-set-fade var(--dur-3) var(--ease-out); }

/* Usage: chat.css's usage block (.lc-use-…), with room above */
.lc-set [data-lc="settings-usage"] { padding-top: 10px; }

/* phones and narrow windows: the whole screen, the sections as a row of tabs */
@media (max-width: 640px) {
  .lc-set-scrim { padding: 0; align-items: stretch; }
  .lc-set { width: 100%; height: 100%; border: 0; border-radius: 0; animation-name: lc-set-up; }
  .lc-set-head { padding: max(10px, env(safe-area-inset-top)) 10px 8px 16px; }
  .lc-set-title { font-size: 24px; }
  .lc-set-body { flex-direction: column; }
  /* The current section is scrolled into view with room on both sides (its pill, focus ring and all). */
  .lc-set-nav { flex-direction: row; width: auto; gap: 4px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-padding-inline: 16px; }
  .lc-set-nav::-webkit-scrollbar { display: none; }
  .lc-set-tab { flex: none; height: 32px; padding: 0 12px; border-radius: var(--r-pill, 999px); }
  .lc-set-panel { padding: 2px 16px calc(28px + env(safe-area-inset-bottom)); }
  .lc-set-pick, .lc-set-select { width: 100%; }
  .lc-set-row > .lc-set-ctl:has(.lc-set-pick, .lc-set-seg) { width: 100%; }
}
@keyframes lc-set-up { from { opacity: 0; transform: translateY(16px); } }
/* iPhone Safari zooms into a text box under 16 px when it's focused (chat.css's touch block). */
@media (pointer: coarse) { .lc-set-input, .lc-set-select, .lc-set-area { font-size: 16px; } }
