/* Shared theme switch in the desktop navigation. */
.top-nav__theme {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--color-hairline-strong);
  border-radius: 8px;
  background: var(--color-surface-card);
  color: var(--color-ink);
  cursor: pointer;
}

.top-nav__theme:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.top-nav__theme:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.top-nav__theme svg {
  width: 19px;
  height: 19px;
}

.top-nav__theme-sun,
html[data-theme="dark"] .top-nav__theme-moon {
  display: none;
}

html[data-theme="dark"] .top-nav__theme-sun {
  display: block;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #ff7840;
  --color-primary-active: #ff935f;
  --color-ink: #f1f2f5;
  --color-body: #d4d7df;
  --color-body-strong: #f1f2f5;
  --color-muted: #a9afbd;
  --color-muted-soft: #9098a8;
  --color-hairline: #3a4050;
  --color-hairline-soft: #313746;
  --color-hairline-strong: #596171;
  --color-canvas: #151922;
  --color-canvas-soft: #1d222d;
  --color-surface-card: #242a36;
  --color-surface-strong: #353c4a;
  --color-on-primary: #171b24;
  --color-success: #55d6a1;
  --color-error: #ff6f93;
  --color-semantic-success: #55d6a1;
  --color-surface-muted: #303746;
  --status-pending-bg: #343944;
  --status-pending-text: #d1d5de;
  --status-pending-border: #555d69;
  --status-processing-bg: #343b48;
  --status-processing-text: #eff1f6;
  --status-processing-border: #606b7b;
  --status-completed-bg: #173b32;
  --status-completed-text: #81e5ba;
  --status-completed-border: #307961;
  --status-timeout-bg: #472633;
  --status-timeout-text: #ff91a9;
  --status-timeout-border: #a6556e;
  --status-exception-bg: #452530;
  --status-exception-text: #ff91a9;
  --status-exception-border: #a6556e;
  --status-warning-bg: #443920;
  --status-warning-text: #f7cf70;
  --status-warning-border: #8a713a;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .top-nav {
  background: var(--color-canvas);
}

html[data-theme="dark"] .top-nav__links a.top-nav__create,
html[data-theme="dark"] .top-nav__links a.top-nav__create:hover,
html[data-theme="dark"] .top-nav__links a.top-nav__create:focus,
html[data-theme="dark"] .top-nav__links a.top-nav__create.is-active {
  color: var(--color-on-primary) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: var(--color-muted-soft);
}

html[data-theme="dark"] :is(input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="password"], select, textarea) {
  background-color: var(--color-canvas-soft);
  color: var(--color-ink);
  border-color: var(--color-hairline-strong);
}

/* Workbench surfaces with fixed light colors in app.css. */
html[data-theme="dark"] .wb-person-card__form,
html[data-theme="dark"] .wb-supplier-card__inner {
  background: linear-gradient(180deg, #293345, var(--color-surface-card) 58%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .wb-people-tabs,
html[data-theme="dark"] .wb-supplier-item,
html[data-theme="dark"] .order-card__metric {
  background: var(--color-canvas-soft);
  border-color: var(--color-hairline-soft);
}

html[data-theme="dark"] .wb-people-tab:hover,
html[data-theme="dark"] .wb-supplier-item:hover,
html[data-theme="dark"] .wb-sku-agg__item > summary:hover {
  background: #354153;
  color: var(--color-ink);
}

html[data-theme="dark"] .wb-people-tab.is-active,
html[data-theme="dark"] .wb-supplier-item.is-active {
  background: #263d5d;
  color: #a9cbff;
  border-color: #557bb0;
}

html[data-theme="dark"] a.stat-card--link:hover {
  background: #303847;
}

html[data-theme="dark"] a.stat-card--open.is-alert {
  background: #442631;
  animation: none;
}

html[data-theme="dark"] a.stat-card--open.is-alert :is(.stat-card__label, .stat-card__value) {
  color: #ff91a9;
}

html[data-theme="dark"] a.stat-card--link.is-active {
  border-color: #94b8ff;
  background: #2559b8;
  box-shadow: 0 0 0 2px rgba(148, 184, 255, 0.3);
}

html[data-theme="dark"] a.stat-card--open.is-alert.is-active {
  border-color: #ff91a9;
  background: #ac2448;
  box-shadow: 0 0 0 2px rgba(255, 145, 169, 0.3);
}

html[data-theme="dark"] a.stat-card--link.is-active :is(.stat-card__label, .stat-card__value),
html[data-theme="dark"] a.stat-card--open.is-alert.is-active :is(.stat-card__label, .stat-card__value) {
  color: #fff;
}

html[data-theme="dark"] .wb-search-summary,
html[data-theme="dark"] .wb-search__dates-summary,
html[data-theme="dark"] .wb-search__group {
  background: var(--color-canvas-soft);
}

html[data-theme="dark"] .wb-search__dates-fold[open] > .wb-search__dates-summary,
html[data-theme="dark"] .wb-search__dates-summary:hover {
  background: #3b302c;
}

html[data-theme="dark"] .batch-supplier-toolbar {
  background: #1e3045;
  border-color: #456687;
}

html[data-theme="dark"] .order-card__left,
html[data-theme="dark"] .order-card.is-timeout .order-card__left,
html[data-theme="dark"] .order-card--combo-item .order-card__left,
html[data-theme="dark"] .order-card--combo-item.is-timeout .order-card__left {
  background: linear-gradient(180deg, #2c3340, #242a36);
}

html[data-theme="dark"] .order-card__metric--done {
  background: #1d3b33;
  border-color: #36745c;
}

html[data-theme="dark"] .order-card__metric--todo {
  background: #493224;
  border-color: #936343;
}

html[data-theme="dark"] .order-card__metric--todo .order-card__metric-v {
  color: #ffad75;
}

html[data-theme="dark"] .order-card__owner--supplier {
  color: #80ddcf;
}

html[data-theme="dark"] .order-card__owner--follow {
  color: #9dc0ff;
}

html[data-theme="dark"] .order-card__owner--biz {
  color: #ffae80;
}

html[data-theme="dark"] .order-card__progress .progress-bar {
  background: var(--color-surface-strong);
}

html[data-theme="dark"] .order-card > .combo-items,
html[data-theme="dark"] .order-card.order-card--combo-item {
  background: #1d2b3e;
  border-color: #486a98;
}

html[data-theme="dark"] .combo-items__note {
  color: #a9c6ed;
}

html[data-theme="dark"] .wb-alert-panel {
  background: linear-gradient(180deg, #462637, #2a202d);
}

html[data-theme="dark"] .wb-alert-panel__sub,
html[data-theme="dark"] .wb-alert-list {
  background: transparent;
  color: #ffc1cf;
}

html[data-theme="dark"] .wb-alert-item,
html[data-theme="dark"] .wb-alert-item:hover {
  background: #352a36;
  color: var(--color-ink);
}

html[data-theme="dark"] .wb-alert-item__sku,
html[data-theme="dark"] .wb-alert-item__no {
  color: var(--color-ink);
}

html[data-theme="dark"] .wb-alert-item__node,
html[data-theme="dark"] .wb-alert-item__more {
  background: #543044;
  color: #ffc1cf;
}

html[data-theme="dark"] .flash,
html[data-theme="dark"] .flash-ok {
  background: #1d3b33;
  color: #9de8bf;
}

html[data-theme="dark"] .flash-error {
  background: #472633;
  color: #ff9fb3;
}

/* Other pages that share the desktop shell. */
html[data-theme="dark"] .wb-stat,
html[data-theme="dark"] .wb-panel,
html[data-theme="dark"] .wb-card__left,
html[data-theme="dark"] .users-role-tab,
html[data-theme="dark"] .image-thumb.has-image .image-thumb__box,
html[data-theme="dark"] .image-thumb__clear {
  background: var(--color-surface-card);
}

html[data-theme="dark"] .wb-card,
html[data-theme="dark"] .wb-card.is-timeout,
html[data-theme="dark"] .close-confirm-box,
html[data-theme="dark"] .form-field--image .image-thumb__box {
  background: var(--color-canvas-soft);
}

html[data-theme="dark"] .close-confirm-box.is-done {
  background: #1d3b33;
}

html[data-theme="dark"] .timeline__item.is-return-leg {
  background: #272d4b;
}

html[data-theme="dark"] .batch-supplier-toolbar__field :is(select, .user-picker__input) {
  background: var(--color-canvas-soft);
  color: var(--color-ink);
}

@media (max-width: 720px) {
  .top-nav__theme {
    width: 44px;
  }
}
