/* Operator panel redesign, phase 1: one select everywhere, the sidebar workspace switcher and the
 * account menu. Loaded last; reuses the graphite tokens. */

/* ---------- our select ---------- */
/* The native select stays as the value holder: invisible, but still validated (required fields). */
select.inventory-select-native {
  position: absolute !important;
  width: 1px !important;
  min-width: 0 !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}
.inventory-select-trigger {
  gap: 10px;
}
.inventory-select-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.inventory-select-trigger--placeholder .inventory-select-value {
  color: var(--muted);
}
/* Every option text shares one grid cell, so the trigger is as wide as the widest option. */
.inventory-select-face {
  display: grid;
  min-width: 0;
  overflow: hidden;
}
.inventory-select-value,
.inventory-select-sizer > span {
  grid-area: 1 / 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-select-sizer {
  display: contents;
}
.inventory-select-sizer > span {
  height: 0;
  visibility: hidden;
}

/* Compact menu: 28px rows, menu as wide as the trigger, check mark on the selected row. */
.inventory-select-menu[popover] {
  width: max-content;
  padding: 4px;
  border-color: #3f3f3f;
  border-radius: 8px;
  box-shadow: 0 10px 28px #0007;
}
.inventory-select-menu .inventory-select-search {
  height: 28px;
  margin: 0 0 4px;
  padding: 5px 8px;
  border-radius: 5px;
}
.inventory-select-menu .inventory-select-search:focus-visible {
  border-color: #6a6a6a;
  outline: none;
  box-shadow: none;
}
.inventory-select-option {
  overflow: hidden;
  padding: 6px 28px 6px 9px;
  border-radius: 5px;
  font-size: 12.5px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-select-option[aria-selected='true'] {
  background: #2f3633;
}
.inventory-select-option[aria-selected='true']::after {
  right: 9px;
  font-size: 11px;
}
.inventory-select-option:disabled {
  background: transparent;
  color: #777;
  cursor: default;
}
.inventory-select-empty {
  margin: 0;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
}

/* Same sizes the native selects had in each place. */
.dialog .inventory-select-trigger {
  height: auto;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-field);
  color: var(--text);
  font-size: 13px;
}
.marketplace-integration__option .inventory-select {
  width: 240px;
  max-width: 100%;
}
.dialog .marketplace-integration__option .inventory-select-trigger {
  min-height: 36px;
  margin-top: 0;
}

/* Small selects that replaced segmented toggles (period, measure, webhook view, add mode). */
.toolbar-select,
.dialog .toolbar-select,
.dialog .bot-add-modes {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.toolbar-select .inventory-select-trigger,
.dialog .toolbar-select .inventory-select-trigger,
.dialog .bot-add-modes .inventory-select-trigger {
  width: auto;
  height: 30px;
  min-height: 30px;
  margin-top: 0;
  padding: 0 10px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #1f1f1f;
  color: var(--text);
  font-size: 12.5px;
}
.dialog .bot-add-modes .inventory-select-trigger {
  height: 34px;
  min-height: 34px;
  font-size: 13px;
}
.webhook-view {
  align-self: flex-start;
  margin: 6px 0 14px;
}
.price-direction-picker {
  margin-bottom: 4px;
}
.price-direction-detail {
  margin: 0 0 16px;
}

/* ---------- sidebar workspace switcher ---------- */
.workspace-switch {
  display: flex;
  flex-direction: column;
  padding: 16px 10px 0;
}
.workspace-switch .inventory-select-trigger {
  height: 34px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #222;
  color: var(--text);
  font-size: 12.5px;
}
/* A group whose every entry is hidden (Market without selling or prices) drops its heading too. */
.nav-group:not(:has(> button:not([hidden]))) {
  display: none;
}
@media (max-width: 980px) {
  .workspace-switch {
    padding: 8px 10px 0;
  }
}

/* ---------- phase 2: Home action queue, workspace cards, rail counts, list columns ---------- */
/* Rail counts: problems waiting behind a nav entry. */
.workspace-nav button > span:not(.nav-count) {
  flex: 1;
  min-width: 0;
}
.nav-count {
  flex: none;
  padding: 0 7px;
  border: 1px solid #60503a;
  border-radius: 999px;
  background: rgb(221 194 143 / 6%);
  color: #e2c99d;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
}
.badge--info {
  background: #28313c;
  color: #b2cbed;
  border-color: #425570;
}
.badge--hold {
  background: #2e2a3c;
  color: #c9b6f2;
  border-color: #51466e;
}

/* Action queue: dot, text column, one right-aligned action group with Details last. */
.action-queue .table-card__head p {
  margin: 3px 0 0;
  font-size: 11.5px;
}
.action-queue .table-card__head > div:first-child {
  flex: 1 1 360px;
  min-width: 0;
}
.action-queue .table-card__head {
  flex-wrap: wrap;
  padding: 12px 14px;
}
.action-queue > .error-text {
  margin: 0;
  padding: 10px 14px 0;
}
.queue-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  padding: 10px 14px;
  border-top: 1px solid #2c2c2c;
}
.queue-list > .queue-row:first-child {
  border-top: 0;
}
.queue-row__dot {
  align-self: start;
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: #8a8a8a;
}
.queue-row__dot--info {
  background: #b2cbed;
}
.queue-row__dot--warning {
  background: var(--warning);
}
.queue-row__dot--danger {
  background: var(--danger);
}
.queue-row__body {
  min-width: 0;
}
.queue-row__title {
  display: block;
  font-size: 13px;
  font-weight: 550;
}
.queue-row__detail {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
/* Bot banned: what is still inside CS2 Trade Protection, per group. */
.ban-exposure {
  margin: 8px 0 2px;
  font-size: 12px;
}
.ban-exposure__summary,
.ban-exposure__note {
  margin: 0 0 6px;
  color: var(--text);
}
.ban-exposure__note {
  margin: 6px 0 0;
  color: var(--muted);
}
.ban-exposure__groups {
  display: grid;
  max-width: 560px;
  border: 1px solid #2c2c2c;
  border-radius: 6px;
}
.ban-exposure__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 52px 92px;
  gap: 8px;
  align-items: baseline;
  padding: 5px 10px;
  border-top: 1px solid #2c2c2c;
  font-variant-numeric: tabular-nums;
}
.ban-exposure__row > span:not(:first-child) {
  text-align: right;
}
.ban-exposure__notes {
  grid-column: 1 / -1;
  margin-top: -3px;
  color: var(--muted);
  font-size: 11px;
}
.ban-exposure__row--head {
  border-top: 0;
  color: #8f8f8f;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ban-exposure__procedure {
  margin-top: 6px;
  color: var(--muted);
}
.ban-exposure__procedure summary {
  padding: 5px 0;
  cursor: pointer;
  color: var(--text);
}
.ban-exposure__procedure ul {
  margin: 4px 0 0;
  padding-left: 18px;
}
.queue-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 4px 0 0;
  color: #8f8f8f;
  font-size: 11.5px;
}
.queue-row__meta .queue-row__kind {
  padding: 0 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 16px;
  text-transform: uppercase;
}
.queue-row__workspace {
  color: var(--text);
}
.queue-row__actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
.queue-row__actions .button {
  white-space: nowrap;
}
.queue-row__actions .queue-row__details {
  min-width: 72px;
}
.queue-empty {
  margin: 0;
  padding: 28px 16px;
  font-size: 13px;
  text-align: center;
}
.queue-more {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.queue-more[hidden] {
  display: none;
}
@media (max-width: 600px) {
  .ban-exposure__row {
    grid-template-columns: minmax(0, 1fr) 46px 40px 76px;
    gap: 6px;
    padding: 5px 8px;
  }
}
@media (max-width: 1100px) {
  .queue-row {
    grid-template-columns: 8px minmax(0, 1fr);
  }
  .queue-row__actions {
    grid-column: 2;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* Workspace cards (All workspaces): one per workspace, a click switches to it. */
.workspace-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.workspace-cards[hidden] {
  display: none;
}
.workspace-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.workspace-card:hover {
  border-color: #4a4a4a;
}
.workspace-card:focus-visible {
  outline: 2px solid #8a8a8a;
  outline-offset: 2px;
}
.workspace-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.workspace-card__top strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-card__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.workspace-card__dot--success {
  background: var(--success);
}
.workspace-card__dot--warning {
  background: var(--warning);
}
.workspace-card__numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.workspace-card__numbers small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.workspace-card__numbers b {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.workspace-card__alert {
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid #60503a;
  border-radius: 6px;
  background: rgb(221 194 143 / 6%);
  color: #e2c99d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bots list: Workspace column in All workspaces, sync freshness dots, mode badges. */
.bots-workspace-column {
  display: none;
}
.all-workspaces .bots-workspace-column {
  display: table-cell;
}
.sync-cell__label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.sync-cell__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a8a8a;
}
.sync-cell--success .sync-cell__dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgb(161 210 178 / 15%);
}
.sync-cell--warning .sync-cell__dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgb(221 194 143 / 18%);
}
.sync-cell--danger .sync-cell__dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgb(237 170 170 / 18%);
}
.sync-cell--info .sync-cell__dot {
  background: #b2cbed;
}
.bots-view .sync-cell--warning {
  color: var(--warning);
}
.bots-view .sync-cell--danger {
  color: var(--danger);
}
.bot-mode-cell {
  white-space: nowrap;
}
.bot-mode-cell .badge + .badge {
  margin-left: 4px;
}

/* Activities: Workspace column in All workspaces. */
.activities-columns__workspace,
.runtime-activity__workspace {
  display: none;
}
.runtime-activity__workspace {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activities-panel .table-card__head {
  flex-wrap: wrap;
}
.all-workspaces .activities-columns__workspace,
.all-workspaces .runtime-activity__workspace {
  display: block;
}
.all-workspaces .activities-columns,
.all-workspaces .runtime-activity__summary {
  grid-template-columns:
    116px minmax(180px, 1.5fr) minmax(120px, 1fr) minmax(110px, 0.8fr)
    70px 110px 56px;
}
@media (max-width: 1100px) {
  .all-workspaces .activities-columns,
  .all-workspaces .runtime-activity__summary {
    grid-template-columns:
      104px minmax(140px, 1.4fr) minmax(100px, 1fr) minmax(90px, 0.8fr)
      95px 48px;
  }
  /* The base rule hides the fourth column (Duration); with Workspace it is the fifth. */
  .all-workspaces .activities-columns > :nth-child(4) {
    display: block;
  }
  .all-workspaces .activities-columns > :nth-child(5) {
    display: none;
  }
}
@media (max-width: 700px) {
  .all-workspaces .activities-columns__workspace,
  .all-workspaces .runtime-activity__workspace {
    display: none;
  }
  .all-workspaces .runtime-activity__summary {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }
}

/* ---------- phase 3: offer composer, Add bot workspace, Inventory selection and proposals ---------- */
/* Offer composer: the sending bot first, then the send-limit line above the offer settings. */
#trade-dialog .trade-bot-field .inventory-select-trigger {
  width: 100%;
}
.trade-send-summary {
  margin: 10px 0 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1c1c1c;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* Add bot: workspace and mode side by side; the limit warning sits right under them. */
.bot-add-target {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 20px;
}
.dialog .bot-add-target .bot-add-modes {
  margin-bottom: 0;
}
.dialog .bot-add-limit {
  margin: -8px 0 18px;
  color: var(--danger);
  font-size: 12.5px;
}

/* Inventory: price proposals card above the table. */
.proposals-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.proposals-card__text {
  display: flex;
  flex: 1 1 320px;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.proposals-card__text strong {
  font-size: 13.5px;
  font-weight: 600;
}
.proposals-card__text > span {
  color: var(--muted);
  font-size: 12px;
}
.proposals-card__actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.proposals-card__actions .button {
  min-width: 84px;
}

/* Inventory: a select column before the sticky item column. */
#fleet-inventory-table th.check-column,
#fleet-inventory-table td.fleet-check {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-right: 0;
  box-shadow: none;
}
#fleet-inventory-table th:nth-child(2),
#fleet-inventory-table td:nth-child(2) {
  position: sticky;
  left: 36px;
  z-index: 1;
  background: #202020;
  box-shadow: 1px 0 0 var(--line);
}
#fleet-inventory-table tbody tr:hover td:nth-child(2) {
  background: #262626;
}
.fleet-selection-bar {
  margin: 12px 0 0;
}
.fleet-selection-bar .selection-bar__count {
  flex: 1 1 260px;
  color: #d8d8d8;
}

/* Rail menu spans the full rail width so its right edge lines up with the workspace switcher. */
.nav-rail > .workspace-nav {
  margin-right: 0;
}

/* ---------- Operator actions: webhook delivery stats in Workspace settings → Webhooks ---------- */
.sx-stats.webhook-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}
.webhook-stats .sx-stat {
  padding: 12px 16px;
}

/* ---------- WP4 shell: workspace colours, breadcrumb scope, swarm pill, rail ---------- */
/* Workspace colour dots: one slot per workspace, derived from its ID (workspace-context.js). */
.ws-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8a8a8a;
}
.ws-dot--0 {
  background: #b2cbed;
}
.ws-dot--1 {
  background: #ddc28f;
}
.ws-dot--2 {
  background: #a1d2b2;
}
.ws-dot--3 {
  background: #c8bde7;
}
.ws-dot--4 {
  background: #e7a99e;
}
.ws-dot--5 {
  background: #93cfd3;
}
.ws-dot--6 {
  background: #e2b3d3;
}
.ws-dot--7 {
  background: #c9d58f;
}
.ws-dot--none {
  background: #5f5f5f;
}
.ws-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Sidebar switcher: the scope's dot sits inside the select. */
.workspace-switch__box {
  position: relative;
  display: block;
}
.workspace-switch__box > .ws-dot {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  pointer-events: none;
}
.workspace-switch__box .inventory-select-trigger {
  width: 100%;
  padding-left: 26px;
}

/* Breadcrumb: Scope › Group › Page. */
#crumb-scope:empty {
  display: none;
}
#crumb-scope:empty + li::before {
  content: none;
}
@media (max-width: 760px) {
  .breadcrumb {
    display: none;
  }
}

/* Rail as wide as the mock's, so the switcher and its meta line fit on one line. */
@media (min-width: 981px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }
}

/* ---------- WP4 pages: Bots and Inventory use the mock's page head and stat tiles ---------- */
#bots-view > .page-header,
#fleet-inventory-view > .page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 14px;
}
#bots-view > .page-header > div:first-child,
#fleet-inventory-view > .page-header > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}
#bots-view > .page-header h1,
#fleet-inventory-view > .page-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
#bots-view > .page-header > div:first-child > .muted,
#fleet-inventory-view > .page-header > div:first-child > .muted {
  display: block;
  margin: 3px 0 0;
  font-size: 12.5px;
}
#bots-view > .page-header .page-actions,
#fleet-inventory-view > .page-header .page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#bots-view > .page-header .page-actions .button,
#fleet-inventory-view > .page-header .page-actions .button {
  margin: 0;
}
#bots-view > .stat-grid,
#fleet-inventory-view .stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
#fleet-inventory-view .stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
#bots-view > .stat-grid .stat-card,
#fleet-inventory-view .stat-grid .stat-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: none;
  padding: 14px 16px;
  border-radius: 12px;
}
#bots-view > .stat-grid .stat-card__label,
#fleet-inventory-view .stat-grid .stat-card__label {
  color: #bdbdbd;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
#bots-view > .stat-grid .stat-card__value,
#fleet-inventory-view .stat-grid .stat-card__value {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
#bots-view > .stat-grid .stat-card__detail,
#fleet-inventory-view .stat-grid .stat-card__detail {
  margin: 4px 0 0;
  color: #9c9c9c;
  font-size: 12px;
}
@media (max-width: 1100px) {
  #fleet-inventory-view .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  #bots-view > .stat-grid,
  #fleet-inventory-view .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  #bots-view > .stat-grid,
  #fleet-inventory-view .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Bots: search and Status sit at the top of the table card. */
.bots-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.bots-filters .search {
  flex: 1 1 200px;
  max-width: 320px;
  margin: 0;
}
#bots-view .bots-filters input,
#bots-view .bots-filters .inventory-select-trigger {
  height: 30px;
  min-height: 30px;
  font-size: 12px;
}
.bots-filters .toolbar-select > span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home-offers .table-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Inventory: filters with labels at the top of the table card, then the Items head. */
#fleet-inventory-view .inventory-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
#fleet-inventory-view .inventory-filters > label {
  display: flex;
  flex: 1 1 150px;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  max-width: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
#fleet-inventory-view .inventory-filters > label.inventory-filters__search {
  flex: 2 1 260px;
}
#fleet-inventory-view .inventory-filters input,
#fleet-inventory-view .inventory-filters .inventory-select-trigger {
  height: 30px;
  min-height: 30px;
  font-size: 12px;
}
#fleet-inventory-view .inventory-items-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
#fleet-inventory-view .inventory-items-head > div:first-child {
  flex: 1 1 360px;
  min-width: 0;
}
#fleet-inventory-view .inventory-items-head strong {
  font-size: 13px;
  font-weight: 600;
}
#fleet-inventory-view .inventory-items-head .count {
  margin-left: 6px;
}
#fleet-inventory-view .inventory-items-head small,
#fleet-inventory-freshness {
  display: block;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.inventory-items-head__actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
#fleet-table-search {
  width: 220px;
  max-width: 100%;
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #1f1f1f;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.inventory-items-head__actions .price-toolbar {
  margin: 0;
}

/* Selection: an info line above the table, like the mock. */
#fleet-inventory-view .fleet-selection-bar {
  position: static;
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid #48607f;
  border-radius: 8px;
  background: rgb(178 203 237 / 6%);
  box-shadow: none;
  backdrop-filter: none;
  color: #b2cbed;
  font-size: 12.5px;
}
#fleet-inventory-view .fleet-selection-bar .selection-bar__count {
  flex: 1 1 260px;
  color: inherit;
}
@media (max-width: 760px) {
  #fleet-table-search {
    width: 100%;
  }
  .inventory-items-head__actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
}
/* Phone and tablet: workspace switcher and section row first, then the top bar (as in the mock). */
@media (max-width: 980px) {
  .app-shell {
    grid-template:
      'rail' auto
      'top' auto
      'main' minmax(0, 1fr)
      / minmax(0, 1fr);
  }
}

/* ---------- WP4 composer: mock width, URL with its Load button, collapsed settings, totals ---------- */
#trade-dialog {
  width: min(860px, calc(100vw - 32px));
}
#trade-dialog .partner-inventory.span-2 {
  grid-column: span 1;
  min-width: 0;
}
#trade-dialog .partner-inventory table {
  min-width: 0;
}
@media (max-width: 760px) {
  #trade-dialog .partner-inventory.span-2 {
    grid-column: 1 / -1;
  }
}
.trade-url-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trade-url-row {
  display: flex;
  gap: 8px;
}
.trade-url-row input {
  flex: 1;
  min-width: 0;
}
.trade-url-row .button {
  flex: none;
}
#trade-partner {
  margin: 0;
}
@media (max-width: 560px) {
  .trade-url-row {
    flex-wrap: wrap;
  }
}
.trade-settings {
  margin-top: 14px;
}
.trade-settings > summary {
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.trade-settings > .form-grid {
  margin-top: 12px;
}
.trade-summary {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.trade-summary p {
  margin: 0;
}
.trade-summary .trade-send-summary {
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}
/* Composer pick lists: the name, one line with wear, type and asset ID, then float and seed. */
#trade-dialog .partner-inventory thead {
  display: none;
}
#trade-bot-items-body .item-float,
#trade-bot-items-body .item-inspect-trigger,
#partner-items-body .item-float,
#partner-items-body .item-inspect-trigger,
#trade-dialog .partner-inventory [data-price-direction='sell'],
#trade-dialog .partner-inventory .price-confidence,
#trade-dialog .partner-inventory .price-risk-score,
#trade-dialog .partner-inventory .price-direction-label,
#trade-bot-items-body td:nth-child(5) {
  display: none;
}
#trade-dialog .partner-inventory td {
  padding-top: 7px;
  padding-bottom: 7px;
  vertical-align: middle;
}
#trade-dialog .partner-inventory .item-name {
  font-size: 12.5px;
}
#trade-bot-items-body .item-inspect-summary,
#partner-items-body .item-inspect-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#trade-dialog .partner-inventory > label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
}
#trade-dialog .partner-inventory > label .inventory-select {
  flex: 1;
}
#trade-dialog .partner-inventory > label .inventory-select-trigger {
  height: 30px;
  min-height: 30px;
  margin: 0;
  font-size: 12px;
}
#trade-dialog .partner-inventory__head {
  padding: 8px 12px;
  font-size: 12.5px;
}
#trade-dialog .partner-inventory table {
  width: 100%;
}
#trade-dialog .partner-inventory td.item-pricing,
#trade-bot-items-body td:nth-child(4) {
  width: 1%;
  white-space: nowrap;
}
#trade-dialog .partner-inventory .price-directions {
  display: block;
  min-width: 0;
}
#trade-bot-items-body td:nth-child(4) .subline {
  display: none;
}
#trade-dialog .partner-inventory td:first-child {
  width: 28px;
  padding-right: 0;
}
#trade-dialog .partner-inventory .item-identity,
#trade-dialog .partner-inventory .item-copy {
  min-width: 0;
  max-width: none;
}
#trade-dialog .partner-inventory .item-name {
  white-space: normal;
}
#trade-dialog .partner-inventory .price-trigger {
  min-width: 0;
  padding: 0;
}

/* ---------- WP4 price import: workspace first, then the file, then the sample download ---------- */
.price-import__scope {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}
.price-import__scope label {
  display: grid;
  gap: 6px;
}
.price-import__scope .field-note {
  margin: 0;
}
.price-import__notice {
  margin: 6px 0 0;
  padding: 9px 12px;
  border: 1px solid #60503a;
  border-radius: 8px;
  background: rgb(221 194 143 / 6%);
  color: var(--warning);
  font-size: 12.5px;
}
.price-import__file input[type='file']:disabled {
  opacity: 0.45;
}
.price-import__file .price-import__sample {
  justify-self: start;
  margin-top: 10px;
  padding: 0;
  font-size: 12px;
  text-align: left;
  text-decoration: underline;
}
#trade-bot-items-body,
#partner-items-body {
  font-size: 12.5px;
}
#trade-dialog .partner-inventory table {
  table-layout: fixed;
}
#trade-dialog .partner-inventory td.item-pricing {
  width: 104px;
  padding-left: 8px;
  text-align: right;
}
#trade-bot-items-body td:nth-child(4) {
  width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#trade-dialog .partner-inventory .item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .trade-url-row input {
    flex-basis: 100%;
  }
  #trade-dialog .partner-inventory .item-name {
    white-space: normal;
  }
  #trade-bot-items-body td:nth-child(4) {
    width: 96px;
  }
}
#home-offers-all {
  flex: none;
  white-space: nowrap;
}

/* Workspace switch: the page stays in place, faded, with a thin progress line, until the new
   workspace has loaded. */
.workspace > :not(dialog) {
  transition: opacity 120ms ease;
}
.workspace[aria-busy='true'] {
  cursor: progress;
}
.workspace[aria-busy='true'] > :not(dialog.side-panel),
body:has(.workspace[aria-busy='true']) .nav-count {
  opacity: 0.4;
}
.workspace[aria-busy='true']::before {
  content: '';
  position: sticky;
  top: 0;
  z-index: 3;
  display: block;
  height: 2px;
  margin-bottom: -2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 40% 100%
    no-repeat;
  animation: workspace-switch-progress 900ms ease-in-out infinite;
}
@keyframes workspace-switch-progress {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .workspace > :not(dialog) {
    transition: none;
  }
  .workspace[aria-busy='true']::before {
    animation: none;
    background-size: 100% 100%;
  }
}

/* ---------- FX1 sign-in: the mock's 400px card, brand eyebrow, actions on the right ---------- */
body:not(.authenticated) #auth-dialog {
  width: min(400px, calc(100vw - 32px));
  margin-top: 32px;
  border: 1px solid #373737;
  border-radius: 12px;
  background: #202020;
}
body:not(.authenticated) #auth-dialog::backdrop {
  background: #181818;
}
body:not(.authenticated) #auth-dialog .dialog__head {
  padding: 18px 22px 0;
}
body:not(.authenticated) #auth-dialog .dialog__body {
  padding: 4px 22px 18px;
}
body:not(.authenticated) #auth-dialog .auth-brand {
  display: block;
  margin: 0 0 4px;
  color: #a4a4a4;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
body:not(.authenticated) #auth-dialog h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
body:not(.authenticated) #account-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
body:not(.authenticated) #admin-login,
body:not(.authenticated) #login-credentials {
  gap: 14px;
}
body:not(.authenticated) #admin-login {
  padding-top: 14px;
}
body:not(.authenticated) #admin-login label {
  gap: 6px;
  color: #d0d0d0;
  font-size: 12px;
  font-weight: 550;
}
body:not(.authenticated) #admin-login input {
  min-height: 34px;
  padding: 0 12px;
  border-color: #444;
  background: #1a1a1a;
  font-size: 13px;
}
body:not(.authenticated) #auth-dialog[data-login-step='totp'] #login-totp input {
  font-size: 13px;
  letter-spacing: normal;
}
body:not(.authenticated) #admin-login label small {
  font-size: 11.5px;
}
body:not(.authenticated) #admin-login .account-login-actions,
#auth-dialog[data-login-step='credentials'] #admin-login .account-login-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}
body:not(.authenticated) #admin-login .account-login-actions .button,
#auth-dialog[data-login-step='credentials'] #admin-login .account-login-actions .button {
  flex: none;
  min-height: 34px;
  padding: 0 14px;
  font-size: 12px;
}

/* ---------- FX1 account menu: avatar and name, then a compact menu like the mock ---------- */
.workspace-menu > .workspace-access {
  min-height: 34px;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  border: 1px solid #3b3b3b;
  border-radius: 9px;
  background: transparent;
  font-size: 12px;
}
.workspace-menu .workspace-access__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3b3b3b;
  color: #e5e5e5;
  font-size: 11px;
  font-weight: 500;
}
.workspace-menu > .workspace-access .workspace-access__copy {
  display: block;
  min-width: 0;
}
.workspace-menu .workspace-access__copy strong {
  display: block;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}
.workspace-menu__panel {
  top: calc(100% + 6px);
  width: 260px;
  padding: 6px;
  border-color: #3d3d3d;
  border-radius: 10px;
  background: #202020;
  box-shadow: 0 20px 70px rgb(0 0 0 / 35%);
}
.workspace-menu__identity {
  gap: 2px;
  padding: 6px 8px 8px;
}
.workspace-menu__identity strong {
  font-size: 12px;
}
.workspace-menu__identity span {
  color: #8a8a8a;
  font-size: 12px;
}
.workspace-menu__actions {
  padding-top: 0;
}
.workspace-menu__actions button {
  min-height: 36px;
  padding: 6px 4px;
  border-bottom: 1px solid #2c2c2c;
  border-radius: 0;
  font-size: 12.5px;
}
.workspace-menu__actions #menu-sign-out {
  color: var(--text);
}
@media (max-width: 680px) {
  .workspace-menu > .workspace-access {
    max-width: 160px;
  }
  .workspace-menu__panel {
    top: 110px;
  }
}

/* ---------- FX1 Home recent offers: the seven columns fit the card at 1440 like the mock ---------- */
#home-offers-table .bot-identity__login,
#home-offers-table .offer-countdown {
  display: none;
}
#home-offers-table td.offer-status {
  min-width: 0;
}
#home-offers-table .trade-bot__offer {
  margin-left: 8px;
}
#home-offers-table .trade-origin__actor {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* ---------- FX1 Home: the mock's card sizes, 2 x 2 availability tiles, one row of inventory cards ---------- */
.home-view.dense-view .kpi-row {
  gap: 12px;
}
.home-view.dense-view .kpi-card {
  padding-top: 16px;
  border-radius: 12px;
}
.home-view.dense-view .kpi-card__label {
  padding: 0 16px;
  font-size: 11px;
}
.home-view.dense-view .kpi-card__value {
  margin: 10px 0 0;
  padding: 0 16px;
  font-size: 21px;
}
.home-view.dense-view .kpi-card__detail {
  margin: 4px 0 0;
  padding: 0 16px;
  font-size: 12px;
}
.home-view.dense-view .kpi-card__spark {
  height: 44px;
  margin-top: 10px;
}
.home-view.dense-view .home-charts,
.home-view.dense-view .home-row {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
}
.home-view.dense-view .chart-card,
.home-view.dense-view .home-card {
  padding: 18px 20px;
  border-radius: 12px;
}
.home-view.dense-view .chart-card__head,
.home-view.dense-view .home-card > header {
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.home-view.dense-view .chart-card__head p {
  margin: 4px 0 0;
  font-size: 12.5px;
}
.home-view.dense-view .chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 6px;
  font-size: 12px;
}
.home-view.dense-view .stat-grid {
  gap: 12px;
  margin: 0 0 14px;
}
.home-view.dense-view #home-availability-now {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.home-view.dense-view #home-availability-now .stat-card,
.home-view.dense-view #home-value-cards .value-card {
  padding: 14px 16px;
  border-radius: 12px;
}
.home-view.dense-view #home-availability-now .stat-card__label,
.home-view.dense-view #home-value-cards .value-card__label {
  color: #bdbdbd;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.home-view.dense-view #home-availability-now .stat-card__value,
.home-view.dense-view #home-value-cards .value-card__value {
  margin: 6px 0 0;
  font-size: 22px;
}
.home-view.dense-view #home-availability-now .stat-card__detail,
.home-view.dense-view #home-value-cards .value-card__detail {
  display: block;
  max-width: 100%;
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-view.dense-view .home-inventory__body {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.home-view.dense-view #home-value-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 14px;
}
.home-view.dense-view .chart-card .unlock-schedule {
  padding: 16px 18px;
  border: 1px solid #383838;
  border-radius: 12px;
  background: #202020;
}
.home-view.dense-view .unlock-schedule header {
  gap: 4px 12px;
  margin-bottom: 12px;
}
.home-view.dense-view #unlock-summary {
  font-size: 12px;
}
.home-view.dense-view .unlock-note {
  margin: 10px 0 0;
  font-size: 12px;
}
/* Holdings and activity: the mock's list rows, a type tile for items without a picture. */
.home-view.dense-view .home-list__row {
  gap: 12px;
  padding: 8px 6px;
  border-radius: 8px;
}
.home-view.dense-view .home-list__copy strong,
.home-view.dense-view .home-list__value {
  font-size: 13px;
}
.home-view.dense-view .home-list__copy small {
  font-size: 11.5px;
}
.home-view.dense-view .home-thumb {
  display: grid;
  place-items: center;
  width: 40px;
  height: 30px;
  border: 1px solid #444;
  border-radius: 6px;
  background: radial-gradient(circle at 50% 38%, #4a4a4a, #2a2a2a 72%);
  color: #bdbdbd;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.home-view.dense-view .home-thumb img {
  width: 36px;
  height: 26px;
  object-fit: contain;
}
.home-view.dense-view .home-list__time {
  color: #8a8a8a;
  font-size: 12px;
  white-space: nowrap;
}
@media (max-width: 1180px) {
  .home-view.dense-view .home-charts,
  .home-view.dense-view .home-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .home-view.dense-view .kpi-row,
  .home-view.dense-view #home-value-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-view.dense-view .chart-card,
  .home-view.dense-view .home-card {
    padding: 14px 16px;
  }
}
/* Home select labels in small capitals, as the mock's Period, Show and Measure. */
#home-view .toolbar-select > span:not(.inventory-select) {
  color: #a8a8a8;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* The page-header rule that moves stat grids last on tablets must not reorder Home cards. */
.home-view.dense-view .stat-grid {
  order: 0;
}
.home-view.dense-view .home-row {
  align-items: stretch;
}
#home-offers-all {
  min-height: 28px;
  padding: 0 10px;
}
@media (max-width: 680px) {
  .topbar #refresh-all {
    display: inline-flex;
  }
  .topbar .workspace-menu > .workspace-access .workspace-access__copy {
    display: none;
  }
  .topbar .workspace-menu > .workspace-access {
    padding-inline: 5px;
  }
}

/* Loading skeletons: until a view's first data arrives (app.js sets [data-loading] on the view) and
   while a panel's content is empty, data containers show a shimmering placeholder instead of nothing. */
@keyframes skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
:is([data-loading])
  :is(
    #queue-list,
    #home-kpis,
    #home-activity-chart,
    #home-availability-now,
    #home-availability-chart,
    #home-value-cards,
    #unlock-days,
    #home-top-items,
    #home-activity,
    #fleet-inventory-summary,
    #activities-list,
    #catalog-sync,
    #sales-connections,
    #send-approvals-list
  ):empty,
#bot-health-cells:empty,
#bot-summary-cards:empty,
#bot-diagnostics:empty,
#offer-detail-content:empty,
#item-panel-content:empty,
#settings-changes:empty {
  display: block;
  min-height: 96px;
  border-radius: 10px;
  background: linear-gradient(90deg, #222 30%, #2b2b2b 50%, #222 70%) 0 0 / 300% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}
:is([data-loading]) :is(#home-activity-chart, #home-availability-chart):empty {
  min-height: 210px;
}
/* Table bodies: a full-width placeholder under the table header while the first page loads (on the
   table's wrapper, since a pseudo-element inside a tbody would be a single narrow cell). */
:is([data-loading])
  :has(
    > table
      > :is(
        #home-offers-body,
        #fleet-inventory-items,
        #catalog-items,
        #sales-items,
        #bots-body,
        #trades-body
      ):empty
  )::after,
:has(> table > :is(#items-body, #offers-body):empty)::after {
  content: '';
  display: block;
  height: 132px;
  margin: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, #222 30%, #2b2b2b 50%, #222 70%) 0 0 / 300% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  [data-loading] *,
  #bot-health-cells,
  #offer-detail-content,
  #item-panel-content {
    animation: none !important;
  }
}

/* Home charts: the Daily activity chart fills its card when Bot availability makes the row taller. */
.home-charts .chart-card {
  display: flex;
  flex-direction: column;
}
.home-charts #home-activity-chart {
  flex: 1 1 auto;
  min-height: 210px;
}
