:root {
  color-scheme: light;
  --chart-bars: #d6e1dc;
  --chart-line: #087e68;
  --chart-ticks: #6d7d75;
  --chart-grid: #eff2ef;
  --chart-tooltip: #20382f;
  --chart-tooltip-text: #ffffff;
  --theme-surface: #f4f7f5;
  --theme-selected: #ffffff;
  --action-hover: #066c59;
  --success: #087e68;
}

.legend-mark { background: var(--chart-bars); }
.legend-mark.green { background: var(--chart-line); }

.finding-row:hover { background: #f7f8fa; }
.finding-row.selected { background: #eef1f4; }
.finding-row>svg { color: #6c7680; }
.product-thumb { background: #ffffff; border-color: #cbd1d6; color: #4b5561; }

.appearance-section {
  max-width: 720px;
  border-top: 1px solid var(--line);
  padding: 24px 0 28px;
}
.appearance-section .section-heading { margin-bottom: 20px; }
.appearance-options { border: 0; padding: 0; margin: 0; min-width: 0; }
.appearance-options legend { font-size: 12px; font-weight: 650; padding: 0; margin-bottom: 12px; }
.theme-picker {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  gap: 3px;
  background: var(--theme-surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.theme-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 13px;
  min-height: 42px;
  min-width: 128px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
}
.theme-choice:has(input:checked) { background: var(--theme-selected); border-color: var(--line); }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.theme-choice:has(input:disabled) { cursor: wait; }
.theme-choice input { margin: 0; width: 14px; height: 14px; accent-color: var(--green); }
.theme-choice svg { width: 16px; height: 16px; }
#appearance-result { min-height: 18px; margin: 12px 0 0; font-size: 11px; color: var(--muted); }
#appearance-result.form-error { color: var(--red); }

:root[data-theme="dark"] {
  color-scheme: dark;
  color: #e5e8e7;
  background: #252629;
  --surface: #2c2e31;
  --surface-raised: #323438;
  --surface-input: #25272a;
  --sidebar: #212225;
  --green: #83ceb3;
  --green-soft: #293b34;
  --line: #414448;
  --muted: #b0b6b9;
  --amber: #e7bf78;
  --red: #f2a298;
  --action: #246d57;
  --action-hover: #2d7d65;
  --action-border: #489c7e;
  --success: #83ceb3;
  --chart-bars: #59665f;
  --chart-line: #83ceb3;
  --chart-ticks: #b0b6b9;
  --chart-grid: #3b3e41;
  --chart-tooltip: #373b3e;
  --chart-tooltip-text: #f0f3f1;
  --theme-surface: #212225;
  --theme-selected: #373a3e;
  scrollbar-color: #60666a #252629;
}

[data-theme="dark"] body { background: #252629; }
[data-theme="dark"] .platform-strip { background: #202124; border-color: var(--line); }
[data-theme="dark"] .platform-tabs>a:hover { background: var(--surface); }
[data-theme="dark"] .platform-tabs>a[aria-selected="true"] { background: #252629; border-color: var(--line); }
[data-theme="dark"] .sidebar { background: var(--sidebar); }
[data-theme="dark"] :is(.sidebar nav>a:hover,.sidebar-bottom>a:hover,.icon-button:hover) { background: var(--surface-raised); }
[data-theme="dark"] .sidebar a.active { color: var(--green); background: var(--green-soft)!important; }
[data-theme="dark"] :is(.sidebar a.active svg,.strip-brand>svg,.company-avatar) { color: var(--green); }
[data-theme="dark"] .owner-avatar { background: #3c4043; color: #e5e8e7; }
[data-theme="dark"] .avito-logo { background: #304a3f; color: #a5ddc7; }
[data-theme="dark"] .ozon-logo { background: #2e3d53; color: #a7c9fa; }
[data-theme="dark"] .wb-logo { background: #4e354b; color: #ebbee0; }
[data-theme="dark"] .tab-status { background: #79817e; }
[data-theme="dark"] .tab-status.ready { background: var(--success); }

[data-theme="dark"] :is(
  .local-label,.company div>span,.nav-heading,.sidebar nav>a svg,.sidebar-bottom>a svg,
  .nav-count,.sidebar-owner div>span,.breadcrumb,.breadcrumb svg,.source-indicator,
  .eyebrow,.page-heading p,.metric-label,.metric-caption,.metric-value.missing,
  .section-caption,.inspector .overline,.inspector .item-context,.manual-note,
  .finding-product,.chart-legend,.subtle-text,.coverage-line span:last-child,
  .search-input svg,.data-table th,.table-title small,.table-footer,
  .empty-state p,.connection-name p,.connection-detail span:last-child,
  .modal-help,footer,.auth-shell p,.auth-brand>span,.auth-foot,
  .listing-modal-context,.listing-period,.lead-tile>p,.lead-open svg,
  .auth-page .auth-brand>span,.loading-state,.empty-state>.lucide
) { color: var(--muted); }

[data-theme="dark"] .breadcrumb span:last-child { color: #e5e8e7; }
[data-theme="dark"] :is(.nav-count.warning,.count-tag,.finding-meta) { color: var(--amber); }
[data-theme="dark"] :is(.form-label,.inspector label) { color: #c9cfcc; }
[data-theme="dark"] .source-note { color: #e4ca96; background: #302e28; border-color: #514939; }
[data-theme="dark"] .evidence { color: #d1d8d4; border-color: #c29f61; }
[data-theme="dark"] .filter-tabs button { color: var(--muted); }
[data-theme="dark"] .filter-tabs button.active { color: var(--green); }
[data-theme="dark"] .finding-row:hover { background: var(--surface); }
[data-theme="dark"] .finding-row.selected { background: var(--surface-raised); }
[data-theme="dark"] .finding-row>svg { color: var(--muted); }
[data-theme="dark"] .product-thumb { background: #212225; border-color: #5b6066; color: #e1e5e8; }
[data-theme="dark"] .status-tag { background: #433a2a; color: #f0ca87; }
[data-theme="dark"] .status-tag.neutral { background: #373b3f; color: #c6ced0; }
[data-theme="dark"] .status-tag.green { background: #2e4439; color: #a1dbc2; }
[data-theme="dark"] :is(.coverage-line .available,.connection-detail .available,.table-title .checked-label) { color: var(--success)!important; }

[data-theme="dark"] .button { background: var(--surface); border-color: #575c60; }
[data-theme="dark"] .button:hover { background: var(--surface-raised); }
[data-theme="dark"] .button.primary { background: var(--action); border-color: var(--action-border); color: #f7faf8; }
[data-theme="dark"] .button.primary:hover { background: var(--action-hover); }
[data-theme="dark"] .button.danger { color: var(--red); }
[data-theme="dark"] .data-table th { background: #292b2e; }
[data-theme="dark"] .lead-tile { background: var(--surface); }
[data-theme="dark"] .reminder-tag { color: #b0d4c2; }
[data-theme="dark"] .reminder-tag.overdue { color: #eec18e; }
[data-theme="dark"] .review-stars { color: #e3be79; }
[data-theme="dark"] .review-stars svg { fill: #d6ae60; }
[data-theme="dark"] .job-progress { color: var(--green); }

[data-theme="dark"] :is(
  .inspector input,.inspector select,.inspector textarea,.toolbar select,
  .modal-form input,.settings-form>input,.settings-form>select,.form-grid input,
  .form-grid select,.form-grid textarea,.leads-toolbar select,.reviews-section select,
  .auth-shell input,#period-controls select,#period-controls input
) { background: var(--surface-input); border-color: #61676b; color: #e5e8e7; }
[data-theme="dark"] :is(.search-input,.pagination button) { border-color: #61676b; }
[data-theme="dark"] .search-input input { color: #e5e8e7; }
[data-theme="dark"] ::placeholder { color: #aeb6b8; opacity: 1; }
[data-theme="dark"] input:-webkit-autofill {
  -webkit-text-fill-color: #e5e8e7;
  box-shadow: 0 0 0 1000px var(--surface-input) inset;
  caret-color: #e5e8e7;
}
[data-theme="dark"] dialog { background: var(--surface); color: #e5e8e7; border-color: #62676a; box-shadow: 0 20px 90px #00000060; }
[data-theme="dark"] dialog::backdrop { background: #10111399; }
[data-theme="dark"] .auth-page { background: #252629; }
[data-theme="dark"] #period-controls :is(label,span) { color: var(--muted); }
[data-theme="dark"] #toast { background: #355c4b; color: #f5f8f6; }
[data-theme="dark"] .toast-error { background: #75413b!important; }
[data-theme="dark"] [data-tooltip]:hover:after { background: #e0e5e2; color: #252629; }

/* Existing --green tokens represent interactive accents, not success states. */
:root[data-channel="ozon"] {
  --green: #005bea;
  --green-soft: #eaf1ff;
  --action-hover: #004bc4;
}
:root[data-channel="wb"] {
  --green: #bd167c;
  --green-soft: #fbeaf4;
  --action-hover: #9e1268;
}
:root[data-theme="dark"][data-channel="ozon"] {
  --green: #8cbcff;
  --green-soft: #29384f;
  --action: #245cc5;
  --action-hover: #2c69d8;
  --action-border: #6094ed;
}
:root[data-theme="dark"][data-channel="wb"] {
  --green: #f39dcc;
  --green-soft: #452e3d;
  --action: #9b246d;
  --action-hover: #af2d7e;
  --action-border: #d86ba9;
}
.sidebar a.active { background: var(--green-soft)!important; color: var(--green); }
.sidebar a.active svg { color: var(--green); }
.button.primary:hover { background: var(--action-hover); }
.job-progress { color: var(--green); }
.market-logo { background: #ffda00; color: #252629; }
:root[data-channel="market"] {
  --market-accent: #ffda00;
  --green: #252629;
  --green-soft: #fff6bf;
  --action-hover: #f4cf00;
}
:root[data-theme="dark"][data-channel="market"] {
  --green: #ffda00;
  --green-soft: #343434;
  --action-hover: #f4cf00;
}
[data-channel="market"] .button.primary {
  background: var(--market-accent);
  border-color: var(--market-accent);
  color: #252629;
}
[data-channel="market"] .button.primary:hover {
  background: var(--action-hover);
  border-color: var(--action-hover);
}
[data-channel="market"] .platform-tabs>a[aria-selected="true"] { box-shadow: inset 0 2px var(--market-accent); }
[data-channel="market"] .text-link {
  text-decoration: underline;
  text-decoration-color: var(--market-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.platform-tabs { min-width: 0; overflow-x: auto; flex: 1; }
.platform-tabs>a { flex-shrink: 0; }
@media(max-width:700px) {
  .platform-tabs { min-width: 0; }
  .platform-tabs>a { flex: 0 0 auto; min-width: 120px; }
  .platform-tabs>a[data-platform="market"] { min-width: 164px; }
}
:is(.coverage-line .available,.connection-detail .available,.table-title .checked-label) { color: var(--success)!important; }

@media(max-width:360px) {
  .theme-choice { min-width: 0; padding: 10px; gap: 6px; }
}
