.commerce-intake {
  display: flex;
  flex-direction: column;
  gap: var(--greyne-spacing-xl);
}

.intake-header {
  display: flex;
  flex-direction: column;
  gap: var(--greyne-spacing-xs);
}

.intake-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.6rem);
}

.intake-header p {
  margin: 0;
  color: rgba(32, 39, 51, 0.65);
  font-size: 1rem;
}

.duplicate-card {
  display: flex;
  flex-direction: column;
  gap: var(--greyne-spacing-md);
}

.duplicate-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--greyne-spacing-md);
}

.duplicate-summary-card {
  border-radius: var(--greyne-border-radius-lg);
  padding: var(--greyne-spacing-md);
  background: rgba(241, 91, 103, 0.08);
  border: 1px solid rgba(241, 91, 103, 0.25);
}

.duplicate-summary-card h4 {
  margin: 0 0 var(--greyne-spacing-xs);
  font-size: 1rem;
  color: var(--greyne-danger);
}

.duplicate-summary-card p {
  margin: 0;
  color: rgba(32, 39, 51, 0.7);
  font-size: 0.95rem;
}

.duplicate-summary-card p span {
  font-weight: 700;
  color: var(--greyne-dark);
}

.duplicate-summary-card p.dup-count span {
  color: var(--greyne-danger);
}

.duplicate-details {
  background: rgba(47, 141, 228, 0.08);
  border-radius: var(--greyne-border-radius-md);
  padding: var(--greyne-spacing-sm) var(--greyne-spacing-md);
}

.duplicate-details summary {
  cursor: pointer;
  font-weight: 600;
}

.duplicate-details ul {
  margin: var(--greyne-spacing-sm) 0 0 0;
  padding-left: 1.2rem;
  color: rgba(32, 39, 51, 0.7);
  font-size: 0.95rem;
}

.duplicate-details li {
  margin-bottom: 0.35rem;
}

.duplicate-details .dup-meta {
  margin-left: var(--greyne-spacing-xs);
  color: rgba(32, 39, 51, 0.55);
  font-size: 0.85rem;
}

.orders-preview,
.routing-preview {
  display: flex;
  flex-direction: column;
  gap: var(--greyne-spacing-md);
}

.orders-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--greyne-spacing-md);
  align-items: center;
  justify-content: space-between;
}

.orders-toolbar .toolbar-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(32, 39, 51, 0.6);
}

.orders-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--greyne-spacing-sm);
  align-items: center;
}

.orders-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--greyne-spacing-xs);
}

.orders-actions {
  display: flex;
  gap: var(--greyne-spacing-sm);
}

.orders-tree-table {
  margin-top: var(--greyne-spacing-md);
}

.orders-tree-table .tabulator {
  border: 1px solid rgba(221, 227, 240, 0.9);
  border-radius: var(--greyne-border-radius-lg);
  box-shadow: var(--greyne-shadow-sm);
  overflow: hidden;
}

.orders-tree-table .tabulator .tabulator-header {
  background: rgba(248, 250, 255, 0.9);
  border-bottom: 1px solid rgba(221, 227, 240, 0.9);
  font-weight: 600;
  color: rgba(32, 39, 51, 0.75);
}

.orders-tree-table .tabulator-row {
  border-bottom: 1px solid rgba(221, 227, 240, 0.6);
}

.orders-tree-table .tabulator-row:hover {
  background: rgba(47, 141, 228, 0.06);
}

.orders-tree-table .tabulator-row.is-duplicate {
  background: rgba(241, 91, 103, 0.08);
}

.orders-tree-table .tabulator-row.is-new {
  background: rgba(47, 141, 228, 0.08);
}

.tree-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.tree-title {
  font-weight: 600;
  color: var(--greyne-dark);
}

.tree-meta {
  font-size: 0.85rem;
  color: rgba(32, 39, 51, 0.6);
}

.tree-sub {
  font-size: 0.8rem;
  color: rgba(32, 39, 51, 0.55);
}

.ship-cell {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ship-name {
  font-weight: 600;
  color: rgba(32, 39, 51, 0.85);
}

.ship-line {
  font-size: 0.85rem;
  color: rgba(32, 39, 51, 0.6);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill.status-new {
  background: rgba(47, 141, 228, 0.15);
  color: var(--greyne-primary);
}

.status-pill.status-duplicate {
  background: rgba(241, 91, 103, 0.15);
  color: var(--greyne-danger);
}

.filter-chip {
  border: 1px solid rgba(47, 141, 228, 0.35);
  background: rgba(47, 141, 228, 0.12);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  color: var(--greyne-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip:hover,
.filter-chip.is-active {
  background: var(--greyne-primary);
  color: #fff;
}

.filter-chip.reset {
  border-color: rgba(32, 39, 51, 0.2);
  background: transparent;
  color: rgba(32, 39, 51, 0.7);
}

.filter-chip.reset:hover {
  background: rgba(32, 39, 51, 0.08);
  color: var(--greyne-dark);
}

.commerce-intake .button-light-outline {
  color: var(--greyne-primary);
  border-color: rgba(47, 141, 228, 0.4);
  background: rgba(47, 141, 228, 0.08);
}

.commerce-intake .button-light-outline:hover,
.commerce-intake .button-light-outline:focus {
  background: var(--greyne-primary);
  color: #fff;
  border-color: var(--greyne-primary);
}

.orders-empty {
  padding: var(--greyne-spacing-md);
  border: 1px dashed rgba(221, 227, 240, 0.9);
  border-radius: var(--greyne-border-radius-lg);
  background: rgba(248, 250, 255, 0.5);
  color: rgba(32, 39, 51, 0.6);
  text-align: center;
}

.routing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--greyne-spacing-md);
}

.routing-card {
  background: rgba(47, 141, 228, 0.08);
  border-radius: var(--greyne-border-radius-lg);
  padding: var(--greyne-spacing-md);
  box-shadow: var(--greyne-shadow-sm);
}

.routing-card h3 {
  margin-top: 0;
  margin-bottom: var(--greyne-spacing-xs);
}

.routing-card p {
  margin: 0;
  color: rgba(32, 39, 51, 0.7);
}

.routing-card p span {
  font-weight: 700;
  color: var(--greyne-dark);
}

.intake-hero {
  display: flex;
  flex-direction: column;
  gap: var(--greyne-spacing-sm);
}

.intake-hero p {
  margin: 0;
  color: rgba(32, 39, 51, 0.65);
}

.selected-batch {
  display: inline-flex;
  align-items: center;
  gap: var(--greyne-spacing-sm);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: var(--greyne-spacing-xs) var(--greyne-spacing-md);
  box-shadow: var(--greyne-shadow-sm);
}

.selected-batch .label {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(32, 39, 51, 0.6);
}

.selected-batch .value {
  font-family: var(--greyne-font-family-primary);
  font-weight: var(--greyne-font-weight-bold);
  color: var(--greyne-primary);
}

.intake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: var(--greyne-spacing-md);
}

.intake-card {
  display: flex;
  flex-direction: column;
  gap: var(--greyne-spacing-md);
  min-height: 100%;
}

.intake-card.disabled {
  opacity: 0.6;
}

.intake-card.disabled .button {
  cursor: not-allowed;
}

.intake-card header h2 {
  margin: 0 0 var(--greyne-spacing-xs);
}

.intake-card header p {
  margin: 0;
  color: rgba(32, 39, 51, 0.65);
}

.intake-form {
  display: flex;
  flex-direction: column;
  gap: var(--greyne-spacing-sm);
}

.form-control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-control label {
  font-size: 0.85rem;
  font-weight: var(--greyne-font-weight-bold);
  color: rgba(32, 39, 51, 0.7);
}

.form-control input[type="text"],
.form-control input[type="file"] {
  background: rgba(255, 255, 255, 0.95);
}

.form-hint {
  font-size: 0.85rem;
  color: rgba(32, 39, 51, 0.6);
}

.button.wide {
  width: 100%;
  justify-content: center;
}

.button.small {
  padding: var(--greyne-spacing-xs) var(--greyne-spacing-md);
  font-size: 0.8rem;
}

.table-wrapper {
  overflow-x: auto;
}

.recent-batches table {
  width: 100%;
  border-collapse: collapse;
}

.recent-batches th,
.recent-batches td {
  padding: var(--greyne-spacing-sm) var(--greyne-spacing-md);
  border-bottom: 1px solid rgba(221, 227, 240, 0.7);
  text-align: left;
}

.recent-batches tbody tr:hover {
  background: rgba(47, 141, 228, 0.08);
}

@media (max-width: 768px) {
  .selected-batch {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .button.wide {
    width: 100%;
  }
}
