/* Personal colour theme only. Existing layout, spacing and typography stay intact. */
body.p32-theme-dark {
  --p32-bg: #12151a;
  --p32-card: #1b1f26;
  --p32-ink: #e8ebf1;
  --p32-muted: #a4adba;
  --p32-line: #343b47;
  --p32-orange-dark: #ffad6d;
  --p32-warn: #ff9a8f;
  --p32-positive: #62d69a;
  --p32-negative: #ff9189;
  --p32-portal-ink: #e8ebf1;
  --p32-portal-muted: #a4adba;
  --subtle-fg: #12151a;
  --subtle-bg: #1b1f26;
  --fg-color: #1b1f26;
  --bg-color: #12151a;
  --card-bg: #1b1f26;
  --text-color: #e8ebf1;
  --text-light: #e8ebf1;
  --text-muted: #a4adba;
  --border-color: #343b47;
  --control-bg: #222730;
  --control-bg-on-gray: #222730;
  --input-bg: #222730;
  --disabled-control-bg: #292e37;
  --shadow-color: rgba(0, 0, 0, .35);
  background-color: #12151a;
  color: #e8ebf1;
  color-scheme: dark;
}

body.p32-theme-dark .p32-work,
body.p32-theme-dark .p32-messenger {
  --p32-bg: #12151a;
  --p32-card: #1b1f26;
  --p32-ink: #e8ebf1;
  --p32-muted: #a4adba;
  --p32-line: #343b47;
  --p32-line-strong: #4a5361;
  --p32-orange-dark: #ffad6d;
  --p32-mm-bg: #12151a;
  --p32-mm-card: #1b1f26;
  --p32-mm-panel: #1b1f26;
  --p32-mm-chat: #12151a;
  --p32-mm-ink: #e8ebf1;
  --p32-mm-muted: #a4adba;
  --p32-mm-line: #343b47;
  --p32-mm-line-strong: #4a5361;
  --p32-mm-orange-soft: #35232e;
  --p32-list-row-hover: rgba(235, 92, 151, .16);
}

body.p32-theme-dark .p32-erp-rail,
body.p32-theme-dark .p32-worker-header,
body.p32-theme-dark .p32-card,
body.p32-theme-dark .card,
body.p32-theme-dark .portal-section,
body.p32-theme-dark .portal-footer,
body.p32-theme-dark .p32-messenger-inbox,
body.p32-theme-dark .p32-messenger-detail,
body.p32-theme-dark .p32-messenger-detail-content,
body.p32-theme-dark .p32-messenger-conversation-head,
body.p32-theme-dark .p32-client-drawer,
body.p32-theme-dark .p32-messenger-compose,
body.p32-theme-dark .p32-messenger-dialog form,
body.p32-theme-dark .p32-messenger-dialog,
body.p32-theme-dark .p32-messenger-conversation-menu > div,
body.p32-theme-dark .p32-messenger-message-menu > div,
body.p32-theme-dark .p32-messenger-advanced-popover,
body.p32-theme-dark .p32-erp-profile-popover,
body.p32-theme-dark .dropdown-menu,
body.p32-theme-dark .modal-content,
body.p32-theme-dark .popover,
body.p32-theme-dark .frappe-card {
  background-color: #1b1f26;
  border-color: #343b47;
  color: #e8ebf1;
}

body.p32-theme-dark .p32-messenger-shell,
body.p32-theme-dark .p32-messenger-message-list,
body.p32-theme-dark .p32-messenger-empty,
body.p32-theme-dark .p32-messenger-role-state,
body.p32-theme-dark .p32-messenger-channel-summary,
body.p32-theme-dark .p32-work {
  background-color: #12151a;
  color: #e8ebf1;
}

body.p32-theme-dark .p32-erp-nav-item,
body.p32-theme-dark .p32-erp-profile > summary,
body.p32-theme-dark .p32-messenger-conversation-heading h1,
body.p32-theme-dark .p32-messenger-contact-name,
body.p32-theme-dark .p32-messenger-organization,
body.p32-theme-dark .p32-messenger-conversation,
body.p32-theme-dark .p32-messenger-conversation-name,
body.p32-theme-dark .p32-messenger-message,
body.p32-theme-dark .p32-messenger-message-copy,
body.p32-theme-dark .p32-messenger-message-html,
body.p32-theme-dark .p32-messenger-empty,
body.p32-theme-dark .p32-client-drawer,
body.p32-theme-dark .p32-messenger-dialog,
body.p32-theme-dark .p32-messenger-dialog label,
body.p32-theme-dark .p32-messenger-conversation-menu button,
body.p32-theme-dark .p32-messenger-message-menu button,
body.p32-theme-dark .p32-messenger-message-menu a,
body.p32-theme-dark .p32-messenger-orders-toggle,
body.p32-theme-dark .p32-messenger-order-context-indicator,
body.p32-theme-dark .p32-messenger-detail-message,
body.p32-theme-dark .p32-work h1,
body.p32-theme-dark .p32-work h2,
body.p32-theme-dark .p32-work h3,
body.p32-theme-dark .p32-work label,
body.p32-theme-dark .p32-work a,
body.p32-theme-dark .portal-container,
body.p32-theme-dark .portal-footer a {
  color: #e8ebf1;
}

body.p32-theme-dark .p32-messenger-conversation-meta,
body.p32-theme-dark .p32-messenger-conversation-preview,
body.p32-theme-dark .p32-messenger-conversation-time,
body.p32-theme-dark .p32-messenger-message-footer,
body.p32-theme-dark .p32-messenger-message-time,
body.p32-theme-dark .p32-messenger-dialog-intro,
body.p32-theme-dark .p32-messenger-dialog-kicker,
body.p32-theme-dark .p32-messenger-compose textarea::placeholder,
body.p32-theme-dark .p32-work .text-muted,
body.p32-theme-dark small {
  color: #a4adba;
}

body.p32-theme-dark input,
body.p32-theme-dark textarea,
body.p32-theme-dark select,
body.p32-theme-dark .form-control,
body.p32-theme-dark .p32-messenger-search-label,
body.p32-theme-dark .p32-messenger-compose-row,
body.p32-theme-dark .p32-messenger-advanced-popover,
body.p32-theme-dark .p32-messenger-advanced input,
body.p32-theme-dark .p32-messenger-advanced select,
body.p32-theme-dark .p32-messenger-link-results,
body.p32-theme-dark .p32-messenger-new-email-dialog input,
body.p32-theme-dark .p32-messenger-new-email-dialog select {
  background-color: #222730;
  border-color: #414a58;
  color: #e8ebf1;
  caret-color: #e8ebf1;
}

body.p32-theme-dark input::placeholder,
body.p32-theme-dark textarea::placeholder {
  color: #8f99a8;
}

body.p32-theme-dark .p32-erp-profile > summary:hover,
body.p32-theme-dark .p32-erp-profile[open] > summary,
body.p32-theme-dark .p32-erp-profile-popover a:hover,
body.p32-theme-dark .p32-messenger-conversation-menu button:hover,
body.p32-theme-dark .p32-messenger-message-menu button:hover,
body.p32-theme-dark .p32-messenger-message-menu a:hover,
body.p32-theme-dark .p32-messenger-orders-toggle:hover,
body.p32-theme-dark .p32-messenger-message-actions button:hover,
body.p32-theme-dark .p32-messenger-message-actions a:hover,
body.p32-theme-dark .p32-messenger-reply-close:hover,
body.p32-theme-dark .p32-client-drawer-close:hover,
body.p32-theme-dark .dropdown-item:hover {
  background-color: #2a303a;
}

body.p32-theme-dark .p32-portal-account-identity,
body.p32-theme-dark .p32-portal-header,
body.p32-theme-dark .p32-erp-rail,
body.p32-theme-dark .p32-messenger-conversation-head,
body.p32-theme-dark .p32-client-section,
body.p32-theme-dark .p32-messenger-compose,
body.p32-theme-dark .p32-messenger-dialog header,
body.p32-theme-dark .p32-messenger-dialog footer,
body.p32-theme-dark .modal-header,
body.p32-theme-dark .modal-footer {
  border-color: #343b47;
}

body.p32-theme-dark .p32-portal-account-roles li,
body.p32-theme-dark .p32-messenger-quick-filters > button,
body.p32-theme-dark .p32-messenger-client-channel-bar button,
body.p32-theme-dark .p32-messenger-reply-preview,
body.p32-theme-dark .p32-messenger-order-context-indicator,
body.p32-theme-dark .p32-messenger-message--system,
body.p32-theme-dark .p32-messenger-system-event-text,
body.p32-theme-dark .p32-messenger-full-text,
body.p32-theme-dark .p32-messenger-quote,
body.p32-theme-dark .p32-messenger-attachment-item,
body.p32-theme-dark .p32-messenger-attachment-lightbox-info,
body.p32-theme-dark .p32-messenger-attachment-lightbox-strip {
  background-color: #242a33;
  color: #d9dee7;
}

body.p32-theme-dark .p32-messenger-message-html a,
body.p32-theme-dark .p32-messenger-message-copy a,
body.p32-theme-dark .p32-messenger-full-text a {
  color: #8ebcff;
}

body.p32-theme-dark .p32-messenger-send-action,
body.p32-theme-dark .p32-messenger-advanced-submit,
body.p32-theme-dark .p32-messenger-orders-toggle.is-active,
body.p32-theme-dark .p32-messenger-orders-toggle[aria-pressed="true"],
body.p32-theme-dark .p32-messenger-contact-name[aria-pressed="true"],
body.p32-theme-dark .p32-messenger-organization[aria-pressed="true"],
body.p32-theme-dark .p32-messenger-quick-filters > button.is-active,
body.p32-theme-dark .p32-button:not(.p32-button-secondary),
body.p32-theme-dark .btn-primary {
  background-color: #d62f75;
  border-color: #d62f75;
  color: #fff;
}

body.p32-theme-dark .p32-button-secondary,
body.p32-theme-dark .btn-secondary {
  background-color: #242a33;
  border-color: #414a58;
  color: #e8ebf1;
}

body.p32-theme-dark .p32-menu-danger,
body.p32-theme-dark .p32-portal-account-logout {
  color: #ff9189;
}

body.p32-theme-dark .p32-menu-divider {
  background-color: #343b47;
}

body.p32-theme-dark .p32-messenger-attachment-lightbox,
body.p32-theme-dark .p32-messenger-attachment-lightbox-shell,
body.p32-theme-dark .p32-messenger-attachment-lightbox-header,
body.p32-theme-dark .p32-messenger-attachment-lightbox-stage {
  background-color: #12151a;
  color: #e8ebf1;
}

body.p32-theme-dark .p32-contact-address-book label { color: #d9dee7; }
body.p32-theme-dark .p32-contact-address-book input {
  background-color: #222730;
  border-color: #414a58;
  color: #e8ebf1;
}

/* Only the newly added account row receives its own layout. */
.p32-theme-account-row {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.p32-theme-account-row label {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  margin: 0;
}

.p32-theme-account-row svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.p32-theme-account-row select {
  max-width: 180px;
}

/* Published Print32 preset: mint canvas, white surfaces and blue shared actions.
   Channel bubbles keep their provider colours from messenger-approved.css. */
body.p32-theme-mint-print {
  --p32-bg: #a7d5bf;
  --p32-card: #fcfefd;
  --p32-ink: #1f3434;
  --p32-muted: #607776;
  --p32-line: #c6ddda;
  --p32-orange: #1976cf;
  --p32-orange-dark: #1976cf;
  --p32-portal-ink: #1f3434;
  --p32-portal-muted: #607776;
  --fg-color: #fcfefd;
  --bg-color: #a7d5bf;
  --card-bg: #fcfefd;
  --text-color: #1f3434;
  --text-light: #1f3434;
  --text-muted: #607776;
  --border-color: #c6ddda;
  --control-bg: #f5fbfa;
  --control-bg-on-gray: #f5fbfa;
  --input-bg: #fff;
  background-color: #a7d5bf;
  color: #1f3434;
  color-scheme: light;
}

body.p32-theme-mint-print .p32-work,
body.p32-theme-mint-print .p32-messenger {
  --p32-bg: #a7d5bf;
  --p32-card: #fcfefd;
  --p32-ink: #1f3434;
  --p32-muted: #607776;
  --p32-line: #c6ddda;
  --p32-line-strong: #9ec7c2;
  --p32-orange: #1976cf;
  --p32-orange-dark: #1976cf;
  --p32-mm-bg: #a7d5bf;
  --p32-mm-card: #fcfefd;
  --p32-mm-panel: #f5fbfa;
  --p32-mm-chat: #a7d5bf;
  --p32-mm-ink: #1f3434;
  --p32-mm-muted: #607776;
  --p32-mm-line: #c6ddda;
  --p32-mm-line-strong: #9ec7c2;
  --p32-mm-orange: #1976cf;
  --p32-mm-orange-dark: #1976cf;
  --p32-list-row-hover: rgba(51, 144, 236, .11);
}

body.p32-theme-mint-print .p32-messenger-workspace {
  --p32-accent: #1976cf;
  background-color: #a7d5bf !important;
  background-image:
    url("../images/messenger-mint-pattern.svg"),
    linear-gradient(135deg, #acd9c3 0%, #a3d2c7 100%) !important;
  background-position: left top, center !important;
  background-repeat: repeat, no-repeat !important;
  background-size: 720px 546px, auto !important;
}

body.p32-theme-mint-print .p32-portal-header,
body.p32-theme-mint-print .p32-erp-rail,
body.p32-theme-mint-print .p32-worker-header,
body.p32-theme-mint-print .p32-card,
body.p32-theme-mint-print .card,
body.p32-theme-mint-print .portal-section,
body.p32-theme-mint-print .portal-footer,
body.p32-theme-mint-print .p32-messenger-inbox,
body.p32-theme-mint-print .p32-messenger-conversation-head,
body.p32-theme-mint-print .p32-messenger-client-channel-bar,
body.p32-theme-mint-print .p32-client-drawer,
body.p32-theme-mint-print .p32-messenger-compose-row,
body.p32-theme-mint-print .p32-messenger-dialog,
body.p32-theme-mint-print .p32-messenger-dialog form,
body.p32-theme-mint-print .p32-messenger-conversation-menu > div,
body.p32-theme-mint-print .p32-messenger-message-menu > div,
body.p32-theme-mint-print .p32-messenger-advanced-popover,
body.p32-theme-mint-print .p32-erp-profile-popover,
body.p32-theme-mint-print .p32-portal-account-menu,
body.p32-theme-mint-print .dropdown-menu,
body.p32-theme-mint-print .modal-content,
body.p32-theme-mint-print .popover {
  background-color: #fcfefd !important;
  border-color: #c6ddda !important;
  color: #1f3434 !important;
}

body.p32-theme-mint-print .p32-messenger-message-list,
body.p32-theme-mint-print .p32-messenger-detail,
body.p32-theme-mint-print .p32-messenger-detail-content,
body.p32-theme-mint-print .p32-messenger-shell {
  background-color: transparent !important;
  color: #1f3434;
}

body.p32-theme-mint-print .p32-messenger-conversation.is-selected,
body.p32-theme-mint-print .p32-messenger-conversation.is-selected:hover,
body.p32-theme-mint-print .p32-messenger-quick-filters > button.is-active,
body.p32-theme-mint-print .p32-messenger-new-chat,
body.p32-theme-mint-print .p32-messenger-advanced-submit,
body.p32-theme-mint-print .p32-messenger-send-action,
body.p32-theme-mint-print .p32-button:not(.p32-button-secondary),
body.p32-theme-mint-print .btn-primary {
  background-color: #1976cf !important;
  border-color: #1976cf !important;
  color: #fff !important;
}

body.p32-theme-mint-print .p32-messenger-conversation.is-selected :is(
  .p32-messenger-conversation-main,
  .p32-messenger-conversation-preview,
  .p32-messenger-conversation-project,
  .p32-messenger-balance,
  .p32-messenger-row-time
) {
  color: #fff !important;
}

body.p32-theme-mint-print input,
body.p32-theme-mint-print textarea,
body.p32-theme-mint-print select,
body.p32-theme-mint-print .form-control,
body.p32-theme-mint-print .p32-messenger-search-label {
  background-color: #fff !important;
  border-color: #b8d5d1 !important;
  color: #1f3434 !important;
  caret-color: #1f3434;
}

body.p32-theme-mint-print :is(a, .p32-messenger-inline-link) {
  color: #176fba;
}

body.p32-theme-mint-print :is(button, a, input, textarea, select):focus-visible {
  outline-color: rgba(51, 144, 236, .62);
}

/* The profile menu uses the same ordered registry as account settings. The
   round swatch always previews the theme that one click will apply. */
.p32-erp-theme-cycle {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 13px;
  color: #50616a;
  cursor: pointer;
  display: grid;
  gap: 9px;
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 44px;
  padding: 5px 7px;
  text-align: left;
  width: 100%;
}

.p32-erp-theme-cycle:hover {
  background: #fff1e7;
  color: #c94968;
}

.p32-erp-theme-cycle:disabled {
  cursor: wait;
  opacity: .58;
}

.p32-theme-cycle-preview {
  background: linear-gradient(135deg, #ff9d12, #d62f75);
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(38, 53, 61, .16), 0 4px 10px rgba(38, 53, 61, .16);
  display: block;
  height: 30px;
  width: 30px;
}

.p32-theme-cycle-label {
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p32-erp-rail.is-collapsed .p32-erp-rail-bottom > .p32-erp-theme-cycle {
  border-radius: 50%;
  display: flex;
  height: 38px;
  justify-content: center;
  margin-inline: auto;
  min-height: 38px;
  padding: 4px;
  position: relative;
  width: 38px;
}

.p32-erp-rail.is-collapsed .p32-erp-rail-bottom > .p32-erp-theme-cycle .p32-theme-cycle-label {
  display: none;
}

.p32-erp-rail.is-collapsed .p32-erp-rail-bottom > .p32-erp-theme-cycle::after {
  background: #24343c;
  border-radius: 8px;
  color: #fff;
  content: attr(data-label);
  font-size: 11px;
  left: calc(100% + 9px);
  opacity: 0;
  padding: 6px 8px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-4px, -50%);
  transition: opacity .12s ease, transform .12s ease;
  white-space: nowrap;
  z-index: 160;
}

.p32-erp-rail.is-collapsed .p32-erp-rail-bottom > .p32-erp-theme-cycle:focus-visible::after,
.p32-erp-rail.is-collapsed .p32-erp-rail-bottom > .p32-erp-theme-cycle:hover::after {
  opacity: 1;
  transform: translate(0, -50%);
}

body.p32-theme-dark .p32-erp-theme-cycle {
  color: #a4adba;
}

body.p32-theme-dark .p32-erp-theme-cycle:hover {
  background: #2a303a;
  color: #e8ebf1;
}

body.p32-theme-mint-print .p32-erp-theme-cycle:hover {
  background: rgba(51, 144, 236, .11);
  color: #176fba;
}

@media (max-width: 1180px) {
  .p32-erp-rail-bottom > .p32-erp-theme-cycle {
    border-radius: 50%;
    display: flex;
    height: 38px;
    justify-content: center;
    margin-inline: auto;
    min-height: 38px;
    padding: 4px;
    width: 38px;
  }

  .p32-erp-rail-bottom > .p32-erp-theme-cycle .p32-theme-cycle-label { display: none; }
}
