/* Opt-in black neutral surfaces. Brand colors, status colors and images stay original.
   This palette is independent of the application's forced light data-theme. */
html[data-ct-palette="dark"] {
  color-scheme: dark;
  background: #000000 !important;
  color: #ffffff;
  --background-color: #000000;
  --background-color-hover: #101010;
  --color: #ffffff;
  --text-color: #ffffff;
  --span-color: #c6c6c6;
  --md-bg: #000000;
  --ct-page: #000000;
  --ct-surface: #000000;
  --ct-surface-soft: #000000;
  --ct-ink: #ffffff;
  --ct-muted: #c6c6c6;
  --ct-line: rgba(255, 255, 255, .25);
  --ct-line-soft: rgba(255, 255, 255, .16);
  --ct-selected: #101010;
  --ct-shadow: none;
  --ct-shadow-hover: none;
}

/* The single control sits before the original language button in the app header.
   Auth and standalone About use the same compact control at the upper right. */
.ct-appearance-control {
  position: static; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: 0 0 44px; margin: 0;
}
.ct-appearance-control--fallback {
  position: fixed; top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right)); z-index: 900;
}
html body .ct-appearance-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 10px;
  margin: 0; border: 0; border-radius: 10px !important;
  background: transparent; color: var(--ct-ink, #102b5d); box-shadow: none;
  font: inherit; line-height: 1; cursor: pointer;
}
html body .ct-appearance-toggle:hover { background: var(--ct-selected, #e8f1ff); }
html body .ct-appearance-toggle:focus-visible { outline: 3px solid #3d83fa; outline-offset: 2px; }
html body .ct-appearance-toggle .ct-appearance-toggle__icon { display: block; width: 24px; height: 24px; flex: none; object-fit: contain; }
body.ct-about-page:has(> .ct-appearance-control--fallback) > header { padding-right: calc(70px + env(safe-area-inset-right, 0px)); }

/* Neutral shells, forms and Ant portals already consume the neutral variables.
   Explicit rules below cover hard-coded light backgrounds and text only. */
html[data-ct-palette="dark"] body,
html[data-ct-palette="dark"] body:has(.styles_C6Q6h) {
  background: var(--ct-surface) !important;
  background-image: none !important;
  color: var(--ct-ink);
}
html[data-ct-palette="dark"] :is(.styles_6Kq-F, .styles_qrUYZ, .styles_J2CiH, .styles_sew6T) {
  background: var(--ct-surface) !important;
}
html[data-ct-palette="dark"] :is(.styles_svCqL, .styles_6Kq-F, .styles_J2CiH) { box-shadow: none; }
html[data-ct-palette="dark"] :is(.ant-select-item, .ant-cascader-menu-item, .ant-pagination-item a,
  .ant-modal-close, .ant-drawer-close, .ant-input-password-icon, .ant-select-arrow,
  .ant-picker-suffix, .ant-empty-description) { color: var(--ct-ink); }
html[data-ct-palette="dark"] :is(.ant-select-item-option-disabled, .ant-cascader-menu-item-disabled) { color: var(--ct-muted); }
html[data-ct-palette="dark"] :is(.ant-modal-mask, .ant-drawer-mask) { background: rgba(0, 0, 0, .65) !important; }
html[data-ct-palette="dark"] .styles_AIcra .styles_Sey3B { background: var(--ct-surface) !important; }

/* Keep the original blue/violet summary surface and its matching text colors.
   Local neutral variables prevent white text inheriting onto its pale gradient. */
html[data-ct-palette="dark"] .styles_hX1su .styles_-0DSw {
  --ct-ink: #102b5d;
  --ct-muted: #536d9d;
}
html[data-ct-palette="dark"][data-theme="dark"] .styles_hX1su .styles_-0DSw {
  --ct-ink: #edf4ff;
  --ct-muted: #c0d0ec;
}
/* Original platform hover used inherited text; retain each tile's own color. */
html[data-ct-palette="dark"] .ct-platform:hover { color: #2869bd; }
html[data-ct-palette="dark"] .ct-platform:nth-child(2):hover { color: #685bd1; }
html[data-ct-palette="dark"] .ct-platform:nth-child(3):hover { color: #318976; }
html[data-ct-palette="dark"] .ct-platform:nth-child(4):hover { color: #64758e; }
html[data-ct-palette="dark"][data-theme="dark"] .ct-platform:hover { color: #b8d5ff; }
html[data-ct-palette="dark"][data-theme="dark"] .ct-platform:nth-child(2):hover { color: #d3caff; }
html[data-ct-palette="dark"][data-theme="dark"] .ct-platform:nth-child(3):hover { color: #b3ead9; }
html[data-ct-palette="dark"][data-theme="dark"] .ct-platform:nth-child(4):hover { color: #d0dced; }

/* The existing general typography rule must not hide semantic status colors. */
html[data-ct-palette="dark"] .ant-typography-success { color: var(--ant-success-color, #52c41a) !important; }
html[data-ct-palette="dark"] .ant-typography-warning { color: var(--ant-warning-color, #faad14) !important; }
html[data-ct-palette="dark"] .ant-typography-danger { color: var(--ant-error-color, #ff4d4f) !important; }
html[data-ct-palette="dark"] .ant-typography-secondary { color: var(--ct-muted) !important; }
html[data-ct-palette="dark"] :is(.ant-alert-info, .ant-alert-success, .ant-alert-warning, .ant-alert-error) .ant-typography:not(.ant-typography-success):not(.ant-typography-warning):not(.ant-typography-danger) { color: #102b5d !important; }

html[data-ct-palette="dark"][data-theme="dark"] :is(.ant-alert-info, .ant-alert-success, .ant-alert-warning, .ant-alert-error) .ant-typography:not(.ant-typography-success):not(.ant-typography-warning):not(.ant-typography-danger) { color: #edf4ff !important; }

/* A generic card span rule must not mute colored node/status tags. */
html[data-ct-palette="dark"] .ant-tag-has-color { color: #ffffff !important; }
html[data-ct-palette="dark"] .ant-tag-magenta { color: #c41d7f !important; }
html[data-ct-palette="dark"] .ant-tag-red { color: #cf1322 !important; }
html[data-ct-palette="dark"] .ant-tag-volcano { color: #d4380d !important; }
html[data-ct-palette="dark"] .ant-tag-orange { color: #d46b08 !important; }
html[data-ct-palette="dark"] .ant-tag-gold { color: #d48806 !important; }
html[data-ct-palette="dark"] .ant-tag-cyan { color: #08979c !important; }
html[data-ct-palette="dark"] .ant-tag-lime { color: #7cb305 !important; }
html[data-ct-palette="dark"] .ant-tag-green { color: #389e0d !important; }
html[data-ct-palette="dark"] .ant-tag-blue { color: #096dd9 !important; }
html[data-ct-palette="dark"] .ant-tag-geekblue { color: #1d39c4 !important; }
html[data-ct-palette="dark"] .ant-tag-purple { color: #531dab !important; }
html[data-ct-palette="dark"] .ant-tag-success { color: var(--ant-success-color, #52c41a) !important; }
html[data-ct-palette="dark"] .ant-tag-processing { color: var(--ant-info-color, #1890ff) !important; }
html[data-ct-palette="dark"] .ant-tag-warning { color: var(--ant-warning-color, #faad14) !important; }
html[data-ct-palette="dark"] .ant-tag-error { color: var(--ant-error-color, #ff4d4f) !important; }

/* The browser guidance has neutral panels but retains its blue action and icon. */
html[data-ct-palette="dark"] :is(.ct-browser-guidance, .ct-browser-guidance__panel) {
  background: var(--ct-surface); color: var(--ct-ink); border-color: var(--ct-line); box-shadow: none;
}
html[data-ct-palette="dark"] :is(.ct-browser-guidance__title, .ct-browser-guidance__close) { color: var(--ct-ink); }
html[data-ct-palette="dark"] :is(.ct-browser-guidance__description, .ct-browser-guidance__status) { color: var(--ct-muted); }
html[data-ct-palette="dark"] :is(.ct-browser-guidance__browser, .ct-browser-guidance__continue, .ct-browser-guidance__manual) {
  background: var(--ct-surface); color: var(--ct-ink); border-color: var(--ct-line);
}
html[data-ct-palette="dark"] :is(.ct-browser-guidance__close, .ct-browser-guidance__continue):hover { background: var(--ct-selected); }
html[data-ct-palette="dark"] body .ct-appearance-toggle {
  background: var(--ct-surface) !important; color: var(--ct-ink) !important; border-color: var(--ct-ink) !important;
}

/* Standalone about.html loads its own style after this file; scope and importance
   keep its neutral surfaces dark while its blue links/buttons and logo stay original. */
html[data-ct-palette="dark"] .ct-about-page { color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] .ct-about-page :is(.hero, .card) {
  background: var(--ct-surface) !important; color: var(--ct-ink) !important;
  border-color: var(--ct-line) !important; box-shadow: none !important;
}
html[data-ct-palette="dark"] .ct-about-page :is(.brand, h1, h2, h3) { color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] .ct-about-page :is(p, footer) { color: var(--ct-muted) !important; }
html[data-ct-palette="dark"] .ct-about-page footer { border-color: var(--ct-line); }
html[data-ct-palette="dark"] .ct-about-page .button:not(.primary) {
  background: var(--ct-surface) !important; color: var(--ct-ink) !important; border-color: var(--ct-line) !important;
}

/* Ant's light segmented skin has explicit black text even when the shell is dark. */
html[data-ct-palette="dark"] body .ant-segmented,
html[data-ct-palette="dark"] body .ant-segmented:not(.ant-segmented-disabled):is(:hover,:focus) { background: #101010 !important; color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] body .ant-segmented-item { color: var(--ct-muted) !important; }
html[data-ct-palette="dark"] body .ant-segmented-item:is(:hover,:focus),
html[data-ct-palette="dark"] body .ant-segmented-item-selected { color: #ffffff !important; }
html[data-ct-palette="dark"] body :is(.ant-segmented-item-selected,.ant-segmented-thumb) { background: #252525 !important; box-shadow: inset 0 0 0 1px #3d83fa !important; }
html[data-ct-palette="dark"] body .ant-segmented-item-disabled { color: #888888 !important; }

/* Native invite headings and backend plan HTML are ordinary h elements, not Ant statistics. */
html[data-ct-palette="dark"] body :is(.styles_k4tc0,.styles_HfIhN,.styles_6tUXZ,.styles_blCPo,.styles_ot859,.styles_voham,.styles_O566M) :is(h1,h2,h3,h4,h5,h6),
html[data-ct-palette="dark"] body .styles_a1mQ8 :is(h1,h2,h3,h4,h5,h6,p,li) { color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] body :is(.styles_gn7KK,.styles_7t200,.styles_ZqlYM) > :is(b,strong) { color: var(--ct-ink) !important; }

/* Dropdown selection previously kept Ant's pale background behind the new white text. */
html[data-ct-palette="dark"] body :is(.ant-dropdown-menu-item,.ant-dropdown-menu-submenu-title,.ant-cascader-menu-item,.ant-select-item-option) { color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] body :is(.ant-dropdown-menu-item-selected,.ant-dropdown-menu-submenu-title-selected,.ant-cascader-menu-item-active,.ant-select-item-option-selected:not(.ant-select-item-option-disabled)) { background: #202020 !important; color: #ffffff !important; }
html[data-ct-palette="dark"] body :is(.ant-dropdown-menu-item,.ant-dropdown-menu-submenu-title,.ant-cascader-menu-item,.ant-select-item-option):hover { background: var(--ct-selected) !important; }
html[data-ct-palette="dark"] body :is(.ant-dropdown-menu-item-active,.ant-dropdown-menu-submenu-title-active,.ant-cascader-menu-item-active,.ant-select-item-option-active) { background: var(--ct-selected) !important; }
html[data-ct-palette="dark"] body .ant-dropdown-menu-title-content { color: inherit !important; }
html[data-ct-palette="dark"] body :is(.ant-dropdown-menu-item-disabled,.ant-dropdown-menu-submenu-disabled,.ant-select-item-option-disabled,.ant-cascader-menu-item-disabled) { color: #888888 !important; }
html[data-ct-palette="dark"] body :is(.ant-dropdown-menu-submenu-arrow-icon,.ant-select-item-option-state,.ant-cascader-menu-item-expand-icon) { color: var(--ct-muted) !important; }

/* Knowledge is a portal outside #root. Normalize its actual Markdown elements,
   retaining child spans with brand/syntax colors and all images or embedded media. */
html[data-ct-palette="dark"] body .markdown-body { background: var(--ct-surface) !important; color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] body .markdown-body :is(h1,h2,h3,h4,h5,h6,p,li,dt,dd,blockquote,th,td,pre,code) { color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] body .markdown-body a { color: #8ab4ff !important; }
html[data-ct-palette="dark"] body .markdown-body :is(pre,code,.hljs,blockquote) { background: #141414 !important; border-color: #5a5a5a !important; }
html[data-ct-palette="dark"] body .markdown-body :is(table,thead,tbody,tr,th,td) { background: var(--ct-surface) !important; border-color: #5a5a5a !important; }
html[data-ct-palette="dark"] body .markdown-body :is(thead,th),
html[data-ct-palette="dark"] body .markdown-body tr:nth-child(2n) { background: #141414 !important; }
html[data-ct-palette="dark"] body .markdown-body hr { background: #5a5a5a !important; border-color: #5a5a5a !important; }

/* Additional Ant descendants have their own light-skin text rather than inheriting the shell. */
html[data-ct-palette="dark"] body :is(.ant-collapse-header,.ant-collapse-content-box,.ant-list-item,.ant-list-item-meta-content,.ant-popover-inner-content,.ant-menu-submenu-title,.ant-input-number-input,.ant-picker-header,.ant-picker-content th,.ant-picker-cell-in-view,.ant-form-item-label > label) { color: var(--ct-ink) !important; }
html[data-ct-palette="dark"] body :is(.ant-input-clear-icon,.ant-select-clear,.ant-picker-clear,.ant-input-number-handler,.ant-pagination-prev .ant-pagination-item-link,.ant-pagination-next .ant-pagination-item-link,.ant-picker-header button) { color: var(--ct-muted) !important; }
html[data-ct-palette="dark"] body :is(.ant-select-clear,.ant-picker-clear,.ant-input-number-handler-wrap,.ant-picker-panel,.ant-picker-time-panel-column) { background: var(--ct-surface) !important; }
html[data-ct-palette="dark"] body .ant-picker-cell:not(.ant-picker-cell-in-view) { color: #888888 !important; }
html[data-ct-palette="dark"] body :is(.ant-picker-cell-in-view.ant-picker-cell-selected,.ant-picker-cell-in-view.ant-picker-cell-range-start,.ant-picker-cell-in-view.ant-picker-cell-range-end) .ant-picker-cell-inner { color: #ffffff !important; }
html[data-ct-palette="dark"] body .ant-checkbox:not(.ant-checkbox-checked) .ant-checkbox-inner,
html[data-ct-palette="dark"] body .ant-radio-inner { background: var(--ct-surface) !important; border-color: #888888 !important; }
html[data-ct-palette="dark"] body .ant-radio-checked .ant-radio-inner { border-color: #3d83fa !important; }
html[data-ct-palette="dark"] body .ant-switch:not(.ant-switch-checked) { background: #454545 !important; }

/* Card captions must not recolor action text: inherit the existing primary/danger hue. */
html[data-ct-palette="dark"] body .ant-btn > span { color: inherit !important; }
/* Preserve warning/success hues while matching their backgrounds to the dark surface. */
html[data-ct-palette="dark"] body :is(.ant-tag-gold,.ant-tag-warning) { color: #ffd666 !important; background: #332500 !important; border-color: #8c6b1e !important; }
html[data-ct-palette="dark"] body .ant-tag-success { color: #95de64 !important; background: #102414 !important; border-color: #3b6c40 !important; }
