/* Application theme shared by the native AYNELI dashboard pages. */
:root {
  color-scheme: light;
  --ay-canvas: #f7f9fc;
  --ay-surface: #fff;
  --ay-raised: #f1f5fb;
  --ay-ink: #182235;
  --ay-muted: #475569;
  --ay-border: #dbe4f3;
  --ay-soft: #eaf2ff;
  --ay-accent: #1d4ed8;
  --ay-focus: #2563eb;
  --ay-blue: #2563eb;
  --ay-blue-hover: #1d4ed8;
  --ay-danger: #b42318;
  --ay-danger-bg: #fff0ef;
  --ay-positive: #14643a;
  --ay-positive-bg: #e8f7ee;
  --ay-warning: #8c4b00;
  --ay-warning-bg: #fff5df;
  --ay-radius: 12px;
  --ay-shadow: 0 8px 30px #1733670b;
  --ay-body: Inter, system-ui, "Segoe UI", sans-serif;
  --ay-heading: Manrope, Inter, system-ui, "Segoe UI", sans-serif;
  --ay-mono: "JetBrains Mono", Consolas, monospace;
}
:root[data-ayneli-theme="dark"] {
  color-scheme: dark;
  --ay-canvas: #0b101a;
  --ay-surface: #151d2b;
  --ay-raised: #1c293d;
  --ay-ink: #edf4ff;
  --ay-muted: #aabbd3;
  --ay-border: #33455e;
  --ay-soft: #203459;
  --ay-accent: #a9c7ff;
  --ay-focus: #8ec1ff;
  --ay-blue: #2563eb;
  --ay-blue-hover: #1e4ed2;
  --ay-danger: #ffb4ad;
  --ay-danger-bg: #492725;
  --ay-positive: #a8e5be;
  --ay-positive-bg: #1d3a31;
  --ay-warning: #ffd392;
  --ay-warning-bg: #49391f;
  --ay-shadow: 0 8px 30px #02050b4d;
}
:root[data-ayneli-theme] body {
  background: var(--ay-canvas);
  color: var(--ay-ink);
  font-family: var(--ay-body);
  --u-ink: var(--ay-ink);
  --u-muted: var(--ay-muted);
  --u-line: var(--ay-border);
  --u-soft: var(--ay-soft);
  --u-green: var(--ay-blue);
}
:root[data-ayneli-theme] :is(h1,h2,h3) { font-family: var(--ay-heading); }
:root[data-ayneli-theme] :is(code,pre,kbd) { font-family: var(--ay-mono); }
:root[data-ayneli-theme] .unified-app { background: var(--ay-canvas); color: var(--ay-ink); }
:root[data-ayneli-theme] .unified-app :is(.topbar,.unified-sidebar) {
  background: var(--ay-surface); color: var(--ay-ink); border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.u-card,.card,.metric-card,.developer-card,.strategy-card,.mkt-compact-card,.ayneli-form-section,dialog) {
  background: var(--ay-surface); color: var(--ay-ink); border-color: var(--ay-border);
  border-radius: var(--ay-radius);
}
:root[data-ayneli-theme] .unified-app :is(.u-card,.developer-card) { box-shadow: var(--ay-shadow); }
:root[data-ayneli-theme] .unified-app :is(.unified-heading,.unified-tabs,.comm-conversation,.mkt-source-coverage,.comm-watch-item) {
  background-color: var(--ay-surface); color: var(--ay-ink); border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(thead th,.comm-company-status,.mkt-compact-preview.is-logo,pre) {
  background-color: var(--ay-raised); color: var(--ay-ink); border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(td,th,summary,hr) { border-color: var(--ay-border); }
:root[data-ayneli-theme] .unified-app :is(.u-subtitle,.muted,.mkt-small,.mkt-description,.comm-group-title,.unified-breadcrumb,.unified-eyebrow,.unified-sidebar .brand small) { color: var(--ay-muted); }
:root[data-ayneli-theme] .unified-app :is(a,.mkt-edit-project) { color: var(--ay-accent); }
:root[data-ayneli-theme] .unified-app :is(.brand,.process-link,.process-agents a) { color: var(--ay-ink); }
:root[data-ayneli-theme] .unified-app :is(.process-link,.process-agents a):hover { background: var(--ay-raised); }
:root[data-ayneli-theme] .unified-app :is(.process-group.selected > .process-link,.process-link[aria-current="page"],.process-agents a[aria-current="page"],.mkt-compact-card.selected) {
  color: var(--ay-accent); background: var(--ay-soft); border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.process-link svg,.process-chevron) { color: var(--ay-muted); }
:root[data-ayneli-theme] .unified-app :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {
  color: var(--ay-ink); background-color: var(--ay-surface); border-color: var(--ay-border);
  border-radius: 9px;
}
:root[data-ayneli-theme] .unified-app :is(.primary,button.primary) {
  color: #fff; background: var(--ay-blue); border-color: var(--ay-blue); border-radius: 9px;
}
:root[data-ayneli-theme] .unified-app :is(.primary,button.primary):hover:enabled { background: var(--ay-blue-hover); }
:root[data-ayneli-theme] .unified-app :is(.secondary,.quiet) {
  color: var(--ay-ink); background: var(--ay-raised); border-color: var(--ay-border); border-radius: 9px;
}
:root[data-ayneli-theme] .unified-app :is(.danger,.destructive,.strategy-error) { color: var(--ay-danger); background-color: var(--ay-danger-bg); }
:root[data-ayneli-theme] .unified-app :is(.unified-status,.comm-completed) { color: var(--ay-positive); background-color: var(--ay-positive-bg); }
:root[data-ayneli-theme] .unified-app :is(.comm-approval,.mkt-warning) { color: var(--ay-warning); background-color: var(--ay-warning-bg); }
:root[data-ayneli-theme] .unified-app :is(a,button,input,select,textarea,summary):focus-visible {
  outline: 2px solid var(--ay-focus); outline-offset: 3px;
}
:root[data-ayneli-theme] .unified-app button:disabled { opacity: .62; cursor: not-allowed; }
.ayneli-theme-control {
  display: flex; gap: .4rem; align-items: center; justify-content: space-between;
  margin: 0 5px 12px; color: var(--ay-muted); font-size: .75rem;
}
.ayneli-theme-control select { min-width: 0; width: auto; font: inherit; padding: .35rem; }
@media (prefers-reduced-motion: reduce) {
  .unified-app :is(.process-link,.process-agents a,.primary,.secondary) { transition: none; }
}

/* Named component surfaces. Semantic statuses keep their meaning in both palettes. */
:root {
  --ay-status-radius: 999px;
  --ay-control-radius: 9px;
  --ay-space-sm: 8px;
  --ay-space-md: 12px;
  --ay-space-lg: 20px;
  --ay-dialog-scrim: #14253b75;
  --ay-agent-bg: #f0edff;
  --ay-agent-text: #4a318a;
}
:root[data-ayneli-theme="dark"] {
  --ay-dialog-scrim: #02050bb3;
  --ay-agent-bg: #30264e;
  --ay-agent-text: #e3d5ff;
}
:root[data-ayneli-theme] .unified-app :is(.u-summary > div,.u-agent-card,.mkt-project,.mkt-channel,.comm-column h2,.developer-card,.profile-card,.knowledge-card,.conversation-card,.auth-card) {
  color: var(--ay-ink);
  background: var(--ay-surface);
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.comm-tile,.ticket-card,.mkt-wizard,.mkt-hero,.website-check,.website-cover,.strategy-message,.u-note,.u-card .u-action) {
  color: var(--ay-ink);
  background: var(--ay-raised);
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.comm-message,.comm-proposal,.comm-company,.strategy-message.owner,.website-dialog .strategy-message,.u-links a) {
  color: var(--ay-ink);
  background: var(--ay-soft);
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.comm-owner,.comm-company-status,.reliability-status,.ticket-description) {
  color: var(--ay-ink);
  background-color: var(--ay-raised);
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.mkt-hero h2,.u-summary b,.agent-card-copy strong,.u-task a,.reliability-recovery-plan,.db-builder,.task-card h3 a) {
  color: var(--ay-ink);
}
:root[data-ayneli-theme] .unified-app :is(.mkt-hero p,.mkt-status,.mkt-domain,.mkt-channel small,.website-check-label,.website-check small,.website-status.unknown,
  .comm-tile small,.comm-message small,.comm-topic > summary,.comm-specialists,.comm-mode small,.ticket-card small,.strategy-message small,.u-card > p,
  .u-section-label,.u-metric-label,.u-metric small,.u-task small,.u-empty,.u-capabilities li,.u-agent-card small,
  .developer-board > header p,.developer-card p,.developer-rule small,.developer-documentation pre,
  .reliability-row p,.reliability-row small,.reliability-group-date,.reliability-recovery-plan ol,.reliability-recovery-limits,
  .agent-card-copy > span,.agent-future-panel p,.task-card p,.task-card footer,.watch-card > p) {
  color: var(--ay-muted);
}
:root[data-ayneli-theme] .unified-app :is(.mkt-kicker,.mkt-project-links a,.mkt-reason,.ticket-formatted h2,.developer-card a,.reliability-recovery-plan summary,.u-links a) {
  color: var(--ay-accent);
}
:root[data-ayneli-theme] .unified-app :is(.comm-selected,.ticket-card.selected,.mkt-channel.picked,.agent-card.is-selected) {
  color: var(--ay-accent);
  background: var(--ay-soft);
  border-color: var(--ay-focus);
}
:root[data-ayneli-theme] .unified-app :is(.comm-tile,.ticket-card,.agent-card):hover {
  background: var(--ay-soft);
  border-color: var(--ay-focus);
}
:root[data-ayneli-theme] .unified-app :is(.comm-mode,.comm-profile-reminder,.comm-agent-icon,.agent-card-icon) {
  color: var(--ay-agent-text);
  background: var(--ay-agent-bg);
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.reliability-status,.unified-status) { border-radius: var(--ay-status-radius); }
:root[data-ayneli-theme] .unified-app :is(.reliability-status.ok,.website-status.ok,.website-check-ok,.status-done) {
  color: var(--ay-positive); background-color: var(--ay-positive-bg);
}
:root[data-ayneli-theme] .unified-app :is(.reliability-status.error,.website-incident,.website-connect,.comm-urgent,.status-error,.status-blocked) {
  color: var(--ay-danger); background-color: var(--ay-danger-bg);
}
:root[data-ayneli-theme] .unified-app :is(.reliability-status.warn,.reliability-status.stale,.unified-status.future,.status-needs_answer,.status-approval) {
  color: var(--ay-warning); background-color: var(--ay-warning-bg);
}
:root[data-ayneli-theme] .unified-app :is(.comm-dialog,.comm-editor,.website-dialog,.ticket-editor) {
  color: var(--ay-ink);
  background: var(--ay-surface);
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] :is(.comm-dialog,.comm-editor,.website-dialog,.ticket-editor)::backdrop {
  background: var(--ay-dialog-scrim);
}
:root[data-ayneli-theme] .unified-app :is(.developer-rule,.reliability-group,.reliability-ai-grid > .reliability-row,.task-card,.watch-card) {
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.comm-dialog,.comm-editor,.website-dialog,.ticket-editor) :is(input,textarea,select),
:root[data-ayneli-theme] .unified-app .question-form textarea {
  color: var(--ay-ink); background-color: var(--ay-surface) !important; border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.comm-dialog,.comm-editor,.website-dialog,.ticket-editor) { border-radius: var(--ay-radius); }
:root[data-ayneli-theme] .unified-app :is(.mkt-chat-button,.u-search button) {
  color: var(--ay-accent) !important;
  background: var(--ay-soft);
  border-color: var(--ay-border);
}
:root[data-ayneli-theme] .unified-app :is(.u-chart,.economy-chart,.strategy-chart) svg text { fill: var(--ay-muted); }
:root[data-ayneli-theme] body.ayneli-standalone :is(main,article,section,fieldset) {
  color: var(--ay-ink);
  background-color: var(--ay-surface);
  border-color: var(--ay-border);
  border-radius: var(--ay-radius);
}
:root[data-ayneli-theme] body.ayneli-standalone :is(label,input,textarea,select) {
  color: var(--ay-ink);
  background-color: var(--ay-surface);
  border-color: var(--ay-border);
  border-radius: var(--ay-control-radius);
}
:root[data-ayneli-theme] body.ayneli-standalone [role="alert"] { color: var(--ay-danger); background: var(--ay-danger-bg); }
:root[data-ayneli-theme] body.ayneli-standalone a { color: var(--ay-accent); }
:root[data-ayneli-theme] :is(.unified-app,.ayneli-standalone) :is(a,button,summary,input,textarea,select):focus-visible {
  outline: 2px solid var(--ay-focus); outline-offset: 3px;
}
@media (max-width: 620px) {
  .ayneli-theme-control { gap: var(--ay-space-sm); }
  .ayneli-theme-control select { min-height: 40px; }
}
/* Dark surfaces shared by the dashboard and its embedded agent chats. */
:root[data-ayneli-theme="dark"] {
  --ay-canvas:#181a1b; --ay-surface:#1d2021; --ay-raised:#252829;
  --ay-ink:#e3dfd8; --ay-muted:#b2bdc5; --ay-border:#414b53;
  --ay-soft:#233247; --ay-accent:#9dc8ff; --ay-focus:#9dc8ff;
  scrollbar-color:#60676b #242729;
}
:root[data-ayneli-theme="dark"] :is(.app,.unified-app) {
  --paper:var(--ay-surface); --ayneli-paper:var(--ay-surface);
}
:root[data-ayneli-theme="dark"] :is(.process-more,.mkt-text-button,.mkt-section-add,.mkt-edit-project,.mkt-compact-card button:not(.primary),.comm-compose button:not(.primary),.crm-chat-tools button,.comm-task-actions button:not(.primary)) {
  background:var(--ay-raised); color:var(--ay-ink); border-color:var(--ay-border);
}
:root[data-ayneli-theme="dark"] :is(.process-more,.mkt-compact-card button:not(.primary)):hover {
  background:var(--ay-soft); color:var(--ay-accent);
}
:root[data-ayneli-theme="dark"] .mkt-compact-card .mkt-project-name {
  color:var(--ay-accent)!important; background:none!important;
}
:root[data-ayneli-theme="dark"] :is(.mkt-compact-progress,.mkt-lifecycle h4,.mkt-site-lifecycle h4,.mkt-task-details summary,.mkt-connections>summary,.mkt-progress-label>strong,.mkt-lead-source>a,.mkt-balance-line>strong:last-child,.mkt-balance-item>a,.mkt-connection>a) {
  color:var(--ay-accent);
}
:root[data-ayneli-theme="dark"] :is(.mkt-context>div,.mkt-launch-sticky,.mkt-launch-progress,.mkt-edit-form,.mkt-campaign,.mkt-inline-section,.mkt-compact-preview,.mkt-source-editor,.mkt-metrics-table tbody tr,.developer-documentation,.developer-rule,.db-builder,.reliability-row,.watch-card,.notice,.message,.auth-card,.profile-card,.knowledge-card,.ticket-editor,.strategy-panel,.u-service-frame) {
  color:var(--ay-ink); background-color:var(--ay-surface); border-color:var(--ay-border);
}
:root[data-ayneli-theme="dark"] :is(.mkt-small,.mkt-deadline,.mkt-metrics-table,.mkt-metrics-table tbody th,.mkt-metrics-table tbody td,.comm-file,.comm-knowledge-file,.identity,.comm-agent-intro,.comm-system small) {
  color:var(--ay-muted);
}
:root[data-ayneli-theme="dark"] :is(.mkt-count,.mkt-task-state,.unified-nav-title span) {
  background:var(--ay-soft); color:var(--ay-accent);
}
:root[data-ayneli-theme="dark"] :is(.mkt-task-state.done,.mkt-connection-status.connected,.mkt-progress-delta) {
  background:var(--ay-positive-bg); color:var(--ay-positive);
}
:root[data-ayneli-theme="dark"] .mkt-connection-status:not(.connected) {
  background:var(--ay-warning-bg); color:var(--ay-warning);
}
:root[data-ayneli-theme="dark"] :is(.crm-marketer-frame,.comm-inline-conversation,.crm-chat-composer,.comm-compose) {
  background-color:var(--ay-canvas); color:var(--ay-ink); border-color:var(--ay-border);
}
:root[data-ayneli-theme="dark"] .crm-marketer-frame :is(.comm-column,.crm-marketer-check,.comm-agent-chat,.comm-agent-watch,.comm-history,dialog) {
  background:var(--ay-surface); color:var(--ay-ink); border-color:var(--ay-border);
}
:root[data-ayneli-theme="dark"] :is(.unified-app,.crm-marketer-frame) .comm-message {
  background:var(--ay-raised); color:var(--ay-ink); border-color:var(--ay-border);
}
:root[data-ayneli-theme="dark"] :is(.unified-app,.crm-marketer-frame) .comm-ai { border-color:#385775; }
:root[data-ayneli-theme="dark"] :is(.unified-app,.crm-marketer-frame) .comm-owner {
  background:#282a2b; border-color:#4a4b4b;
}
:root[data-ayneli-theme="dark"] .comm-message small { color:var(--ay-muted); }
:root[data-ayneli-theme="dark"] :is(.app,.crm-marketer-frame,.auth-shell) :is(input:not([type=radio]):not([type=checkbox]),select,textarea) {
  background-color:var(--ay-canvas); color:var(--ay-ink); border-color:var(--ay-border);
}
:root[data-ayneli-theme="dark"] :is(input,textarea)::placeholder { color:#a9b4ba; opacity:1; }
:root[data-ayneli-theme="dark"] :is(.comm-file,.comm-knowledge-file,.crm-chat-file) { color:var(--ay-accent); }
.comm-setup-status { margin:0 0 .7rem; font-size:.82rem; color:var(--ay-muted,#475569); }
.comm-message[data-first-unread] { border-inline-start:3px solid var(--ay-focus,#2563eb); }
