/* ═════════════════════════════════════════════════════════════════════
   COMPONENTS — Design System Components Unificados
   Herda os tokens de design-system.css.
   Substitui classes de cliente/fornecedor/gestao específicas.
   ═════════════════════════════════════════════════════════════════════ */

/* ─── CARD GRID (clientes, fornecedores) ─── */
.ds-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.ds-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.ds-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}
.ds-card--inactive {
  border-left-color: var(--amber);
}

/* ─── AVATAR (unificado) ─── */
.ds-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  font-weight: 600;
  font-family: var(--font-body);
  line-height: 1;
}
.ds-avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 0.55rem;
}

/* ─── FILTER TOOLBAR ─── */
.ds-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

/* ─── META ROW ─── */
.ds-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── PROGRESS BAR ─── */
.ds-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-progress .bar {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.ds-progress .bar .fill {
  height: 100%;
  border-radius: 3px;
  background: var(--brand);
  transition: width 0.3s ease;
}
.ds-progress .pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 2.2em;
  text-align: right;
}

/* ─── MODAL ─── */
.ds-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}
.ds-modal-overlay.active {
  display: flex;
}
.ds-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 92%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
}
.ds-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.ds-modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}
.ds-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.ds-modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.ds-modal-body {
  padding: 1.25rem;
}
.ds-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light);
}

/* ─── FORM ─── */
.ds-form-group {
  margin-bottom: 1rem;
}
.ds-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.ds-form-group input,
.ds-form-group select,
.ds-form-group textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-fast);
}
.ds-form-group input:focus,
.ds-form-group select:focus,
.ds-form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(42,157,143,0.08);
}

/* ─── FORM (classes diretas) ─── */
.ds-field {
  margin-bottom: 0.85rem;
}
.ds-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.ds-input,
.ds-select,
.ds-textarea {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}
.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(42,157,143,0.08);
}
.ds-row {
  display: flex;
  gap: 12px;
}
.ds-row > .ds-field {
  flex: 1;
}

/* ─── BOTÕES (extras) ─── */
.ds-btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
}
.ds-btn-danger {
  background: var(--red);
  color: #fff;
}
.ds-btn-danger:hover {
  background: #DC2626;
}

/* ─── MODAL SM ─── */
.ds-modal-sm {
  max-width: 400px;
}

/* ─── TABLE ─── */
.ds-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.ds-table th {
  text-align: left;
  padding: 0.6rem 0.9rem;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border-light);
}
.ds-table td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.ds-table tr:last-child td {
  border-bottom: none;
}
.ds-table tr:hover td {
  background: var(--surface-hover);
}

/* ─── EMPTY STATE ─── */
.ds-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── DETAIL CARD ─── */
.ds-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.ds-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.ds-detail-item .label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.ds-detail-item .value {
  font-size: 0.9rem;
  color: var(--text);
}
.ds-detail-item .value.mono {
  font-family: var(--font-mono);
}


/* ═══ MONO (dados numéricos, contagens) ═══ */
.ds-mono {
  font-family: var(--font-mono);
}

/* ═══ BADGES COLORIDOS ═══ */
.ds-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.ds-badge-red,
.ds-badge-critical,
.ds-badge-overdue {
  background: var(--red-soft);
  color: var(--red);
}
.ds-badge-amber,
.ds-badge-warning,
.ds-badge-at-risk {
  background: var(--amber-soft);
  color: var(--amber);
}
.ds-badge-teal,
.ds-badge-safe,
.ds-badge-on-time {
  background: var(--teal-soft);
  color: var(--teal);
}
.ds-badge-slate,
.ds-badge-ghost {
  background: var(--slate-soft);
  color: var(--slate);
}

/* ═══ MARCA NOS TITULOS (quadrado antes do titulo) ═══ */
.ds-title-mark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ds-title-mark::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--brand);
  border-radius: 3px;
  flex-shrink: 0;
}
