/* Control-panel themes only. Player documents and media are not themed. */
html[data-cbi-theme="light"] {color-scheme:light;--cbi-ink:#15243b;--cbi-soft:#edf2f8;--cbi-border:#d4deeb;--cbi-mark:#427a13;}
html[data-cbi-theme="dark"] {color-scheme:dark;--cbi-ink:#e6edf7;--cbi-soft:#1c293d;--cbi-border:#35445b;--cbi-mark:#bcf477;}
.cbi-home {display:inline-flex;flex-direction:column;flex:none;width:max-content;max-width:100%;color:var(--cbi-ink);text-decoration:none;line-height:1.35;padding:3px 0;transition:opacity .18s;}
.cbi-home strong {font:800 25px/1.3 Tahoma,Arial,sans-serif;letter-spacing:2px;}
.cbi-home span {font:700 9px/1.7 Tahoma,Arial,sans-serif;letter-spacing:1.8px;color:var(--cbi-mark);white-space:nowrap;}
.cbi-home:hover {opacity:.78;}
.cbi-brand-controls {display:flex;align-items:center;gap:12px;flex:none;}
button.cbi-theme-toggle {position:relative;display:inline-grid;place-items:center;flex:0 0 34px;width:34px;height:34px;min-height:34px;padding:0;border:1px solid var(--cbi-border);border-radius:50%;color:var(--cbi-ink);background:var(--cbi-soft);cursor:pointer;overflow:hidden;transition:box-shadow .2s,transform .2s;}
button.cbi-theme-toggle:hover:not(:disabled) {background:var(--cbi-soft);transform:rotate(12deg);box-shadow:0 0 0 3px color-mix(in srgb,var(--cbi-border) 45%,transparent);}
.cbi-theme-toggle svg {position:absolute;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;transition:transform .3s,opacity .3s;}
[data-cbi-theme="light"] .cbi-moon {opacity:0;transform:translateY(24px) rotate(-70deg);}
[data-cbi-theme="dark"] .cbi-sun {opacity:0;transform:translateY(-24px) rotate(70deg);}
.cbi-home:focus-visible,.cbi-theme-toggle:focus-visible {outline:2px solid #4084e8;outline-offset:4px;}

/* TikTok: the original dark palette remains available. */
html[data-cbi-app="tiktok"][data-cbi-theme="light"] {background:#f2f5fa;color:#17263c;--panel:#fff;--line:#d7e0eb;--muted:#5a6c83;--accent:#427a13;--danger:#b62c44;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] body {background:#f2f5fa;color:#17263c;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .sidebar {background:#fff;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] button {background:#edf2f8;color:#21344d;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] button:hover:not(:disabled) {background:#e0e9f4;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] :is(input,select,textarea,dialog) {background:#fff;color:#17263c;border-color:#c4d1e0;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] :is(input,textarea)::placeholder {color:#697b91;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .native-date-picker {color-scheme:light;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] :is(button.primary,.apply-media) {background:#baf36b;color:#20330d;border-color:#9bd74d;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] button.primary:hover:not(:disabled) {background:#a9e853;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] :is(nav button.active,.studio-tabs .active,.room-list button.selected,.layer-list button.selected,.media-choice.selected) {background:#eaf5dd;color:#365f13;border-color:#76a849;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .canvas-shell {background:#e7edf5;}
[data-cbi-app="tiktok"] .canvas {--accent:#bcf477;color:#e5e9f1;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .drop-zone {background:#f1f8e9;color:#427a13;border-color:#8cad6d;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .drop-zone.dragover {background:#e1f2ce;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .badge {background:#e7edf5;color:#405772;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .badge.good {background:#e0f4e8;color:#22663d;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .badge.warn {background:#fff0d1;color:#805719;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .note {background:#e8f1fc;color:#284b77;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .danger {color:#b62c44;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .progress {background:#dbe4ef;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .swal2-popup {background:#fff!important;color:#17263c!important;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .swal2-html-container {color:#354b66!important;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .swal2-confirm {background:#baf36b!important;color:#20330d!important;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .swal2-cancel {background:#e5ebf3!important;color:#263b55!important;}
[data-cbi-app="tiktok"][data-cbi-theme="light"] .swal2-validation-message {background:#ffedf0!important;color:#a82a41!important;}

/* Facebook: dark surfaces for the editor and product controls. */
html[data-cbi-app="facebook"][data-cbi-theme="dark"] {--panel:#142034;--soft:#1b2940;--border:#32425b;--text:#e5edf8;--muted:#a1b1c9;--sky:#6ba7f7;--sky-soft:#253f65;--danger:#ffa298;--success:#279b6b;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] body {background:#0b1220;color:var(--text);}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.pitem,.special-item,.chip,.img-drop,input[type=color]) {background:#18263b;color:var(--text);}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(input[type=text],input[type=number],select,textarea,.list-search input,.filter-select) {background:#101b2c;color:var(--text);border-color:var(--border);}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(input,textarea)::placeholder {color:#98aac4;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.btn-ghost,.workspace-btn,.filter-reset,.mode-tab,.editor-close,.status-pill,.logout-link,.product-type-switch) {background:#21324b;color:#d6e4f6;border-color:var(--border);}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.mode-tab.active,.workspace-btn.active,.product-type-btn.active) {background:#294d7a;color:#e9f2ff;border-color:#6798d8;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.product-type-btn,.special-item-code,.list-search .search-clear) {color:#b9cbe4;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.workspace-btn:hover,.filter-reset:hover,.editor-close:hover,.mode-tab:hover,.chip:hover,.product-type-btn:hover) {background:#2b405d;color:#f1f6ff;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.product-type-note,.product-subtype-badge,.product-subtype-badge.jibbitz,.filter-reset.is-active) {background:#223b5d;color:#b7d6ff;border-color:#42648d;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.pitem.active,.special-item.active) {background:#193b31;border-color:#3e936d;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] .display-control.on .state-txt {color:#8ae2b4;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] .btn-danger {background:#482934;color:#ffb3b6;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] .btn-primary {background:#326ab2;color:#fff;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] .switch:not(.on) {background:#475874;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] .plist::-webkit-scrollbar-thumb {background:#415371;}
[data-cbi-app="facebook"][data-cbi-theme="dark"] :is(.img-drop .ph,.pitem .ph) {background:#253752;color:#b6c7df;}
@media(max-width:760px){
  [data-cbi-app="tiktok"] .sidebar .cbi-home {display:inline-flex;margin-bottom:8px;}
  .cbi-home strong {font-size:21px;}
  .cbi-home span {font-size:8px;}
}
@media(prefers-reduced-motion:reduce){.cbi-home,button.cbi-theme-toggle,.cbi-theme-toggle svg{transition:none;}}
