/* T2 — CEMI universal light/dark semantic contract. This file owns palette semantics and bridges only. */
html[data-cemi-theme="light"]{
  color-scheme:light;
  --cemi-theme-bg:#f3f1f2;
  --cemi-theme-bg-elevated:#ece9eb;
  --cemi-theme-surface:#ffffff;
  --cemi-theme-surface-soft:#f8f6f7;
  --cemi-theme-surface-raised:#f1eef0;
  --cemi-theme-surface-strong:#1a2231;
  --cemi-theme-section:#ffffff;
  --cemi-theme-card:#fbfafb;
  --cemi-theme-card-hover:#f3eff1;
  --cemi-theme-control:#ffffff;
  --cemi-theme-control-hover:#f1edef;
  --cemi-theme-text:#1a2231;
  --cemi-theme-muted:#66707c;
  --cemi-theme-text-subtle:#7b8490;
  --cemi-theme-text-on-strong:#ffffff;
  --cemi-theme-line:#d9d3d7;
  --cemi-theme-line-soft:#e8e3e6;
  --cemi-theme-line-strong:#bdb4ba;
  --cemi-theme-inverse:#ffffff;
  --cemi-theme-accent-soft:#f7e4ed;
  --cemi-theme-focus:rgba(200,23,104,.32);
  --cemi-theme-overlay:rgba(26,34,49,.72);
  --cemi-theme-backdrop:rgba(10,14,20,.58);
  --cemi-theme-disabled-bg:#ebe7e9;
  --cemi-theme-disabled-text:#969099;
  --cemi-theme-placeholder:#858d97;
  --cemi-theme-shadow:0 12px 30px rgba(26,34,49,.10);
}
html[data-cemi-theme="dark"]{
  color-scheme:dark;
  --cemi-theme-bg:#121316;
  --cemi-theme-bg-elevated:#17191e;
  --cemi-theme-surface:#1c1e23;
  --cemi-theme-surface-soft:#23262c;
  --cemi-theme-surface-raised:#2a2d34;
  --cemi-theme-surface-strong:#0d1118;
  --cemi-theme-section:#191b20;
  --cemi-theme-card:#202329;
  --cemi-theme-card-hover:#282b31;
  --cemi-theme-control:#17191e;
  --cemi-theme-control-hover:#24272e;
  --cemi-theme-text:#f7f4f6;
  --cemi-theme-muted:#b8b2b6;
  --cemi-theme-text-subtle:#948f93;
  --cemi-theme-text-on-strong:#ffffff;
  --cemi-theme-line:#383a41;
  --cemi-theme-line-soft:#2d3036;
  --cemi-theme-line-strong:#555861;
  --cemi-theme-inverse:#ffffff;
  --cemi-theme-accent-soft:#3a1d2c;
  --cemi-theme-focus:rgba(200,23,104,.44);
  --cemi-theme-overlay:rgba(5,8,12,.78);
  --cemi-theme-backdrop:rgba(0,0,0,.72);
  --cemi-theme-disabled-bg:#26282e;
  --cemi-theme-disabled-text:#777980;
  --cemi-theme-placeholder:#8e9097;
  --cemi-theme-shadow:0 14px 34px rgba(0,0,0,.24);
}

/* Private surface bridge: advisor, admin and Capture consume one semantic source. */
html[data-cemi-theme] body.cemi-private-runtime,
html[data-cemi-theme] .cemi-surface-advisor,
html[data-cemi-theme] .cemi-surface-advisor-single,
html[data-cemi-theme] .cemi-surface-admin,
html[data-cemi-theme] .cemi-capture-v5-shell{
  --cemi-private-bg:var(--cemi-theme-bg);
  --cemi-private-bg-elevated:var(--cemi-theme-bg-elevated);
  --cemi-private-panel:var(--cemi-theme-surface);
  --cemi-private-panel-soft:var(--cemi-theme-surface-soft);
  --cemi-private-panel-raised:var(--cemi-theme-surface-raised);
  --cemi-private-panel-strong:var(--cemi-theme-surface-strong);
  --cemi-private-control:var(--cemi-theme-control);
  --cemi-private-control-hover:var(--cemi-theme-control-hover);
  --cemi-private-line:var(--cemi-theme-line);
  --cemi-private-line-soft:var(--cemi-theme-line-soft);
  --cemi-private-line-strong:var(--cemi-theme-line-strong);
  --cemi-private-text:var(--cemi-theme-text);
  --cemi-private-muted:var(--cemi-theme-muted);
  --cemi-private-text-subtle:var(--cemi-theme-text-subtle);
  --cemi-private-text-on-strong:var(--cemi-theme-text-on-strong);
  --cemi-private-accent:var(--cemi-theme-accent);
  --cemi-private-accent-soft:var(--cemi-theme-accent-soft);
  --cemi-private-focus:var(--cemi-theme-focus);
  --cemi-private-overlay:var(--cemi-theme-overlay);
  --cemi-private-backdrop:var(--cemi-theme-backdrop);
  --cemi-private-disabled-bg:var(--cemi-theme-disabled-bg);
  --cemi-private-disabled-text:var(--cemi-theme-disabled-text);
  --cemi-private-placeholder:var(--cemi-theme-placeholder);
  --cemi-private-shadow:var(--cemi-theme-shadow);
}

/* Visitor/public bridge. Specificity intentionally wins over legacy :root visitor defaults. */
html[data-cemi-theme] .cemi-surface-public,
html[data-cemi-theme] .cemi-surface-visitor-public,
html[data-cemi-theme] body.cemi-property-public-runtime:not(.cemi-private-runtime){
  --cemi-visitor-color-primary:var(--cemi-theme-text);
  --cemi-visitor-color-secondary:var(--cemi-theme-surface-soft);
  --cemi-visitor-color-accent:var(--cemi-theme-accent);
  --cemi-visitor-color-text:var(--cemi-theme-text);
  --cemi-visitor-color-muted:var(--cemi-theme-muted);
  --cemi-visitor-color-subtle:var(--cemi-theme-text-subtle);
  --cemi-visitor-color-on-strong:var(--cemi-theme-text-on-strong);
  --cemi-visitor-color-on-accent:var(--cemi-theme-on-accent);
  --cemi-visitor-color-success:var(--cemi-theme-success);
  --cemi-visitor-color-warning:var(--cemi-theme-warning);
  --cemi-visitor-color-danger:var(--cemi-theme-danger);
  --cemi-visitor-bg:var(--cemi-theme-bg);
  --cemi-visitor-bg-elevated:var(--cemi-theme-bg-elevated);
  --cemi-visitor-surface-bg:var(--cemi-theme-surface);
  --cemi-visitor-surface-soft:var(--cemi-theme-surface-soft);
  --cemi-visitor-surface-raised:var(--cemi-theme-surface-raised);
  --cemi-visitor-surface-strong:var(--cemi-theme-surface-strong);
  --cemi-visitor-card-bg:var(--cemi-theme-card);
  --cemi-visitor-card-hover:var(--cemi-theme-card-hover);
  --cemi-visitor-control-bg:var(--cemi-theme-control);
  --cemi-visitor-control-hover:var(--cemi-theme-control-hover);
  --cemi-visitor-border:var(--cemi-theme-line);
  --cemi-visitor-border-soft:var(--cemi-theme-line-soft);
  --cemi-visitor-border-strong:var(--cemi-theme-line-strong);
  --cemi-visitor-accent-soft:var(--cemi-theme-accent-soft);
  --cemi-visitor-focus:var(--cemi-theme-focus);
  --cemi-visitor-overlay:var(--cemi-theme-overlay);
  --cemi-visitor-backdrop:var(--cemi-theme-backdrop);
  --cemi-visitor-disabled-bg:var(--cemi-theme-disabled-bg);
  --cemi-visitor-disabled-text:var(--cemi-theme-disabled-text);
  --cemi-visitor-placeholder:var(--cemi-theme-placeholder);
  --cemi-visitor-shadow:var(--cemi-theme-shadow);
  --cemi-visitor-radius-panel:var(--cemi-theme-radius-panel);
  --cemi-visitor-radius-card:var(--cemi-theme-radius-card);
  --cemi-visitor-radius-control:var(--cemi-theme-radius-control);
  --cemi-visitor-transition-fast:var(--cemi-theme-transition);
}

/* Shared portal bridge. Public/advisor/admin shells can consume the same semantic vocabulary. */
html[data-cemi-theme] .cemi-surface-public,
html[data-cemi-theme] .cemi-surface-advisor,
html[data-cemi-theme] .cemi-surface-advisor-single,
html[data-cemi-theme] .cemi-surface-admin{
  --cemi-portal-bg:var(--cemi-theme-bg);
  --cemi-portal-bg-elevated:var(--cemi-theme-bg-elevated);
  --cemi-portal-header-bg:var(--cemi-theme-bg-elevated);
  --cemi-portal-panel:var(--cemi-theme-surface);
  --cemi-portal-panel-soft:var(--cemi-theme-surface-soft);
  --cemi-portal-panel-raised:var(--cemi-theme-surface-raised);
  --cemi-portal-panel-strong:var(--cemi-theme-surface-strong);
  --cemi-portal-section:var(--cemi-theme-section);
  --cemi-portal-card:var(--cemi-theme-card);
  --cemi-portal-card-hover:var(--cemi-theme-card-hover);
  --cemi-portal-control:var(--cemi-theme-control);
  --cemi-portal-control-hover:var(--cemi-theme-control-hover);
  --cemi-portal-line:var(--cemi-theme-line);
  --cemi-portal-line-soft:var(--cemi-theme-line-soft);
  --cemi-portal-line-strong:var(--cemi-theme-line-strong);
  --cemi-portal-text:var(--cemi-theme-text);
  --cemi-portal-muted:var(--cemi-theme-muted);
  --cemi-portal-text-subtle:var(--cemi-theme-text-subtle);
  --cemi-portal-text-on-strong:var(--cemi-theme-text-on-strong);
  --cemi-portal-accent:var(--cemi-theme-accent);
  --cemi-portal-accent-soft:var(--cemi-theme-accent-soft);
  --cemi-portal-focus:var(--cemi-theme-focus);
  --cemi-portal-overlay:var(--cemi-theme-overlay);
  --cemi-portal-backdrop:var(--cemi-theme-backdrop);
  --cemi-portal-disabled-bg:var(--cemi-theme-disabled-bg);
  --cemi-portal-disabled-text:var(--cemi-theme-disabled-text);
  --cemi-portal-placeholder:var(--cemi-theme-placeholder);
  --cemi-portal-shadow:var(--cemi-theme-shadow);
}
