.orders-table-wrap {
  overflow-x: visible;
}

.filter-group {
  min-width: 0;
}

.orders-heading {
  gap: 22px;
}

.sync-control {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px #e1f4ed;
}

.sync-dot.active {
  background: var(--brand);
  box-shadow: 0 0 0 3px #e6edff;
  animation: sync-pulse 1.4s ease-in-out infinite;
}

.sync-button {
  min-height: 40px;
}

.sync-button:disabled {
  background: #9aa9c9;
  cursor: wait;
}

.flash.success {
  background: #e1f4ed;
  color: var(--good);
}

.flash.info {
  background: #e6edff;
  color: var(--brand);
}

@keyframes sync-pulse {
  50% { opacity: .35; }
}

.filter-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.multi-filter {
  position: relative;
}

.multi-filter summary {
  min-height: 42px;
  padding: 10px 34px 10px 11px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  position: relative;
}

.multi-filter summary::-webkit-details-marker {
  display: none;
}

.multi-filter summary::after {
  content: "⌄";
  position: absolute;
  right: 12px;
  top: 8px;
  color: var(--muted);
  font-size: 18px;
}

.multi-filter[open] summary::after {
  content: "⌃";
}

.filter-checklist {
  position: absolute;
  z-index: 5;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid #cbd3dc;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 28px #17212b24;
}

.filter-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 9px !important;
  padding: 8px;
  border-radius: 6px;
  color: var(--ink) !important;
  cursor: pointer;
}

.filter-option:hover {
  background: var(--bg);
}

.filter-option input {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

.chart-card {
  padding-bottom: 10px;
}

.chart-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  margin-bottom: 18px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-item i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--brand);
}

.legend-item.pickup_refusal i {
  border: 1px solid #8da0d9;
  background: repeating-linear-gradient(45deg,#dfe7ff 0,#dfe7ff 3px,#6f86cf 3px,#6f86cf 5px);
}

.account-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: 700 10px/1.2 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  cursor: pointer;
}

.account-chip.active {
  border-color: #9fb0e8;
  background: #eef2ff;
  color: var(--ink);
}

.account-chip .market {
  padding: 1px 4px;
  font-size: 8px;
}

.chart-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(150px, .65fr) minmax(190px, 1fr) minmax(330px, 1.55fr) minmax(120px, .42fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.range-filter {
  position: relative;
  min-width: 0;
}

.range-trigger {
  display: flex;
  width: 100%;
  height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.range-popover {
  position: absolute;
  z-index: 8;
  top: calc(100% + 5px);
  left: 0;
  width: 292px;
  padding: 12px;
  border: 1px solid #cbd3dc;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 34px #17212b2b;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.calendar-head button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  gap: 3px;
}

.calendar-weekdays span {
  padding: 3px 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.calendar-grid button,
.calendar-grid > span {
  min-height: 32px;
}

.calendar-grid button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.calendar-grid button:hover {
  background: var(--bg);
}

.calendar-grid button.in-range {
  border-radius: 0;
  background: #e8edff;
}

.calendar-grid button.range-start,
.calendar-grid button.range-end {
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.calendar-help {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.chart-filters > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-filters input[type="month"],
.chart-filters .multi-filter summary {
  height: 48px;
}

.metric-control {
  min-width: 0;
}

.metric-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  height: 48px;
}

.metric-switch label {
  min-width: 0;
  cursor: pointer;
}

.metric-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.metric-switch span {
  display: grid;
  height: 48px;
  place-items: center;
  padding: 6px 9px;
  border: 1px solid #cbd3dc;
  border-right: 0;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.metric-switch label:first-of-type span {
  border-radius: 8px 0 0 8px;
}

.metric-switch label:last-of-type span {
  border-right: 1px solid #cbd3dc;
  border-radius: 0 8px 8px 0;
}

.metric-switch input:checked + span {
  border-color: var(--brand);
  background: #e6edff;
  color: var(--brand);
}

.metric-switch .disabled {
  cursor: not-allowed;
}

.metric-switch .disabled span {
  background: #f1f3f5;
  color: #9aa3ad;
}

.chart-submit {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 14px;
}

.chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.orders-chart {
  display: block;
  width: 100%;
  min-width: 560px;
  height: auto;
}

.chart-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis-label,
.chart-day,
.chart-value {
  fill: var(--muted);
  font: 8px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.chart-value {
  fill: var(--ink);
  font-weight: 750;
}

.chart-bar {
  fill: var(--brand);
}

.chart-bar.pickup_refusal {
  fill: url(#pickup-refusal-pattern);
  stroke: #6f86cf;
  stroke-width: .7;
}

.chart-notice {
  margin-bottom: 10px;
  font-size: 12px;
}

.section-heading {
  margin: 28px 0 14px;
}

.orders-table {
  width: 100%;
  table-layout: fixed;
  white-space: normal;
}

.orders-table .order-date { width: 8%; }
.orders-table .order-source { width: 9%; }
.orders-table .order-number { width: 11%; }
.orders-table .order-seller-article { width: 10%; }
.orders-table .order-product { width: 31%; }
.orders-table .order-quantity { width: 3%; }
.orders-table .order-status { width: 10%; }
.orders-table .order-cancellation { width: 18%; }

.orders-table th,
.orders-table td {
  padding: 7px 5px;
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.orders-table th {
  font-size: 9px;
  letter-spacing: .02em;
}

.orders-table td:nth-child(6) {
  max-width: none;
}

.orders-table th:nth-child(6),
.orders-table td:nth-child(6) {
  padding-left: 1px;
  padding-right: 1px;
  text-align: center;
}

.orders-table td:first-child {
  font-size: 9px;
  overflow-wrap: normal;
  word-break: normal;
}

.orders-table .market,
.orders-table .status {
  padding: 2px 5px;
  font-size: 9px;
  white-space: nowrap;
}

.cell-secondary,
.cancellation-cell span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.25;
}

.cancellation-cell span:first-child {
  margin-top: 0;
  color: var(--ink);
  font-size: 10px;
}

.cancellation-cell span:last-child {
  color: var(--ink);
  font-size: 10px;
}

.order-product-cell {
  font-size: 12px !important;
  line-height: 1.35 !important;
}

.order-number-cell {
  font-size: 10px !important;
}

.order-seller-article-cell {
  font-size: 10px !important;
  line-height: 1.25 !important;
}

.order-seller-article-cell span {
  display: block;
}

.order-seller-article-cell span + span {
  margin-top: 3px;
}

@media (max-width: 900px) {
  .chart-heading {
    display: block;
  }

  .account-chips {
    justify-content: flex-start;
    margin-top: 10px;
  }

  .chart-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-filters .metric-control {
    grid-column: span 2;
  }

  .orders-table th,
  .orders-table td {
    padding: 6px 3px;
    font-size: 10px;
  }

  .orders-table .order-date { width: 8%; }
  .orders-table .order-source { width: 9%; }
  .orders-table .order-number { width: 11%; }
  .orders-table .order-seller-article { width: 10%; }
  .orders-table .order-product { width: 31%; }
  .orders-table .order-quantity { width: 3%; }
  .orders-table .order-status { width: 10%; }
  .orders-table .order-cancellation { width: 18%; }

  .order-product-cell {
    font-size: 11px !important;
  }

  .cell-secondary,
  .cancellation-cell span {
    font-size: 8px;
  }

  .cancellation-cell span:first-child,
  .cancellation-cell span:last-child {
    font-size: 9px;
  }
}

@media (max-width: 520px) {
  .orders-heading,
  .sync-control {
    align-items: flex-start;
  }

  .orders-heading {
    flex-direction: column;
  }

  .sync-control {
    width: 100%;
    flex-direction: column;
  }

  .sync-control form,
  .sync-button {
    width: 100%;
  }

  .chart-filters {
    grid-template-columns: 1fr;
  }

  .chart-filters .metric-control {
    grid-column: auto;
  }

  .metric-switch span {
    padding: 7px 5px;
    font-size: 10px;
  }
}
