.admin-dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
}

.dashboard-header h1 {
  margin: 0;
}

.dashboard-header p {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
}

.header-actions {
  display: flex;
  gap: var(--space-2);
}

.list-panel,
.detail-panel {
  min-width: 0;
}

.list-panel h2 {
  font-size: 1.05rem;
  margin-bottom: var(--space-2);
}

.list-toolbar {
  display: grid;
  grid-template-columns:
    minmax(230px, 1.6fr)
    minmax(170px, 1fr)
    minmax(190px, 1fr)
    minmax(170px, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.toolbar-field {
  display: grid;
  gap: var(--space-1);
}

.toolbar-field span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

tbody tr {
  cursor: pointer;
}

tbody tr.selected {
  background: #fff5b8;
}

tbody tr.no-results {
  cursor: default;
}

tbody tr.no-results:hover {
  background: transparent;
}

.order-uuid {
  font-size: 0.84rem;
  color: var(--color-text-muted);
}

.order-uuid code {
  font-size: 0.82rem;
}

.detail-header h2 {
  margin: 0 0 var(--space-2);
}

.detail-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.actions-block {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-3);
}

.status-editor {
  display: grid;
  gap: var(--space-2);
}

.status-editor label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}

.item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-3);
}

.item-main {
  min-width: 0;
  display: grid;
  gap: var(--space-2);
}

.item-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.file-name {
  margin: 0;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  margin: 0;
  font-size: 0.84rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.item-meta__color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.item-tech,
.item-total {
  margin: 0;
  font-size: 0.84rem;
}

.item-tech {
  color: var(--color-text-muted);
}

.item-total {
  font-weight: 600;
  color: var(--color-text);
}

.item-actions {
  display: flex;
  align-items: flex-start;
}

.item-actions button {
  justify-self: start;
}

.color-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
}

.error {
  color: var(--color-danger-500);
  margin: 0;
}

.order-type-badge,
.item-kind-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: var(--color-neutral-100);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.order-type-badge--mixed {
  background: color-mix(in srgb, #f59e0b 16%, white);
  color: #9a5b00;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 32, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  padding: var(--space-4);
}

.modal-card {
  width: min(860px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.modal-header h3 {
  margin: 0;
}

.close-btn {
  white-space: nowrap;
}

.modal-grid {
  margin-bottom: var(--space-4);
}

h4 {
  margin: 0 0 var(--space-2);
}

.file-color-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.file-color-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-card);
}

.file-color-row:last-child {
  border-bottom: 0;
}

.filename {
  font-size: 0.9rem;
}

.file-color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

@media (max-width: 1280px) {
  .detail-panel {
    min-height: unset;
  }
}

@media (max-width: 820px) {
  .admin-dashboard {
    gap: var(--space-4);
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .list-toolbar {
    grid-template-columns: 1fr;
  }

  .item {
    align-items: flex-start;
  }

  .item-actions {
    width: 100%;
  }

  .actions-block {
    flex-direction: column;
    align-items: stretch;
  }

  .status-editor {
    width: 100%;
  }

  .status-editor select {
    width: 100%;
    min-width: 0;
  }

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

  .items {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .ui-data-table th,
  .ui-data-table td {
    padding: var(--space-2);
    font-size: 0.88rem;
  }

  .modal-backdrop {
    padding: var(--space-2);
  }
}
