:root {
  --bg-page: #e5edf7;
  --window-bg: rgba(255, 255, 255, 0.96);
  --window-border: rgba(148, 163, 184, 0.6);
  --window-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.08);
  --text-main: #0f172a;
  --text-soft: #64748b;
  --error: #e11d48;
  --success: #15803d;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-pill: 999px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "SF Pro Text",
    "Helvetica Neue", sans-serif;
  background: radial-gradient(circle at top, #e0edff 0, #eef2ff 45%, #e5e7eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Splash */

.splash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #e0edff 0, #eef2ff 45%, #e5e7eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 1;
  transform: scale(1);
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.splash-hide {
  opacity: 0;
  transform: scale(1.03);
}

.splash-inner {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 22px 26px 20px;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.55);
}

.splash-logo {
  width: 110px;
  height: auto;
  border-radius: 22px;
  animation: splash-logo-pulse 1800ms ease-in-out forwards;
}

.splash-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
}

.splash-subtitle {
  font-size: 13px;
  color: var(--text-soft);
}

.splash-spinner {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 3px solid #bfdbfe;
  border-top-color: #0f172a;
  animation: spin 900ms linear infinite;
  margin: 0 auto;
}

/* App shell */

.app-shell {
  width: 100%;
  max-width: 960px;
  padding: 24px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 350ms ease-out, transform 350ms ease-out;
}

.app-shell.ready {
  opacity: 1;
  transform: translateY(0);
}

/* macOS window */

.window {
  position: relative;
  border-radius: var(--radius-xl);
  border: 1px solid var(--window-border);
  background: var(--window-bg);
  box-shadow: var(--window-shadow);
  overflow: hidden;
}

/* Header */

.window-header {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  background: linear-gradient(
    135deg,
    rgba(248, 250, 252, 0.96),
    rgba(241, 245, 249, 0.9)
  );
}

.window-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.75);
}

.dot-red {
  background: radial-gradient(circle at 30% 30%, #fed7d7, #ff5f57);
}

.dot-yellow {
  background: radial-gradient(circle at 30% 30%, #fef3c7, #febc2e);
}

.dot-green {
  background: radial-gradient(circle at 30% 30%, #bbf7d0, #28c840);
}

.window-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.window-logo {
  height: 40px;
  width: auto;
  border-radius: 12px;
}

.window-title-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--text-main);
}

.window-title-text p {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

/* Nav superior */

.window-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.window-nav-btn {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(248, 250, 252, 0.9);
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 160ms ease-out, box-shadow 160ms ease-out,
    transform 120ms ease-out, color 120ms ease-out, border-color 160ms ease-out;
}

.window-nav-btn:hover {
  background: #e5edff;
  transform: translateY(-0.5px);
}

.window-nav-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: transparent;
}

/* Body + vistas */

.window-body {
  padding: 20px 22px 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Formulario */

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row.full,
.falla-row,
.product-row {
  grid-column: 1 / -1;
}

.form-row label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

.form-control,
.form-select {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.9);
  background-color: #ffffff;
  font-size: 13px;
  padding: 8px 11px;
  color: var(--text-main);
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.3);
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out,
    transform 120ms ease-out;
}

.form-control::placeholder {
  color: rgba(148, 163, 184, 0.9);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft),
    0 14px 30px rgba(148, 163, 184, 0.4);
  transform: translateY(-1px);
  outline: none;
}

.uppercase-input {
  text-transform: uppercase;
}

.falla-row textarea {
  min-height: 170px;
  width: 100%;
}

/* Hints / status */

.hint {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-soft);
}

.form-status {
  font-size: 12px;
  min-height: 18px;
  color: var(--text-soft);
}

.form-status.error {
  color: var(--error);
}

.form-status.success {
  color: var(--success);
}

/* Cartel imprimir comprobante */

.print-banner {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.print-banner.hidden {
  display: none;
}

.print-banner.visible {
  display: flex;
}

.print-banner-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(219, 234, 254, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.55);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

.print-banner-icon {
  font-size: 18px;
  color: #1d4ed8;
}

.print-banner-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  color: var(--text-soft);
  flex: 1;
}

.print-banner-text strong {
  color: var(--text-main);
}

/* Producto suggestions */

.product-input-wrapper {
  position: relative;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 210px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.75);
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
  z-index: 20;
}

.suggestions.hidden {
  display: none;
}

.suggestions li {
  padding: 6px 8px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-main);
}

.suggestions li span.sku {
  font-weight: 600;
}

.suggestions li span.meta {
  font-size: 11px;
  color: var(--text-soft);
}

.suggestions li:hover {
  background: linear-gradient(
    135deg,
    rgba(219, 234, 254, 0.9),
    rgba(191, 219, 254, 0.8)
  );
}

/* Botones estilo macOS */

.btn-primary-macos {
  grid-column: 1 / -1;
  justify-self: flex-end;
  border-radius: var(--radius-pill);
  padding-inline: 20px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #0a84ff, #2563eb);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.35);
  border: none;
}

.btn-primary-macos .btn-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary-macos .btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  animation: spin 650ms linear infinite;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.btn-primary-macos.loading .btn-spinner {
  opacity: 1;
  transform: scale(1);
}

.btn-primary-macos.loading .btn-label {
  opacity: 0.9;
}

.btn-primary-macos:disabled {
  opacity: 0.7;
  box-shadow: 0 10px 20px rgba(148, 163, 184, 0.3);
}

.btn-outline-primary-macos {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(37, 99, 235, 0.9);
  background: transparent;
  font-size: 12px;
  padding: 4px 11px;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: none;
}

.btn-outline-primary-macos:hover {
  background: rgba(219, 234, 254, 0.7);
  color: #1d4ed8;
}

.btn-outline-secondary-macos {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: rgba(248, 250, 252, 0.9);
  font-size: 12px;
  padding: 4px 11px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.45);
}

.btn-outline-secondary-macos:hover {
  background: #e5edff;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

/* Overlay envío */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  padding: 16px 18px 14px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.8);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;        /* spinner + título centrados */
  text-align: center;
  gap: 6px;
  min-width: 260px;
  max-width: 360px;
}

.overlay-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-main);
}

.overlay-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.7);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}

/* Overlay steps */

.overlay-steps {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--text-soft);
  max-height: 120px;
  overflow-y: auto;
  align-self: stretch;    /* lista ocupa todo el ancho */
  text-align: left;       /* texto de pasos alineado a la izquierda */
}

.overlay-steps li + li {
  margin-top: 3px;
}

/* Toast */

.toast-macos {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid rgba(22, 163, 74, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  font-size: 12px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.toast-macos.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.toast-macos .toast-icon {
  font-size: 16px;
  color: var(--success);
}

.toast-macos .toast-content strong {
  display: block;
  color: var(--text-main);
}

.toast-macos .toast-content span {
  color: var(--text-soft);
}

.toast-macos.hidden {
  opacity: 0;
}

/* Historial */

.history-header .history-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.history-header .history-subtitle {
  font-size: 12px;
  color: var(--text-soft);
}

.history-search .input-group-text {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.7);
}

.history-search .form-control {
  border-color: rgba(148, 163, 184, 0.7);
  font-size: 12px;
}

.history-list {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.history-card {
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
  padding: 10px 11px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.history-card-title h3 {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.badge-ticket {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.btn-icon {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  font-size: 14px;
  color: var(--text-main);
  padding: 0;
}

.btn-icon:hover {
  background: #e5edff;
}

.history-card-body {
  font-size: 11px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.history-row i {
  margin-top: 1px;
}

.history-row span strong {
  color: var(--text-main);
}

.history-row-falla span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-card-footer {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
}

.history-pagination {
  font-size: 11px;
  color: var(--text-soft);
}

.history-page-indicator {
  padding-inline: 6px;
}

.history-empty p {
  font-size: 13px;
}

.history-empty small {
  font-size: 11px;
}

/* Animations */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes splash-logo-pulse {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* Responsive */

@media (max-width: 768px) {
  body {
    align-items: flex-start;  
  }

  .app-shell {
    padding: 14px;
    margin-top: 40px;          
  }

  .window-body {
    padding: 16px 14px 18px;
  }

  .form {
    grid-template-columns: 1fr;
  }

  .btn-primary-macos {
    justify-self: stretch;
  }

  .window-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .history-list {
    grid-template-columns: 1fr;
  }
}

.view {
  display: none;
  margin-top: 8px;  /* nuevo */
}

.view.active {
  display: block;
}
