* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f3f4f6;
  color: #111827;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content {
  flex-grow: 1;
  max-width: 80rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 {
  font-size: 1.875rem;
  font-weight: 700;
}

.subtitle {
  color: #4338ca;
  font-weight: 700;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.btn-primary {
  background-color: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #4338ca;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.btn-danger {
  background-color: #dc2626;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #4b5563;
}

.status-dot {
  width: 0.75rem;
  height: 0.75rem;
  background-color: #22c55e;
  border-radius: 9999px;
  position: relative;
  flex-shrink: 0;
}

.status-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: #22c55e;
  border-radius: 9999px;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

.error-box {
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: #fee2e2;
  border: 1px solid #f87171;
  color: #b91c1c;
  border-radius: 0.375rem;
}

/* !important para ganar sobre display:flex de .modal-overlay */
.hidden {
  display: none !important;
}

.table-card {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

table {
  min-width: 100%;
  border-collapse: collapse;
}

thead {
  background-color: #f9fafb;
}

th {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  white-space: nowrap;
  border-top: 1px solid #e5e7eb;
}

td.empty {
  text-align: center;
}

.badge {
  display: inline-flex;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-manual {
  background-color: #fef3c7;
  color: #78350f;
}

.badge-automatic {
  background-color: #e0e7ff;
  color: #312e81;
}

.badge-success {
  background-color: #dcfce7;
  color: #166534;
}

.badge-error {
  background-color: #fee2e2;
  color: #991b1b;
}

.link-details {
  background: none;
  border: none;
  color: #4f46e5;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
}

.link-details:hover {
  color: #312e81;
  text-decoration: underline;
}

/* Modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(79, 70, 229, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10;
}

.modal {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
  max-width: 56rem;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 500;
}

.modal-x {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.modal-x:hover {
  color: #ef4444;
}

.modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.btn-secondary {
  width: 100%;
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background-color: #f9fafb;
}

.product-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  background-color: #f9fafb;
  margin-bottom: 1rem;
}

.product-card h4 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.product-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.product-values h5 {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.product-values p {
  font-size: 0.875rem;
  color: #6b7280;
}

.product-values p strong {
  color: #111827;
  font-weight: 500;
}

/* Footer */

.footer {
  background-color: #16a34a;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #fff;
}

.footer a {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.footer a:hover {
  color: #e5e7eb;
  text-decoration: underline;
}

/* Login */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f3f4f6;
  padding: 1rem;
}

.login-card {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  width: 100%;
  max-width: 24rem;
}

.login-card h1 {
  margin-bottom: 0.25rem;
}

.login-card h3 {
  color: #4338ca;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.login-card label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.login-card input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.login-card input:focus {
  outline: 2px solid #4f46e5;
  border-color: transparent;
}

.login-card button {
  width: 100%;
  background-color: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.login-card button:hover {
  background-color: #4338ca;
}

.login-card button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
