/* Neutral surfaces, a single blue action colour, semantic status colours. */
:root {
  --ink:#101828;
  --secondary:#475467;
  --muted:#667085;
  --faint:#667085;
  --bg:#f7f8fa;
  --surface:#ffffff;
  --surface-2:#f9fafb;
  --surface-3:#eff1f5;
  --board:#eff1f5;
  --line:#e4e7ec;
  --control-line:#8591a4;
  --accent:#465fff;
  --blue-text:#364bd3;
  --blue-soft:#eef2ff;
  --blue-line:#c7d2fe;
  --violet-text:#6941c6;
  --violet-soft:#f4f0ff;
  --cyan-text:#176478;
  --cyan-soft:#e8f7fb;
  --success-text:#067647;
  --success-soft:#ecfdf3;
  --success-line:#abefc6;
  --danger-text:var(--danger-red);
  --danger-soft:color-mix(in srgb,var(--danger-red) 6%,var(--surface));
  --focus:#465fff45;
  --shadow-color:#1018280b;
  --shadow-strong:#1018282b;
  --overlay:#10182875;
  --header:#ffffff;
  --hero-start:#eef2ff;
  --hero-end:#f7f8fa;
  --hero-line:#d9e0ff;
  --field-bg:#ffffff;
  --field-line:#8591a4;
  --field-hover:#f5f7ff;
  --field-label:#344054;
  --field-placeholder:#667085;
  --field-focus:#465fff;
  --field-ring:#465fff26;
  --field-error:var(--danger-red);
  --card-section-border:#e4e7ec;
  --workspace-bg:#f7f8fa;
  --chat-bg:#f4f6fb;
  --own-message:#eef2ff;
  --own-message-line:#c7d2fe;
  --primary-start:#465fff;
  --primary-end:#465fff;
  --primary-hover:#364bd3;
  --sidebar-start:#ffffff;
  --sidebar-end:#ffffff;
  --card-field-bg:var(--field-bg);--card-field-border:var(--field-line);--card-label:var(--field-label);--card-hover:var(--field-hover);
}
:root[data-theme=dark] {
  --ink:#f2f4f7;
  --secondary:#d0d5dd;
  --muted:#aab4c4;
  --faint:#aab4c4;
  --bg:#101828;
  --surface:#1d2939;
  --surface-2:#172131;
  --surface-3:#2b3749;
  --board:#172131;
  --line:#344054;
  --control-line:#718098;
  --accent:#9facff;
  --blue-text:#bac4ff;
  --blue-soft:#252f55;
  --blue-line:#4a59a0;
  --violet-text:#d0b9ff;
  --violet-soft:#392c50;
  --cyan-text:#a0dcea;
  --cyan-soft:#223e4a;
  --success-text:#8ee3b3;
  --success-soft:#17392c;
  --success-line:#386950;
  --danger-text:var(--danger-red);
  --danger-soft:color-mix(in srgb,var(--danger-red) 12%,var(--surface));
  --focus:#9facff55;
  --shadow-color:#080d171a;
  --shadow-strong:#080d1766;
  --overlay:#080d179c;
  --header:#1d2939;
  --hero-start:#252f55;
  --hero-end:#1d2939;
  --hero-line:#3c4877;
  --field-bg:#172131;
  --field-line:#718098;
  --field-hover:#24334a;
  --field-label:#d0d5dd;
  --field-placeholder:#aab4c4;
  --field-focus:#9facff;
  --field-ring:#9facff35;
  --field-error:var(--danger-red);
  --card-section-border:#344054;
  --workspace-bg:#101828;
  --chat-bg:#141e30;
  --own-message:#252f55;
  --own-message-line:#485787;
  --primary-start:#465fff;
  --primary-end:#465fff;
  --primary-hover:#3e55eb;
  --sidebar-start:#172131;
  --sidebar-end:#172131;
  --card-field-bg:var(--field-bg);--card-field-border:var(--field-line);--card-label:var(--field-label);--card-hover:var(--field-hover);
}
:root[data-theme] .btn.primary,:root[data-theme] .task-work-top .task-create,:root[data-theme] .mail-work-toolbar .mail-write{background:var(--primary-start);border-color:var(--primary-start);color:#fff;box-shadow:0 2px 5px var(--shadow-color)}
:root[data-theme] .btn.primary:hover{background:var(--primary-hover);border-color:var(--primary-hover)}
:root[data-theme] .page:is([data-page=tasks],[data-page=mail]){background:var(--workspace-bg)}
:root[data-theme] .task-plan-board .plan-task-card{background:var(--surface);border-color:var(--line);box-shadow:0 2px 7px var(--shadow-color)}
:root[data-theme] .task-plan-board .task-plan-column{--task-tone:#426da1}
:root[data-theme] .task-plan-board .task-tone-1{--task-tone:#39715b}
:root[data-theme] .task-plan-board .task-tone-2{--task-tone:#6b5896}
:root[data-theme] .task-plan-board .task-tone-3{--task-tone:#596b80}
:root[data-theme] .mail-work-folders nav button.active{background:var(--blue-soft);border-color:var(--blue-line);color:var(--blue-text)}
:root[data-theme] .messenger-shell .chat-main,:root[data-theme] .messenger-shell .messages{background:var(--chat-bg)}
:root[data-theme] .messenger-shell .bubble{background:var(--surface);border-color:var(--line)}
:root[data-theme] .messenger-shell .own .bubble{background:var(--own-message);border-color:var(--own-message-line)}
:root[data-theme] .messenger-shell .chat-channel.active{background:var(--blue-soft);color:var(--ink);box-shadow:inset 3px 0 var(--accent)}
:root[data-theme] .messenger-shell .chat-channel.active :is(strong,small,time,.chat-preview,.chat-channel-name){color:var(--ink)}
:root[data-theme] .chat-day span{background:var(--surface);color:var(--secondary);border:1px solid var(--line)}
:root[data-theme] .stat::before{opacity:.35}:root[data-theme] .stat-value{color:var(--ink)}
/* Restore text hierarchy where older dark-theme rules forced white labels. */
:root[data-theme=dark] :is(#app,#modal-root,#call-root) :is(input,select,textarea,.task-title-link,.dash-metric,.dash-item-open,.dash-widget){color:var(--ink)}
:root[data-theme=dark] :is(#app,#modal-root,#call-root) :is(.tc-label,.field,.portal-filter-field,.task-filter-field,.task-filter-reset,.work-upload-zone>span){color:var(--field-label)}
:root[data-theme=dark] :is(#app,#modal-root) :is(.tc-value.tc-empty-value,.tc-context,.tc-help,.tc-empty,.tc-pencil,.tc-check-count,.tc-comment small,.cc-updated,.cc-related-row small,.co-updated,.co-related-row small,.co-contact small,.pc-summary span,.pc-attention small,.task-heading-note,.task-empty-state p,.task-results-caption,.task-due,.plan-task-project,.task-column-empty,.task-comment-count,.task-checks,.mail-account-note,.mail-row-message small,.mail-row-open time,.mail-envelope small){color:var(--muted)}
:root[data-theme=dark] :is(.task-view-tabs button,.task-focus-tabs button,.task-more-filters,.task-status-quick,.task-quick-add,.mail-select-all,.mail-task-chip){color:var(--secondary)}
:root[data-theme] #app .task-due.is-overdue,
:root[data-theme=dark] .dash-late{color:var(--danger-text);background:var(--danger-soft)}
:root[data-theme=dark] .tc-signal-late{background:var(--danger-soft);border-color:var(--danger-red);color:var(--danger-red)}
:root[data-theme=dark] .tc-signal-blocked{background:#4c4333;border-color:#8e7b5e;color:#e8d7b8}
:root[data-theme=dark] :is(.da-status.done,.da-mail .da-event-icon){color:var(--success-text)}
:root[data-theme=dark] :is(input,textarea)::placeholder{color:var(--field-placeholder);opacity:1}
:root[data-theme=dark] input:-webkit-autofill{-webkit-text-fill-color:var(--ink)}
:root[data-theme=dark] .chat-day span{color:var(--secondary)}

:root[data-theme] :is(.call-chat-send,.ai-tabs [aria-current=page]){background:var(--primary-start);color:#fff;border-color:var(--primary-start)}


/* Navigation and page surfaces use the same theme. */
:root[data-theme] .sidebar {
  background:var(--sidebar-start);
  border-color:var(--line);
  scrollbar-color:var(--control-line) transparent;
}
:root[data-theme] .sidebar :is(.brand small,.nav-label,.pilot-note) {color:var(--muted)}
:root[data-theme=light] .sidebar .brand img {filter:none}
:root[data-theme] .sidebar .nav button,
:root[data-theme] .sidebar .nav button .icon {color:var(--secondary)}
:root[data-theme] .sidebar .nav button:hover {background:var(--surface-2);color:var(--ink)}
:root[data-theme] .sidebar .nav button.active {
  background:var(--blue-soft);
  border-color:transparent;
  color:var(--blue-text);
  box-shadow:none;
}
:root[data-theme] .sidebar .nav button.active .icon {color:inherit}
:root[data-theme] .sidebar .nav .count {background:var(--surface-3);color:var(--secondary)}
:root[data-theme] .sidebar .nav button.active .count {background:var(--surface);color:var(--blue-text)}
:root[data-theme] .pilot-note strong {color:var(--ink)}
:root[data-theme] .topbar{background:var(--header);border-color:var(--line);backdrop-filter:none;color:var(--ink)}
:root[data-theme] .topbar :is(.breadcrumb,.breadcrumb span,.updated,.profile small){color:var(--muted)}
:root[data-theme] .topbar :is(.breadcrumb b,.updated strong,.profile strong){color:var(--ink)}
:root[data-theme] .topbar :is(.btn,.icon-btn){background:var(--surface);border-color:var(--line);color:var(--secondary);box-shadow:none}
:root[data-theme] .topbar :is(.btn,.icon-btn):hover{background:var(--blue-soft);border-color:var(--blue-line);color:var(--blue-text)}
:root[data-theme] .topbar .profile{border-color:var(--line)}
:root[data-theme] .topbar :is(.btn,.icon-btn):focus-visible{outline:2px solid var(--field-focus);outline-offset:3px}
:root[data-theme] .sidebar button:focus-visible{outline:2px solid var(--field-focus);outline-offset:3px}
:root[data-theme] .main-shell{background:var(--workspace-bg)}
:root[data-theme] .messenger-shell .chat-list{background:var(--surface)}
:root[data-theme] .messenger-shell .chat-main,:root[data-theme] .messenger-shell .messages{background:var(--chat-bg)}
:root[data-theme] .chat-channel-row:has(.active) .channel-row-menu{color:var(--blue-text)}
:root[data-theme] .dash-progress i{background:var(--accent)}
:root[data-theme] .dash-metric.attention:before{background:var(--danger-text)}
:root[data-theme] .dash-late{color:var(--danger-text)}
:root[data-theme] .segmented button.active{background:var(--surface);color:var(--blue-text)}
:root[data-theme=dark]{--select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c4cdd9' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}

:root[data-theme] .sidebar .mobile-nav-close {
  background:var(--surface);
  border-color:var(--line);
  color:var(--secondary);
}
:root[data-theme] .topbar .theme-toggle {
  background:var(--surface);
  border-color:var(--line);
  color:var(--secondary);
  border-radius:var(--ui-radius);
  box-shadow:none;
}
:root[data-theme] :is(.dash-quick,.dash-refresh) .icon-btn {
  background:var(--surface);
  border:1px solid var(--line);
  color:var(--secondary);
}
:root[data-theme] :is(.dash-quick,.dash-refresh) .icon-btn:hover {
  background:var(--blue-soft);
  border-color:var(--blue-line);
  color:var(--blue-text);
}

/* Settings previews reflect the actual light and dark surfaces. */
:root .preview-light{background:#f7f8fa;border-color:#e4e7ec}
:root .preview-light i{background:#fff;border:1px solid #e4e7ec}
:root .preview-light b{background:#e4e7ec}
:root .preview-light em{border-color:#465fff}
:root .preview-dark{background:#101828;border-color:#344054}
:root .preview-dark i{background:#172131;border:1px solid #344054}
:root .preview-dark b{background:#344054}
:root .preview-dark em{background:#1d2939;border-color:#9facff}
:root .preview-system{background:linear-gradient(90deg,#f7f8fa 50%,#101828 50%);border-color:#718098}
:root .preview-system i{background:#fff;border:1px solid #e4e7ec}
:root .preview-system b{background:linear-gradient(90deg,#e4e7ec 48%,#344054 48%)}
:root .preview-system em{border-color:#465fff}
:root .preview-system em:last-child{background:#1d2939;border-color:#9facff}
