/* =========================================================================
   views/settings.css — Settings pages
   Split from the old monolithic styles/views.css. LOAD ORDER MATTERS:
   the <link> order in Magnet CRM.html / Client App.html reproduces the
   original file order, so the cascade is unchanged — add new rules to the
   matching feature file, not the end of the list.
   ========================================================================= */
/* ---------------------------------------------------------------------- */
/* Settings pages                                                         */
/* ---------------------------------------------------------------------- */
.set-page { max-width: 720px; margin: 0 auto; padding: var(--space-6) var(--space-6) var(--space-10); display: flex; flex-direction: column; gap: var(--space-6); }
.set-section { display: flex; flex-direction: column; gap: var(--space-4); }
.set-section-head h2 { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--text-strong); letter-spacing: -0.01em; }
.set-section-head p { margin-top: 4px; font-size: var(--text-sm); color: var(--text-soft); max-width: 56ch; }
.set-card { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }

.set-profile-top { display: flex; align-items: center; gap: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border-faint); }
.set-avatar .avatar { width: 56px; height: 56px; font-size: var(--text-lg); }
.set-profile-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-profile-name { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.set-profile-role { font-size: var(--text-sm); color: var(--text-soft); }

.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.set-field { display: flex; flex-direction: column; gap: 6px; }
.set-field--full { grid-column: 1 / -1; }
.set-label { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }
.set-foot { display: flex; justify-content: flex-end; gap: var(--space-2); }
.set-card-foot { display: flex; justify-content: flex-end; padding-top: var(--space-1); }
.set-subhead { margin-top: var(--space-2); }
.set-pic { display: flex; align-items: center; gap: var(--space-4); padding-bottom: var(--space-3); }
.set-pic-avatar { flex-shrink: 0; display: flex; }
.set-pic-avatar .avatar { width: 84px; height: 84px; font-size: var(--text-2xl); }
.set-pic-img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; display: block; }
.set-pic-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1; }
.set-pic-title { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.set-pic-desc { font-size: var(--text-sm); color: var(--text-soft); }
.set-pic-btn { align-self: flex-start; margin-top: 10px; }
.set-readfield { position: relative; display: flex; align-items: center; }
.set-readinput { padding-right: 64px; background: var(--gray-50); color: var(--text-muted); }
.set-readinput:not([readonly]) { background: var(--surface); color: var(--text); }
.set-read-edit { position: absolute; right: 6px; height: 30px; }

.pw-input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 6px; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: none; background: transparent; border-radius: var(--radius-sm);
  color: var(--text-soft); cursor: pointer; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .pw-toggle:hover { color: var(--text); background: var(--gray-50); }
}
.pw-toggle svg { width: 17px; height: 17px; }

/* toggle rows */
.set-rows { gap: 0; padding: var(--space-2) var(--space-5); }
.set-rows-label { font-size: var(--text-xs); font-weight: var(--fw-bold); letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-soft); padding: var(--space-3) 0 var(--space-2); }
.set-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; border-top: 1px solid var(--border-faint); }
.set-rows-label + .set-row { border-top: 0; }
.set-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-row-title { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.set-row-desc { font-size: var(--text-xs); color: var(--text-soft); }
.set-block-head { margin-bottom: var(--space-1); }

/* toggle switch */
.set-row-ctrl { display: inline-flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.set-time { width: auto; height: 34px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.stoggle { flex-shrink: 0; width: 40px; height: 24px; border-radius: 999px; background: var(--gray-200); position: relative; cursor: pointer; transition: background var(--dur) var(--ease); }
.stoggle .stoggle-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform var(--dur) var(--ease); }
.stoggle.on { background: var(--primary-600); }
.stoggle.on .stoggle-knob { transform: translateX(16px); }

/* client lead-alert numbers — chip input (Enter adds a number) */
.set-row--stack { flex-direction: column; align-items: stretch; gap: var(--space-2); }
.set-phones {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 44px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--btn-shadow); cursor: text;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.set-phones:focus-within { border-color: var(--primary-400); box-shadow: var(--ring-primary); }
.set-phone-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 5px 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary-600) 10%, transparent);
  color: var(--primary-600); font-size: var(--text-sm); font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.set-phone-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.set-phone-x svg { width: 11px; height: 11px; }
@media (hover: hover) and (pointer: fine) {
  .set-phone-x:hover { background: color-mix(in srgb, var(--primary-600) 16%, transparent); }
}
.set-phones-field {
  flex: 1; min-width: 140px; height: 30px; padding: 0 4px;
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: var(--text-sm); color: var(--text);
  font-variant-numeric: tabular-nums;
}
/* the wrapper carries the focus ring — kill the global :focus-visible ring on
   the inner field so it doesn't read as double-wrapped */
.set-phones-field:focus, .set-phones-field:focus-visible { outline: none; box-shadow: none; }
.set-phones-field::placeholder { color: var(--text-soft); }
.set-phones-field:disabled { cursor: default; }
.set-phones-kbd { flex-shrink: 0; align-self: center; padding-right: 2px; }
.set-phones-kbd kbd { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--gray-50); color: var(--text-soft); font-family: var(--font-sans); font-size: var(--text-2xs); font-weight: var(--fw-semibold); letter-spacing: 0.02em; }

/* workspace integrations */
.set-intg-list { display: flex; flex-direction: column; gap: var(--space-3); }
.set-intg { flex-direction: row; align-items: center; gap: var(--space-4); padding: var(--space-4); }
.set-intg-logo { flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.set-intg-logo svg { width: 22px; height: 22px; }
.set-intg-logo--drive { background: linear-gradient(140deg, #1fa463, #2684fc); }
.set-intg-logo--slack { background: #611f69; }
.set-intg-logo--meta { background: #0081fb; }
.set-intg-logo--cal { background: linear-gradient(140deg, #4285f4, #34a853); }
.set-intg-logo--track { background: linear-gradient(140deg, #6d3df0, #2684fc); }
.set-intg-groups { display: flex; flex-direction: column; gap: var(--space-6); }
.set-intg-cat-head { font-size: var(--text-xs); font-weight: var(--fw-bold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); margin-bottom: var(--space-3); }
.set-intg-logo--brand { background: var(--surface); border: 1px solid var(--border); }
.set-intg-logo--brand svg { width: 25px; height: 25px; }
.set-intg-logo--brand[data-tone="meta"] svg { width: 27px; height: auto; }
.set-intg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.set-intg-name { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.set-intg-badge { font-size: var(--text-2xs); font-weight: var(--fw-semibold); color: var(--success-600); background: var(--success-bg); padding: 1px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; }
.set-intg-desc { font-size: var(--text-sm); color: var(--text-soft); }
.set-intg-btn { flex-shrink: 0; min-width: 116px; justify-content: center; }

/* accounts (admins + client accounts) */
.acct-list { display: flex; flex-direction: column; gap: var(--space-3); }
.acct-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .acct-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
}
.acct-av { flex-shrink: 0; display: inline-flex; }
.acct-av .logo, .acct-av .avatar, .acct-av .proj-logo { width: 40px; height: 40px; font-size: var(--text-md); }
.acct-av .logo, .acct-av .proj-logo { border-radius: var(--radius-md); }
.acct-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.acct-name { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.acct-sub { font-size: var(--text-sm); color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-you { font-size: var(--text-2xs); font-weight: var(--fw-bold); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-soft); background: var(--gray-100); padding: 2px 7px; border-radius: 999px; }
.acct-role { flex-shrink: 0; font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-muted); margin-right: var(--space-2); }
.acct-open { flex-shrink: 0; gap: 6px; }
.acct-open svg { width: 15px; height: 15px; }
.acct-pin { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px; border: none; border-radius: 999px; background: var(--gray-100); color: var(--text-soft); cursor: pointer; font-family: ui-monospace, Menlo, monospace; font-size: var(--text-sm); letter-spacing: 0.14em; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .acct-pin:hover { background: var(--gray-200); }
}
.acct-pin.is-open { color: var(--text-strong); background: var(--primary-50); }
/* dark theme keeps the light primary-50 ramp, which would put near-white text
   on a near-white pill — tint the surface instead (same as .time-slot.active) */
html[data-theme="dark"] .acct-pin.is-open { background: color-mix(in srgb, var(--primary-500) 22%, var(--surface)); }
/* copied-to-clipboard confirmation flash (--success-bg is theme-aware; the
   html[data-theme] variant outranks the dark .is-open background above) */
.acct-pin.is-copied,
html[data-theme="dark"] .acct-pin.is-copied { color: var(--success-600); background: var(--success-bg); }
@media (hover: hover) and (pointer: fine) {
  .acct-pin.is-copied:hover { color: var(--success-600); background: var(--success-bg); }
}
.acct-pin-ico { display: inline-flex; }
.acct-pin-ico svg { width: 13px; height: 13px; }
.acct-del { flex-shrink: 0; color: var(--text-soft); }
@media (hover: hover) and (pointer: fine) {
  .acct-del:hover { color: var(--danger-600); border-color: color-mix(in srgb, var(--danger-600) 40%, var(--border)); background: var(--danger-bg); }
}
/* design-system .search bar, stretched full-width for the accounts list */
.acct-search { display: flex; width: 100%; margin-bottom: var(--space-3); }
.acct-count { font-size: var(--text-xs); font-weight: var(--fw-semibold); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-soft); margin-bottom: var(--space-3); }
.acct-empty { padding: var(--space-6); text-align: center; color: var(--text-soft); font-size: var(--text-sm); }

/* appearance */
.set-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.set-theme { display: flex; flex-direction: column; gap: 8px; padding: 6px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .set-theme:hover { border-color: var(--border-strong); }
}
.set-theme.sel { border-color: var(--primary-500); box-shadow: 0 0 0 1px var(--primary-500); }
.set-theme-prev { position: relative; height: 116px; border-radius: var(--radius-md); border: 1px solid var(--border-faint); overflow: hidden; }
.set-sk { display: block; width: 100%; height: 100%; }
.set-theme-prev--light, .set-theme-prev--system { --sk-bg: #ffffff; --sk-side: #f5f5f8; --sk-line: #e1e1e7; --sk-faint: #eeeef2; --sk-logo: #c8c8d2; --sk-pill: #eaf1ff; }
.set-theme-prev--dark { --sk-bg: #1c1c22; --sk-side: #25252d; --sk-line: #3b3b45; --sk-faint: #2b2b33; --sk-logo: #50505c; --sk-pill: #1d2942; }
.set-theme-prev-dark { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); --sk-bg: #1c1c22; --sk-side: #25252d; --sk-line: #3b3b45; --sk-faint: #2b2b33; --sk-logo: #50505c; --sk-pill: #1d2942; }
.set-theme-label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text); }
.set-theme-label > svg { width: 15px; height: 15px; color: var(--text-soft); }
.set-theme.sel .set-theme-label > svg:first-child { color: var(--text); }
.set-theme-label > svg:last-child { color: var(--primary-600); }
.set-theme.sel .set-theme-label > span { font-weight: var(--fw-semibold); }

.set-accents { display: flex; gap: var(--space-3); align-items: center; }
.set-accent { width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform var(--dur) var(--ease); }
.set-accent-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--swatch); transition: box-shadow var(--dur) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .set-accent:hover { transform: scale(1.08); }
}
.set-accent.sel { box-shadow: inset 0 0 0 2px var(--swatch); border-radius: 50%; }
.set-accent.sel .set-accent-dot { width: 12px; height: 12px; }
.set-density { display: inline-flex; }

@media (max-width: 560px) { .set-grid, .set-themes { grid-template-columns: 1fr; } }

/* Meta card: lead-webhook health chip (settingsIntegrations statusHTML) —
   warn variant for "connected but Meta isn't delivering" (base .intg-status
   lives in lead-drawer.css, loaded before this file in both shells). */
.intg-status--warn { color: var(--warning-600); background: var(--warning-bg); }
.intg-status--warn .intg-dot { background: var(--warning-600); }
.intg-name-row { flex-wrap: wrap; row-gap: 4px; }

/* ---- Settings → Employees (client portal, main account only) ----------
   Row anatomy: name input · PIN field (the shared .cd-pin-field look from
   clients.css) · remove; the section-visibility toggles sit underneath as a
   wrapping row of switch+label pairs. */
.emp-add { display: flex; gap: 10px; }
.emp-add .input { flex: 1; min-width: 0; }
.emp-row { padding: 14px 2px; }
.emp-row:first-child { padding-top: 4px; }
.emp-row + .emp-row { border-top: 1px solid var(--border); }
.emp-row-top { display: flex; align-items: center; gap: 10px; }
.emp-name { flex: 1; min-width: 0; font-weight: var(--fw-medium); }
.emp-pin { flex: 0 0 200px; gap: 8px; }
.emp-pin .cd-pin-val { font-size: var(--text-md); }
.emp-del { color: var(--text-soft); }
@media (hover: hover) and (pointer: fine) {
  .emp-del:hover { color: var(--danger-600); }
}
.emp-perms { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 12px; }
.emp-perm-cell { display: inline-flex; align-items: center; gap: 8px; }
.emp-perm-label { font-size: var(--text-sm); color: var(--text-muted); font-weight: var(--fw-medium); }
@media (max-width: 560px) {
  .emp-row-top { flex-wrap: wrap; }
  .emp-name { flex-basis: 100%; }
  .emp-pin { flex: 1; }
}
