/*
 * Account Defaults: same light grey page background as settings-account-defaults.php /
 * Settings › General (no white bordered card). Content sits on --bg.
 */
.settings__main.ad-defaults-main {
  min-width: 0;
  padding: 0 0 80px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .settings__main.ad-defaults-main {
    padding-bottom: 80px;
  }
}

/*
 * Account Defaults: the design's boxed tab bar (.set-tabs--boxed in settings.css).
 * deals.css restyles every .set-tabs / .set-tab with !important (underline tabs with a brand-coloured
 * bar), and the design page does not load it, so the design's look is restored here, scoped to this
 * page. Same approach as connected-apps.css.
 * Active tab uses --bg so it opens into the grey page background.
 */
.ad-tabs.set-tabs.set-tabs--boxed {
  display: flex !important;
  align-items: stretch !important;
  gap: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border-bottom: 1px solid var(--border-strong) !important;
  margin-bottom: var(--sp-5);
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

.ad-tabs .set-tab {
  display: inline-block !important;
  min-width: 0 !important;
  padding: 12px 22px !important;
  margin-bottom: -1px !important;
  border: 1px solid var(--border-strong) !important;
  border-left-width: 0 !important;
  border-bottom-width: 1px !important;
  border-radius: 0 !important;
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  font-size: 14.5px !important;
  font-weight: 500 !important;
}

.ad-tabs .set-tab:first-child {
  border-left-width: 1px !important;
  border-top-left-radius: var(--radius-sm) !important;
}

.ad-tabs .set-tab:last-child {
  border-top-right-radius: var(--radius-sm) !important;
}

.ad-tabs .set-tab:hover {
  background: var(--surface-hover) !important;
  color: var(--text) !important;
}

.ad-tabs .set-tab.active {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-bottom-color: var(--bg) !important;
  font-weight: 600 !important;
}

.ad-tabs .set-tab::after,
.ad-tabs .set-tab.active::after {
  content: none !important;
  display: none !important;
}

@media (max-width: 767.98px) {
  .ad-tabs .set-tab {
    padding: 10px 14px !important;
  }
}

/* Notification Profiles: full-page profile editor (#profile-editor-view). */
.np-subview {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

.np-subview-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-3);
  min-height: 60px;
  padding: 0 var(--sp-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.np-subview-head__right {
  display: flex;
  justify-content: flex-end;
}

.np-subview-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.np-subview-back:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.np-subview-title-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.np-subview-title {
  max-width: 48vw;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.np-title-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.np-title-edit-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.np-title-inline-input {
  width: min(360px, 48vw);
  height: 34px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.np-subview-save {
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--brand-contrast);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.np-subview-save:hover {
  background: var(--brand-hover);
}

.np-subview-body {
  flex: 1;
  overflow-y: auto;
}

.np-subview-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) 64px;
}

.np-note-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--brand-soft);
}

.np-note-badge {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-ink);
}

.np-channels-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: var(--sp-5);
}

.np-channel-item {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 96px;
  padding: 8px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.np-channel-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.np-channel-icon-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: help;
}

.np-channel-svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.np-th-svg {
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
}

.np-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.np-topics-accordion-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.np-acc + .np-acc {
  border-top: 1px solid var(--border);
}

.np-acc__head {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-4);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.np-acc__head:hover {
  background: var(--surface-hover);
}

.np-acc__title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.np-acc__arrow {
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.np-acc.is-open .np-acc__arrow {
  transform: rotate(90deg);
}

.np-acc__title {
  font-size: 14px;
  font-weight: 600;
}

.np-acc__body {
  overflow-x: auto;
  padding: 0 var(--sp-4) var(--sp-3);
}

.np-topic-table {
  width: 100%;
  border-collapse: collapse;
}

.np-topic-table th {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  vertical-align: middle;
}

.np-topic-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.np-topic-table tr:last-child td {
  border-bottom: 0;
}

.np-topic-table .np-channel-col-header,
.np-topic-table .np-channel-col-cell {
  width: 64px;
  text-align: center;
}

.np-dash {
  font-size: 13px;
}

.np-topic-title {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

.np-topic-desc {
  margin-top: 3px !important;
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 767.98px) {
  .np-subview-head {
    padding: 0 var(--sp-3);
  }
}

/* Notification Profiles table: design columns (Name 32%, Assigned to 25%,
   Last Updated 30%, Actions 13%). The table stays inside its card, and the
   dated name and "Last Updated" wrap instead of pushing Actions off screen. */
.np-table.su-table.set-table {
  width: 100%;
  min-width: 0;
}

.settings .np-table th,
.settings .np-table td {
  text-transform: none;
}

.np-table td:first-child,
.settings .np-table td:nth-child(3).crm-text-body-secondary {
  white-space: normal;
  overflow-wrap: break-word;
}

/* Three icon buttons (Edit, Clone, Delete) in one row, like the design. */
.np-table .col-actions {
  width: 13%;
  text-align: right;
  white-space: nowrap;
}

.np-table .np-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.np-table .np-row-actions .icon-btn {
  width: 32px;
  height: 32px;
}

.np-table .np-row-delete:hover {
  color: var(--danger);
}

/* Feature Releases: gradual releases is admin-only; email notifications work for every user. */
#feature-releases .check:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Add currency modal: keep the searchable list under the trigger (not clipped). */
#currency-dialog {
  overflow: visible;
}

#currency-dialog .set-modal__body {
  overflow: visible;
}

#currency-dialog .custom-select-wrapper {
  display: block;
  width: 100%;
}

#currency-dialog .custom-select__options {
  max-height: 220px;
}

/*
 * Info tip defaults open upward (into the modal title) and is centred on the (i),
 * so the left edge clips the copy. Open below and align to the icon instead.
 */
#currency-dialog .set-info::after {
  bottom: auto !important;
  top: calc(100% + 8px) !important;
  left: 0 !important;
  right: auto !important;
  transform: none !important;
  max-width: min(260px, calc(100vw - 64px));
  z-index: 40;
}

/* Exchange rate log modal (PHP #ratelog-dialog / design screenshot). */
#ratelog-dialog {
  width: min(500px, calc(100vw - 32px));
  overflow: visible;
}

#ratelog-dialog .set-modal__body {
  gap: 16px;
  overflow: visible;
}

#ratelog-dialog .input,
#ratelog-dialog .custom-select__trigger {
  height: 40px;
}

#ratelog-dialog .input[disabled] {
  background: var(--surface-2, #f5f8fa);
  color: var(--text-muted);
  cursor: not-allowed;
}

#ratelog-dialog .custom-select-wrapper {
  display: block;
  width: 100%;
}

#ratelog-dialog .btn-crm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.crm-date-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.crm-date-input-icon {
  position: absolute;
  left: 12px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

#ratelog-dialog .crm-date-input {
  width: 100%;
  padding-left: 36px;
}

.ratelog-results-wrap {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.ratelog-results-table {
  width: 100%;
  border-collapse: collapse;
}

.ratelog-results-table th {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #516f90);
  text-align: left;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
}

.ratelog-results-table th:first-child {
  width: 55%;
}

.ratelog-results-table th:last-child {
  width: 45%;
}

.ratelog-results-table td {
  padding: 14px 0 4px;
  vertical-align: top;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}

.ratelog-results-table td:last-child {
  font-size: 13px;
}

.ratelog-results-table .user-avatar-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-2, #e5e7eb);
  color: var(--text-muted, #6b7280);
  flex-shrink: 0;
}

/* View history drawer pagination (PHP #fx-history-drawer .crm-pager). */
#fx-history-drawer .crm-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: var(--sp-4) 0 0;
}

#fx-history-drawer .crm-pager__nums {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#fx-history-drawer .crm-pager__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
}

#fx-history-drawer .crm-pager__btn:hover:not(:disabled) {
  background: var(--surface-hover);
}

#fx-history-drawer .crm-pager__btn:disabled {
  color: var(--text-subtle, var(--text-muted));
  cursor: default;
}

#fx-history-drawer .crm-pager__btn--num {
  padding: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

#fx-history-drawer .crm-pager__btn--num[aria-current='page'] {
  border-color: var(--text-muted);
  font-weight: 700;
}

#fx-history-drawer .crm-pager__gap {
  padding: 0 4px;
  color: var(--text-muted);
}

/* All Currencies — match settings-account-defaults.php / attached design */
#currency .cur-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

#currency .cur-table th:nth-child(1) {
  width: 38%;
}
#currency .cur-table th:nth-child(2) {
  width: 20%;
}
#currency .cur-table th:nth-child(3) {
  width: 18%;
}
#currency .cur-table th:nth-child(4) {
  width: 24%;
}

#currency .cur-table td {
  vertical-align: middle;
}

.badge-company-currency {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill, 9999px);
  border: 1px solid var(--success, #039855);
  color: var(--success, #039855);
  background: var(--success-bg, #ecfdf3);
}

.cur-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease;
  flex: 0 0 auto;
}

#currency .set-table tbody tr:hover .cur-row-actions,
#currency .set-table tbody tr:focus-within .cur-row-actions,
#currency .set-table tbody tr:has([aria-expanded='true']) .cur-row-actions,
.cur-row-actions.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cur-row-actions .btn-crm {
  --btn-h: 28px !important;
  height: 28px !important;
  padding: 0 10px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  border-radius: 9999px !important;
  gap: 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Portaled menu — fixed width; overrides global `.dropdown__menu { right: 0 }` stretch */
.cur-actions-menu.dropdown__menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  max-width: 220px;
  width: 220px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  right: auto;
  left: auto;
  transform-origin: top left;
}

.cur-actions-menu .dropdown__item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.cur-actions-menu .dropdown__item:hover,
.cur-actions-menu .dropdown__item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

#archive-currency-dialog .btn-crm--danger {
  background: var(--danger, #d92d20);
  border-color: var(--danger, #d92d20);
  color: #fff;
}

#archive-currency-dialog .btn-crm--danger:hover {
  background: var(--danger, #b42318);
  border-color: var(--danger, #b42318);
}

@media (max-width: 767.98px) {
  #currency .cur-row-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  #currency .cur-table th:nth-child(1),
  #currency .cur-table th:nth-child(2),
  #currency .cur-table th:nth-child(3),
  #currency .cur-table th:nth-child(4) {
    width: auto;
  }
}

