/* Market Analytics v0.4.10 — user-selectable theme for ALL pages. */
.theme-toggle {
  display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:32px;
  padding:5px 10px; border:1px solid var(--border); border-radius:9px;
  color:var(--text); background:var(--surface); font-size:11px; font-weight:650;
  cursor:pointer; transition:background .18s,border-color .18s;
}
.theme-toggle:hover { border-color:var(--blue); }
.theme-toggle:focus-visible { outline:2px solid var(--blue); outline-offset:3px; }
.theme-toggle [data-theme-icon] { font-size:17px;line-height:1; }
.account-theme-toggle { position:absolute; right:clamp(12px,3vw,36px); top:20px; z-index:2; }
.wb-sync-diagnostic {display:flex;align-items:flex-start;gap:11px;padding:13px 16px;margin:0 0 16px;border:1px solid #f1bdc7;border-radius:11px;background:#fff0f2;color:#923b49;font-size:12px;line-height:1.55;}
.wb-sync-diagnostic[hidden]{display:none!important;}
.wb-sync-diagnostic-icon{display:grid;place-items:center;flex:0 0 27px;width:27px;height:27px;border-radius:50%;background:#cf364a;color:white;font-weight:800;font-size:18px;}
.wb-sync-diagnostic-body{flex:1;min-width:0;overflow-wrap:anywhere;}
.wb-sync-diagnostic-body>strong{font-size:13px;}
.wb-sync-diagnostic p{margin:4px 0 0;}
.wb-sync-diagnostic details{margin-top:7px;font-size:11px;}
.wb-sync-diagnostic summary{cursor:pointer;font-weight:700;}
.wb-sync-diagnostic details p{overflow-wrap:anywhere;}
.wb-diagnostic-link{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;min-height:30px;padding:0 10px;border:1px solid #f1cad0;background:white;border-radius:7px;text-decoration:none;color:#a23144;font-size:11px;font-weight:700;}
.wb-analytics-ping{display:flex;gap:10px;align-items:flex-start;flex-wrap:wrap;border-top:1px solid var(--border);margin-top:13px;padding-top:13px;}
.wb-analytics-ping>.integration-message{flex:1 1 180px;margin-top:5px;overflow-wrap:anywhere;}
.api-ping-ok{color:#168258!important;}.api-ping-error{color:#c14459!important;}

/* Dark scheme maintains contrast without changing business colors/signals. */
:root[data-theme="dark"] {
  color-scheme:dark;
  --bg:#101827;
  --surface:#192537;
  --text:#eaf0fa;
  --muted:#a4b3ca;
  --border:#31435c;
  --blue:#7294ff;
  --blue-soft:#263758;
  --green:#55c89a;
  --green-soft:#173d34;
  --purple:#b09aff;
  --orange:#ffb268;
  --shadow:0 8px 22px rgba(0,0,0,.15);
  --dark-deep:#141e2e;
  --dark-raised:#213049;
  --dark-subtle:#9eafc9;
}
:root[data-theme="dark"] body, :root[data-theme="dark"] .main-content {background:var(--bg);color:var(--text);}
:root[data-theme="dark"] .sidebar, :root[data-theme="dark"] .topbar {background:var(--dark-deep);border-color:var(--border);}
:root[data-theme="dark"] .brand, :root[data-theme="dark"] .breadcrumbs strong {color:var(--text);}
:root[data-theme="dark"] .nav-link, :root[data-theme="dark"] .market-link, :root[data-theme="dark"] .more {color:#b7c5dd;}
:root[data-theme="dark"] .nav-link.active {background:#293d65;color:#a5baff;}
:root[data-theme="dark"] .nav-link.active>span {color:#a5baff;}
:root[data-theme="dark"] .plan-card {background:linear-gradient(140deg,#242d52,#312745);border-color:#414469;}
:root[data-theme="dark"] .plan-icon {background:#403c68;}
:root[data-theme="dark"] .plan-card p, :root[data-theme="dark"] .plan-card a {color:#b7c5e8;}
:root[data-theme="dark"] .segmented-control, :root[data-theme="dark"] .auth-tabs {background:#243248;}
:root[data-theme="dark"] .segment, :root[data-theme="dark"] .auth-tab {color:#b3c1d7;}
:root[data-theme="dark"] .segment.active, :root[data-theme="dark"] .auth-tab.active {background:#344666;color:#c8d6ff;}
:root[data-theme="dark"] .account-link, :root[data-theme="dark"] .secondary-button, :root[data-theme="dark"] .date-preset, :root[data-theme="dark"] .cost-edit-button, :root[data-theme="dark"] .wb-diagnostic-link {background:#263650;color:#bacbff;border-color:#3c5277;}
:root[data-theme="dark"] .account-link:hover, :root[data-theme="dark"] .secondary-button:hover, :root[data-theme="dark"] .date-preset:hover {background:#324769;}
:root[data-theme="dark"] .date-preset.active {background:#304775;border-color:#6381d4;color:#d1ddff;box-shadow:none;}
:root[data-theme="dark"] .kpi-card, :root[data-theme="dark"] .panel {background:var(--surface);border-color:var(--border);}
:root[data-theme="dark"] h1, :root[data-theme="dark"] .kpi-value, :root[data-theme="dark"] .orders-total, :root[data-theme="dark"] .orders-title-row h2, :root[data-theme="dark"] .orders-overview-right h3, :root[data-theme="dark"] .orders-mini-card strong, :root[data-theme="dark"] .orders-unknown-card strong {color:var(--text);}
:root[data-theme="dark"] .breadcrumbs, :root[data-theme="dark"] .date-controls label, :root[data-theme="dark"] .kpi-top, :root[data-theme="dark"] .kpi-foot, :root[data-theme="dark"] .orders-title-row p, :root[data-theme="dark"] .panel-heading p, :root[data-theme="dark"] .orders-status-percent {color:var(--muted);}
:root[data-theme="dark"] .demo-pill {background:#4c3a25;color:#ffd28f;}
:root[data-theme="dark"] .demo-pill.account-mode, :root[data-theme="dark"] .positive-chip {background:#1d443a;color:#7ee0b5;}
:root[data-theme="dark"] .neutral-chip, :root[data-theme="dark"] .orders-total-caption, :root[data-theme="dark"] .orders-status-note, :root[data-theme="dark"] .finance-summary, :root[data-theme="dark"] .cost-coverage, :root[data-theme="dark"] .estimate-result-main, :root[data-theme="dark"] .estimate-settings, :root[data-theme="dark"] .cost-bulk-form, :root[data-theme="dark"] .notice-card {background:#222f45;border-color:#3a4b64;color:#b4c4dd;}
:root[data-theme="dark"] .orders-mini-card, :root[data-theme="dark"] .orders-unknown-card {background:#253249;border-color:#3b4c68;color:#cad8ed;}
:root[data-theme="dark"] .orders-unknown-card {background:#302d52;border-color:#544a83;}
:root[data-theme="dark"] .orders-overview-left, :root[data-theme="dark"] .orders-status-row, :root[data-theme="dark"] .quick-stat-row {border-color:var(--border);}
:root[data-theme="dark"] .orders-status-row, :root[data-theme="dark"] .orders-status-count, :root[data-theme="dark"] .marketplace-name, :root[data-theme="dark"] .expense-value, :root[data-theme="dark"] .quick-stat-row strong, :root[data-theme="dark"] .product-title, :root[data-theme="dark"] .product-category {color:#dce6f7;}
:root[data-theme="dark"] .orders-progress, :root[data-theme="dark"] .progress-track, :root[data-theme="dark"] .expense-track {background:#344359;}
:root[data-theme="dark"] .orders-status-row.unavailable, :root[data-theme="dark"] .orders-status-row.unavailable .orders-status-count {color:#8d9ab1;}
:root[data-theme="dark"] .orders-status-icon.unavailable-icon, :root[data-theme="dark"] .product-thumb {background:#344159;color:#a9bad8;}
:root[data-theme="dark"] .kpi-icon.blue {background:#283e69;color:#aac5ff;}
:root[data-theme="dark"] .kpi-icon.green {background:#20483d;color:#73e0b1;}
:root[data-theme="dark"] .kpi-icon.violet, :root[data-theme="dark"] .orders-top-icon {background:#353058;color:#cab7ff;}
:root[data-theme="dark"] .kpi-icon.orange {background:#493827;color:#ffcc97;}
:root[data-theme="dark"] .finance-integration h3, :root[data-theme="dark"] .finance-summary-line strong, :root[data-theme="dark"] .cost-form-title strong, :root[data-theme="dark"] .estimate-result-main>strong, :root[data-theme="dark"] .estimate-cost-row strong, :root[data-theme="dark"] .integration-heading h2 {color:var(--text);}
:root[data-theme="dark"] .estimate-breakdown, :root[data-theme="dark"] .finance-integration, :root[data-theme="dark"] .finance-promotion-block {border-color:var(--border);color:#b0c2db;}
:root[data-theme="dark"] .estimate-settings>summary, :root[data-theme="dark"] .cost-selected-counter {color:#b0c2ff;}
:root[data-theme="dark"] .estimate-warning {color:#ffd08a;background:#594025;border-color:#896033;}
:root[data-theme="dark"] .cost-coverage-stat, :root[data-theme="dark"] .cost-missing-filter, :root[data-theme="dark"] .cost-form-fields label, :root[data-theme="dark"] .estimate-fields label {color:#c6d4eb;}
:root[data-theme="dark"] .cost-coverage-stat strong {color:#ffbe79;}
:root[data-theme="dark"] thead th {background:#243249;color:#b9c7df;border-color:#3c4d66;}
:root[data-theme="dark"] tbody td {color:#becde4;border-color:#35445b;}
:root[data-theme="dark"] .combined-products-table th:last-child {background:#243249;box-shadow:-1px 0 0 #465776,-9px 0 16px -13px #000;}
:root[data-theme="dark"] .combined-products-table td:last-child {background:var(--surface);box-shadow:-1px 0 0 #465776,-9px 0 16px -13px #000;}
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea {background:#111c2d;color:#eff5ff;border-color:#445673;accent-color:#81a2ff;}
:root[data-theme="dark"] input::placeholder {color:#8294b0;}
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] select:focus {border-color:#819dff;box-shadow:0 0 0 2px #4e66aa55;}
:root[data-theme="dark"] .sync-hint {background:#203451;color:#c2d7fc;border-color:#355483;}
:root[data-theme="dark"] .wb-sync-top-state {background:#263550;color:#c3d2e9;}
:root[data-theme="dark"] .wb-sync-top-state[data-state="updated"]{background:#214738;color:#91e4b8;}
:root[data-theme="dark"] .wb-sync-top-state[data-state="running"]{background:#2b4670;color:#bfd0ff;}
:root[data-theme="dark"] .wb-sync-top-state[data-state="partial"]{background:#534126;color:#ffd094;}
:root[data-theme="dark"] .wb-sync-top-state[data-state="error"], :root[data-theme="dark"] .wb-sync-top-state[data-state="rights"]{background:#572c3c;color:#ffb6c6;}
:root[data-theme="dark"] .wb-sync-diagnostic {background:#442836;border-color:#915066;color:#ffd5dc;}
:root[data-theme="dark"] .wb-order-alert {background:#442836;border-color:#915066;color:#ffd5dc;}
:root[data-theme="dark"] .wb-order-alert .secondary-button {background:#3d3045;color:#ffbfcd;}
:root[data-theme="dark"] .sync-alert-badge {border-color:var(--surface);}
:root[data-theme="dark"] .account-page {background:radial-gradient(circle at 15% 10%,#223759 0,transparent 33%),var(--bg);}
:root[data-theme="dark"] .account-card {background:var(--surface);border-color:var(--border);box-shadow:0 18px 60px #050a1477;}
:root[data-theme="dark"] .account-card .field, :root[data-theme="dark"] .field input, :root[data-theme="dark"] .integration-card-heading strong {color:#dce7fa;}
:root[data-theme="dark"] .integration-card, :root[data-theme="dark"] .integration-guide, :root[data-theme="dark"] .wb-token-rights {background:#1f2c40;border-color:#3a4e6b;color:#bac8dd;}
:root[data-theme="dark"] .integration-guide .guide-note {background:#2a3851;color:#c9d7ed;}
:root[data-theme="dark"] .integration-guide summary, :root[data-theme="dark"] .integration-guide a {color:#a8bdff;}
:root[data-theme="dark"] .integration-status {background:#344158;color:#bccbe1;}
:root[data-theme="dark"] .integration-status.connected {background:#214a3c;color:#8ae4b3;}
:root[data-theme="dark"] .integration-status.error, :root[data-theme="dark"] .form-error {background:#4c2937;color:#ffb6c4;}
:root[data-theme="dark"] .form-success {background:#224b3b;color:#91e7b9;}
:root[data-theme="dark"] .wb-right.granted {background:#264b3d;color:#a2ebc4;}
:root[data-theme="dark"] .wb-right.denied {background:#50313b;color:#ffb5be;}
:root[data-theme="dark"] .toast {background:#30435d;}
@media (max-width:760px){.theme-toggle [data-theme-label]{display:none;}.theme-toggle{width:34px;padding:4px;}.account-theme-toggle{width:auto;padding:4px 9px;}.account-theme-toggle [data-theme-label]{display:inline;}}
@media (max-width:560px){.wb-sync-diagnostic{flex-wrap:wrap;}.wb-diagnostic-link{margin-left:39px;}}

/* v0.4.11: actionable progress for pending pages in either theme. */
.wb-sync-diagnostic[data-kind="partial"]{background:#fff7e8;color:#896121;border-color:#e7d3a5;}
.wb-sync-diagnostic[data-kind="partial"] .wb-sync-diagnostic-icon{background:#b9892e;}
.wb-sync-source-list{display:grid;grid-template-columns:repeat(2,minmax(220px,1fr));gap:9px;margin-top:12px;}
.wb-sync-source-row{display:grid;grid-template-columns:24px 1fr;gap:3px 9px;align-items:center;min-width:0;padding:11px;border-radius:9px;border:1px solid #c6cbd263;background:#ffffffa0;font-size:11px;}
.wb-sync-source-symbol{grid-row:1/3;display:grid;place-items:center;width:23px;height:23px;border-radius:50%;background:#e8ebf2;color:#596780;font-weight:800;font-size:15px;}
.wb-sync-source-row strong{grid-column:2;font-size:12px;}
.wb-sync-source-row span:not(.wb-sync-source-symbol){grid-column:2;font-weight:650;}
.wb-sync-source-row p{grid-column:1/-1;margin:4px 0 0!important;overflow-wrap:anywhere;line-height:1.5;}
.wb-sync-source-row[data-kind="complete"] .wb-sync-source-symbol{color:#137d54;background:#d8f5e5;}
.wb-sync-source-row[data-kind="pending"] .wb-sync-source-symbol{color:#94641a;background:#fff1c9;}
.wb-sync-source-row[data-kind="error"] .wb-sync-source-symbol{color:#c33b4d;background:#ffe1e7;}
.wb-sync-source-row[data-kind="running"] .wb-sync-source-symbol{color:#3e66be;background:#e4ecff;animation:wb-turn 1s linear infinite;}
.wb-sync-diagnostic [hidden]{display:none!important;}
:root[data-theme="dark"] .wb-sync-diagnostic[data-kind="partial"]{background:#43351e;color:#ffe2ab;border-color:#7b5c2e;}
:root[data-theme="dark"] .wb-sync-source-row{background:#ffffff0b;border-color:#ffffff25;color:inherit;}
:root[data-theme="dark"] .wb-sync-source-row[data-kind="pending"] .wb-sync-source-symbol{background:#624a22;color:#ffe19e;}
@media(max-width:720px){.wb-sync-source-list{grid-template-columns:1fr;}}
@media(prefers-reduced-motion:reduce){.wb-sync-source-row[data-kind="running"] .wb-sync-source-symbol{animation:none;}}

/* v0.4.12 — calm dashboard sync summary, diagnostics are opt-in. */
.wb-sync-diagnostic,
.wb-sync-diagnostic[data-kind="normal"],
.wb-sync-diagnostic[data-kind="warning"],
.wb-sync-diagnostic[data-kind="critical"] {
  display:block; margin:0 0 17px; padding:12px 16px 11px;
  background:#f7f9fc; color:#4b5972; border:1px solid #e2e9f3;
  border-radius:12px; line-height:1.55; box-shadow:0 1px 5px rgba(24,35,60,.025);
}
.wb-sync-compact-heading{display:flex;gap:10px;align-items:center;}
.wb-sync-diagnostic .wb-sync-diagnostic-icon{
  background:#e3f4eb;color:#168058;font-size:16px;flex:0 0 25px;width:25px;height:25px;
}
.wb-sync-diagnostic[data-kind="warning"] .wb-sync-diagnostic-icon {background:#fff0d1;color:#996e18;}
.wb-sync-diagnostic[data-kind="critical"] .wb-sync-diagnostic-icon {background:#fce1e5;color:#b53646;}
.wb-sync-diagnostic-body>strong{color:#2c3a52;font-size:13px;}
.wb-sync-diagnostic-body>p{margin:2px 0 0;color:#64748d;font-size:11px;}
.wb-sync-status-chips{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 4px;}
.wb-status-chip{
  display:inline-flex;gap:5px;align-items:center;min-height:26px;padding:4px 8px;
  border-radius:7px;border:1px solid #e4e9f2;background:#fff;
  color:#53647d;font-size:11px;line-height:1.35;
}
.wb-status-chip>span{font-size:13px;color:#19845b;font-weight:800;}
.wb-status-chip[data-kind="retry"]>span, .wb-status-chip[data-kind="idle"]>span{color:#7888a0;}
.wb-status-chip[data-kind="pending"]>span, .wb-status-chip[data-kind="warning"]>span{color:#ad8028;}
.wb-status-chip[data-kind="critical"]>span{color:#bb3f50;}
.wb-status-chip[data-kind="running"]>span{color:#4d70bd;display:inline-block;animation:wb-turn 1s linear infinite;}
.wb-sync-folders{display:flex;flex-wrap:wrap;gap:7px 20px;align-items:flex-start;margin-top:9px;}
.wb-sync-folders details{margin:0;flex:1 1 270px;min-width:0;border-top:1px solid #e2e9f3;padding-top:8px;font-size:11px;}
.wb-sync-folders summary{cursor:pointer;display:list-item;color:#506482;font-weight:700;user-select:none;}
.wb-sync-folders summary:hover{color:#466dcc;}
.wb-sync-folders details[open]{padding-bottom:7px;}
.wb-sync-folders p{font-size:11px;}
.wb-sync-schedule-intro{max-width:700px;color:#73829a;}
.wb-sync-schedule-list{display:grid;gap:0;margin-top:8px;}
.wb-schedule-row{display:grid;grid-template-columns:minmax(100px,1fr) minmax(140px,auto);gap:2px 8px;align-items:center;padding:7px 3px;border-top:1px solid #e3e8f0;}
.wb-schedule-row strong{color:#43536f;}
.wb-schedule-row>span{text-align:right;color:#344866;font-weight:650;}
.wb-schedule-row>small{grid-column:1/-1;color:#8b99ae;font-size:10px;}
.wb-sync-diagnostic .wb-sync-source-row{background:#ffffffad;border-color:#e2e8f1;}
.wb-sync-diagnostic .wb-sync-source-row[data-kind="retry"] .wb-sync-source-symbol{color:#657591;background:#e9eef5;}
.wb-sync-diagnostic .wb-sync-source-row[data-kind="warning"] .wb-sync-source-symbol{color:#996e18;background:#fff0d1;}
.wb-sync-diagnostic .wb-sync-source-row[data-kind="critical"] .wb-sync-source-symbol{color:#b53646;background:#fce1e5;}
.wb-sync-top-state[data-state="partial"], .wb-sync-top-state[data-state="waiting"]{
  background:#eff3fa;color:#53647d;
}
.wb-sync-top-state[data-state="warning"]{background:#fff3dd;color:#997023;}
:root[data-theme="dark"] .wb-sync-diagnostic,
:root[data-theme="dark"] .wb-sync-diagnostic[data-kind="normal"],
:root[data-theme="dark"] .wb-sync-diagnostic[data-kind="warning"],
:root[data-theme="dark"] .wb-sync-diagnostic[data-kind="critical"]{
  background:#202e43;color:#bbcae0;border-color:#33455f;
}
:root[data-theme="dark"] .wb-sync-diagnostic-body>strong,
:root[data-theme="dark"] .wb-schedule-row strong{color:#e1ebfc;}
:root[data-theme="dark"] .wb-sync-diagnostic-body>p,
:root[data-theme="dark"] .wb-sync-schedule-intro{color:#a0b3d0;}
:root[data-theme="dark"] .wb-sync-status-chips .wb-status-chip{background:#27384f;border-color:#3a4b65;color:#cbdaef;}
:root[data-theme="dark"] .wb-sync-folders summary{color:#a8c0ea;}
:root[data-theme="dark"] .wb-sync-folders details,
:root[data-theme="dark"] .wb-schedule-row{border-color:#394962;}
:root[data-theme="dark"] .wb-schedule-row>span{color:#cbdcf5;}
:root[data-theme="dark"] .wb-schedule-row>small{color:#a1b3ce;}
:root[data-theme="dark"] .wb-sync-diagnostic .wb-sync-source-row{background:#2a3a51;border-color:#42536a;}
:root[data-theme="dark"] .wb-sync-top-state[data-state="partial"],
:root[data-theme="dark"] .wb-sync-top-state[data-state="waiting"]{background:#263550;color:#c3d2e9;}
:root[data-theme="dark"] .wb-sync-top-state[data-state="warning"]{background:#534126;color:#ffd094;}
@media(max-width:700px){.wb-sync-folders{display:block;}.wb-sync-folders details+details{margin-top:8px;}}
@media(prefers-reduced-motion:reduce){.wb-status-chip[data-kind="running"]>span{animation:none;}}
