/* Additive ERP polish layer. It intentionally uses existing design tokens and
   does not replace the compiled application stylesheet. */
:root {
  --erp-focus: #818cf8;
  --erp-focus-soft: rgba(129, 140, 248, .18);
  --erp-success: #10b981;
  --erp-danger: #f87171;
  --erp-warning: #fbbf24;
}

html.dark body,
html.dark #root {
  color-scheme: dark;
}

button,
input,
select,
textarea {
  transition: border-color .18s ease, box-shadow .18s ease,
    background-color .18s ease, color .18s ease, transform .12s ease,
    opacity .18s ease;
}

button:not(:disabled):active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--erp-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--erp-focus-soft);
}

html.dark input,
html.dark select,
html.dark textarea {
  border-color: #334155;
  background-color: #111c2e;
  color: #e5e7eb;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #94a3b8;
}

html.dark input:hover:not(:disabled),
html.dark select:hover:not(:disabled),
html.dark textarea:hover:not(:disabled) {
  border-color: #64748b;
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: var(--erp-focus);
  box-shadow: 0 0 0 3px var(--erp-focus-soft);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .62;
}

html.dark .ds-table tbody tr,
html.dark table tbody tr {
  border-color: #263752;
}

html.dark .ds-table tbody tr:hover,
html.dark table tbody tr:hover {
  background: rgba(99, 102, 241, .075);
}

.erp-ux-progress {
  position: fixed;
  z-index: 2147483000;
  inset: 0 0 auto;
  height: 3px;
  pointer-events: none;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: right;
  background: linear-gradient(90deg, #22d3ee, #6366f1, #a78bfa);
  box-shadow: 0 0 14px rgba(99, 102, 241, .7);
  transition: transform .25s ease, opacity .2s ease;
}

.erp-ux-progress.is-active {
  opacity: 1;
  transform: scaleX(.72);
  animation: erp-ux-progress 1.2s ease-in-out infinite alternate;
}

.erp-ux-progress.is-finishing {
  opacity: 0;
  transform: scaleX(1);
}

@keyframes erp-ux-progress {
  from { transform: scaleX(.25); }
  to { transform: scaleX(.86); }
}

.erp-ux-busy {
  position: relative;
}

.erp-ux-busy::after {
  content: "";
  width: 1em;
  height: 1em;
  margin-inline-start: .45em;
  display: inline-block;
  vertical-align: -.12em;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
  animation: erp-ux-spin .65s linear infinite;
}

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

@media (max-width: 640px) {
  .ds-toolbar,
  .sales-search-toolbar,
  .sales-filter-panel {
    gap: .55rem !important;
  }

  .ds-toolbar button,
  .sales-search-toolbar button,
  .sales-filter-panel button,
  .sales-filter-panel select {
    min-height: 42px;
  }

  .overflow-x-auto {
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .sect-card,
  .ds-card {
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
