/* Global Theme Design Tokens — the single color source for the application. */
:root,[data-theme="night"]{
  color-scheme:dark;
  --theme-background:#191919;--theme-panel:#242424;--theme-card:#242424;
  --theme-sidebar:#242424;--theme-header:#242424;--theme-elevated:#303030;
  --theme-border:#383838;--theme-border-strong:#665a49;--theme-divider:#383838;
  --theme-text-primary:#ededed;--theme-text-secondary:#ababab;--theme-text-muted:#ababab;--theme-placeholder:#ababab;
  --theme-primary:#d7bd91;--theme-primary-hover:#e6cda4;--theme-primary-soft:#3c3225;
  --theme-hover:#303030;--theme-input:#303030;--theme-timeline:#242424;
  --theme-preview:#111111;--theme-library:#242424;--theme-overlay:rgba(0,0,0,.64);
  --theme-shadow:inset 0 1px 0 #ffffff08,0 4px 14px #00000024;--theme-scrollbar:#665a49;
}
[data-theme="day"]{
  color-scheme:light;
  --theme-background:#F7F8FA;--theme-panel:#FFFFFF;--theme-card:#FFFFFF;
  --theme-sidebar:#FFFFFF;--theme-header:#FFFFFF;--theme-elevated:#FFFFFF;
  --theme-border:#E5E7EB;--theme-border-strong:#D1D5DB;--theme-divider:#ECECEC;
  --theme-text-primary:#111827;--theme-text-secondary:#6B7280;--theme-text-muted:#9CA3AF;--theme-placeholder:#9CA3AF;
  --theme-primary:#C88A3D;--theme-primary-hover:#B7792F;--theme-primary-soft:rgba(200,138,61,.10);
  --theme-hover:#F1F3F5;--theme-input:#F7F8FA;--theme-timeline:#F5F6F8;
  --theme-preview:#090B10;--theme-library:#FFFFFF;--theme-overlay:rgba(17,24,39,.32);
  --theme-shadow:0 3px 16px rgba(17,24,39,.06);--theme-scrollbar:#C9CED6;
}

/* Legacy token bridge: old components now consume the global provider tokens. */
[data-theme]{
  --ink-deepest:var(--theme-background);--ink-base:var(--theme-input);
  --stone:var(--theme-panel);--stone-raised:var(--theme-card);--stone-high:var(--theme-elevated);
  --mist:var(--theme-border);--mist-visible:var(--theme-border-strong);--mist-hover:var(--theme-border-strong);
  --paper:var(--theme-text-primary);--paper-dim:var(--theme-text-secondary);--paper-muted:var(--theme-text-muted);
  --gold:var(--theme-primary);--gold-dim:var(--theme-primary-hover);--gold-soft:var(--theme-primary-soft);
  --bg:var(--theme-background);--surface:var(--theme-panel);--surface2:var(--theme-card);
  --border:var(--theme-border);--border-hover:var(--theme-border-strong);--text:var(--theme-text-primary);--muted:var(--theme-text-secondary);
  --accent:var(--theme-primary);--accent-dim:var(--theme-primary-hover);--focus:var(--theme-primary-soft);
  --app-bg:var(--theme-background);--header-bg:var(--theme-header);--panel-bg:var(--theme-panel);
  --panel-secondary-bg:var(--theme-card);--elevated-bg:var(--theme-elevated);--control-bg:var(--theme-input);
  --border-color:var(--theme-border);--border-strong-color:var(--theme-border-strong);
  --text-primary:var(--theme-text-primary);--text-secondary:var(--theme-text-secondary);--text-muted:var(--theme-text-muted);
  --input-bg:var(--theme-input);--hover-bg:var(--theme-hover);--timeline-bg:var(--theme-timeline);
  --timeline-secondary-bg:var(--theme-panel);--row-line:var(--theme-divider);--shadow-color:var(--theme-shadow);--scrollbar-thumb:var(--theme-scrollbar);
}

html,body{background:var(--theme-background);color:var(--theme-text-primary)}
[data-theme-toggle]{cursor:pointer}
body,#main,#content,.editor-shell,.workspace,.stage,.mode-select{background-color:var(--theme-background)!important}
#topbar,.topbar{background:var(--theme-header)!important;border-color:var(--theme-border)!important}
#sidebar,.sidebar,.ai-panel,.assets-panel{background:var(--theme-sidebar)!important;border-color:var(--theme-border)!important}
.card,.panel,.mode-card,.theme-menu,.toast,.dropdown,.menu,.popover,.dialog,.modal-content,.export-modal>div{background:var(--theme-card)!important;border-color:var(--theme-border)!important;color:var(--theme-text-primary)!important;box-shadow:var(--theme-shadow)}
input,textarea,select,.input-field,.asset-search,.prompt-composer{background:var(--theme-input)!important;border-color:var(--theme-border)!important;color:var(--theme-text-primary)!important}
input::placeholder,textarea::placeholder{color:var(--theme-placeholder)!important}
.btn-secondary,.btn-ghost,.button.secondary,.goal-option,.asset-import-secondary{background:var(--theme-input)!important;border-color:var(--theme-border)!important;color:var(--theme-text-primary)!important}
.btn-primary,.btn-accent,.button.primary,.director-mode-button,.asset-import-primary{background:var(--theme-primary)!important;color:#17120B!important}
.btn-primary:hover,.btn-accent:hover,.button.primary:hover{background:var(--theme-primary-hover)!important}
.timeline-panel,.timeline-toolbar,.tracks-viewport,.track-row,.ruler,.track-labels,.timeline-preview{background-color:var(--theme-timeline)!important;border-color:var(--theme-border)!important}
.video-frame,.shoot-preview,#cameraPanel,#previewVideo{background-color:var(--theme-preview)!important}
.asset-grid,.empty-assets-state{background-color:var(--theme-library)!important}
.nav a:hover,.asset-tabs button:hover,.preview-tools button:hover,.theme-option:hover{background:var(--theme-hover)!important}
.nav a.on{background:linear-gradient(90deg,var(--theme-primary-soft),transparent)!important}
.message,.user-message,.system-message,.insight-card,.voice-btn,.session-stats>span,.competitor-mock-row,.analysis-benefits,.device-status-row,.shoot-grid{background-color:var(--theme-card)!important;border-color:var(--theme-border)!important}
.player-controls{background:var(--theme-elevated)!important;border-color:var(--theme-border)!important}
.export-modal{background:var(--theme-overlay)!important}
*{scrollbar-color:var(--theme-scrollbar) transparent}

[data-theme="day"] .editor-shell{background:radial-gradient(circle at 50% 0,var(--theme-primary-soft),transparent 30%),var(--theme-background)!important}
[data-theme="day"] .screen>.card{background:var(--theme-hover)!important;border-color:var(--theme-border)!important}
[data-theme="day"] .nav-step .step-num{background:var(--theme-border)!important;color:var(--theme-text-secondary)!important;border-color:var(--theme-border-strong)!important}
[data-theme="day"] .nav-step.active .step-num{background:var(--theme-primary)!important;color:#17120B!important;border-color:var(--theme-primary)!important}
[data-theme="day"] .video-frame,[data-theme="day"] .shoot-preview,[data-theme="day"] #cameraPanel,[data-theme="day"] #previewVideo{color:#E5E7EB}
[data-theme="day"] .clip{color:#FFFFFF}
[data-theme="day"] .mode-symbol.free-symbol{color:#6F65C8}
[data-theme="day"] .brand-logo{color:var(--theme-primary)}

body,.editor-shell,#topbar,.topbar,#sidebar,.sidebar,.card,.panel,.mode-card,input,textarea,select,.timeline-panel,.player-controls,.theme-menu{
  transition:background-color .24s ease,border-color .24s ease,color .24s ease,box-shadow .24s ease;
}
