.dashboard-page {
  font-family: 'Helvetica', sans-serif;
  background-color: #fff;
  min-height: 100vh;
  padding: 24px 40px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.header-left {
  .page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--action-primary-default, #834DD0);
    margin: 0 0 4px 0;
  }

  .page-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
  }
}

.header-right {
  display: flex;
  gap: 16px;
  align-items: center;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;

  .search-icon {
    position: absolute;
    left: 10px;
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #9ca3af;
  }

  .search-input {
    padding: 8px 12px 8px 34px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    width: 220px;
    outline: none;
    transition: border-color 0.2s;

    &::placeholder {
      color: #9ca3af;
    }

    &:focus {
      border-color: var(--action-primary-default, #834DD0);
    }
  }
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;

  &:hover {
    background: #f9fafb;
  }
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--action-primary-default, #834DD0);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.dropdown-icon {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #6b7280;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  color: #6b7280;

  .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--action-primary-default, #834DD0);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

// KPI Stat Cards
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 6px;
}

.stat-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;

  mat-icon { font-size: 20px; width: 20px; height: 20px; }
}

.icon-blue {
  background: #dbeafe;
  color: #2563eb;
}

.icon-purple {
  background: var(--bg-surface, #F4E7FF);
  color: var(--action-primary-default, #834DD0);
}

.icon-amber {
  background: #fef3c7;
  color: #d97706;
}

.icon-green {
  background: #dcfce7;
  color: #16a34a;
}

.icon-red {
  background: #fee2e2;
  color: #dc2626;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
}

// Amendment Activity Bar
.amendment-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f5f0ff;
  border-left: 4px solid var(--action-primary-default, #834DD0);
  border-radius: 8px;
  margin-bottom: 20px;
}

.amendment-left {
  display: flex;
  align-items: center;
  gap: 10px;

  mat-icon {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--action-primary-default, #834DD0);
  }
}

.amendment-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.amendment-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.amendment-stat {
  font-size: 13px;
  font-weight: 600;

  &.text-amber { color: #f59e0b; }
  &.text-green { color: #10b981; }
}

// Middle 3-Column Grid
.middle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.middle-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

  .card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 16px 0;
  }
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;

  &:hover,
  &.drag-over {
    border-color: var(--action-primary-default, #834DD0);
    background: #faf5ff;
  }
}

.upload-icon {
  font-size: 36px;
  width: 36px;
  height: 36px;
  color: #9ca3af;
  margin-bottom: 8px;
}

.upload-text {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin: 0 0 4px 0;
}

.upload-subtext {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;

  &.badge-amber { background: #f59e0b; }
  &.badge-blue { background: #3b82f6; }
  &.badge-green { background: #10b981; }
}

.queue-label {
  flex: 1;
  font-size: 13px;
  color: #374151;
}

.queue-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;

  &.badge-amber { background: #fffbeb; color: #f59e0b; }
  &.badge-blue { background: #eff6ff; color: #3b82f6; }
  &.badge-green { background: #ecfdf5; color: #10b981; }
}

.attention-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attention-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #fffbeb;
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
}

.attention-icon {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 1px;
}

.attention-text {
  display: flex;
  flex-direction: column;
}

.attention-title {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.attention-subtitle {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

.empty-state-small {
  text-align: center;
  padding: 20px;
  color: #9ca3af;

  p { margin: 0; font-size: 13px; }
}

// Recent Orders Table
.recent-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  color: #9ca3af;

  mat-icon { font-size: 40px; width: 40px; height: 40px; margin-bottom: 8px; }
  p { margin: 0; font-size: 14px; }
}

.table-container {
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;

  th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    background: var(--bg-surface, #F4E7FF);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  td {
    padding: 12px 16px;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
  }

  tbody tr:hover td {
    background: #faf5ff;
  }
}

.id-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-icon {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: var(--action-primary-default, #834DD0);
}

.buyer-cell {
  display: flex;
  flex-direction: column;
}

.buyer-name {
  font-weight: 600;
  color: #1f2937;
}

.buyer-email {
  font-size: 11px;
  color: #6b7280;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-completed {
  background: #dcfce7;
  color: #16a34a;
}

.status-validated {
  background: #dbeafe;
  color: #2563eb;
}

.status-processing {
  background: #fef3c7;
  color: #d97706;
}

.status-queued {
  background: #f3f4f6;
  color: #6b7280;
}

.status-failed {
  background: #fee2e2;
  color: #dc2626;
}

.btn-view {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #6b7280;
  font-size: 12px;

  mat-icon { font-size: 16px; width: 16px; height: 16px; }
  &:hover { background: var(--bg-surface, #F4E7FF); color: var(--action-primary-default, #834DD0); }
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .middle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-page {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    gap: 16px;
  }

  .header-right {
    width: 100%;
  }
}
