.workbench-container { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.kpi-strip {
  display: flex; gap: 8px; padding: 12px 16px; flex-wrap: wrap;
  background: var(--surface-primary, #fff); border-bottom: 1px solid #e0e0e0;

  .kpi-chip {
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 14px; border-radius: 8px; cursor: pointer; min-width: 80px;
    border: 2px solid transparent; transition: all 0.15s;
    &.active { border-color: currentColor; box-shadow: 0 0 0 1px currentColor; }
    .kpi-value { font-size: 20px; font-weight: 700; line-height: 1; }
    .kpi-label { font-size: 11px; margin-top: 2px; opacity: 0.85; }
  }
  .chip-all         { background: #f5f5f5; color: #333; }
  .chip-planned     { background: #e3f2fd; color: #1565c0; }
  .chip-released    { background: #e8f5e9; color: #2e7d32; }
  .chip-inprogress  { background: #fff3e0; color: #e65100; }
  .chip-pending     { background: #fff8e1; color: #f57f17; }
  .chip-waitrelease { background: #fce4ec; color: #c62828; }
  .chip-complete    { background: #e8f5e9; color: #1b5e20; }
}

.toolbar {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  border-bottom: 1px solid #e0e0e0;

  .search-input {
    flex: 1; max-width: 300px; padding: 6px 10px;
    border: 1px solid #ccc; border-radius: 4px; font-size: 13px;
  }
  .view-toggle {
    display: flex; gap: 0;
    button {
      padding: 5px 14px; border: 1px solid #ccc; background: #fff;
      cursor: pointer; font-size: 13px;
      &:first-child { border-radius: 4px 0 0 4px; }
      &:last-child  { border-radius: 0 4px 4px 0; }
      &:not(:first-child) { border-left: none; }
      &.active { background: #1565c0; color: #fff; border-color: #1565c0; }
    }
  }
}

.loading-bar { padding: 8px 16px; font-size: 13px; color: #666; }
.empty-state  { padding: 32px; text-align: center; color: #999; font-size: 14px; }

.cwo-list { flex: 1; overflow-y: auto; padding: 8px 16px; }

.cwo-group {
  border: 1px solid #e0e0e0; border-radius: 6px; margin-bottom: 8px;

  .cwo-header {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    cursor: pointer; background: #fafafa; border-radius: 6px;
    mat-icon { color: #666; font-size: 20px; }
    .cwo-number { font-weight: 600; font-size: 13px; min-width: 140px; color: #1565c0; }
    .cwo-item   { flex: 1; font-size: 13px; }
    .cwo-qty    { font-size: 12px; color: #666; min-width: 80px; }
    .stage-dots { display: flex; gap: 4px; align-items: center; }
    .stage-dot  { width: 12px; height: 12px; border-radius: 50%; }
  }

  &.expanded .cwo-header { border-radius: 6px 6px 0 0; }

  .cwo-stages { padding: 4px 12px 8px; border-top: 1px solid #e8e8e8; }

  .stage-row {
    display: flex; align-items: center; gap: 12px; padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0; font-size: 12px;
    &:last-child { border-bottom: none; }
    .stage-name    { min-width: 140px; font-weight: 500; }
    .stage-wc      { min-width: 120px; color: #555; }
    .stage-qty     { min-width: 60px; text-align: right; }
    .stage-status  { min-width: 120px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; display: inline-block; }
    .stage-actions { margin-left: auto; display: flex; gap: 4px; }
  }
}

.table-wrapper { flex: 1; overflow: auto; padding: 8px 16px; }
.wo-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  th { background: #f5f5f5; padding: 8px 10px; text-align: left; border-bottom: 2px solid #ddd; white-space: nowrap; }
  td { padding: 7px 10px; border-bottom: 1px solid #f0f0f0; }
  tr:hover td { background: #f8f8f8; }
  .action-cell { display: flex; gap: 4px; }
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 12px 16px; overflow-y: auto; }
.wo-card {
  border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden;
  .card-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-weight: 600; font-size: 13px; }
  .card-body   { padding: 10px 12px; }
  .card-row    { display: flex; gap: 8px; font-size: 12px; margin-bottom: 4px; label { color: #666; min-width: 80px; } }
  .card-actions { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid #f0f0f0; }
}

.status-planned     { background: #e3f2fd; color: #1565c0; }
.status-released    { background: #e8f5e9; color: #2e7d32; }
.status-inprogress  { background: #fff3e0; color: #e65100; }
.status-pending     { background: #fff8e1; color: #f57f17; }
.status-waitrelease { background: #fce4ec; color: #c62828; }
.status-complete    { background: #e8f5e9; color: #1b5e20; }

.status-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }

button {
  padding: 5px 12px; border: 1px solid #ccc; background: #fff;
  cursor: pointer; border-radius: 4px; font-size: 12px;
}
.btn-primary   { background: #1565c0; color: #fff; border-color: #1565c0; }
.btn-secondary { background: #fff; color: #333; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center; z-index: 1000;

  .modal {
    background: #fff; border-radius: 8px; padding: 24px; min-width: 360px; max-width: 480px;
    h3 { margin: 0 0 12px; font-size: 16px; }
    p  { font-size: 13px; color: #444; margin: 0 0 16px; }
    label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #555; }
    input { width: 100%; padding: 7px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; margin-bottom: 12px; box-sizing: border-box; }
    .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
  }
}
