/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #333;
  background: #f0f2f5;
  line-height: 1.6;
}
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.dashboard-header {
  background: #1a1a2e;
  color: #fff;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.dashboard-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-left h1 { font-size: 1.3rem; font-weight: 700; }
.header-subtitle { font-size: 0.85rem; color: #888; }
.header-right { display: flex; align-items: center; gap: 12px; }
.badge {
  background: rgba(255,255,255,0.1);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-primary {
  background: #4a90d9;
  color: #fff;
}
.btn-primary:hover { background: #357abd; }
.btn-secondary {
  background: #e0e0e0;
  color: #333;
}
.btn-secondary:hover { background: #d0d0d0; }

/* ===== Filters ===== */
.filters {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-group label {
  font-size: 0.8rem;
  color: #888;
  font-weight: 600;
}
.filter-group select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  min-width: 180px;
}

/* ===== Table ===== */
.table-container {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
  margin-bottom: 20px;
}
.orders-table {
  width: 100%;
  border-collapse: collapse;
}
.orders-table th {
  background: #f8f9fa;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
}
.orders-table td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid #f0f0f0;
}
.orders-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.orders-table tbody tr:hover { background: #f8f9ff; }
.loading {
  text-align: center;
  color: #999;
  padding: 40px !important;
}
.loading.error { color: #e74c3c; }
.order-id {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: #666;
}
.price { font-weight: 700; color: #1a1a2e; }
.date-cell { font-size: 0.8rem; color: #888; }

/* ===== Status Badge ===== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== Supplier Badge ===== */
.supplier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.supplier-domus { background: #dbeafe; color: #1e40af; }
.supplier-decora { background: #d1fae5; color: #065f46; }
.supplier-kolorama { background: #fef3c7; color: #92400e; }

/* ===== Detail Panel ===== */
.detail-panel {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 20px;
  overflow: hidden;
}
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
}
.detail-header h2 { font-size: 1.1rem; color: #1a1a2e; }
.detail-body { padding: 20px; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.detail-section { margin-bottom: 20px; }
.detail-section h3 {
  font-size: 0.9rem;
  color: #1a1a2e;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}
.detail-section table { width: 100%; }
.detail-section td {
  padding: 4px 0;
  font-size: 0.85rem;
}
.detail-section td:first-child { color: #888; width: 140px; }
.detail-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  flex-wrap: wrap;
}
.muted { color: #999; font-size: 0.85rem; }

/* ===== Status History ===== */
.status-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.history-time { font-size: 0.8rem; color: #888; }

/* ===== JSON Preview ===== */
.json-preview {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 16px;
  border-radius: 8px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

/* ===== XML Modal ===== */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.xml-modal {
  background: #fff;
  border-radius: 10px;
  width: 800px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.xml-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}
.xml-modal-header h3 { font-size: 1rem; }
.xml-content {
  flex: 1;
  overflow: auto;
  padding: 20px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre;
}
.xml-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
}