/* HomeNest-inspired palette. Color-only layer; layout and behavior stay in component styles.
   Keep brand tokens here. Legacy --teal aliases remain for existing components. */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --brand-blue: #0052cc;
  --brand-blue-bright: #166ad9;
  --brand-navy: #0c1e5b;
  --brand-purple: #6f42c1;
  --theme-primary: #0052cc;
  --theme-primary-hover: #003fa3;
  --theme-primary-solid: #0052cc;
  --theme-primary-solid-hover: #003fa3;
  --theme-on-primary: #ffffff;
  --theme-primary-soft: #edf4ff;
  --theme-page: #f8faff;
  --theme-panel: #ffffff;
  --theme-panel-raised: #ffffff;
  --theme-panel-soft: #f3f6fc;
  --theme-field: #ffffff;
  --theme-ink: #0d1321;
  --theme-heading: #0c1e5b;
  --theme-muted: #56647a;
  --theme-line: #d9e2f1;
  --theme-teal: var(--theme-primary);
  --theme-teal-soft: var(--theme-primary-soft);
  --theme-accent-soft: var(--theme-primary-soft);
  --theme-purple: #6f42c1;
  --theme-purple-soft: #f3effb;
  --theme-danger: #c52d32;
  --theme-danger-soft: #fff0f1;
  --theme-warning-soft: #fff7e6;
  --theme-success-soft: #ecf8f1;
  --theme-info-soft: var(--theme-primary-soft);
  --theme-shadow: 0 14px 32px rgba(12,30,91,.08);
  --brand-header: linear-gradient(135deg,#ffffff 0%,#f0f5ff 72%,#f5f1fb 100%);
  --brand-nav: rgba(255,255,255,.96);
  --brand-action: linear-gradient(125deg,#166ad9,#1745a5);
  --brand-action-hover: linear-gradient(125deg,#1059bd,#11388b);
  --brand-sidebar: #0c1e5b;
  --brand-nav-ink: #1a3b91;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-blue: #0052cc;
  --brand-blue-bright: #166ad9;
  --brand-navy: #0c1e5b;
  --brand-purple: #6f42c1;
  --theme-primary: #96bfff;
  --theme-primary-hover: #bed7ff;
  --theme-primary-solid: #1d5fd2;
  --theme-primary-solid-hover: #174fb3;
  --theme-on-primary: #ffffff;
  --theme-primary-soft: #192d50;
  --theme-page: #0b1221;
  --theme-panel: #131e33;
  --theme-panel-raised: #19263f;
  --theme-panel-soft: #101b2f;
  --theme-field: #0d192c;
  --theme-ink: #e9effb;
  --theme-heading: #e3edff;
  --theme-muted: #a5b4cd;
  --theme-line: #344765;
  --theme-teal: var(--theme-primary);
  --theme-teal-soft: var(--theme-primary-soft);
  --theme-accent-soft: var(--theme-primary-soft);
  --theme-purple: #c5abff;
  --theme-purple-soft: #2d2448;
  --theme-danger: #ff9ca1;
  --theme-danger-soft: #3b202d;
  --theme-warning-soft: #382e1f;
  --theme-success-soft: #15352c;
  --theme-info-soft: var(--theme-primary-soft);
  --theme-shadow: 0 16px 38px rgba(0,0,0,.35);
  --brand-header: linear-gradient(135deg,#111d32,#15243e 72%,#22203a);
  --brand-nav: #19263f;
  --brand-action: linear-gradient(125deg,#246bd9,#204eb5);
  --brand-action-hover: linear-gradient(125deg,#1d5bc1,#193f99);
  --brand-sidebar: #0e1930;
  --brand-nav-ink: #b4ceff;
}
/* Root specificity also overrides page-local legacy :root definitions. */
:root[data-theme] {
  --page: var(--theme-page);
  --panel: var(--theme-panel);
  --ink: var(--theme-ink);
  --muted: var(--theme-muted);
  --line: var(--theme-line);
  --teal: var(--theme-primary);
  --shadow: var(--theme-shadow);
  --home-page: var(--theme-page);
  --home-ink: var(--theme-ink);
  --home-muted: var(--theme-muted);
  --home-line: var(--theme-line);
  --home-teal: var(--theme-primary);
  --focus-ring: color-mix(in srgb,var(--theme-primary) 24%,transparent);
}
:root[data-theme] body { background-color: var(--theme-page); color: var(--theme-ink); }
:root[data-theme] body > header,
:root[data-theme] .home-header {
  background: var(--brand-header) !important;
  border-color: var(--theme-line) !important;
}
:root[data-theme] :is(h1,h2,h3,h4) { color: var(--theme-heading); }
:root[data-theme] body > header :is(.nav-actions,.app-nav-submenu),
:root[data-theme] body.nav-actions-fixed > header .nav-actions {
  background: var(--brand-nav);
  border-color: var(--theme-line);
  box-shadow: 0 8px 24px rgba(12,30,91,.12);
}
:root[data-theme] body > header .nav-actions :is(.nav-link,.app-nav-group-trigger) { color: var(--brand-nav-ink) !important; }
:root[data-theme] body > header .nav-actions :is(.nav-link:hover,.nav-link:focus-visible,.nav-link.active,.app-nav-group-trigger:hover),
:root[data-theme] body > header .app-nav-group:is(.is-active,[open]) > .app-nav-group-trigger {
  background: var(--brand-action);
  color: var(--theme-on-primary) !important;
}
@media(hover:hover) {
  :root[data-theme] body > header .app-nav-group:hover > .app-nav-group-trigger { background: var(--brand-action); color: #fff !important; }
}
:root[data-theme] body > header .app-nav-submenu .nav-link:not(.active):hover {
  background: var(--theme-primary-soft); color: var(--theme-primary) !important;
}
:root[data-theme] :is(.app-user-menu,.app-user-popover,.app-user-dropdown,.owner-quick-links) {
  background-color: var(--theme-panel-raised); border-color: var(--theme-line); color: var(--theme-ink);
}
/* Explicit primary actions only: never style every button as a primary action. */
:root[data-theme] :is(.button.primary,.add-button,.confirm-task-button,.analysis-button.primary,
 .story-prompt-button.primary,.tts-button.tts-primary,.sve-primary,.sl-primary,
 .source-video-guard-confirm,.sud-dialog .sud-confirm,.selected-video-form button,
 .selected-social-form-row button,.selected-detected-links-save,.selected-note-save,
 .my-channel-info-editor .is-primary,#generateChannelNames,
 .replace-button,.capcut-notification-button,.capcut-create-button,.capcut-download-button,
 .team-chat .tc-send,.team-chat .tc-new,.team-chat .tc-group-save) {
  background: var(--brand-action); border-color: var(--theme-primary-solid); color: var(--theme-on-primary);
}
:root[data-theme] :is(.button.primary,.add-button,.confirm-task-button,.analysis-button.primary,
 .story-prompt-button.primary,.tts-button.tts-primary,.sve-primary,.sl-primary,
 .source-video-guard-confirm,.sud-dialog .sud-confirm,.selected-video-form button,
 .selected-social-form-row button,.selected-detected-links-save,.selected-note-save,
 .my-channel-info-editor .is-primary,#generateChannelNames,
 .replace-button,.capcut-notification-button,.capcut-create-button,.capcut-download-button,
 .team-chat .tc-send,.team-chat .tc-new,.team-chat .tc-group-save):hover:not(:disabled) {
  background: var(--brand-action-hover); border-color: var(--theme-primary-solid-hover); color: var(--theme-on-primary);
}
:root[data-theme] :is(.tab.active,.filter-button.active,.page-button.active,.put-back-button,
 .source-toggle input:checked + i,.detail-toggle input:checked + i) {
  background: var(--theme-primary-solid); border-color: var(--theme-primary-solid); color: #fff;
}
:root[data-theme] :is(input,textarea,select,[contenteditable="true"]) {
  accent-color: var(--theme-primary-solid); caret-color: var(--theme-primary);
}
:root[data-theme] :is(input,textarea,select):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
  border-color: var(--theme-line); color: var(--theme-ink);
}
:root[data-theme] :is(input,textarea,select):focus-visible { outline-color: var(--theme-primary); border-color: var(--theme-primary); }
:root[data-theme] :is(table,th,td) { border-color: var(--theme-line); }
:root[data-theme] :is(thead th,thead td) { background-color: var(--theme-panel-soft) !important; color: var(--theme-heading) !important; }
:root[data-theme] .admin-sidebar { background: var(--brand-sidebar); border-color: var(--theme-line); }
:root[data-theme] .admin-sidebar :is(h1,h2,h3,a,button) { color: #e5edff; }
:root[data-theme] .admin-menu :is(a,button):is(:hover,.active) { background: #214b9e; color: #fff; }
:root[data-theme] .capcut-page { --capcut-auto: var(--theme-primary-solid); --capcut-auto-ink: #fff; --capcut-create: #5940a8; --capcut-create-ink: #fff; }
:root[data-theme] .capcut-page #guidedCapcutStartButton { background: var(--brand-action); color: #fff; }
:root[data-theme] .team-chat { --tc-message-own: #dceaff; --tc-message-other: #ffffff; --tc-mention-text-middle: #6f42c1; }
:root[data-theme="dark"] .team-chat { --tc-message-own: #1d3b6b; --tc-message-other: #19263f; --tc-mention-text-middle: #c5abff; }
:root[data-theme] .team-chat .tc-message.own .tc-avatar { background-color: var(--theme-primary-solid); color: #fff; }
:root[data-theme] .app-navigation-progress span { background: linear-gradient(90deg,#166ad9,#6f42c1); }
:root[data-theme] .app-theme-toggle { color: var(--theme-primary); }
/* Keep semantic feedback distinct from the brand palette. */
:root[data-theme] .button.danger { background: #a61f32; border-color: #a61f32; color: #fff; }
:root[data-theme] .button.danger:hover:not(:disabled) { background: #85182a; border-color: #85182a; color: #fff; }
:root[data-theme] :is(.login-card form,.admin-login-panel form) button[type="submit"] {
  background: var(--brand-action); border-color: var(--theme-primary-solid); color: #fff;
}
:root[data-theme] :is(.login-card form,.admin-login-panel form) button[type="submit"]:hover {
  background: var(--brand-action-hover); border-color: var(--theme-primary-solid-hover); color: #fff;
}
:root[data-theme] .team-chat .tc-message.is-own .tc-avatar { background: var(--theme-primary-solid); color: #fff; }
:root[data-theme] .app-navigation-progress > span { box-shadow: 0 0 8px rgba(22,106,217,.55); }
:root[data-theme] .home-user-filter-option:has(input:checked) { background: var(--theme-primary-soft); border-color: var(--theme-primary); color: var(--theme-primary); }
:root[data-theme] :is(.filter-button:not(.active),.page-button:not(.active),.button.secondary,.button:not([class*=" "]),.refresh-button):hover:not(:disabled) {
  border-color: var(--theme-primary); color: var(--theme-primary);
}
:root[data-theme] .upcoming-publishes { background: var(--theme-primary-soft); border-color: var(--theme-line); border-left-color: var(--theme-primary-solid); }
:root[data-theme] .my-channel-banner-button { background: rgba(12,30,91,.86); color: #fff; border-color: rgba(255,255,255,.35); }
:root[data-theme] .my-channel-banner-button:hover:not(:disabled) { background: #1745a5; border-color: #91b7ff; color: #fff; }
:root[data-theme] .my-channel-banner-button.is-danger:hover:not(:disabled) { background: #a61f32; color: #fff; border-color: #ffb8be; }
