main{ padding: 24px;}

header.page-header{ display: grid; gap: 8px; margin: 12px 0 24px; }
.page-title{ font-size: clamp(22px, 4vw, 32px); font-weight: 800; letter-spacing: -0.02em; }
.page-sub{ color: var(--muted); font-size: 15px; }

.orders{ display: grid; gap: 16px; grid-template-columns: 1fr; }
@media(min-width: 720px){ .orders{ grid-template-columns: 1fr 1fr; } }

.order-card{
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: 10px;
  overflow: clip;
  display: grid; grid-template-rows: auto 1fr; 
}

.order-head{ display: grid; gap: 10px; padding: 16px 16px 0; }
.order-meta{ display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; font-size: 13px; }
.order-meta strong{ font-weight: 700; color: var(--text); }

.badge{ display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.status_APPROVED{ background: #e6f8f0; color: var(--success); }
.status_PENDING{ background: #fff6e5; color: var(--warning); }
.status_CANCELLED{ background: #ffe7eb; color: var(--danger); }

.order-body{ padding: 12px 16px 16px; display: grid; gap: 14px; }

/* Mejoras para la agrupación de servicios - Mobile First */
.order-card .items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-item-group {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 8px;
}

.order-item-group .thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Placeholder para items sin imagen */
.order-item-group__placeholder {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  font-size: 1.5rem;
}

.order-item-group__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.order-item-group__title {
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  line-height: 1.3;
}

.order-item-group__rates {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.order-item-group__rate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #555;
}

.order-item-group__rate-label {
  color: #666;
}

.order-item-group__rate-qty {
  font-weight: 600;
  color: #333;
  background: white;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.order-item-group__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a1a;
  border-top: 1px solid #dee2e6;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.order-item-group__total span:last-child {
  background: white;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

/* Estilos legacy para items antiguos (si existen) */
.thumb{ width: 44px; height: 44px; border-radius: 10px; overflow: hidden; border: 1px solid var(--stroke); display: grid; place-items: center; background: #f5f5f5; font-weight: 700; color: var(--brand); font-size: 12px; }

.item-text{ display: grid; gap: 4px; }
.item-title{ 
  font-weight: 700; 
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40ch;
  white-space: nowrap;
}
.item-sub{ color: var(--muted); font-size: 13px; }

.order-footer{ display:flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 0 16px 16px; }
.price{ font-size: 14px; color: var(--muted); }
.price strong{ font-size: 18px; color: var(--text); }

.btns{ display:flex; gap: 10px; align-items: center; }
.btn{ appearance: none; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; padding: 10px 14px; }
.btn--ghost{ border: 1px solid var(--stroke); background: transparent; color: var(--text); }

.empty{ border: 1px dashed var(--stroke); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); background: #fdfdfd; }
.empty strong{ color: var(--text); }

.buyer__login-input{ margin-bottom: 20px; }

/* Tablet y Desktop */
@media (min-width: 768px) {
  .order-item-group {
    padding: 1rem;
  }

  .order-item-group .thumb,
  .order-item-group__placeholder {
    width: 90px;
    height: 90px;
  }

  .order-item-group__title {
    font-size: 1rem;
  }

  .order-item-group__rate {
    font-size: 0.9rem;
  }
}