/* App surfaces only. Website previews and imported/exported files keep their own palettes. */
:root {
  --ui-night: #101629;
  --ui-panel: #2b4054;
  --ui-panel-raised: #354d63;
  --ui-field: #1c2c40;
  --ui-heading: #e3e9ef;
  --ui-copy: #d3dde7;
  --ui-muted: #bdcbd9;
  --ui-border: #71879b;
  --ui-accent: #7acde0;
  --ui-on-accent: #112b3c;
  --ui-paper: #edf1f5;
  --ui-on-paper: #26394c;
}

/* Decorative labels are redundant with the heading immediately below them. */
body[data-ui-theme] :is(.eyebrow,.section-label,.workspace-label,.dropdown-title) { display: none !important; }

body[data-ui-theme="dark"] {
  color-scheme: dark;
  color: var(--ui-copy);
  background-color: var(--ui-night);
  --ink: var(--ui-copy);
  --muted: var(--ui-muted);
  --technical-panel: var(--ui-panel);
  --technical-rule: var(--ui-border);
}
body[data-ui-theme="dark"] :is(h1,h2,h3,h4,strong,legend) { color: var(--ui-heading); }
body[data-ui-theme="dark"] :is(p,li,label,small,.intro,.lead,.hint,.footnote,.wizard-hint,.generation-help,.generation-status,.type-sample-body,.currency-note,.small) { color: var(--ui-copy); }
body[data-ui-theme="dark"] :is(.option-card small,.card-info p,.plan-note,.wizard-progress,footer,.effective) { color: var(--ui-muted); }
body[data-ui-theme="dark"] .hint { color: var(--ui-muted) !important; }
body[data-ui-theme="dark"] :is(a,a:visited) { color: #a6dce8; }
body[data-ui-theme="dark"] a.skip-link { background: var(--ui-panel); color: var(--ui-heading); }
body[data-ui-theme="dark"] :is(h1 em,.accent) { color: #9ad6e4; }
body[data-ui-theme="dark"] :is(.composer,.bring-card,.guide,.template,.overview article,.ai-direction,.ai-steps li,.summary,.seo-note,.design-refine,.custom-palette,.option-card,.page-options>label,.notice,.policy-contact,.rules,.plan,.plan-card,.pack,.credit-pack,.rule-grid>div,dialog) {
  background: var(--ui-panel);
  color: var(--ui-copy);
  border-color: var(--ui-border);
  opacity: 1;
}
body[data-ui-theme="dark"] .composer {
  background: rgba(47,69,89,.96);
  border: 1px solid var(--ui-border);
  box-shadow: 0 12px 32px #0002;
}
body[data-ui-theme="dark"] :is(input,textarea,select,.composer textarea) {
  background-color: var(--ui-field);
  color: var(--ui-copy);
  border: 1px solid var(--ui-border);
  padding: 12px;
}
body[data-ui-theme="dark"] :is(input,textarea)::placeholder { color: var(--ui-muted); opacity: 1; }
body[data-ui-theme="dark"] :is(input[type="checkbox"],input[type="radio"]) { accent-color: var(--ui-accent); }
body[data-ui-theme="dark"] input:is([type="checkbox"],[type="radio"],[type="color"],[type="range"]) { padding: 0; }
body[data-ui-theme="dark"] .composer textarea { height: auto; min-height: 90px; border-radius: 10px; }
body[data-ui-theme="dark"] :is(button,.chip,.preview-controls button) { background: var(--ui-panel-raised); color: var(--ui-heading); border-color: var(--ui-border); }
body[data-ui-theme="dark"] :is(button:hover,.chip:hover) { background: #405c74; color: var(--ui-heading); }
body[data-ui-theme="dark"] :is(.primary,.choose,.actions a.primary,.bring .primary) { background: var(--ui-accent); color: var(--ui-on-accent); border-color: #9cdeeb; }
body[data-ui-theme="dark"] :is(.primary:hover,.choose:hover,.actions a.primary:hover) { background: #9bdbe8; color: var(--ui-on-accent); }
body[data-ui-theme="dark"] :is(.back,.back:hover) { background: transparent; color: var(--ui-copy); }
body[data-ui-theme="dark"] :is(.option-card,.option-card:hover) { background: var(--ui-panel); color: var(--ui-heading); }
body[data-ui-theme="dark"] :is(.option-card[aria-pressed="true"],.preview-controls button[aria-pressed="true"],.pack[aria-pressed="true"]) { background: var(--ui-panel-raised); border-color: var(--ui-accent); color: var(--ui-heading); }
body[data-ui-theme="dark"] button:disabled { background: #2c3e51; color: #b5c2d0; opacity: 1; cursor: not-allowed; }
body[data-ui-theme="dark"] :is(table,td,th,.policy section,.policy-footer) { border-color: #62758a; }
body[data-ui-theme="dark"] :is(th,caption) { color: var(--ui-heading); }
body[data-ui-theme="dark"] :is(dialog,dialog p,dialog h2,dialog label) { color: var(--ui-copy); }
/* Keyboard focus. Headings and other targets that are only focused by script (tabindex="-1", never in the Tab
   order) get no outline. After a mouse or touch press, a button or link the pointer pressed shows none either (pages
   that track this set html[data-input]); the next key press brings it back. Fields always show it. */
body[data-ui-theme="dark"] :focus-visible:not([tabindex="-1"]) { outline: 3px solid #9adce9; outline-offset: 4px; }
html[data-input="pointer"] body[data-ui-theme="dark"] :is(button,a,[role="button"]):focus-visible:not([tabindex="-1"]) { outline: none; }
body[data-ui-theme="dark"] dialog::backdrop { background: #07101cbb; }

/* The editor keeps its light workspace; its dark header and controls need light text. */
body[data-ui-theme="editor"] { background: var(--ui-paper) !important; color: var(--ui-on-paper) !important; }
body[data-ui-theme="editor"] a { color: #075f82; }
body[data-ui-theme="editor"] > header {
  background-color: var(--ui-night) !important;
  color: var(--ui-heading) !important;
  border-bottom-color: #5b7188 !important;
  color-scheme: dark;
}
body[data-ui-theme="editor"] > header :is(a,strong,span,button,select) { color: var(--ui-heading) !important; }
body[data-ui-theme="editor"] > header span { color: var(--ui-muted) !important; }
body[data-ui-theme="editor"] > header :is(button,select) { background-color: var(--ui-field) !important; border-color: var(--ui-border) !important; }
body[data-ui-theme="editor"] :is(button,.upload) { background-color: #e4ebf1; color: var(--ui-on-paper); border-color: #90a2b4; }
body[data-ui-theme="editor"] button:disabled { color: #4a5d70; background: #dce4ec; }
body[data-ui-theme="editor"] :is(.preview-heading,.demo-details,footer) { background: #e7edf3 !important; }
body[data-ui-theme="editor"] .demo-details > summary { color: var(--ui-on-paper) !important; }
body[data-ui-theme="editor"] :is(.workspace-dropdown summary,.dropdown-panel) { background: #e4ebf1 !important; color: var(--ui-on-paper) !important; }
body[data-ui-theme="editor"] .workspace-dropdown summary::after { border-color: #42627b !important; }
body[data-ui-theme="editor"] .editor-drawer-heading { background: var(--ui-paper); }
body[data-ui-theme="editor"] :is(.preview-heading select,.preview-heading label) {
  background-color: #23394e !important;
  color: var(--ui-heading) !important;
  border-color: var(--ui-border) !important;
  color-scheme: dark;
}
body[data-ui-theme="editor"] :is(.preview-heading select,header select) option { background: #23394e; color: var(--ui-heading); }
body[data-ui-theme="editor"] :is(.editor-drawer,dialog) { background: var(--ui-paper) !important; color: var(--ui-on-paper) !important; }
body[data-ui-theme="editor"] :is(.editor-drawer,dialog) :is(input,textarea,select) { background: #e4ebf1 !important; color: var(--ui-on-paper) !important; border-color: #7c8fa2 !important; }
body[data-ui-theme="editor"] :is(.editor-drawer,dialog) :is(input,textarea)::placeholder { color: #52677b !important; opacity: 1; }
body[data-ui-theme="editor"] :is(.editor-drawer>aside,.editor-drawer>.source,.project-card,.image-card) { background: #e4ebf1 !important; }
body[data-ui-theme="editor"] .cloud-divider { color: #52677b; }
body[data-ui-theme="editor"] .cloud-divider::before,body[data-ui-theme="editor"] .cloud-divider::after { background: #9aaaba; }
body[data-ui-theme="editor"] :is(.dropdown-panel button,.dropdown-panel a,.dropdown-panel .upload) { color: var(--ui-on-paper) !important; }
body[data-ui-theme="editor"] :is(.dropdown-panel button,.dropdown-panel a,.dropdown-panel .upload):hover { background: #dce7ef !important; color: var(--ui-on-paper) !important; }
body[data-ui-theme="editor"] .dropdown-panel button:disabled { color: #596d80 !important; }
body[data-ui-theme="editor"] #editor-auth-status { color: var(--ui-on-paper); }

/* Script focus on text (a heading, panel or message moved to for screen readers) draws no ring; controls keep theirs. */
[tabindex="-1"]:not(a,button,input,select,textarea,summary,[role=menuitem],[role=menuitemradio],[role=menuitemcheckbox],[role=option],[role=tab],[role=button],[role=link],[role=radio],[role=checkbox],[role=switch],[role=treeitem],[role=gridcell]):focus{outline:none!important}
