/* ==========================================================================
   SETTINGS PAGES  (assets/css/settings-pages.css)
   --------------------------------------------------------------------------
   Extra styles for the Settings pages built on includes/settings-ui.php
   (Notifications, Security, Properties, Objects, Meetings, Inboxes, ...).
   Loads after settings.css. Behaviour: assets/js/settings-pages.js

   1. Sections        .su-section
   2. Toggle rows     .su-toggle   .su-check
   3. Toolbars        .su-toolbar  .su-search
   4. Tables          .su-table    .su-matrix
   5. Code block      .su-code
   6. App cards       .su-grid     .su-app
   7. Stats / lists   .su-stats    .su-list  .su-item
   8. Misc            bands, hours, cookie preview, secret field
   ========================================================================== */

/* 1. SECTIONS ------------------------------------------------------------- */
.su-section {
  max-width: 820px;
  margin-bottom: var(--sp-8);
}
.su-section--wide {
  max-width: none;
}
.su-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.su-section__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.su-section__sub {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  max-width: 680px;
}
.su-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}
.su-new {
  margin-left: 6px;
  vertical-align: 2px;
  font-size: 11px;
  padding: 2px 8px;
}

/* 2. TOGGLE ROWS (switch left, text right) ------------------------------- */
.su-toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
}
.su-toggle + .su-toggle {
  border-top: 1px solid var(--border);
}
.su-toggle .switch {
  margin-top: 1px;
}
.su-toggle__body {
  min-width: 0;
  flex: 1;
}
.su-toggle__title {
  font-weight: 600;
  cursor: pointer;
}
.su-toggle__desc {
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 620px;
}
.su-toggle__body > .link {
  font-size: 14px;
  font-weight: 600;
  margin-left: 6px;
}
.su-more {
  margin-top: var(--sp-3);
  max-width: 480px;
}
.su-more[hidden] {
  display: none;
}

.su-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}
.su-checks {
  display: grid;
  gap: 12px;
}
.su-checks--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.su-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
}
.su-radio input {
  margin-top: 3px;
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  flex: none;
}
.su-radio:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.su-radio strong {
  display: block;
  font-size: 14px;
}
.su-radio span span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
}

/* 3. TOOLBARS ------------------------------------------------------------- */
.su-search.settings-nav__search {
  margin: 0;
  width: 300px;
  max-width: 100%;
  height: 40px;
}
.su-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.su-toolbar select.input {
  width: auto;
  height: 40px;
  font-size: 14px;
}
.su-toolbar__end {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}
.su-count {
  color: var(--text-muted);
  font-size: 14px;
}

/* 4. TABLES --------------------------------------------------------------- */
.su-table {
  min-width: 720px;
}
.su-table td {
  vertical-align: middle;
}
.su-table .su-sub {
  display: block;
  font-size: 12.5px;
  color: var(--text-subtle);
  margin-top: 2px;
  font-weight: 400;
}
.su-table .su-num {
  text-align: right;
}
.su-table tr[hidden] {
  display: none;
}
.su-row-actions {
  display: inline-flex;
  gap: var(--sp-3);
}
.su-danger {
  color: var(--danger) !important;
}
.su-empty {
  text-align: center;
  color: var(--text-subtle);
  padding: var(--sp-8) var(--sp-4);
}
.su-empty[hidden] {
  display: none;
}
.su-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.su-matrix {
  min-width: 640px;
}
.su-matrix th:not(:first-child),
.su-matrix td:not(:first-child) {
  text-align: center;
  width: 110px;
}
.su-matrix td .check {
  margin: 0 auto;
}
.su-matrix .su-group td {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.su-matrix tbody tr.su-group:hover td {
  background: var(--surface-2);
}

/* 5. CODE BLOCK ----------------------------------------------------------- */
.su-code {
  position: relative;
  margin: 0;
  padding: var(--sp-4) var(--sp-5);
  padding-right: 96px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}
.su-code-wrap {
  position: relative;
}
.su-code__copy {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* 6. APP CARDS ------------------------------------------------------------ */
.su-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}
.su-app {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
}
.su-app__top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.su-app__logo {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: var(--logo, var(--brand));
}
.su-app__name {
  font-weight: 700;
}
.su-app__by {
  font-size: 12.5px;
  color: var(--text-subtle);
}
.su-app__desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
.su-app__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.su-app[hidden] {
  display: none;
}

/* 7. STATS + LISTS -------------------------------------------------------- */
.su-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.su-stat {
  padding: var(--sp-4) var(--sp-5);
}
.su-stat__label {
  font-size: 13px;
  color: var(--text-muted);
}
.su-stat__value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.su-list {
  display: grid;
  gap: var(--sp-2);
}
.su-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.su-item[hidden] {
  display: none;
}
.su-item__grip {
  color: var(--text-subtle);
  cursor: grab;
  user-select: none;
  display: inline-flex;
}
.su-item__main {
  flex: 1;
  min-width: 0;
}
.su-item__title {
  font-weight: 600;
}
.su-item__meta {
  font-size: 12.5px;
  color: var(--text-subtle);
}
.su-item .input {
  height: 38px;
}
.su-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  background: var(--dot, var(--brand));
}
.su-item__side {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
}
.su-item__side select.input {
  width: auto;
  font-size: 13.5px;
}

/* 8. MISC ----------------------------------------------------------------- */
.su-bands {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
}
.su-band {
  padding: var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 4px solid var(--band, var(--success));
  background: var(--surface);
}
.su-band__name {
  font-weight: 700;
}
.su-band .field__help {
  margin-bottom: var(--sp-2);
}

.su-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.su-inline .input {
  width: auto;
}
.su-hours {
  min-width: 520px;
}
.su-hours td:first-child {
  width: 180px;
}
.su-hours .input {
  height: 38px;
  width: 140px;
}
.su-hours tr.is-off .input {
  opacity: 0.4;
  pointer-events: none;
}

.su-preview {
  padding: var(--sp-6);
  border-radius: var(--radius-lg);
  background: var(--surface-3);
}
.su-banner {
  max-width: 540px;
  margin: 0 auto;
  padding: var(--sp-5);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.su-banner p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
  line-height: 1.55;
}
.su-banner__btns {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  flex-wrap: wrap;
}
.su-preview.is-bottom-left .su-banner {
  margin-left: 0;
}
.su-preview.is-bottom-right .su-banner {
  margin-right: 0;
}

.su-secret {
  display: flex;
  gap: var(--sp-2);
}
.su-secret .input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.su-callout {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  border: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}
.su-callout p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
  max-width: 620px;
}
.su-scopes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

@media (max-width: 767.98px) {
  .su-search.settings-nav__search {
    width: 100%;
  }
  .su-toolbar__end {
    margin-left: 0;
    width: 100%;
  }
  .su-checks--2,
  .su-bands,
  .su-scopes {
    grid-template-columns: 1fr;
  }
  .su-code {
    padding-right: var(--sp-5);
    padding-top: 52px;
  }
  .su-item {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   Two-factor authentication (settings-security.php)
   ========================================================================== */
.tfa-sub {
  font-size: 15px;
  font-weight: 700;
  margin: var(--sp-6) 0 var(--sp-2);
}
[data-tfa-methods-error],
[data-codes-error] {
  display: none;
}
.tfa-me {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.tfa-me .badge {
  margin-left: 6px;
  vertical-align: 1px;
}
.tfa-steps {
  display: flex;
  gap: var(--sp-2);
  counter-reset: s;
}
.tfa-steps li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-subtle);
  padding-bottom: 10px;
  border-bottom: 3px solid var(--border);
}
.tfa-steps li span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--surface-3);
  font-size: 12px;
}
.tfa-steps li.is-active {
  color: var(--text);
  border-color: var(--brand);
}
.tfa-steps li.is-active span {
  background: var(--brand);
  color: var(--brand-contrast);
}
.tfa-steps li.is-done {
  color: var(--text-muted);
  border-color: var(--success);
}
.tfa-steps li.is-done span {
  background: var(--success-bg);
  color: var(--success);
}
.tfa-option {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.tfa-option + .tfa-option {
  margin-top: var(--sp-3);
}
.tfa-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.tfa-option input {
  margin-top: 3px;
  accent-color: var(--brand);
}
.tfa-option small {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}
.tfa-qr {
  width: 168px;
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tfa-qr i {
  aspect-ratio: 1;
}
.tfa-qr i.on {
  background: #111;
}
.tfa-secret {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.tfa-secret code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  letter-spacing: 0.06em;
}
.tfa-code {
  letter-spacing: 0.4em;
  font-size: 18px;
  max-width: 200px;
}
.tfa-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.tfa-codes li {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

/* Properties: row flashes after it was edited */
.su-table tr.is-updated td {
  background: var(--brand-soft);
  transition: background-color 1.2s var(--ease);
}

/* ==========================================================================
   Pricing & Features (pricing.php)
   ========================================================================== */
.pp {
  max-width: 1180px;
  margin: 0 auto;
}
.pp--narrow {
  max-width: 900px;
}
.pp .settings-nav__back {
  margin-bottom: var(--sp-2);
}
.pp-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}
.pp-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
}
.pp-toggle__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.pp-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}
.pp-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.pp-plan.is-popular {
  border-color: var(--brand);
  box-shadow:
    0 0 0 1px var(--brand),
    var(--shadow);
}
.pp-plan.is-current {
  background: var(--surface-2);
}
.pp-plan__flag {
  position: absolute;
  top: -12px;
  left: var(--sp-6);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: 12px;
  font-weight: 700;
}
.pp-plan__name {
  font-size: 20px;
}
.pp-plan__tag {
  color: var(--text-muted);
  font-size: 14px;
  min-height: 42px;
}
.pp-plan__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.pp-plan__price span {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.pp-plan__price small {
  color: var(--text-muted);
}
.pp-plan__bill {
  color: var(--text-subtle);
  font-size: 13px;
  margin-top: -8px;
}
.pp-plan__list {
  display: grid;
  gap: 8px;
  margin-top: var(--sp-2);
}
.pp-plan__list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
}
.pp-plan__list .icon {
  color: var(--success);
  margin-top: 2px;
}
.pp-table .pp-col {
  text-align: center;
}
.pp-table th.pp-col.is-current {
  color: var(--brand);
}
.pp-yes {
  display: inline-flex;
  color: var(--success);
}
.pp-no {
  color: var(--text-subtle);
}
.pp-sum {
  display: grid;
  gap: 8px;
  padding: var(--sp-4);
}
.pp-sum > div {
  display: flex;
  justify-content: space-between;
}
.pp-sum__total {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  font-size: 16px;
}
@media (max-width: 991.98px) {
  .pp-plans {
    grid-template-columns: minmax(0, 1fr);
  }
}

.rea-areas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
.rea-area {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.rea-area:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.rea-area input {
  margin-top: 3px;
  accent-color: var(--brand);
}
.rea-area small {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}
[data-rea-areas-error] {
  display: none;
  margin-top: var(--sp-2);
}
@media (max-width: 575.98px) {
  .rea-areas {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Tables fit the settings column: actions wrap under each other instead of
   pushing the table wider than its card; long text cells may wrap. */
.su-table {
  min-width: 600px;
}
.set-table .su-row-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 4px;
}
.set-table .su-row-actions > * {
  white-space: nowrap;
}
.su-table td:nth-child(n + 3) {
  white-space: normal;
}
.su-table td .badge,
.su-table td.su-num,
.su-table td.col-actions {
  white-space: nowrap;
}
.su-table th,
.su-table td {
  padding-left: 12px;
  padding-right: 12px;
}
.su-table td.crm-text-body-secondary {
  white-space: nowrap;
}
.su-table td[data-name] {
  overflow-wrap: anywhere;
  min-width: 120px;
}
.settings table th,
.settings table td:nth-child(2) {
  text-transform: capitalize;
}

.settings table th,
.settings table td:nth-child(2) {
  text-transform: capitalize;
}

.settings table th,
.settings table td:nth-child(2),
.settings table td:nth-child(2) .prp-name__link,
.settings table td:nth-child(2) .crm-fw-semibold,
.ut-name__link {
  text-transform: capitalize;
}

/* #459: emails in the name cell were title-cased (Mailto:Name@Domain.Com). */
.settings table td .ut-email {
  text-transform: none;
}

/* Security page: permission health cards and user-management drawer */
.security-permissions .set-intro { margin-bottom: 18px; }
.security-risk-list { display: grid; gap: 12px; max-width: 100%; }
.security-risk-card { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-width: 0; }
.security-risk-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; }
.security-risk-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.security-risk-icon--warning { color: #d97757; }
.security-risk-icon--info { color: var(--brand-ink, var(--brand)); }
.security-risk-icon--success { color: var(--brand-ink, var(--brand)); }
.security-risk-copy { flex: 1; min-width: 0; }
.security-risk-copy h2 { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 700; color: var(--text); }
.security-risk-copy p { margin: 3px 0 0; max-width: 780px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.security-risk-card > .btn-crm { flex: none; min-width: 74px; border-radius: 8px; }
.security-manage-drawer .set-drawer__body { padding-top: 18px; }
.security-user-row { display: flex; align-items: center; gap: 12px; padding: 14px 10px; border-top: 1px solid var(--border); cursor: pointer; }
.security-user-row input { accent-color: var(--brand); width: 16px; height: 16px; }
.security-user-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--surface-3); color: var(--text); font-weight: 600; }
.security-user-row strong, .security-user-row small { display: block; }
.security-user-row strong { font-size: 13px; font-weight: 600; }
.security-user-row small, .security-review-user span { color: var(--text-muted); font-size: 12px; }
.security-review-user { margin-top: 18px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.security-review-user span { display: block; margin-top: 3px; }
@media (max-width: 767px) {
  .security-risk-card { align-items: flex-start; flex-wrap: wrap; padding: 15px; gap: 10px; }
  .security-risk-copy { flex: 1 1 calc(100% - 42px); }
  .security-risk-card > .btn-crm { margin-left: 38px; }
}

/* Private Apps move notice (settings-private-apps.php) */
.private-apps-empty-state {
  max-width: 720px;
}
.private-apps-empty-state__copy h2.fw-500 {
  margin: 0 0 var(--sp-2);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: normal;
  line-height: 1.4;
  color: var(--text);
}
.private-apps-empty-state__copy p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}
